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