/
WorldState.extension.st
205 lines (185 loc) · 6.11 KB
/
WorldState.extension.st
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
Extension { #name : #WorldState }
{ #category : #'*Morphic-Base' }
WorldState >> addAlarm: aSelector withArguments: argArray for: aTarget at: scheduledTime [
"Add a new alarm with the given set of parameters"
self alarms add:
(MorphicAlarm
scheduledAt: scheduledTime
receiver: aTarget
selector: aSelector
arguments: argArray).
]
{ #category : #'*Morphic-Base' }
WorldState class >> codeWorldMenuOn: aBuilder [
<worldMenu>
(aBuilder item: #Develop)
order: 10;
help: 'Tools to develop in Pharo.';
with: [
(aBuilder group: #Browsing)
order: 1;
withSeparatorAfter.
(aBuilder group: #InputOutput)
order: 2;
withSeparatorAfter.
(aBuilder group: #Testing)
order: 3;
withSeparatorAfter.
(aBuilder group: #Searching)
order: 4]
]
{ #category : #'*Morphic-Base' }
WorldState class >> debugWorldMenuOn: aBuilder [
<worldMenu>
(aBuilder item: #Debug)
order: 50;
with: [
(aBuilder group: #Breakpoints)
order: 1;
withSeparatorAfter.
(aBuilder group: #Profiling)
order: 2;
withSeparatorAfter.
(aBuilder group: #Counters)
order: 3]
]
{ #category : #'*Morphic-Base' }
WorldState >> menuBuilder [
^ (PragmaMenuBuilder
pragmaKeyword: self discoveredMenuPragmaKeyword
model: self)
menuSpec;
yourself
]
{ #category : #'*Morphic-Base' }
WorldState class >> startMessageTally [
(self confirm: 'MessageTally will start now,
and stop when the cursor goes
to the top of the screen' translated)
ifFalse: [ ^ self ].
TimeProfiler spyAllOn: [
MorphicRenderLoop new doOneCycleWhile: [
self currentWorld activeHand position y > 0 ] ]
]
{ #category : #'*Morphic-Base' }
WorldState >> startMessageTally [
self class startMessageTally
]
{ #category : #'*Morphic-Base' }
WorldState >> startStepping: aMorph at: scheduledTime selector: aSelector arguments: args stepTime: stepTime [
"Add the given morph to the step list. Do nothing if it is already being stepped."
self stopStepping: aMorph selector: aSelector.
self adjustWakeupTimesIfNecessary.
stepList add:(
StepMessage
scheduledAt: scheduledTime
stepTime: stepTime
receiver: aMorph
selector: aSelector
arguments: args)
]
{ #category : #'*Morphic-Base' }
WorldState >> startThenBrowseMessageTally [
self class startThenBrowseMessageTally
]
{ #category : #'*Morphic-Base' }
WorldState class >> startThenBrowseMessageTally [
"Tally only the UI process"
(self confirm: 'MessageTally the UI process until the
mouse pointer goes to the top of the screen')
ifFalse: [ ^ self ].
TimeProfiler onBlock: [
MorphicRenderLoop new doOneCycleWhile: [
self currentWorld activeHand position y > 10 ] ]
]
{ #category : #'*Morphic-Base' }
WorldState class >> systemOn: aBuilder [
<worldMenu>
(aBuilder item: #System)
order: 80;
with: [
(aBuilder group: #SystemTools)
order: 1;
withSeparatorAfter.
(aBuilder group: #Startup)
order: 2;
withSeparatorAfter.
(aBuilder group: #Image)
order: 3;
with: [
(aBuilder item: #'Space left')
help: 'Do a garbage collection, and report results about the to the user.';
order: 1;
action: [ Smalltalk informSpaceLeftAfterGarbageCollection ].
(aBuilder item: #'Do Image Cleanup')
help: 'Clean out any caches and other state that should be flushed when trying to get an image into a pristine state.';
order: 2;
action: [ Smalltalk cleanUp: true ].
aBuilder withSeparatorAfter].
(aBuilder group: #World)
order: 4;
with: [
(aBuilder item: #'Start drawing again')
help: 'Resume the drawing after a draw error of the world.';
order: 1;
action: [ self currentWorld resumeAfterDrawError ].
(aBuilder item: #'Start stepping again')
help: 'Resume stepping of Morph after an error has occured.';
order: 2;
action: [ self currentWorld resumeAfterStepError ].
(aBuilder item: #'Restore display')
help: 'Restore Morphic display.';
order: 3;
action: [ self currentWorld restoreMorphicDisplay ].
aBuilder withSeparatorAfter ] ]
]
{ #category : #'*Morphic-Base' }
WorldState class >> vcsWorldMenuOn: aBuilder [
<worldMenu>
(aBuilder item: #VCS)
order: 20;
help: 'Version control tools';
with: [
(aBuilder group: #Versioning)
order: 1;
withSeparatorAfter.
(aBuilder group: #Packaging)
order: 2;
withSeparatorAfter.
(aBuilder group: #Changes)
order: 3 ]
]
{ #category : #'*Morphic-Base' }
WorldState class >> windowsOn: aBuilder [
<worldMenu>
(aBuilder item: #Windows)
order: 90;
with: [ (aBuilder item: #'Collapse all windows')
action: [ self currentWorld collapseAll ];
help: 'Reduce all open windows to collapsed forms that only show titles' translated.
(aBuilder item: #'Expand all windows')
iconName: #expandBoxIcon;
action: [ self currentWorld expandAll ];
help: 'Expand all collapsed windows back to their expanded forms' translated.
(aBuilder item: #'Fit all windows')
action: [ self currentWorld fitAllVisibleWindows ];
help: 'Fit all open windows as visible in World' translated.
(aBuilder item: #'Close all debuggers')
help: 'Close all opened debugger in the image.';
action: [ OupsDebuggerSystem closeAllDebuggers ].
(aBuilder item: #'Send top window to back (\)')
action: [ SystemWindow sendTopWindowToBack ];
help: 'Make the topmost window become the backmost one, and activate the window just beneath it.' translated.
(aBuilder item: #'Move windows onscreen')
action: [ self currentWorld bringWindowsFullOnscreen ];
help: 'Make all windows fully visible on the screen' translated.
(aBuilder item: #'Delete unchanged windows')
action: [ self currentWorld closeUnchangedWindows ];
help: 'Deletes all windows that do not have unsaved text edits.' translated.
(aBuilder item: #'Delete all windows discarding edits')
action: [ self currentWorld closeAllWindowsDiscardingChanges ];
help: 'Deletes all windows even if they have unsaved text edits.' translated.
(aBuilder item: #'Toggle full screen mode')
action: [ Display toggleFullscreen ];
help: 'Turn full screen mode on when it is off, off when it is on.' translated ]
]