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