500
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1997 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
ToolApplicationModel subclass:#TabItemEditor
|
514
|
16 |
instanceVariableNames:'rebuildMode testView className selector aspects listOfTabs
|
|
17 |
hasChanged selectedIndex'
|
500
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Interface-UIPainter'
|
|
21 |
!
|
|
22 |
|
|
23 |
!TabItemEditor class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 1997 by eXept Software AG
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
|
|
38 |
|
|
39 |
!
|
|
40 |
|
|
41 |
documentation
|
|
42 |
"
|
|
43 |
create and modify or inspect a list of tabs
|
|
44 |
|
|
45 |
[start with:]
|
|
46 |
TabItemEditor open
|
|
47 |
|
|
48 |
[see also:]
|
|
49 |
TabItem
|
|
50 |
TabView
|
|
51 |
NoteBookView
|
|
52 |
UIPainter
|
|
53 |
|
|
54 |
[author:]
|
541
|
55 |
Claus Atzkern, eXept Software AG
|
500
|
56 |
"
|
|
57 |
|
|
58 |
|
|
59 |
! !
|
|
60 |
|
553
|
61 |
!TabItemEditor class methodsFor:'help specs'!
|
|
62 |
|
|
63 |
helpSpec
|
|
64 |
"return a dictionary filled with helpKey -> helptext associations.
|
|
65 |
These are used by the activeHelp tool."
|
|
66 |
|
|
67 |
"
|
|
68 |
UIHelpTool openOnClass:TabItemEditor
|
|
69 |
"
|
|
70 |
|
|
71 |
^ super helpSpec addPairsFrom:#(
|
|
72 |
|
|
73 |
#addTabItem
|
|
74 |
'Adds a new tab item.'
|
|
75 |
|
|
76 |
#fileNew
|
|
77 |
'Creates a new tab list.'
|
|
78 |
|
|
79 |
#fileReload
|
|
80 |
'Reload tab list from current class and selector.'
|
|
81 |
|
|
82 |
#fileSave
|
|
83 |
'Saves current tab list.'
|
|
84 |
|
570
|
85 |
#testPreview
|
|
86 |
'Toggle on/off preview of the tab list.'
|
|
87 |
|
553
|
88 |
)
|
|
89 |
! !
|
|
90 |
|
500
|
91 |
!TabItemEditor class methodsFor:'interface specs'!
|
|
92 |
|
|
93 |
nameAndSelectorSpec
|
|
94 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
95 |
|
|
96 |
"do not manually edit this - the painter/builder may not be able to
|
|
97 |
handle the specification if its corrupted."
|
|
98 |
|
|
99 |
"
|
|
100 |
UIPainter new openOnClass:TabItemEditor andSelector:#nameAndSelectorSpec
|
|
101 |
TabItemEditor new openInterface:#nameAndSelectorSpec
|
|
102 |
"
|
|
103 |
|
|
104 |
<resource: #canvas>
|
|
105 |
|
|
106 |
^
|
|
107 |
|
|
108 |
#(#FullSpec
|
|
109 |
#'window:'
|
|
110 |
#(#WindowSpec
|
526
|
111 |
#'name:' 'Tab Item Editor'
|
530
|
112 |
#'layout:' #(#LayoutFrame 141 0 424 0 456 0 551 0)
|
526
|
113 |
#'label:' 'Tab Item Editor'
|
500
|
114 |
#'min:' #(#Point 10 10)
|
|
115 |
#'max:' #(#Point 1152 900)
|
530
|
116 |
#'bounds:' #(#Rectangle 141 424 457 552)
|
500
|
117 |
#'usePreferredExtent:' false
|
|
118 |
)
|
|
119 |
#'component:'
|
|
120 |
#(#SpecCollection
|
|
121 |
#'collection:'
|
|
122 |
#(
|
530
|
123 |
#(#FramedBoxSpec
|
|
124 |
#'name:' 'framedBox1'
|
|
125 |
#'layout:' #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -33 1.0)
|
|
126 |
#'label:' 'Define class and selector'
|
|
127 |
#'labelPosition:' #topLeft
|
500
|
128 |
)
|
|
129 |
#(#LabelSpec
|
|
130 |
#'name:' 'ClassLabel'
|
530
|
131 |
#'layout:' #(#AlignmentOrigin 58 0.11 37 0 1 0.5)
|
500
|
132 |
#'label:' 'Class:'
|
|
133 |
#'adjust:' #right
|
|
134 |
#'resizeForLabel:' true
|
|
135 |
)
|
|
136 |
#(#InputFieldSpec
|
|
137 |
#'name:' 'ClassField'
|
530
|
138 |
#'layout:' #(#LayoutFrame 62 0.11 26 0 -18 1.0 48 0)
|
500
|
139 |
#'tabable:' true
|
|
140 |
#'model:' #className
|
|
141 |
)
|
|
142 |
#(#LabelSpec
|
|
143 |
#'name:' 'SelectorLabel'
|
530
|
144 |
#'layout:' #(#AlignmentOrigin 58 0.11 62 0 1 0.5)
|
500
|
145 |
#'label:' 'Selector:'
|
|
146 |
#'adjust:' #right
|
|
147 |
#'resizeForLabel:' true
|
|
148 |
)
|
|
149 |
#(#InputFieldSpec
|
|
150 |
#'name:' 'SelectorField'
|
530
|
151 |
#'layout:' #(#LayoutFrame 62 0.11 51 0 -18 1.0 73 0)
|
500
|
152 |
#'tabable:' true
|
|
153 |
#'model:' #selector
|
|
154 |
)
|
|
155 |
#(#UISubSpecification
|
|
156 |
#'name:' 'CommitPanel'
|
|
157 |
#'layout:' #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
|
|
158 |
#'majorKey:' #ToolApplicationModel
|
|
159 |
#'minorKey:' #windowSpecForCommitWithoutChannels
|
|
160 |
)
|
|
161 |
)
|
|
162 |
)
|
|
163 |
)
|
|
164 |
!
|
|
165 |
|
|
166 |
tabSpec
|
|
167 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
168 |
|
|
169 |
"do not manually edit this - the painter/builder may not be able to
|
|
170 |
handle the specification if its corrupted."
|
|
171 |
|
|
172 |
"
|
|
173 |
UIPainter new openOnClass:TabItemEditor andSelector:#tabSpec
|
|
174 |
TabItemEditor new openInterface:#tabSpec
|
|
175 |
"
|
|
176 |
|
|
177 |
<resource: #canvas>
|
|
178 |
|
|
179 |
^
|
|
180 |
|
|
181 |
#(#FullSpec
|
|
182 |
#'window:'
|
|
183 |
#(#WindowSpec
|
|
184 |
#'name:' 'Tab Basic'
|
570
|
185 |
#'layout:' #(#LayoutFrame 171 0 551 0 477 0 751 0)
|
500
|
186 |
#'label:' 'Tab Basic'
|
|
187 |
#'min:' #(#Point 10 10)
|
|
188 |
#'max:' #(#Point 1280 1024)
|
570
|
189 |
#'bounds:' #(#Rectangle 171 551 478 752)
|
500
|
190 |
#'usePreferredExtent:' false
|
|
191 |
)
|
|
192 |
#'component:'
|
|
193 |
#(#SpecCollection
|
|
194 |
#'collection:'
|
|
195 |
#(
|
|
196 |
#(#LabelSpec
|
|
197 |
#'name:' 'Label'
|
570
|
198 |
#'layout:' #(#AlignmentOrigin 104 0 26 0 1 0.5)
|
500
|
199 |
#'label:' 'Label:'
|
|
200 |
#'resizeForLabel:' true
|
|
201 |
)
|
|
202 |
#(#InputFieldSpec
|
|
203 |
#'name:' 'LabelField'
|
570
|
204 |
#'layout:' #(#LayoutFrame 107 0 15 0 -5 1.0 37 0)
|
500
|
205 |
#'activeHelpKey:' #label
|
|
206 |
#'model:' #label
|
|
207 |
)
|
|
208 |
#(#CheckBoxSpec
|
|
209 |
#'name:' 'TranslateLabel'
|
570
|
210 |
#'layout:' #(#LayoutOrigin 107 0 47 0)
|
500
|
211 |
#'activeHelpKey:' #translateLabel
|
|
212 |
#'model:' #translateLabel
|
|
213 |
#'label:' 'Label derives from Application'
|
|
214 |
)
|
|
215 |
#(#ColorMenuSpec
|
|
216 |
#'name:' 'ForegroundColorMenu'
|
549
|
217 |
#'layout:' #(#LayoutFrame 75 0 124 0 -4 1.0 146 0)
|
500
|
218 |
#'activeHelpKey:' #foregroundColor
|
|
219 |
#'model:' #labelForegroundColor
|
|
220 |
#'labelsAreColored:' false
|
|
221 |
)
|
|
222 |
#(#LabelSpec
|
|
223 |
#'name:' 'ForegroundLabel'
|
549
|
224 |
#'layout:' #(#AlignmentOrigin 73 0 136 0 1 0.5)
|
514
|
225 |
#'label:' 'Color:'
|
500
|
226 |
#'adjust:' #right
|
|
227 |
#'resizeForLabel:' true
|
|
228 |
)
|
|
229 |
#(#CheckBoxSpec
|
|
230 |
#'name:' 'CanSelect'
|
570
|
231 |
#'layout:' #(#LayoutFrame 107 0 176 0 226 0 198 0)
|
500
|
232 |
#'model:' #enabled
|
|
233 |
#'label:' 'Can Select'
|
|
234 |
)
|
549
|
235 |
#(#LabelSpec
|
|
236 |
#'name:' 'ArgumentLabel'
|
570
|
237 |
#'layout:' #(#AlignmentOrigin 104 0 91 0 1 0.5)
|
|
238 |
#'label:' 'Argument:'
|
549
|
239 |
#'resizeForLabel:' true
|
|
240 |
)
|
|
241 |
#(#InputFieldSpec
|
|
242 |
#'name:' 'ArgumentField'
|
570
|
243 |
#'layout:' #(#LayoutFrame 107 0 80 0 -5 1.0 102 0)
|
549
|
244 |
#'activeHelpKey:' #label
|
|
245 |
#'model:' #editAgument
|
|
246 |
)
|
500
|
247 |
)
|
|
248 |
)
|
|
249 |
)
|
|
250 |
!
|
|
251 |
|
|
252 |
windowSpec
|
|
253 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
254 |
|
|
255 |
"do not manually edit this - the painter/builder may not be able to
|
|
256 |
handle the specification if its corrupted."
|
|
257 |
|
|
258 |
"
|
|
259 |
UIPainter new openOnClass:TabItemEditor andSelector:#windowSpec
|
|
260 |
TabItemEditor new openInterface:#windowSpec
|
|
261 |
"
|
|
262 |
"TabItemEditor open"
|
|
263 |
|
|
264 |
<resource: #canvas>
|
|
265 |
|
|
266 |
^
|
|
267 |
|
|
268 |
#(#FullSpec
|
|
269 |
#'window:'
|
|
270 |
#(#WindowSpec
|
|
271 |
#'name:' 'TabItem Editor'
|
570
|
272 |
#'layout:' #(#LayoutFrame 275 0 353 0 743 0 681 0)
|
500
|
273 |
#'label:' 'TabItem Editor'
|
|
274 |
#'min:' #(#Point 10 10)
|
|
275 |
#'max:' #(#Point 1152 900)
|
570
|
276 |
#'bounds:' #(#Rectangle 275 353 744 682)
|
500
|
277 |
#'menu:' #menu
|
|
278 |
#'usePreferredExtent:' false
|
|
279 |
)
|
|
280 |
#'component:'
|
|
281 |
#(#SpecCollection
|
|
282 |
#'collection:'
|
|
283 |
#(
|
|
284 |
#(#MenuPanelSpec
|
|
285 |
#'name:' 'menuToolbarView'
|
|
286 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 34 0)
|
|
287 |
#'menu:' #menuToolbar
|
526
|
288 |
#'showSeparatingLines:' true
|
500
|
289 |
)
|
|
290 |
#(#VariableHorizontalPanelSpec
|
|
291 |
#'name:' 'VariablePanel'
|
570
|
292 |
#'layout:' #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -26 1.0)
|
500
|
293 |
#'component:'
|
|
294 |
#(#SpecCollection
|
|
295 |
#'collection:'
|
|
296 |
#(
|
|
297 |
#(#SequenceViewSpec
|
|
298 |
#'name:' 'columnView'
|
|
299 |
#'enableChannel:' #isNotModified
|
|
300 |
#'model:' #selectionHolder
|
|
301 |
#'menu:' #menuEdit
|
|
302 |
#'hasHorizontalScrollBar:' true
|
|
303 |
#'hasVerticalScrollBar:' true
|
|
304 |
#'miniScrollerHorizontal:' true
|
|
305 |
#'useIndex:' true
|
|
306 |
#'sequenceList:' #listOfLabels
|
|
307 |
)
|
|
308 |
#(#ViewSpec
|
|
309 |
#'name:' 'specView'
|
|
310 |
#'component:'
|
|
311 |
#(#SpecCollection
|
|
312 |
#'collection:'
|
|
313 |
#(
|
514
|
314 |
#(#ViewSpec
|
|
315 |
#'name:' 'TestView'
|
570
|
316 |
#'layout:' #(#LayoutFrame 1 0.0 0 0.0 0 1.0 0 1.0)
|
514
|
317 |
#'component:'
|
|
318 |
#(#SpecCollection
|
|
319 |
#'collection:'
|
|
320 |
#(
|
|
321 |
#(#TabViewSpec
|
|
322 |
#'name:' 'TestTabsView'
|
|
323 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 0.5)
|
|
324 |
)
|
|
325 |
)
|
|
326 |
)
|
|
327 |
)
|
500
|
328 |
#(#SubCanvasSpec
|
|
329 |
#'name:' 'specCanvas'
|
570
|
330 |
#'layout:' #(#LayoutFrame 1 0.0 0 0.0 0 1.0 -30 1.0)
|
500
|
331 |
#'specHolder:' #specChannel
|
|
332 |
)
|
|
333 |
#(#HorizontalPanelViewSpec
|
|
334 |
#'name:' 'modifyPanel'
|
570
|
335 |
#'layout:' #(#LayoutFrame 1 0.0 -30 1.0 0 1.0 0 1.0)
|
500
|
336 |
#'component:'
|
|
337 |
#(#SpecCollection
|
|
338 |
#'collection:'
|
|
339 |
#(
|
|
340 |
#(#ActionButtonSpec
|
|
341 |
#'name:' 'cancelButton'
|
|
342 |
#'label:' 'Cancel'
|
|
343 |
#'model:' #cancel
|
|
344 |
#'enableChannel:' #modifiedChannel
|
570
|
345 |
#'extent:' #(#Point 166 24)
|
500
|
346 |
)
|
|
347 |
#(#ActionButtonSpec
|
|
348 |
#'name:' 'acceptButton'
|
|
349 |
#'label:' 'OK'
|
|
350 |
#'model:' #accept
|
|
351 |
#'enableChannel:' #modifiedChannel
|
570
|
352 |
#'extent:' #(#Point 167 24)
|
500
|
353 |
)
|
|
354 |
)
|
|
355 |
)
|
|
356 |
#'horizontalLayout:' #fitSpace
|
|
357 |
#'verticalLayout:' #fitSpace
|
|
358 |
#'horizontalSpace:' 3
|
|
359 |
#'verticalSpace:' 3
|
|
360 |
)
|
|
361 |
)
|
|
362 |
)
|
570
|
363 |
#'level:' -1
|
500
|
364 |
)
|
|
365 |
)
|
|
366 |
)
|
|
367 |
#'handles:' #(#Any 0.259875 1.0)
|
|
368 |
)
|
570
|
369 |
#(#UISubSpecification
|
534
|
370 |
#'name:' 'infoBarSubSpec'
|
570
|
371 |
#'layout:' #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
|
534
|
372 |
#'majorKey:' #ToolApplicationModel
|
|
373 |
#'minorKey:' #windowSpecForInfoBar
|
500
|
374 |
)
|
|
375 |
)
|
|
376 |
)
|
|
377 |
)
|
|
378 |
! !
|
|
379 |
|
526
|
380 |
!TabItemEditor class methodsFor:'menu specs'!
|
500
|
381 |
|
|
382 |
menu
|
|
383 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
384 |
|
|
385 |
"do not manually edit this - the builder may not be able to
|
|
386 |
handle the specification if its corrupted."
|
|
387 |
|
|
388 |
"
|
|
389 |
MenuEditor new openOnClass:TabItemEditor andSelector:#menu
|
|
390 |
(Menu new fromLiteralArrayEncoding:(TabItemEditor menu)) startUp
|
|
391 |
"
|
|
392 |
|
|
393 |
<resource: #menu>
|
|
394 |
|
|
395 |
^
|
|
396 |
|
|
397 |
#(#Menu
|
|
398 |
|
|
399 |
#(
|
|
400 |
#(#MenuItem
|
526
|
401 |
#'label:' 'About'
|
546
|
402 |
#'labelImage:' #(#ResourceRetriever nil #menuIcon)
|
526
|
403 |
#'submenuChannel:' #menuAbout
|
|
404 |
)
|
|
405 |
#(#MenuItem
|
500
|
406 |
#'label:' 'File'
|
|
407 |
#'submenu:'
|
|
408 |
#(#Menu
|
|
409 |
|
|
410 |
#(
|
|
411 |
#(#MenuItem
|
|
412 |
#'label:' 'New'
|
|
413 |
#'value:' #doNew
|
570
|
414 |
#'activeHelpKey:' #fileNew
|
514
|
415 |
)
|
|
416 |
#(#MenuItem
|
|
417 |
#'label:' '-'
|
500
|
418 |
)
|
|
419 |
#(#MenuItem
|
|
420 |
#'label:' 'Reload'
|
|
421 |
#'value:' #doReload
|
570
|
422 |
#'activeHelpKey:' #fileReload
|
500
|
423 |
#'enabled:' #hasClassAndSelector
|
|
424 |
)
|
|
425 |
#(#MenuItem
|
|
426 |
#'label:' '-'
|
|
427 |
)
|
|
428 |
#(#MenuItem
|
514
|
429 |
#'label:' 'Save'
|
|
430 |
#'value:' #doInstallSpec
|
570
|
431 |
#'activeHelpKey:' #fileSave
|
514
|
432 |
#'enabled:' #isNotModified
|
|
433 |
)
|
|
434 |
#(#MenuItem
|
526
|
435 |
#'label:' '-'
|
514
|
436 |
)
|
|
437 |
#(#MenuItem
|
500
|
438 |
#'label:' 'Define Class And Selector...'
|
|
439 |
#'value:' #doDefineClassAndSelector
|
570
|
440 |
#'activeHelpKey:' #fileDefineClassAndSelector
|
500
|
441 |
)
|
|
442 |
#(#MenuItem
|
|
443 |
#'label:' 'Create Aspect Method'
|
|
444 |
#'value:' #doInstallAspect
|
|
445 |
#'enabled:' #hasClassAndSelector
|
|
446 |
)
|
|
447 |
#(#MenuItem
|
526
|
448 |
#'label:' '-'
|
500
|
449 |
)
|
|
450 |
#(#MenuItem
|
|
451 |
#'label:' 'Exit'
|
|
452 |
#'value:' #closeRequest
|
570
|
453 |
#'activeHelpKey:' #fileExit
|
500
|
454 |
#'enabled:' #isNotModified
|
|
455 |
)
|
|
456 |
) nil
|
|
457 |
nil
|
|
458 |
)
|
|
459 |
)
|
514
|
460 |
#(#MenuItem
|
|
461 |
#'label:' 'Edit'
|
|
462 |
#'submenuChannel:' #menuEdit
|
|
463 |
)
|
|
464 |
#(#MenuItem
|
526
|
465 |
#'label:' 'Add'
|
|
466 |
#'submenu:'
|
|
467 |
#(#Menu
|
|
468 |
|
|
469 |
#(
|
|
470 |
#(#MenuItem
|
|
471 |
#'label:' 'Tab Item'
|
560
|
472 |
#'value:' #doCreateTab
|
570
|
473 |
#'activeHelpKey:' #addTabItem
|
561
|
474 |
#'labelImage:' #(#ResourceRetriever nil #newTabItemIcon 'Tab Item')
|
526
|
475 |
)
|
|
476 |
) nil
|
|
477 |
nil
|
|
478 |
)
|
|
479 |
)
|
|
480 |
#(#MenuItem
|
570
|
481 |
#'label:' 'Test'
|
|
482 |
#'activeHelpKey:' #testPreview
|
|
483 |
#'submenu:'
|
|
484 |
#(#Menu
|
|
485 |
|
|
486 |
#(
|
|
487 |
#(#MenuItem
|
|
488 |
#'label:' 'Preview'
|
|
489 |
#'enabled:' #canShowTestMode
|
|
490 |
#'indication:' #testMode
|
|
491 |
)
|
|
492 |
) nil
|
|
493 |
nil
|
|
494 |
)
|
|
495 |
)
|
|
496 |
#(#MenuItem
|
514
|
497 |
#'label:' 'History'
|
|
498 |
#'submenuChannel:' #menuHistory
|
|
499 |
)
|
|
500 |
#(#MenuItem
|
|
501 |
#'label:' 'Help'
|
546
|
502 |
#'startGroup:' #right
|
514
|
503 |
#'submenuChannel:' #menuHelp
|
|
504 |
)
|
500
|
505 |
) nil
|
|
506 |
nil
|
|
507 |
)
|
|
508 |
!
|
|
509 |
|
|
510 |
menuEdit
|
|
511 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
512 |
|
|
513 |
"do not manually edit this - the builder may not be able to
|
|
514 |
handle the specification if its corrupted."
|
|
515 |
|
|
516 |
"
|
514
|
517 |
MenuEditor new openOnClass:TabItemEditor andSelector:#menuEdit
|
|
518 |
(Menu new fromLiteralArrayEncoding:(TabItemEditor menuEdit)) startUp
|
500
|
519 |
"
|
|
520 |
|
|
521 |
<resource: #menu>
|
|
522 |
|
|
523 |
^
|
514
|
524 |
|
500
|
525 |
#(#Menu
|
514
|
526 |
|
500
|
527 |
#(
|
|
528 |
#(#MenuItem
|
|
529 |
#'label:' 'Cut'
|
|
530 |
#'value:' #doCutTab
|
570
|
531 |
#'activeHelpKey:' #editCut
|
500
|
532 |
#'enabled:' #isColumnSelected
|
|
533 |
)
|
|
534 |
#(#MenuItem
|
|
535 |
#'label:' 'Copy'
|
|
536 |
#'value:' #doCopyTab
|
570
|
537 |
#'activeHelpKey:' #editCopy
|
500
|
538 |
#'enabled:' #isColumnSelected
|
|
539 |
)
|
|
540 |
#(#MenuItem
|
|
541 |
#'label:' 'Paste'
|
|
542 |
#'value:' #doPasteTab
|
570
|
543 |
#'activeHelpKey:' #editPaste
|
500
|
544 |
#'enabled:' #valueOfHavingClipboard
|
514
|
545 |
)
|
|
546 |
#(#MenuItem
|
|
547 |
#'label:' '-'
|
|
548 |
)
|
|
549 |
#(#MenuItem
|
526
|
550 |
#'label:' 'Move Up'
|
|
551 |
#'value:' #'doMoveTabUpOrDown:'
|
570
|
552 |
#'activeHelpKey:' #editMoveUp
|
526
|
553 |
#'enabled:' #canMoveTabUpOrDown
|
|
554 |
#'argument:' #up
|
|
555 |
#'labelImage:' #(#ResourceRetriever #ToolApplicationModel #upIcon 'Move Up')
|
|
556 |
)
|
|
557 |
#(#MenuItem
|
|
558 |
#'label:' 'Move Down'
|
|
559 |
#'value:' #'doMoveTabUpOrDown:'
|
570
|
560 |
#'activeHelpKey:' #editMoveDown
|
526
|
561 |
#'enabled:' #canMoveTabUpOrDown
|
|
562 |
#'argument:' #down
|
|
563 |
#'labelImage:' #(#ResourceRetriever #ToolApplicationModel #downIcon 'Move Down')
|
500
|
564 |
)
|
|
565 |
) nil
|
|
566 |
nil
|
|
567 |
)
|
|
568 |
!
|
|
569 |
|
|
570 |
menuToolbar
|
|
571 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
572 |
|
|
573 |
"do not manually edit this - the builder may not be able to
|
|
574 |
handle the specification if its corrupted."
|
|
575 |
|
|
576 |
"
|
|
577 |
MenuEditor new openOnClass:TabItemEditor andSelector:#menuToolbar
|
|
578 |
(Menu new fromLiteralArrayEncoding:(TabItemEditor menuToolbar)) startUp
|
|
579 |
"
|
|
580 |
|
|
581 |
<resource: #menu>
|
|
582 |
|
|
583 |
^
|
|
584 |
|
|
585 |
#(#Menu
|
|
586 |
|
|
587 |
#(
|
|
588 |
#(#MenuItem
|
514
|
589 |
#'label:' 'New'
|
|
590 |
#'isButton:' true
|
|
591 |
#'value:' #doNew
|
570
|
592 |
#'activeHelpKey:' #fileNew
|
514
|
593 |
#'labelImage:' #(#ResourceRetriever nil #newIcon)
|
|
594 |
)
|
|
595 |
#(#MenuItem
|
500
|
596 |
#'label:' 'Save'
|
|
597 |
#'isButton:' true
|
|
598 |
#'value:' #doInstallSpec
|
570
|
599 |
#'activeHelpKey:' #fileSave
|
500
|
600 |
#'enabled:' #isNotModified
|
|
601 |
#'labelImage:' #(#ResourceRetriever nil #saveIcon)
|
|
602 |
)
|
|
603 |
#(#MenuItem
|
|
604 |
#'label:' ''
|
|
605 |
)
|
|
606 |
#(#MenuItem
|
560
|
607 |
#'label:' 'Add Tab Item'
|
500
|
608 |
#'isButton:' true
|
|
609 |
#'value:' #doCreateTab
|
570
|
610 |
#'activeHelpKey:' #addTabItem
|
500
|
611 |
#'enabled:' #isNotModified
|
561
|
612 |
#'labelImage:' #(#ResourceRetriever nil #newTabItemIcon)
|
500
|
613 |
)
|
|
614 |
#(#MenuItem
|
|
615 |
#'label:' ''
|
|
616 |
)
|
|
617 |
#(#MenuItem
|
|
618 |
#'label:' 'Move Tab Up'
|
|
619 |
#'isButton:' true
|
|
620 |
#'value:' #'doMoveTabUpOrDown:'
|
570
|
621 |
#'activeHelpKey:' #editMoveUp
|
500
|
622 |
#'enabled:' #canMoveTabUpOrDown
|
|
623 |
#'argument:' #up
|
|
624 |
#'labelImage:' #(#ResourceRetriever nil #upIcon)
|
|
625 |
)
|
|
626 |
#(#MenuItem
|
|
627 |
#'label:' 'Move Tab Down'
|
|
628 |
#'isButton:' true
|
|
629 |
#'value:' #'doMoveTabUpOrDown:'
|
570
|
630 |
#'activeHelpKey:' #editMoveDown
|
500
|
631 |
#'enabled:' #canMoveTabUpOrDown
|
|
632 |
#'argument:' #down
|
|
633 |
#'labelImage:' #(#ResourceRetriever nil #downIcon)
|
|
634 |
)
|
570
|
635 |
#(#MenuItem
|
|
636 |
#'label:' ''
|
|
637 |
)
|
|
638 |
#(#MenuItem
|
|
639 |
#'label:' 'Preview'
|
|
640 |
#'isButton:' true
|
|
641 |
#'activeHelpKey:' #testPreview
|
|
642 |
#'enabled:' #canShowTestMode
|
|
643 |
#'labelImage:' #(#ResourceRetriever nil #startIcon)
|
|
644 |
#'indication:' #testMode
|
|
645 |
)
|
500
|
646 |
) nil
|
|
647 |
nil
|
|
648 |
)
|
|
649 |
! !
|
|
650 |
|
|
651 |
!TabItemEditor class methodsFor:'resources'!
|
|
652 |
|
561
|
653 |
newTabItemIcon
|
526
|
654 |
"Generated by the Image Editor"
|
|
655 |
"
|
561
|
656 |
ImageEditor openOnClass:self andSelector:#newTabItemIcon
|
526
|
657 |
"
|
500
|
658 |
|
|
659 |
<resource: #image>
|
|
660 |
|
526
|
661 |
^Icon
|
561
|
662 |
constantNamed:#'TabItemEditor newTabItemIcon'
|
|
663 |
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'U@@@@EUPUEUUVEUPUF**+EUPUF**+EUPUF**+EUP@F**+@@@EV***UV@F*****+@F KNC*+NF(("H*+@F((BC +EF(("H*+@F(("C*+MF*****+@F"@ H*K@F"""(LK@F"" ("K@F"""(*K@F"" H*K@F*****+HK??????@@@@@@@@@'); colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:66.9978)); at:4 put:((Color grey:49.9962)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'G?<@G?<@G?<@G?<@G?<@???<???<???<???????<???<???<???<???????=???<???????<???????<???<???='); yourself); yourself]! !
|
500
|
664 |
|
|
665 |
!TabItemEditor methodsFor:'accessing'!
|
|
666 |
|
|
667 |
className
|
|
668 |
^ className
|
|
669 |
!
|
|
670 |
|
514
|
671 |
didInstall
|
|
672 |
^ hasChanged not
|
|
673 |
!
|
|
674 |
|
500
|
675 |
selector
|
|
676 |
^ selector
|
|
677 |
! !
|
|
678 |
|
|
679 |
!TabItemEditor methodsFor:'actions'!
|
|
680 |
|
|
681 |
accept
|
|
682 |
"accept changes
|
|
683 |
"
|
|
684 |
|label|
|
|
685 |
|
|
686 |
self modified ifTrue:[
|
|
687 |
selectedIndex ~~ 0 ifTrue:[
|
|
688 |
rebuildMode := true.
|
|
689 |
label := listOfTabs at:selectedIndex.
|
|
690 |
hasChanged := true.
|
|
691 |
|
|
692 |
aspects keysAndValuesDo:[:aKey :aModel|
|
|
693 |
label perform:(aKey , ':') asSymbol with:(aModel value).
|
|
694 |
].
|
|
695 |
self listOfLabels at:selectedIndex put:(label label).
|
|
696 |
|
|
697 |
rebuildMode := false.
|
|
698 |
].
|
|
699 |
self cancel
|
|
700 |
]
|
|
701 |
!
|
|
702 |
|
|
703 |
cancel
|
|
704 |
"cancel all changes
|
|
705 |
"
|
|
706 |
|tab|
|
|
707 |
|
|
708 |
rebuildMode ifFalse:[
|
|
709 |
selectedIndex ~~ 0 ifTrue:[
|
|
710 |
tab := listOfTabs at:selectedIndex.
|
|
711 |
|
|
712 |
rebuildMode := true.
|
|
713 |
|
|
714 |
aspects keysAndValuesDo:[:aKey :aModel|
|
|
715 |
aModel value:(tab perform:aKey)
|
|
716 |
].
|
|
717 |
|
|
718 |
rebuildMode := false.
|
|
719 |
].
|
|
720 |
self modified:false.
|
|
721 |
].
|
|
722 |
self canMoveTabUpOrDown value:(selectedIndex ~~ 0 and:[listOfTabs size > 1])
|
|
723 |
|
|
724 |
|
|
725 |
|
|
726 |
|
|
727 |
!
|
|
728 |
|
|
729 |
modified
|
|
730 |
"returns true if current tab is modified
|
|
731 |
"
|
|
732 |
^ self modifiedChannel value
|
|
733 |
!
|
|
734 |
|
|
735 |
modified:aState
|
|
736 |
"change modification state
|
|
737 |
"
|
|
738 |
rebuildMode ifFalse:[
|
|
739 |
self modifiedChannel value:aState.
|
|
740 |
self isNotModified value:(aState not).
|
|
741 |
]
|
|
742 |
! !
|
|
743 |
|
|
744 |
!TabItemEditor methodsFor:'aspects'!
|
|
745 |
|
|
746 |
aspectFor:aKey
|
|
747 |
"returns aspect for a key or nil
|
|
748 |
"
|
|
749 |
^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
|
|
750 |
|
|
751 |
|
|
752 |
!
|
|
753 |
|
|
754 |
canMoveTabUpOrDown
|
|
755 |
|
|
756 |
|holder|
|
|
757 |
|
|
758 |
(holder := builder bindingAt:#canMoveTabUpOrDown) isNil ifTrue:[
|
|
759 |
builder aspectAt:#canMoveTabUpOrDown put:(holder := false asValue).
|
|
760 |
].
|
|
761 |
^ holder
|
|
762 |
|
|
763 |
!
|
|
764 |
|
570
|
765 |
canShowTestMode
|
|
766 |
|
|
767 |
|holder|
|
|
768 |
|
|
769 |
(holder := builder bindingAt:#canShowTestMode) isNil ifTrue:[
|
|
770 |
builder aspectAt:#canShowTestMode put:(holder := false asValue).
|
|
771 |
].
|
|
772 |
^ holder
|
|
773 |
|
|
774 |
!
|
|
775 |
|
500
|
776 |
hasClassAndSelector
|
|
777 |
|
|
778 |
|holder|
|
|
779 |
|
|
780 |
(holder := builder bindingAt:#hasClassAndSelector) isNil ifTrue:[
|
|
781 |
builder aspectAt:#hasClassAndSelector put:(holder := false asValue).
|
|
782 |
].
|
|
783 |
^ holder
|
|
784 |
|
|
785 |
!
|
|
786 |
|
|
787 |
isNotModified
|
|
788 |
"returns true if current tab spec is not modified
|
|
789 |
"
|
|
790 |
|holder|
|
|
791 |
|
|
792 |
(holder := builder bindingAt:#isNotModified) isNil ifTrue:[
|
|
793 |
builder aspectAt:#isNotModified put:(holder := true asValue).
|
|
794 |
].
|
|
795 |
^ holder
|
|
796 |
!
|
|
797 |
|
|
798 |
listOfLabels
|
|
799 |
"returns a holder which keeps the list of tab labels
|
|
800 |
"
|
|
801 |
|list|
|
|
802 |
|
|
803 |
(list := builder bindingAt:#listOfLabels) isNil ifTrue:[
|
|
804 |
builder aspectAt:#listOfLabels put:(list := List new).
|
|
805 |
].
|
|
806 |
^ list
|
|
807 |
!
|
|
808 |
|
|
809 |
modifiedChannel
|
|
810 |
"channel which is true if the current tab specification is modified
|
|
811 |
"
|
|
812 |
|holder|
|
|
813 |
|
|
814 |
(holder := builder bindingAt:#modifiedChannel) isNil ifTrue:[
|
|
815 |
builder aspectAt:#modifiedChannel put:(holder := false asValue).
|
|
816 |
].
|
|
817 |
^ holder
|
|
818 |
!
|
|
819 |
|
|
820 |
selectionHolder
|
|
821 |
"holder which keeps the current selection
|
|
822 |
"
|
|
823 |
|holder|
|
|
824 |
|
|
825 |
(holder := builder bindingAt:#selectionHolder) isNil ifTrue:[
|
|
826 |
holder := AspectAdaptor new subject:self; forAspect:#selectedIndex.
|
|
827 |
builder aspectAt:#selectionHolder put:holder.
|
|
828 |
].
|
|
829 |
^ holder
|
|
830 |
!
|
|
831 |
|
|
832 |
specChannel
|
|
833 |
"holder which keeps the current tab specification
|
|
834 |
"
|
|
835 |
|holder|
|
|
836 |
|
|
837 |
(holder := builder bindingAt:#specChannel) isNil ifTrue:[
|
|
838 |
builder aspectAt:#specChannel put:(holder := ValueHolder new).
|
|
839 |
].
|
|
840 |
^ holder
|
570
|
841 |
!
|
|
842 |
|
|
843 |
testMode
|
|
844 |
|
|
845 |
|holder|
|
|
846 |
|
|
847 |
(holder := builder bindingAt:#testMode) isNil ifTrue:[
|
|
848 |
builder aspectAt:#testMode put:(holder := false asValue).
|
|
849 |
holder addDependent: self
|
|
850 |
].
|
|
851 |
^ holder
|
|
852 |
|
500
|
853 |
! !
|
|
854 |
|
514
|
855 |
!TabItemEditor methodsFor:'building'!
|
|
856 |
|
|
857 |
buildFrom:aClass andSelector:aSelector
|
|
858 |
"build from class and selector
|
|
859 |
"
|
|
860 |
|spec list validClSl|
|
|
861 |
|
|
862 |
self doNew.
|
|
863 |
|
|
864 |
selector := nil.
|
|
865 |
className := self resolveName:aClass.
|
|
866 |
validClSl := false.
|
|
867 |
|
|
868 |
className notNil ifTrue:[
|
|
869 |
aSelector notNil ifTrue:[
|
|
870 |
validClSl := true.
|
|
871 |
selector := aSelector asSymbol.
|
|
872 |
|
|
873 |
(className respondsTo:selector) ifTrue:[
|
|
874 |
spec := className perform:selector.
|
|
875 |
list := self listOfLabels.
|
|
876 |
|
|
877 |
spec size ~~ 0 ifTrue:[
|
|
878 |
|
|
879 |
rebuildMode := true.
|
|
880 |
|
|
881 |
spec do:[:aTab|
|
|
882 |
list add:aTab label.
|
|
883 |
listOfTabs add:aTab.
|
|
884 |
].
|
|
885 |
rebuildMode := false.
|
|
886 |
self addToHistory:(className name, ' ', selector) -> #loadFromMessage:
|
|
887 |
]
|
|
888 |
]
|
|
889 |
]
|
|
890 |
].
|
|
891 |
|
|
892 |
self hasClassAndSelector value:validClSl.
|
|
893 |
self modified:false.
|
|
894 |
hasChanged := false.
|
|
895 |
|
|
896 |
listOfTabs notEmpty ifTrue:[
|
|
897 |
self selectionHolder value:1
|
|
898 |
].
|
|
899 |
!
|
|
900 |
|
|
901 |
loadFromMessage:aMessage
|
|
902 |
"load tabs from class and selector derived from history
|
|
903 |
"
|
|
904 |
|msg cls|
|
|
905 |
|
|
906 |
aMessage notNil ifTrue:[
|
|
907 |
msg := aMessage asCollectionOfWords.
|
|
908 |
|
|
909 |
(msg size == 2 and:[(cls := self resolveName:(msg at:1)) notNil]) ifTrue:[
|
|
910 |
self buildFrom:cls andSelector:((msg at:2) asSymbol)
|
|
911 |
]
|
|
912 |
]
|
|
913 |
! !
|
|
914 |
|
500
|
915 |
!TabItemEditor methodsFor:'change & update'!
|
|
916 |
|
|
917 |
update:something with:aParameter from:someObject
|
|
918 |
"one of my aspects has changed; update modified channel
|
|
919 |
"
|
|
920 |
self modified:true.
|
|
921 |
|
570
|
922 |
someObject = self testMode
|
|
923 |
ifTrue:
|
|
924 |
[
|
|
925 |
someObject value
|
|
926 |
ifTrue: [self doTest]
|
|
927 |
ifFalse:[testView lower. self selectionHolder value:1].
|
500
|
928 |
|
570
|
929 |
self valueOfInfoLabel value: self defaultInfoLabel.
|
|
930 |
]
|
|
931 |
! !
|
|
932 |
|
|
933 |
!TabItemEditor methodsFor:'help'!
|
|
934 |
|
|
935 |
defaultInfoLabel
|
|
936 |
|
|
937 |
^self testMode value
|
|
938 |
ifTrue: ['Test mode']
|
|
939 |
ifFalse: ['']
|
500
|
940 |
! !
|
|
941 |
|
|
942 |
!TabItemEditor methodsFor:'selection'!
|
|
943 |
|
|
944 |
selectedIndex
|
|
945 |
^ selectedIndex
|
|
946 |
!
|
|
947 |
|
|
948 |
selectedIndex:anIndex
|
|
949 |
|s oldSel|
|
|
950 |
|
570
|
951 |
self listOfLabels notEmpty ifTrue: [self canShowTestMode value: true].
|
|
952 |
|
500
|
953 |
oldSel := selectedIndex.
|
|
954 |
selectedIndex := anIndex ? 0.
|
|
955 |
|
|
956 |
selectedIndex == oldSel ifTrue:[^ self].
|
|
957 |
|
|
958 |
oldSel == 0 ifTrue:[
|
|
959 |
self specChannel value:(self class tabSpec)
|
|
960 |
] ifFalse:[
|
|
961 |
selectedIndex == 0 ifTrue:[
|
|
962 |
self specChannel value:nil
|
|
963 |
]
|
|
964 |
].
|
|
965 |
self cancel.
|
514
|
966 |
|
|
967 |
testView notNil ifTrue:[
|
570
|
968 |
testView lower.
|
|
969 |
].
|
|
970 |
|
|
971 |
|
|
972 |
"self testMode value not & anIndex notNil ifTrue: [self testMode value: false].
|
|
973 |
"
|
500
|
974 |
! !
|
|
975 |
|
|
976 |
!TabItemEditor methodsFor:'startup / release'!
|
|
977 |
|
|
978 |
closeRequest
|
|
979 |
|
|
980 |
hasChanged ifTrue:[
|
526
|
981 |
( YesNoBox title:'Tab spec was modified!!'
|
|
982 |
yesText:'Waste it and proceed'
|
|
983 |
noText:'Cancel'
|
500
|
984 |
) confirm ifFalse:[
|
|
985 |
^ self
|
|
986 |
].
|
|
987 |
hasChanged := false.
|
|
988 |
].
|
|
989 |
super closeRequest.
|
|
990 |
!
|
|
991 |
|
|
992 |
initialize
|
|
993 |
"setup aspects used by column description specifications
|
|
994 |
"
|
|
995 |
|holder|
|
|
996 |
|
|
997 |
super initialize.
|
|
998 |
|
|
999 |
aspects := IdentityDictionary new.
|
|
1000 |
listOfTabs := OrderedCollection new.
|
|
1001 |
hasChanged := false.
|
|
1002 |
selectedIndex := 0.
|
|
1003 |
rebuildMode := false.
|
|
1004 |
|
|
1005 |
#(
|
|
1006 |
label
|
|
1007 |
translateLabel
|
|
1008 |
labelForegroundColor
|
|
1009 |
enabled
|
549
|
1010 |
editAgument
|
500
|
1011 |
|
|
1012 |
) do:[:aKey|
|
|
1013 |
aspects at:aKey put:(holder := ValueHolder new).
|
|
1014 |
holder addDependent:self.
|
|
1015 |
].
|
|
1016 |
|
|
1017 |
|
|
1018 |
!
|
|
1019 |
|
|
1020 |
openModalOnClass:aClass andSelector:aSelector
|
|
1021 |
|
|
1022 |
className := aClass.
|
|
1023 |
selector := aSelector.
|
|
1024 |
|
|
1025 |
super openInterfaceModal.
|
|
1026 |
|
|
1027 |
|
|
1028 |
!
|
|
1029 |
|
|
1030 |
openOnClass:aClass andSelector:aSelector
|
|
1031 |
|
|
1032 |
className := aClass.
|
|
1033 |
selector := aSelector.
|
|
1034 |
|
|
1035 |
super openInterface.
|
|
1036 |
|
|
1037 |
|
|
1038 |
!
|
|
1039 |
|
|
1040 |
postBuildWith:builder
|
|
1041 |
self buildFrom:className andSelector:selector.
|
514
|
1042 |
testView := builder componentAt:#TestView.
|
500
|
1043 |
! !
|
|
1044 |
|
|
1045 |
!TabItemEditor methodsFor:'user interactions'!
|
|
1046 |
|
|
1047 |
doCopyTab
|
|
1048 |
"copy selected tab
|
|
1049 |
"
|
|
1050 |
selectedIndex ~~ 0 ifTrue:[
|
|
1051 |
self clipboard:(listOfTabs at:selectedIndex) deepCopy
|
|
1052 |
]
|
|
1053 |
!
|
|
1054 |
|
|
1055 |
doCreateTab
|
570
|
1056 |
|
500
|
1057 |
|tab|
|
570
|
1058 |
self testMode value: false.
|
553
|
1059 |
tab := TabItem label:'Tab Item ', (listOfTabs size + 1) printString.
|
500
|
1060 |
|
|
1061 |
listOfTabs add:tab afterIndex:selectedIndex.
|
|
1062 |
self listOfLabels add:(tab label) afterIndex:selectedIndex.
|
|
1063 |
hasChanged := true.
|
|
1064 |
|
|
1065 |
selectedIndex == 0 ifTrue:[
|
|
1066 |
self selectionHolder value:1
|
570
|
1067 |
] ifFalse:[
|
|
1068 |
self selectionHolder value:selectedIndex + 1.
|
500
|
1069 |
self cancel.
|
|
1070 |
]
|
|
1071 |
!
|
|
1072 |
|
|
1073 |
doCutTab
|
|
1074 |
"cut selected tab
|
|
1075 |
"
|
|
1076 |
|list index|
|
|
1077 |
|
|
1078 |
(index := selectedIndex) ~~ 0 ifTrue:[
|
|
1079 |
list := self listOfLabels.
|
|
1080 |
self clipboard:(listOfTabs at:index) deepCopy.
|
|
1081 |
self selectionHolder value:0.
|
|
1082 |
listOfTabs removeIndex:index.
|
|
1083 |
list removeIndex:index.
|
|
1084 |
hasChanged := true.
|
|
1085 |
|
|
1086 |
index > list size ifTrue:[
|
|
1087 |
index := index - 1
|
|
1088 |
].
|
570
|
1089 |
self selectionHolder value:index.
|
|
1090 |
self listOfLabels isEmpty ifTrue: [self canShowTestMode value: false].
|
500
|
1091 |
]
|
|
1092 |
|
|
1093 |
!
|
|
1094 |
|
|
1095 |
doDefineClassAndSelector
|
|
1096 |
"launch a dialog to define class and selector
|
|
1097 |
"
|
|
1098 |
|cls sel bindings|
|
|
1099 |
|
|
1100 |
bindings := IdentityDictionary new.
|
|
1101 |
|
|
1102 |
[true] whileTrue:[
|
|
1103 |
cls := className notNil ifTrue:[className name] ifFalse:['NewApplication'].
|
|
1104 |
sel := selector ? 'tabItemList'.
|
|
1105 |
|
|
1106 |
bindings at:#className put:cls asValue.
|
|
1107 |
bindings at:#selector put:sel asValue.
|
|
1108 |
|
|
1109 |
(self openDialogInterface:#nameAndSelectorSpec withBindings:bindings)
|
|
1110 |
ifFalse:[ ^ self ].
|
|
1111 |
|
|
1112 |
cls := (bindings at:#className) value withoutSeparators.
|
|
1113 |
sel := (bindings at:#selector) value withoutSeparators.
|
|
1114 |
|
|
1115 |
(cls := self resolveName:cls) notNil ifTrue:[
|
|
1116 |
className := cls.
|
|
1117 |
|
|
1118 |
sel notNil ifTrue:[
|
|
1119 |
selector := sel asSymbol.
|
514
|
1120 |
self hasClassAndSelector value:true.
|
|
1121 |
|
|
1122 |
listOfTabs size == 0 ifTrue:[
|
|
1123 |
self buildFrom:className andSelector:selector
|
|
1124 |
].
|
|
1125 |
^ self
|
500
|
1126 |
]
|
|
1127 |
]
|
|
1128 |
]
|
|
1129 |
!
|
|
1130 |
|
|
1131 |
doInstallAspect
|
|
1132 |
"generate aspect method
|
|
1133 |
"
|
|
1134 |
|code|
|
|
1135 |
|
|
1136 |
className isNil ifTrue:[ ^ self information:'No valid class defined!!'].
|
|
1137 |
selector isNil ifTrue:[ ^ self information:'No selector defined!!' ].
|
|
1138 |
|
|
1139 |
(className canUnderstand:selector) ifTrue:[
|
|
1140 |
"/ method already exists, do not overwrite the method automaticaly
|
|
1141 |
|
|
1142 |
( YesNoBox title:'method '
|
|
1143 |
, (Text string:('#', selector) emphasis:#bold)
|
|
1144 |
, ' already exists'
|
|
1145 |
yesText:'overwrite'
|
|
1146 |
noText:'cancel'
|
|
1147 |
) confirm ifFalse:[
|
|
1148 |
^ self
|
|
1149 |
]
|
|
1150 |
].
|
|
1151 |
|
|
1152 |
code := '!!' , className name , ' methodsFor:''aspects''!!\\' ,
|
|
1153 |
selector , '\' ,
|
|
1154 |
' "automatically generated by TabItem Editor ..."\' ,
|
|
1155 |
'\' ,
|
|
1156 |
' |list|\' ,
|
|
1157 |
'\' ,
|
|
1158 |
' (list := builder bindingAt:#' , selector , ') isNil ifTrue:[\' ,
|
|
1159 |
' builder aspectAt:#' , selector, ' put:(list := self class ', selector, ').\' ,
|
|
1160 |
' ].\' ,
|
|
1161 |
' ^ list\' ,
|
|
1162 |
'!! !!\\'.
|
|
1163 |
|
|
1164 |
(ReadStream on:(code withCRs)) fileIn
|
|
1165 |
|
|
1166 |
|
|
1167 |
!
|
|
1168 |
|
|
1169 |
doInstallSpec
|
|
1170 |
"generate code for class and instance
|
|
1171 |
"
|
|
1172 |
|code spec category mthd|
|
|
1173 |
|
|
1174 |
(className isNil or:[selector isNil]) ifTrue:[
|
|
1175 |
self doDefineClassAndSelector
|
|
1176 |
].
|
|
1177 |
className isNil ifTrue:[ ^ self information:'No valid class defined!!'].
|
|
1178 |
selector isNil ifTrue:[ ^ self information:'No selector defined!!' ].
|
|
1179 |
listOfTabs isEmpty ifTrue:[ ^ self information:'No valid tabs defined!!' ].
|
|
1180 |
|
|
1181 |
spec := WriteStream on:String new.
|
|
1182 |
UISpecification prettyPrintSpecArray:(listOfTabs literalArrayEncoding) on:spec indent:5.
|
|
1183 |
spec := spec contents.
|
|
1184 |
|
|
1185 |
"/ if that method already exists, do not overwrite the category
|
|
1186 |
|
|
1187 |
category := 'interface specs'.
|
|
1188 |
|
|
1189 |
(mthd := className class compiledMethodAt:selector) notNil ifTrue:[
|
|
1190 |
category := mthd category.
|
|
1191 |
].
|
|
1192 |
|
|
1193 |
code := Character excla asString
|
|
1194 |
, className name , ' class methodsFor:' , category storeString
|
|
1195 |
, Character excla asString , '\\'
|
|
1196 |
|
|
1197 |
, selector , '\'
|
|
1198 |
, ' "this window spec was automatically generated by the ST/X TabItemEditor"\\'
|
|
1199 |
, ' "do not manually edit this - the builder may not be able to\'
|
|
1200 |
, ' handle the specification if its corrupted."\\'
|
|
1201 |
, ' "\'
|
|
1202 |
, ' TabItemEditor new openOnClass:' , className name , ' andSelector:#' , selector , '\'
|
|
1203 |
, ' "\'.
|
|
1204 |
|
|
1205 |
code := code
|
|
1206 |
, '\'
|
526
|
1207 |
, ' <resource: #tabList>\\'
|
500
|
1208 |
, ' ^\'
|
|
1209 |
, ' ', spec, '\'
|
|
1210 |
, ' collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]'
|
|
1211 |
, '\'
|
|
1212 |
, Character excla asString
|
|
1213 |
, ' '
|
|
1214 |
, Character excla asString
|
|
1215 |
, '\\'.
|
|
1216 |
|
|
1217 |
code := code withCRs.
|
|
1218 |
(ReadStream on:code) fileIn.
|
|
1219 |
hasChanged := false.
|
526
|
1220 |
self addToHistory:(className name, ' ', selector) -> #loadFromMessage:.
|
500
|
1221 |
|
|
1222 |
(className canUnderstand:selector) ifFalse:[
|
|
1223 |
(YesNoBox confirm:'install aspect method') ifTrue:[
|
|
1224 |
self doInstallAspect
|
|
1225 |
]
|
|
1226 |
]
|
|
1227 |
|
|
1228 |
|
|
1229 |
!
|
|
1230 |
|
|
1231 |
doMoveTabUpOrDown:what
|
|
1232 |
"step up or down
|
|
1233 |
"
|
|
1234 |
|tab list index|
|
|
1235 |
|
|
1236 |
(selectedIndex ~~ 0 and:[listOfTabs size > 1]) ifFalse:[
|
|
1237 |
^ self
|
|
1238 |
].
|
|
1239 |
|
|
1240 |
list := self listOfLabels.
|
|
1241 |
tab := listOfTabs at:selectedIndex.
|
|
1242 |
|
|
1243 |
list removeIndex:selectedIndex.
|
|
1244 |
listOfTabs removeIndex:selectedIndex.
|
|
1245 |
|
|
1246 |
what == #down ifTrue:[
|
|
1247 |
index := selectedIndex > list size ifTrue:[1]
|
|
1248 |
ifFalse:[selectedIndex + 1]
|
|
1249 |
] ifFalse:[
|
|
1250 |
index := selectedIndex == 1 ifTrue:[list size + 1]
|
|
1251 |
ifFalse:[selectedIndex - 1]
|
|
1252 |
].
|
|
1253 |
|
|
1254 |
list add:(tab label) beforeIndex:index.
|
|
1255 |
listOfTabs add:tab beforeIndex:index.
|
|
1256 |
hasChanged := true.
|
|
1257 |
|
|
1258 |
rebuildMode := true.
|
|
1259 |
self selectionHolder value:index.
|
|
1260 |
rebuildMode := false.
|
|
1261 |
|
|
1262 |
|
|
1263 |
!
|
|
1264 |
|
|
1265 |
doNew
|
|
1266 |
|
|
1267 |
self modified:false.
|
|
1268 |
|
|
1269 |
rebuildMode := true.
|
|
1270 |
|
|
1271 |
self selectionHolder value:0.
|
|
1272 |
self listOfLabels removeAll.
|
|
1273 |
listOfTabs removeAll.
|
|
1274 |
|
514
|
1275 |
testView notNil ifTrue:[
|
|
1276 |
testView lower
|
|
1277 |
].
|
|
1278 |
|
500
|
1279 |
hasChanged := true.
|
|
1280 |
rebuildMode := false.
|
570
|
1281 |
|
|
1282 |
self canShowTestMode value: false
|
500
|
1283 |
!
|
|
1284 |
|
|
1285 |
doPasteTab
|
|
1286 |
"paste a tab
|
|
1287 |
"
|
|
1288 |
|tab|
|
|
1289 |
|
|
1290 |
tab := self class clipboard deepCopy.
|
|
1291 |
listOfTabs add:tab afterIndex:selectedIndex.
|
|
1292 |
self listOfLabels add:(tab label) afterIndex:selectedIndex.
|
|
1293 |
hasChanged := true.
|
|
1294 |
|
|
1295 |
selectedIndex == 0 ifTrue:[
|
|
1296 |
self selectionHolder value:1
|
570
|
1297 |
] ifFalse:[
|
|
1298 |
self selectionHolder value:selectedIndex + 1.
|
|
1299 |
self cancel.
|
500
|
1300 |
]
|
|
1301 |
!
|
|
1302 |
|
|
1303 |
doReload
|
|
1304 |
"reload from class and selector
|
|
1305 |
"
|
|
1306 |
self buildFrom:className andSelector:selector
|
514
|
1307 |
!
|
|
1308 |
|
|
1309 |
doTest
|
|
1310 |
"run a test
|
|
1311 |
"
|
|
1312 |
|tabView list|
|
|
1313 |
|
|
1314 |
self selectionHolder value:nil.
|
|
1315 |
|
|
1316 |
listOfTabs size ~~ 0 ifTrue:[
|
|
1317 |
list := listOfTabs collect:[:aTab||t|
|
|
1318 |
t := aTab copy.
|
|
1319 |
t setAttributesFromClass:className.
|
|
1320 |
t
|
|
1321 |
]
|
|
1322 |
] ifFalse:[
|
|
1323 |
list := nil
|
|
1324 |
].
|
|
1325 |
tabView := builder componentAt:#TestTabsView.
|
|
1326 |
tabView list:list.
|
|
1327 |
testView raise.
|
|
1328 |
|
|
1329 |
|
570
|
1330 |
|
500
|
1331 |
! !
|
|
1332 |
|
|
1333 |
!TabItemEditor class methodsFor:'documentation'!
|
|
1334 |
|
|
1335 |
version
|
|
1336 |
^ '$Header$'
|
|
1337 |
! !
|