author | Claus Gittinger <cg@exept.de> |
Thu, 23 Dec 1999 22:43:20 +0100 | |
changeset 1282 | 7fa3b3c668f3 |
parent 1245 | fd0127c25b66 |
child 1325 | a7c38b60f2fb |
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 |
|
1183 | 122 |
'An optional argument stored with the tab item.' |
739 | 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 |
||
1183 | 189 |
^ |
190 |
#(#FullSpec |
|
191 |
#name: #tabSpec |
|
192 |
#window: |
|
193 |
#(#WindowSpec |
|
194 |
#label: 'Tab Basic' |
|
195 |
#name: 'Tab Basic' |
|
196 |
#layout: #(#LayoutFrame 220 0 200 0 634 0 425 0) |
|
197 |
#min: #(#Point 10 10) |
|
198 |
#max: #(#Point 1280 1024) |
|
199 |
#bounds: #(#Rectangle 220 200 635 426) |
|
200 |
) |
|
201 |
#component: |
|
202 |
#(#SpecCollection |
|
203 |
#collection: #( |
|
204 |
#(#LabelSpec |
|
205 |
#label: 'Label:' |
|
206 |
#name: 'Label' |
|
207 |
#layout: #(#AlignmentOrigin 98 0 26 0 1 0.5) |
|
208 |
#resizeForLabel: true |
|
209 |
) |
|
210 |
#(#InputFieldSpec |
|
211 |
#name: 'LabelField' |
|
212 |
#layout: #(#LayoutFrame 100 0 15 0 -5 1.0 37 0) |
|
213 |
#activeHelpKey: #label |
|
214 |
#model: #label |
|
215 |
#acceptOnLostFocus: true |
|
216 |
#acceptChannel: #acceptChannel |
|
217 |
#modifiedChannel: #modifiedChannel |
|
218 |
#acceptOnPointerLeave: false |
|
219 |
) |
|
220 |
#(#CheckBoxSpec |
|
221 |
#label: 'Application provides translation ' |
|
222 |
#name: 'TranslateLabel' |
|
223 |
#layout: #(#LayoutFrame 59 0 45 0 -8 1 71 0) |
|
224 |
#activeHelpKey: #labelDerivesFromApplication |
|
225 |
#model: #translateLabel |
|
226 |
) |
|
227 |
#(#LabelSpec |
|
228 |
#label: 'Argument:' |
|
229 |
#name: 'ArgumentLabel' |
|
230 |
#layout: #(#AlignmentOrigin 98 0 182 0 1 0.5) |
|
231 |
#resizeForLabel: true |
|
232 |
) |
|
233 |
#(#InputFieldSpec |
|
234 |
#name: 'ArgumentField' |
|
235 |
#layout: #(#LayoutFrame 100 0 171 0 -5 1.0 193 0) |
|
236 |
#activeHelpKey: #argument |
|
237 |
#model: #editAgument |
|
238 |
#acceptOnLostFocus: true |
|
239 |
#acceptChannel: #acceptChannel |
|
240 |
#modifiedChannel: #modifiedChannel |
|
241 |
#acceptOnPointerLeave: false |
|
242 |
) |
|
243 |
#(#LabelSpec |
|
244 |
#label: 'Color:' |
|
245 |
#name: 'ForegroundLabel' |
|
246 |
#layout: #(#AlignmentOrigin 98 0 91 0 1 0.5) |
|
247 |
#resizeForLabel: true |
|
248 |
#adjust: #right |
|
249 |
) |
|
250 |
#(#ColorMenuSpec |
|
251 |
#name: 'ForegroundColorMenu' |
|
252 |
#layout: #(#LayoutFrame 100 0 79 0 -5 1.0 101 0) |
|
253 |
#activeHelpKey: #color |
|
254 |
#model: #labelForegroundColor |
|
255 |
#labelsAreColored: false |
|
256 |
) |
|
257 |
#(#CheckBoxSpec |
|
258 |
#label: 'Can Select' |
|
259 |
#name: 'CanSelect' |
|
260 |
#layout: #(#LayoutFrame 59 0 110 0 -8 1 132 0) |
|
261 |
#activeHelpKey: #canSelect |
|
262 |
#model: #enabled |
|
263 |
) |
|
264 |
) |
|
265 |
||
266 |
) |
|
739 | 267 |
) |
268 |
! |
|
269 |
||
270 |
windowSpec |
|
271 |
"This resource specification was automatically generated |
|
272 |
by the UIPainter of ST/X." |
|
273 |
||
274 |
"Do not manually edit this!! If it is corrupted, |
|
275 |
the UIPainter may not be able to read the specification." |
|
276 |
||
277 |
" |
|
278 |
UIPainter new openOnClass:TabListEditor andSelector:#windowSpec |
|
279 |
TabListEditor new openInterface:#windowSpec |
|
280 |
TabListEditor open |
|
281 |
" |
|
282 |
||
283 |
<resource: #canvas> |
|
284 |
||
1183 | 285 |
^ |
286 |
#(#FullSpec |
|
287 |
#name: #windowSpec |
|
288 |
#window: |
|
289 |
#(#WindowSpec |
|
290 |
#label: 'Tab List Editor' |
|
291 |
#name: 'Tab List Editor' |
|
292 |
#layout: #(#LayoutFrame 58 0 290 0 659 0 707 0) |
|
293 |
#min: #(#Point 440 280) |
|
294 |
#max: #(#Point 1152 900) |
|
295 |
#bounds: #(#Rectangle 58 290 660 708) |
|
296 |
#menu: #menu |
|
297 |
) |
|
298 |
#component: |
|
299 |
#(#SpecCollection |
|
300 |
#collection: #( |
|
301 |
#(#MenuPanelSpec |
|
302 |
#name: 'menuToolbarView' |
|
303 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 34 0) |
|
304 |
#menu: #menuToolbar |
|
305 |
#showSeparatingLines: true |
|
306 |
) |
|
307 |
#(#VariableHorizontalPanelSpec |
|
308 |
#name: 'VariablePanel' |
|
309 |
#layout: #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -26 1.0) |
|
310 |
#handles: #(#Any 0.259875 1.0) |
|
311 |
#component: |
|
312 |
#(#SpecCollection |
|
313 |
#collection: #( |
|
314 |
#(#SequenceViewSpec |
|
315 |
#name: 'ColumnView' |
|
316 |
#model: #selectionHolder |
|
317 |
#menu: #menuEdit |
|
318 |
#hasHorizontalScrollBar: true |
|
319 |
#hasVerticalScrollBar: true |
|
320 |
#miniScrollerHorizontal: true |
|
321 |
#useIndex: true |
|
322 |
#sequenceList: #listOfLabels |
|
323 |
) |
|
324 |
#(#ViewSpec |
|
325 |
#name: 'SpecView' |
|
326 |
#level: -1 |
|
739 | 327 |
#component: |
1183 | 328 |
#(#SpecCollection |
329 |
#collection: #( |
|
330 |
#(#ViewSpec |
|
331 |
#name: 'TestView' |
|
332 |
#layout: #(#LayoutFrame 1 0.0 0 0.0 0 1.0 0 1.0) |
|
333 |
#component: |
|
334 |
#(#SpecCollection |
|
335 |
#collection: #( |
|
336 |
#(#TabViewSpec |
|
337 |
#name: 'TestTabsView' |
|
338 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 0.5) |
|
739 | 339 |
) |
1183 | 340 |
) |
341 |
||
739 | 342 |
) |
343 |
) |
|
1183 | 344 |
#(#SubCanvasSpec |
345 |
#name: 'specCanvas' |
|
346 |
#layout: #(#LayoutFrame 1 0.0 0 0.0 0 1.0 -30 1.0) |
|
347 |
#specHolder: #specChannel |
|
348 |
) |
|
349 |
#(#UISubSpecification |
|
350 |
#name: 'subSpec' |
|
351 |
#layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1) |
|
352 |
#majorKey: #ToolApplicationModel |
|
353 |
#minorKey: #windowSpecForCommit |
|
354 |
) |
|
355 |
) |
|
356 |
||
739 | 357 |
) |
1183 | 358 |
) |
359 |
) |
|
360 |
||
739 | 361 |
) |
1183 | 362 |
) |
363 |
#(#UISubSpecification |
|
364 |
#name: 'infoBarSubSpec' |
|
365 |
#layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
|
366 |
#majorKey: #ToolApplicationModel |
|
367 |
#minorKey: #windowSpecForInfoBar |
|
368 |
) |
|
369 |
) |
|
370 |
||
371 |
) |
|
739 | 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 |
||
1183 | 743 |
^ builder listAspectFor:#listOfLabels |
739 | 744 |
! |
745 |
||
746 |
selectionHolder |
|
747 |
"holder which keeps the current selection |
|
748 |
" |
|
749 |
|holder| |
|
750 |
||
751 |
(holder := builder bindingAt:#selectionHolder) isNil ifTrue:[ |
|
752 |
holder := AspectAdaptor new subject:self; forAspect:#selectedIndex. |
|
753 |
builder aspectAt:#selectionHolder put:holder. |
|
754 |
]. |
|
755 |
^ holder |
|
756 |
! |
|
757 |
||
758 |
specChannel |
|
759 |
"holder which keeps the current tab specification |
|
760 |
" |
|
761 |
|holder| |
|
762 |
||
763 |
(holder := builder bindingAt:#specChannel) isNil ifTrue:[ |
|
764 |
builder aspectAt:#specChannel put:(holder := ValueHolder new). |
|
765 |
]. |
|
766 |
^ holder |
|
767 |
! |
|
768 |
||
769 |
testMode |
|
770 |
||
771 |
|holder| |
|
772 |
||
773 |
(holder := builder bindingAt:#testMode) isNil ifTrue:[ |
|
774 |
builder aspectAt:#testMode put:(holder := false asValue). |
|
775 |
holder addDependent: self |
|
776 |
]. |
|
777 |
^ holder |
|
778 |
||
779 |
! ! |
|
780 |
||
781 |
!TabListEditor methodsFor:'building'! |
|
782 |
||
783 |
buildFromClass:aClass andSelector:aSelector |
|
784 |
"build from class and selector |
|
785 |
" |
|
1145 | 786 |
|cls spec list selectionHolder| |
739 | 787 |
|
788 |
self testMode value: false. |
|
1145 | 789 |
(selectionHolder := self selectionHolder) value:0. |
739 | 790 |
|
791 |
"if opened on a tab list" |
|
792 |
(aClass isNil and: [aSelector isNil and: [listOfTabs size > 0]]) |
|
1145 | 793 |
ifTrue:[ |
739 | 794 |
listOfTabs notEmpty ifTrue:[ |
1145 | 795 |
selectionHolder value:1 |
739 | 796 |
]. |
1145 | 797 |
^ nil |
739 | 798 |
]. |
799 |
||
800 |
self listOfLabels removeAll. |
|
801 |
listOfTabs removeAll. |
|
802 |
||
803 |
testView notNil ifTrue:[ |
|
804 |
testView lower |
|
805 |
]. |
|
806 |
||
807 |
rebuildMode := false. |
|
808 |
||
809 |
self canShowTestMode value: false. |
|
810 |
||
811 |
cls := self resolveName:aClass. |
|
812 |
specSelector := aSelector. |
|
813 |
||
814 |
cls notNil ifTrue:[ |
|
815 |
specSelector notNil ifTrue:[ |
|
816 |
||
817 |
(cls respondsTo:specSelector) ifTrue:[ |
|
818 |
spec := cls perform:specSelector. |
|
819 |
list := self listOfLabels. |
|
820 |
||
821 |
spec size ~~ 0 ifTrue:[ |
|
822 |
||
823 |
rebuildMode := true. |
|
824 |
||
825 |
spec do:[:aTab| |
|
826 |
list add:aTab label. |
|
827 |
listOfTabs add:aTab. |
|
828 |
]. |
|
829 |
rebuildMode := false. |
|
830 |
self addToHistory:(cls name, ' ', specSelector) -> #loadFromMessage: |
|
831 |
] |
|
832 |
] |
|
833 |
] |
|
834 |
]. |
|
835 |
||
836 |
modified := false. |
|
837 |
||
838 |
listOfTabs notEmpty ifTrue:[ |
|
839 |
self selectionHolder value:1 |
|
840 |
]. |
|
841 |
||
842 |
self updateInfoLabel |
|
843 |
! |
|
844 |
||
845 |
buildFromResourceSpec: aListSpec |
|
846 |
||
847 |
self buildFromTabList: aListSpec |
|
848 |
! |
|
849 |
||
850 |
buildFromTabList: aTabList |
|
851 |
"build from a aTabList" |
|
852 |
||
1145 | 853 |
|selectionHolder listOfLabels| |
854 |
||
739 | 855 |
rebuildMode := true. |
856 |
||
1145 | 857 |
(selectionHolder := self selectionHolder) value: nil. |
858 |
(listOfLabels := self listOfLabels) removeAll. |
|
739 | 859 |
listOfTabs removeAll. |
860 |
||
861 |
aTabList do:[:aTabItem| |
|
862 |
listOfTabs add: aTabItem. |
|
1145 | 863 |
listOfLabels add: aTabItem label |
739 | 864 |
]. |
865 |
rebuildMode := false. |
|
866 |
||
867 |
modified := false. |
|
868 |
||
869 |
listOfTabs notEmpty ifTrue:[ |
|
1145 | 870 |
selectionHolder value:1 |
739 | 871 |
]. |
872 |
||
873 |
self updateInfoLabel |
|
874 |
! ! |
|
875 |
||
876 |
!TabListEditor methodsFor:'change & update'! |
|
877 |
||
878 |
update:something with:aParameter from:someObject |
|
879 |
"one of my aspects has changed; update modified channel |
|
880 |
" |
|
881 |
super update:something with:aParameter from:someObject. |
|
882 |
||
883 |
someObject = self testMode |
|
1145 | 884 |
ifTrue:[ |
739 | 885 |
someObject value |
886 |
ifTrue: [self doTest] |
|
887 |
ifFalse:[testView lower. self selectionHolder value:1]. |
|
888 |
||
889 |
self updateInfoLabel |
|
890 |
] |
|
891 |
! ! |
|
892 |
||
893 |
!TabListEditor methodsFor:'help'! |
|
894 |
||
895 |
defaultInfoLabel |
|
896 |
||
897 |
^self testMode value |
|
898 |
ifTrue: ['Test mode'] |
|
899 |
ifFalse: [super defaultInfoLabel] |
|
900 |
! ! |
|
901 |
||
902 |
!TabListEditor methodsFor:'selection'! |
|
903 |
||
904 |
selectedIndex |
|
905 |
^ selectedIndex |
|
906 |
! |
|
907 |
||
908 |
selectedIndex:anIndex |
|
1145 | 909 |
|oldSel specChannel| |
739 | 910 |
|
911 |
self listOfLabels notEmpty ifTrue: [self canShowTestMode value: true]. |
|
912 |
anIndex notNil ifTrue: [self testMode value: false]. |
|
913 |
||
914 |
oldSel := selectedIndex. |
|
915 |
selectedIndex := anIndex ? 0. |
|
916 |
||
917 |
selectedIndex == oldSel ifTrue:[^ self]. |
|
918 |
||
1145 | 919 |
specChannel := self specChannel. |
920 |
||
739 | 921 |
oldSel == 0 ifTrue:[ |
1145 | 922 |
specChannel value:(self class tabSpec) |
739 | 923 |
] ifFalse:[ |
924 |
selectedIndex == 0 ifTrue:[ |
|
1145 | 925 |
specChannel value:nil |
739 | 926 |
] |
927 |
]. |
|
928 |
self cancel. |
|
929 |
||
930 |
testView notNil ifTrue:[ |
|
931 |
testView lower. |
|
932 |
]. |
|
933 |
||
934 |
self valueOfCanCut value: (anIndex ~~ 0). |
|
935 |
self valueOfCanCopy value: (anIndex ~~ 0). |
|
936 |
self valueOfCanPaste. |
|
937 |
||
938 |
! ! |
|
939 |
||
940 |
!TabListEditor methodsFor:'startup / release'! |
|
941 |
||
942 |
initialize |
|
943 |
"setup aspects used by column description specifications |
|
944 |
" |
|
945 |
||
946 |
super initialize. |
|
947 |
||
948 |
listOfTabs := OrderedCollection new. |
|
949 |
selectedIndex := 0. |
|
950 |
rebuildMode := false. |
|
951 |
! |
|
952 |
||
953 |
openModalOnTabList: aTabList |
|
954 |
"build a tab list from aTabList and open it modal" |
|
955 |
||
956 |
super openModalOnResourceSpec: aTabList |
|
957 |
||
958 |
! |
|
959 |
||
960 |
postBuildWith:builder |
|
961 |
||
962 |
super postBuildWith:builder. |
|
963 |
||
964 |
testView := builder componentAt:#TestView. |
|
965 |
(builder componentAt:#ColumnView) selectConditionBlock: [:i|self askForItemModification]. |
|
966 |
! ! |
|
967 |
||
968 |
!TabListEditor methodsFor:'user actions'! |
|
969 |
||
970 |
accept |
|
971 |
"accept changes |
|
972 |
" |
|
973 |
|label| |
|
974 |
||
1145 | 975 |
self acceptChannel |
976 |
value:true; value:false. "/ toggle to force inputFields to accept |
|
1066
5096f66ba82d
new inputField accept/modified behavior
Claus Gittinger <cg@exept.de>
parents:
883
diff
changeset
|
977 |
|
739 | 978 |
selectedIndex ~~ 0 ifTrue:[ |
979 |
rebuildMode := true. |
|
980 |
label := listOfTabs at:selectedIndex. |
|
981 |
||
982 |
aspects keysAndValuesDo:[:aKey :aModel| |
|
983 |
label perform:(aKey , ':') asSymbol with:(aModel value). |
|
984 |
]. |
|
985 |
self listOfLabels at:selectedIndex put:(label label). |
|
986 |
||
987 |
rebuildMode := false. |
|
988 |
]. |
|
989 |
self cancel. |
|
990 |
modified := true. |
|
991 |
self valueOfEnablingCommitButtons value: false |
|
992 |
! |
|
993 |
||
994 |
cancel |
|
995 |
"cancel all changes |
|
996 |
" |
|
997 |
|tab| |
|
998 |
||
999 |
selectedIndex ~~ 0 ifTrue:[ |
|
1000 |
tab := listOfTabs at:selectedIndex. |
|
1001 |
||
1002 |
rebuildMode := true. |
|
1003 |
||
1004 |
aspects keysAndValuesDo:[:aKey :aModel| |
|
1005 |
aModel value:(tab perform:aKey) |
|
1006 |
]. |
|
1007 |
||
1008 |
rebuildMode := false. |
|
1009 |
]. |
|
1010 |
self canMoveTabItemUpOrDown value:(selectedIndex ~~ 0 and:[listOfTabs size > 1]). |
|
1011 |
self valueOfEnablingCommitButtons value: false |
|
1012 |
||
1013 |
||
1014 |
||
1015 |
! |
|
1016 |
||
1017 |
doCopy |
|
1018 |
"copy selected tab |
|
1019 |
" |
|
1020 |
selectedIndex ~~ 0 ifTrue:[ |
|
749 | 1021 |
self clipboard:(listOfTabs at:selectedIndex) deepCopy. |
1022 |
self updateAllToolInstances. |
|
739 | 1023 |
] |
1024 |
! |
|
1025 |
||
1026 |
doCreateTabItem |
|
1027 |
||
1145 | 1028 |
|tab selectionHolder| |
1029 |
||
739 | 1030 |
self testMode value: false. |
1031 |
tab := TabItem label:'Tab Item ', (listOfTabs size + 1) printString. |
|
1032 |
||
1033 |
listOfTabs add:tab afterIndex:selectedIndex. |
|
1034 |
self listOfLabels add:(tab label) afterIndex:selectedIndex. |
|
1035 |
||
1145 | 1036 |
selectionHolder := self selectionHolder. |
1037 |
||
739 | 1038 |
selectedIndex == 0 ifTrue:[ |
1145 | 1039 |
selectionHolder value:1 |
739 | 1040 |
] ifFalse:[ |
1145 | 1041 |
selectionHolder value:selectedIndex + 1. |
739 | 1042 |
self cancel. |
1043 |
]. |
|
1044 |
||
1045 |
modified := true. |
|
1046 |
! |
|
1047 |
||
1048 |
doCut |
|
1049 |
"cut selected tab |
|
1050 |
" |
|
1145 | 1051 |
|listOfLabels index selectionHolder| |
739 | 1052 |
|
1053 |
(index := selectedIndex) ~~ 0 ifTrue:[ |
|
1054 |
self testMode value: false. |
|
1145 | 1055 |
listOfLabels := self listOfLabels. |
739 | 1056 |
self clipboard:(listOfTabs at:index) deepCopy. |
1145 | 1057 |
(selectionHolder := self selectionHolder) value:0. |
739 | 1058 |
listOfTabs removeIndex:index. |
1145 | 1059 |
listOfLabels removeIndex:index. |
1060 |
index > listOfLabels size ifTrue:[ |
|
739 | 1061 |
index := index - 1 |
1062 |
]. |
|
1145 | 1063 |
selectionHolder value:index. |
1064 |
listOfLabels isEmpty ifTrue: [self canShowTestMode value: false]. |
|
749 | 1065 |
self updateAllToolInstances. |
739 | 1066 |
modified := true. |
1067 |
]. |
|
1068 |
||
1069 |
! |
|
1070 |
||
1071 |
doDelete |
|
1072 |
"delete selected tab |
|
1073 |
" |
|
1145 | 1074 |
|listOfLabels index selectionHolder| |
739 | 1075 |
|
1076 |
(index := selectedIndex) ~~ 0 ifTrue:[ |
|
1077 |
self testMode value: false. |
|
1145 | 1078 |
listOfLabels := self listOfLabels. |
1079 |
(selectionHolder := self selectionHolder) value:0. |
|
739 | 1080 |
listOfTabs removeIndex:index. |
1145 | 1081 |
listOfLabels removeIndex:index. |
1082 |
index > listOfLabels size ifTrue:[index := index - 1]. |
|
1083 |
selectionHolder value:index. |
|
1084 |
listOfLabels isEmpty ifTrue: [self canShowTestMode value: false]. |
|
739 | 1085 |
modified := true. |
1086 |
]. |
|
1087 |
! |
|
1088 |
||
1089 |
doGenerateAspectMethod |
|
1090 |
"generate aspect method |
|
1091 |
" |
|
1092 |
|cls code| |
|
1093 |
||
1094 |
(specClass notNil and:[specSelector notNil]) |
|
1095 |
ifFalse: |
|
1096 |
[ |
|
1097 |
^self information:'No class and selector defined!!' |
|
1098 |
]. |
|
1099 |
||
1100 |
cls := self resolveName: specClass. |
|
1101 |
||
1102 |
(cls canUnderstand:specSelector) ifTrue:[ |
|
1103 |
"/ method already exists, do not overwrite the method automaticaly |
|
1104 |
||
1105 |
( YesNoBox title:'method ' |
|
1106 |
, (Text string:('#', specSelector) emphasis:#bold) |
|
1107 |
, ' already exists!!' |
|
1108 |
yesText:'overwrite' |
|
1109 |
noText:'cancel' |
|
1110 |
) confirm ifFalse:[ |
|
1111 |
^ self |
|
1112 |
] |
|
1113 |
]. |
|
1114 |
||
1115 |
code := '!!' , cls name , ' methodsFor:''aspects''!!\\' , |
|
1116 |
specSelector , '\' , |
|
1117 |
' "Generated by the TabListEditor"\' , |
|
1118 |
'\' , |
|
1119 |
' |list|\' , |
|
1120 |
'\' , |
|
1121 |
' (list := builder bindingAt:#' , specSelector , ') isNil ifTrue:[\' , |
|
1122 |
' builder aspectAt:#' , specSelector, ' put:(list := self class ', specSelector, ').\' , |
|
1123 |
' ].\' , |
|
1124 |
' ^ list\' , |
|
1125 |
'!! !!\\'. |
|
1126 |
||
1127 |
(ReadStream on:(code withCRs)) fileIn |
|
1128 |
||
1129 |
||
1130 |
! |
|
1131 |
||
1132 |
doMoveTabUpOrDown:what |
|
1133 |
"step up or down |
|
1134 |
" |
|
1145 | 1135 |
|tab listOfLabels index nLabels| |
739 | 1136 |
|
1137 |
(selectedIndex ~~ 0 and:[listOfTabs size > 1]) ifFalse:[ |
|
1138 |
^ self |
|
1139 |
]. |
|
1140 |
||
1145 | 1141 |
listOfLabels := self listOfLabels. |
739 | 1142 |
tab := listOfTabs at:selectedIndex. |
1143 |
||
1145 | 1144 |
listOfLabels removeIndex:selectedIndex. |
739 | 1145 |
listOfTabs removeIndex:selectedIndex. |
1146 |
||
1145 | 1147 |
nLabels := listOfLabels size. |
1148 |
||
739 | 1149 |
what == #down ifTrue:[ |
1145 | 1150 |
index := selectedIndex > nLabels ifTrue:[1] |
1151 |
ifFalse:[selectedIndex + 1] |
|
739 | 1152 |
] ifFalse:[ |
1145 | 1153 |
index := selectedIndex == 1 ifTrue:[nLabels + 1] |
739 | 1154 |
ifFalse:[selectedIndex - 1] |
1155 |
]. |
|
1156 |
||
1145 | 1157 |
listOfLabels add:(tab label) beforeIndex:index. |
739 | 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 |
" |
|
1145 | 1171 |
|tab selectionHolder| |
739 | 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 |
||
1145 | 1178 |
selectionHolder := self selectionHolder. |
1179 |
||
739 | 1180 |
selectedIndex == 0 ifTrue:[ |
1145 | 1181 |
selectionHolder value:1 |
739 | 1182 |
] ifFalse:[ |
1145 | 1183 |
selectionHolder value:selectedIndex + 1. |
739 | 1184 |
self cancel. |
1185 |
]. |
|
1186 |
||
1187 |
modified := true. |
|
1188 |
||
1189 |
! |
|
1190 |
||
1191 |
doSave |
|
1192 |
"generate code for class and instance |
|
1193 |
" |
|
1245 | 1194 |
|cls code spec category mthd list| |
739 | 1195 |
|
1196 |
(specClass notNil and:[specSelector notNil]) |
|
1197 |
ifFalse: |
|
1198 |
[ |
|
1199 |
^self doSaveAs |
|
1200 |
]. |
|
1201 |
||
1202 |
cls := self resolveName: specClass. |
|
1203 |
||
1204 |
listOfTabs isEmpty ifTrue:[^self information:'No tab list defined!!']. |
|
1205 |
||
1206 |
spec := WriteStream on:String new. |
|
1245 | 1207 |
list := Array new:(listOfTabs size). |
1208 |
listOfTabs keysAndValuesDo:[:i :el|list at:i put:(el literalArrayEncoding)]. |
|
1209 |
||
1210 |
UISpecification prettyPrintSpecArray:list on:spec indent:5. |
|
739 | 1211 |
spec := spec contents. |
1212 |
||
1213 |
"/ if that method already exists, do not overwrite the category |
|
1214 |
||
1215 |
category := 'list specs'. |
|
1216 |
||
1217 |
(mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[ |
|
1218 |
category := mthd category. |
|
1219 |
]. |
|
1220 |
||
1221 |
code := Character excla asString |
|
1222 |
, cls name , ' class methodsFor:' , category storeString |
|
1223 |
, Character excla asString , '\\' |
|
1224 |
||
1225 |
, specSelector , '\' |
|
1226 |
, (self class codeGenerationComment replChar:$!! withString:'!!!!') |
|
1227 |
, '\\ "\' |
|
1228 |
, ' TabListEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\' |
|
1229 |
, ' "\'. |
|
1230 |
||
1231 |
code := code |
|
1232 |
, '\' |
|
1233 |
, ' <resource: #tabList>\\' |
|
1234 |
, ' ^' |
|
1235 |
, ' ', spec, '\' |
|
1236 |
, ' collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]' |
|
1237 |
, '\' |
|
1238 |
, Character excla asString |
|
1239 |
, ' ' |
|
1240 |
, Character excla asString |
|
1241 |
, '\'. |
|
1242 |
||
1243 |
code := code withCRs. |
|
1244 |
(ReadStream on:code) fileIn. |
|
1245 |
||
1246 |
(cls canUnderstand:specSelector) ifFalse:[ |
|
1247 |
(YesNoBox confirm:'Generate aspect method?') ifTrue:[ |
|
1248 |
self doGenerateAspectMethod |
|
1249 |
] |
|
1250 |
]. |
|
1251 |
||
1252 |
self addToHistory:(cls name, ' ', specSelector) -> #loadFromMessage:. |
|
1253 |
modified := false. |
|
1254 |
hasSaved := true. |
|
1255 |
! |
|
1256 |
||
1257 |
doTest |
|
1258 |
"run a test |
|
1259 |
" |
|
1260 |
|tabView list| |
|
1261 |
||
1262 |
self selectionHolder value:nil. |
|
1263 |
||
1264 |
listOfTabs size ~~ 0 ifTrue:[ |
|
1265 |
list := listOfTabs collect:[:aTab||t| |
|
1266 |
t := aTab copy. |
|
1267 |
t setAttributesFromClass:specClass. |
|
1268 |
t |
|
1269 |
] |
|
1270 |
] ifFalse:[ |
|
1271 |
list := nil |
|
1272 |
]. |
|
1273 |
tabView := builder componentAt:#TestTabsView. |
|
1274 |
tabView list:list. |
|
1275 |
testView raise. |
|
1276 |
||
1277 |
self valueOfCanCut value: false. |
|
1278 |
self valueOfCanCopy value: false. |
|
1279 |
self valueOfCanPaste value: false. |
|
1280 |
||
1281 |
! ! |
|
1282 |
||
1283 |
!TabListEditor class methodsFor:'documentation'! |
|
1284 |
||
1285 |
version |
|
1066
5096f66ba82d
new inputField accept/modified behavior
Claus Gittinger <cg@exept.de>
parents:
883
diff
changeset
|
1286 |
^ '$Header$' |
739 | 1287 |
! ! |