forked from kiddkai/atom-node-debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.coffee
More file actions
154 lines (138 loc) · 3.72 KB
/
Copy pathApp.coffee
File metadata and controls
154 lines (138 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
hg = require 'mercury'
h = hg.h
stepButton = require './StepButton'
breakpointPanel = require './BreakPointPane'
callstackPaneModule = require './CallStackPane'
consolePane = require './ConsolePane'
cancelButton = require './CancelButton'
dragHandler = require './drag-handler'
logger = require '../logger'
StepButton = null
BreakPointPane = null
LeftSidePane = (ConsolePane, state) ->
h('div', {
style: {
display: 'flex'
flex: 'auto'
flexDirection: 'column'
}
}, [
ConsolePane.render(state.logger)
])
RightSidePane = (BreakPointPane, CallStackPane, LocalsPane, StepButton, state) ->
h('div', {
style: {
display: 'flex'
witdh: "#{state.sideWidth}px"
flexBasis: "#{state.sideWidth}px"
height: "#{state.height}px"
flexDirection: 'row'
}
}, [
h('div.resizer', {
style:
width: '5px'
flexBasis: '5px'
cursor: 'ew-resize'
'ev-mousedown': dragHandler state.channels.changeWidth, {}
})
h('div.inset-panel', {
style: {
flexDirection: 'column'
display: 'flex'
flex: 'auto'
}
}, [
h('div.debugger-panel-heading', {
style: {
'flex-shrink': 0
}
}, [
h('div.btn-group', {}, [
StepButton.render(state.steps.stepContinue)
StepButton.render(state.steps.stepNext)
StepButton.render(state.steps.stepIn)
StepButton.render(state.steps.stepOut)
cancelButton.render(state.cancel)
])
])
h('div.panel-body', {
style: {
flex: 'auto'
display: 'list-item'
overflow: 'auto';
}
}, [
BreakPointPane.render(state.breakpoints)
CallStackPane.render(state.callstack)
LocalsPane.render(state.locals)
])
])
])
exports.start = (root, _debugger) ->
StepButton = stepButton.StepButton(_debugger)
BreakPointPane = breakpointPanel.create(_debugger)
{CallStackPane, LocalsPane} = callstackPaneModule.create(_debugger)
ConsolePane = consolePane.create(_debugger)
changeHeight = (state, data) ->
state.height.set(data.height)
changeWidth = (state, data) ->
state.sideWidth.set(data.sideWidth)
App = ->
stepContinue = StepButton('continue', 'continue')
stepIn = StepButton('step in', 'in')
stepOut = StepButton('step out', 'out')
stepNext = StepButton('step next', 'next')
define = {
height: hg.value 350
sideWidth: hg.value 400
channels: {
changeHeight: changeHeight
changeWidth: changeWidth
}
steps: {
stepIn: stepIn
stepOut: stepOut
stepNext: stepNext
stepContinue: stepContinue
}
breakpoints: BreakPointPane()
callstack: CallStackPane()
locals: LocalsPane()
logger: ConsolePane()
cancel: cancelButton.create(_debugger)
}
logger.info 'app init', define
hg.state(define)
App.render = (state) ->
logger.info 'app state', state
h('div', {
style: {
display: 'flex'
flex: 'auto'
flexDirection: 'column'
position: 'relative'
height: "#{state.height}px"
}
}, [
h('div.resizer', {
style:
height: '5px'
cursor: 'ns-resize'
'ev-mousedown': dragHandler state.channels.changeHeight, {}
})
h('div', {
style: {
display: 'flex'
flex: 'auto'
flexDirection: 'row'
}
}, [
LeftSidePane(ConsolePane, state)
RightSidePane(BreakPointPane, CallStackPane, LocalsPane, StepButton, state)
])
])
hg.app(root, App(), App.render)
exports.stop = ->
BreakPointPane.cleanup() if BreakPointPane
callstackPaneModule.cleanup()