author | Claus Gittinger <cg@exept.de> |
Thu, 24 Jun 1999 17:44:30 +0200 | |
changeset 1147 | 422c8afcb0f5 |
parent 1145 | 8d3ca8f7bb71 |
child 1183 | ee9956e2689b |
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 |
" |
|
1145 | 790 |
|cls spec list selectionHolder| |
739 | 791 |
|
792 |
self testMode value: false. |
|
1145 | 793 |
(selectionHolder := self selectionHolder) value:0. |
739 | 794 |
|
795 |
"if opened on a tab list" |
|
796 |
(aClass isNil and: [aSelector isNil and: [listOfTabs size > 0]]) |
|
1145 | 797 |
ifTrue:[ |
739 | 798 |
listOfTabs notEmpty ifTrue:[ |
1145 | 799 |
selectionHolder value:1 |
739 | 800 |
]. |
1145 | 801 |
^ nil |
739 | 802 |
]. |
803 |
||
804 |
self listOfLabels removeAll. |
|
805 |
listOfTabs removeAll. |
|
806 |
||
807 |
testView notNil ifTrue:[ |
|
808 |
testView lower |
|
809 |
]. |
|
810 |
||
811 |
rebuildMode := false. |
|
812 |
||
813 |
self canShowTestMode value: false. |
|
814 |
||
815 |
cls := self resolveName:aClass. |
|
816 |
specSelector := aSelector. |
|
817 |
||
818 |
cls notNil ifTrue:[ |
|
819 |
specSelector notNil ifTrue:[ |
|
820 |
||
821 |
(cls respondsTo:specSelector) ifTrue:[ |
|
822 |
spec := cls perform:specSelector. |
|
823 |
list := self listOfLabels. |
|
824 |
||
825 |
spec size ~~ 0 ifTrue:[ |
|
826 |
||
827 |
rebuildMode := true. |
|
828 |
||
829 |
spec do:[:aTab| |
|
830 |
list add:aTab label. |
|
831 |
listOfTabs add:aTab. |
|
832 |
]. |
|
833 |
rebuildMode := false. |
|
834 |
self addToHistory:(cls name, ' ', specSelector) -> #loadFromMessage: |
|
835 |
] |
|
836 |
] |
|
837 |
] |
|
838 |
]. |
|
839 |
||
840 |
modified := false. |
|
841 |
||
842 |
listOfTabs notEmpty ifTrue:[ |
|
843 |
self selectionHolder value:1 |
|
844 |
]. |
|
845 |
||
846 |
self updateInfoLabel |
|
847 |
! |
|
848 |
||
849 |
buildFromResourceSpec: aListSpec |
|
850 |
||
851 |
self buildFromTabList: aListSpec |
|
852 |
! |
|
853 |
||
854 |
buildFromTabList: aTabList |
|
855 |
"build from a aTabList" |
|
856 |
||
1145 | 857 |
|selectionHolder listOfLabels| |
858 |
||
739 | 859 |
rebuildMode := true. |
860 |
||
1145 | 861 |
(selectionHolder := self selectionHolder) value: nil. |
862 |
(listOfLabels := self listOfLabels) removeAll. |
|
739 | 863 |
listOfTabs removeAll. |
864 |
||
865 |
aTabList do:[:aTabItem| |
|
866 |
listOfTabs add: aTabItem. |
|
1145 | 867 |
listOfLabels add: aTabItem label |
739 | 868 |
]. |
869 |
rebuildMode := false. |
|
870 |
||
871 |
modified := false. |
|
872 |
||
873 |
listOfTabs notEmpty ifTrue:[ |
|
1145 | 874 |
selectionHolder value:1 |
739 | 875 |
]. |
876 |
||
877 |
self updateInfoLabel |
|
878 |
! ! |
|
879 |
||
880 |
!TabListEditor methodsFor:'change & update'! |
|
881 |
||
882 |
update:something with:aParameter from:someObject |
|
883 |
"one of my aspects has changed; update modified channel |
|
884 |
" |
|
885 |
super update:something with:aParameter from:someObject. |
|
886 |
||
887 |
someObject = self testMode |
|
1145 | 888 |
ifTrue:[ |
739 | 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 |
|
1145 | 913 |
|oldSel specChannel| |
739 | 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 |
||
1145 | 923 |
specChannel := self specChannel. |
924 |
||
739 | 925 |
oldSel == 0 ifTrue:[ |
1145 | 926 |
specChannel value:(self class tabSpec) |
739 | 927 |
] ifFalse:[ |
928 |
selectedIndex == 0 ifTrue:[ |
|
1145 | 929 |
specChannel value:nil |
739 | 930 |
] |
931 |
]. |
|
932 |
self cancel. |
|
933 |
||
934 |
testView notNil ifTrue:[ |
|
935 |
testView lower. |
|
936 |
]. |
|
937 |
||
938 |
self valueOfCanCut value: (anIndex ~~ 0). |
|
939 |
self valueOfCanCopy value: (anIndex ~~ 0). |
|
940 |
self valueOfCanPaste. |
|
941 |
||
942 |
! ! |
|
943 |
||
944 |
!TabListEditor methodsFor:'startup / release'! |
|
945 |
||
946 |
initialize |
|
947 |
"setup aspects used by column description specifications |
|
948 |
" |
|
949 |
||
950 |
super initialize. |
|
951 |
||
952 |
listOfTabs := OrderedCollection new. |
|
953 |
selectedIndex := 0. |
|
954 |
rebuildMode := false. |
|
955 |
! |
|
956 |
||
957 |
openModalOnTabList: aTabList |
|
958 |
"build a tab list from aTabList and open it modal" |
|
959 |
||
960 |
super openModalOnResourceSpec: aTabList |
|
961 |
||
962 |
! |
|
963 |
||
964 |
postBuildWith:builder |
|
965 |
||
966 |
super postBuildWith:builder. |
|
967 |
||
968 |
testView := builder componentAt:#TestView. |
|
969 |
(builder componentAt:#ColumnView) selectConditionBlock: [:i|self askForItemModification]. |
|
970 |
! ! |
|
971 |
||
972 |
!TabListEditor methodsFor:'user actions'! |
|
973 |
||
974 |
accept |
|
975 |
"accept changes |
|
976 |
" |
|
977 |
|label| |
|
978 |
||
1145 | 979 |
self acceptChannel |
980 |
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
|
981 |
|
739 | 982 |
selectedIndex ~~ 0 ifTrue:[ |
983 |
rebuildMode := true. |
|
984 |
label := listOfTabs at:selectedIndex. |
|
985 |
||
986 |
aspects keysAndValuesDo:[:aKey :aModel| |
|
987 |
label perform:(aKey , ':') asSymbol with:(aModel value). |
|
988 |
]. |
|
989 |
self listOfLabels at:selectedIndex put:(label label). |
|
990 |
||
991 |
rebuildMode := false. |
|
992 |
]. |
|
993 |
self cancel. |
|
994 |
modified := true. |
|
995 |
self valueOfEnablingCommitButtons value: false |
|
996 |
! |
|
997 |
||
998 |
cancel |
|
999 |
"cancel all changes |
|
1000 |
" |
|
1001 |
|tab| |
|
1002 |
||
1003 |
selectedIndex ~~ 0 ifTrue:[ |
|
1004 |
tab := listOfTabs at:selectedIndex. |
|
1005 |
||
1006 |
rebuildMode := true. |
|
1007 |
||
1008 |
aspects keysAndValuesDo:[:aKey :aModel| |
|
1009 |
aModel value:(tab perform:aKey) |
|
1010 |
]. |
|
1011 |
||
1012 |
rebuildMode := false. |
|
1013 |
]. |
|
1014 |
self canMoveTabItemUpOrDown value:(selectedIndex ~~ 0 and:[listOfTabs size > 1]). |
|
1015 |
self valueOfEnablingCommitButtons value: false |
|
1016 |
||
1017 |
||
1018 |
||
1019 |
! |
|
1020 |
||
1021 |
doCopy |
|
1022 |
"copy selected tab |
|
1023 |
" |
|
1024 |
selectedIndex ~~ 0 ifTrue:[ |
|
749 | 1025 |
self clipboard:(listOfTabs at:selectedIndex) deepCopy. |
1026 |
self updateAllToolInstances. |
|
739 | 1027 |
] |
1028 |
! |
|
1029 |
||
1030 |
doCreateTabItem |
|
1031 |
||
1145 | 1032 |
|tab selectionHolder| |
1033 |
||
739 | 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 |
||
1145 | 1040 |
selectionHolder := self selectionHolder. |
1041 |
||
739 | 1042 |
selectedIndex == 0 ifTrue:[ |
1145 | 1043 |
selectionHolder value:1 |
739 | 1044 |
] ifFalse:[ |
1145 | 1045 |
selectionHolder value:selectedIndex + 1. |
739 | 1046 |
self cancel. |
1047 |
]. |
|
1048 |
||
1049 |
modified := true. |
|
1050 |
! |
|
1051 |
||
1052 |
doCut |
|
1053 |
"cut selected tab |
|
1054 |
" |
|
1145 | 1055 |
|listOfLabels index selectionHolder| |
739 | 1056 |
|
1057 |
(index := selectedIndex) ~~ 0 ifTrue:[ |
|
1058 |
self testMode value: false. |
|
1145 | 1059 |
listOfLabels := self listOfLabels. |
739 | 1060 |
self clipboard:(listOfTabs at:index) deepCopy. |
1145 | 1061 |
(selectionHolder := self selectionHolder) value:0. |
739 | 1062 |
listOfTabs removeIndex:index. |
1145 | 1063 |
listOfLabels removeIndex:index. |
1064 |
index > listOfLabels size ifTrue:[ |
|
739 | 1065 |
index := index - 1 |
1066 |
]. |
|
1145 | 1067 |
selectionHolder value:index. |
1068 |
listOfLabels isEmpty ifTrue: [self canShowTestMode value: false]. |
|
749 | 1069 |
self updateAllToolInstances. |
739 | 1070 |
modified := true. |
1071 |
]. |
|
1072 |
||
1073 |
! |
|
1074 |
||
1075 |
doDelete |
|
1076 |
"delete selected tab |
|
1077 |
" |
|
1145 | 1078 |
|listOfLabels index selectionHolder| |
739 | 1079 |
|
1080 |
(index := selectedIndex) ~~ 0 ifTrue:[ |
|
1081 |
self testMode value: false. |
|
1145 | 1082 |
listOfLabels := self listOfLabels. |
1083 |
(selectionHolder := self selectionHolder) value:0. |
|
739 | 1084 |
listOfTabs removeIndex:index. |
1145 | 1085 |
listOfLabels removeIndex:index. |
1086 |
index > listOfLabels size ifTrue:[index := index - 1]. |
|
1087 |
selectionHolder value:index. |
|
1088 |
listOfLabels isEmpty ifTrue: [self canShowTestMode value: false]. |
|
739 | 1089 |
modified := true. |
1090 |
]. |
|
1091 |
! |
|
1092 |
||
1093 |
doGenerateAspectMethod |
|
1094 |
"generate aspect method |
|
1095 |
" |
|
1096 |
|cls code| |
|
1097 |
||
1098 |
(specClass notNil and:[specSelector notNil]) |
|
1099 |
ifFalse: |
|
1100 |
[ |
|
1101 |
^self information:'No class and selector defined!!' |
|
1102 |
]. |
|
1103 |
||
1104 |
cls := self resolveName: specClass. |
|
1105 |
||
1106 |
(cls canUnderstand:specSelector) ifTrue:[ |
|
1107 |
"/ method already exists, do not overwrite the method automaticaly |
|
1108 |
||
1109 |
( YesNoBox title:'method ' |
|
1110 |
, (Text string:('#', specSelector) emphasis:#bold) |
|
1111 |
, ' already exists!!' |
|
1112 |
yesText:'overwrite' |
|
1113 |
noText:'cancel' |
|
1114 |
) confirm ifFalse:[ |
|
1115 |
^ self |
|
1116 |
] |
|
1117 |
]. |
|
1118 |
||
1119 |
code := '!!' , cls name , ' methodsFor:''aspects''!!\\' , |
|
1120 |
specSelector , '\' , |
|
1121 |
' "Generated by the TabListEditor"\' , |
|
1122 |
'\' , |
|
1123 |
' |list|\' , |
|
1124 |
'\' , |
|
1125 |
' (list := builder bindingAt:#' , specSelector , ') isNil ifTrue:[\' , |
|
1126 |
' builder aspectAt:#' , specSelector, ' put:(list := self class ', specSelector, ').\' , |
|
1127 |
' ].\' , |
|
1128 |
' ^ list\' , |
|
1129 |
'!! !!\\'. |
|
1130 |
||
1131 |
(ReadStream on:(code withCRs)) fileIn |
|
1132 |
||
1133 |
||
1134 |
! |
|
1135 |
||
1136 |
doMoveTabUpOrDown:what |
|
1137 |
"step up or down |
|
1138 |
" |
|
1145 | 1139 |
|tab listOfLabels index nLabels| |
739 | 1140 |
|
1141 |
(selectedIndex ~~ 0 and:[listOfTabs size > 1]) ifFalse:[ |
|
1142 |
^ self |
|
1143 |
]. |
|
1144 |
||
1145 | 1145 |
listOfLabels := self listOfLabels. |
739 | 1146 |
tab := listOfTabs at:selectedIndex. |
1147 |
||
1145 | 1148 |
listOfLabels removeIndex:selectedIndex. |
739 | 1149 |
listOfTabs removeIndex:selectedIndex. |
1150 |
||
1145 | 1151 |
nLabels := listOfLabels size. |
1152 |
||
739 | 1153 |
what == #down ifTrue:[ |
1145 | 1154 |
index := selectedIndex > nLabels ifTrue:[1] |
1155 |
ifFalse:[selectedIndex + 1] |
|
739 | 1156 |
] ifFalse:[ |
1145 | 1157 |
index := selectedIndex == 1 ifTrue:[nLabels + 1] |
739 | 1158 |
ifFalse:[selectedIndex - 1] |
1159 |
]. |
|
1160 |
||
1145 | 1161 |
listOfLabels add:(tab label) beforeIndex:index. |
739 | 1162 |
listOfTabs add:tab beforeIndex:index. |
1163 |
||
1164 |
rebuildMode := true. |
|
1165 |
self selectionHolder value:index. |
|
1166 |
rebuildMode := false. |
|
1167 |
||
1168 |
modified := true. |
|
1169 |
||
1170 |
! |
|
1171 |
||
1172 |
doPaste |
|
1173 |
"paste a tab |
|
1174 |
" |
|
1145 | 1175 |
|tab selectionHolder| |
739 | 1176 |
|
1177 |
self testMode value: false. |
|
1178 |
(tab := self class clipboard deepCopy) isNil ifTrue: [^nil]. |
|
1179 |
listOfTabs add:tab afterIndex:selectedIndex. |
|
1180 |
self listOfLabels add:(tab label) afterIndex:selectedIndex. |
|
1181 |
||
1145 | 1182 |
selectionHolder := self selectionHolder. |
1183 |
||
739 | 1184 |
selectedIndex == 0 ifTrue:[ |
1145 | 1185 |
selectionHolder value:1 |
739 | 1186 |
] ifFalse:[ |
1145 | 1187 |
selectionHolder value:selectedIndex + 1. |
739 | 1188 |
self cancel. |
1189 |
]. |
|
1190 |
||
1191 |
modified := true. |
|
1192 |
||
1193 |
! |
|
1194 |
||
1195 |
doSave |
|
1196 |
"generate code for class and instance |
|
1197 |
" |
|
1198 |
|cls code spec category mthd| |
|
1199 |
||
1200 |
(specClass notNil and:[specSelector notNil]) |
|
1201 |
ifFalse: |
|
1202 |
[ |
|
1203 |
^self doSaveAs |
|
1204 |
]. |
|
1205 |
||
1206 |
cls := self resolveName: specClass. |
|
1207 |
||
1208 |
listOfTabs isEmpty ifTrue:[^self information:'No tab list defined!!']. |
|
1209 |
||
1210 |
spec := WriteStream on:String new. |
|
1211 |
UISpecification prettyPrintSpecArray:(listOfTabs literalArrayEncoding) on:spec indent:5. |
|
1212 |
spec := spec contents. |
|
1213 |
||
1214 |
"/ if that method already exists, do not overwrite the category |
|
1215 |
||
1216 |
category := 'list specs'. |
|
1217 |
||
1218 |
(mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[ |
|
1219 |
category := mthd category. |
|
1220 |
]. |
|
1221 |
||
1222 |
code := Character excla asString |
|
1223 |
, cls name , ' class methodsFor:' , category storeString |
|
1224 |
, Character excla asString , '\\' |
|
1225 |
||
1226 |
, specSelector , '\' |
|
1227 |
, (self class codeGenerationComment replChar:$!! withString:'!!!!') |
|
1228 |
, '\\ "\' |
|
1229 |
, ' TabListEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\' |
|
1230 |
, ' "\'. |
|
1231 |
||
1232 |
code := code |
|
1233 |
, '\' |
|
1234 |
, ' <resource: #tabList>\\' |
|
1235 |
, ' ^' |
|
1236 |
, ' ', spec, '\' |
|
1237 |
, ' collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]' |
|
1238 |
, '\' |
|
1239 |
, Character excla asString |
|
1240 |
, ' ' |
|
1241 |
, Character excla asString |
|
1242 |
, '\'. |
|
1243 |
||
1244 |
code := code withCRs. |
|
1245 |
(ReadStream on:code) fileIn. |
|
1246 |
||
1247 |
(cls canUnderstand:specSelector) ifFalse:[ |
|
1248 |
(YesNoBox confirm:'Generate aspect method?') ifTrue:[ |
|
1249 |
self doGenerateAspectMethod |
|
1250 |
] |
|
1251 |
]. |
|
1252 |
||
1253 |
self addToHistory:(cls name, ' ', specSelector) -> #loadFromMessage:. |
|
1254 |
modified := false. |
|
1255 |
hasSaved := true. |
|
1256 |
! |
|
1257 |
||
1258 |
doTest |
|
1259 |
"run a test |
|
1260 |
" |
|
1261 |
|tabView list| |
|
1262 |
||
1263 |
self selectionHolder value:nil. |
|
1264 |
||
1265 |
listOfTabs size ~~ 0 ifTrue:[ |
|
1266 |
list := listOfTabs collect:[:aTab||t| |
|
1267 |
t := aTab copy. |
|
1268 |
t setAttributesFromClass:specClass. |
|
1269 |
t |
|
1270 |
] |
|
1271 |
] ifFalse:[ |
|
1272 |
list := nil |
|
1273 |
]. |
|
1274 |
tabView := builder componentAt:#TestTabsView. |
|
1275 |
tabView list:list. |
|
1276 |
testView raise. |
|
1277 |
||
1278 |
self valueOfCanCut value: false. |
|
1279 |
self valueOfCanCopy value: false. |
|
1280 |
self valueOfCanPaste value: false. |
|
1281 |
||
1282 |
! ! |
|
1283 |
||
1284 |
!TabListEditor class methodsFor:'documentation'! |
|
1285 |
||
1286 |
version |
|
1066
5096f66ba82d
new inputField accept/modified behavior
Claus Gittinger <cg@exept.de>
parents:
883
diff
changeset
|
1287 |
^ '$Header$' |
739 | 1288 |
! ! |