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