TabListEditor.st
author Claus Gittinger <cg@exept.de>
Wed, 29 Jul 2009 20:02:02 +0200
changeset 2570 4e663bc64364
parent 2432 294274f5e342
child 2667 6cf6c1523e0c
permissions -rw-r--r--
changed #requestPackage
     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 "{ Package: 'stx:libtool2' }"
    13 
    14 ResourceSpecEditor subclass:#TabListEditor
    15 	instanceVariableNames:'listOfTabs'
    16 	classVariableNames:''
    17 	poolDictionaries:''
    18 	category:'Interface-UIPainter'
    19 !
    20 
    21 !TabListEditor class methodsFor:'documentation'!
    22 
    23 copyright
    24 "
    25  COPYRIGHT (c) 1997 by eXept Software AG
    26               All Rights Reserved
    27 
    28  This software is furnished under a license and may be used
    29  only in accordance with the terms of that license and with the
    30  inclusion of the above copyright notice. This software may not
    31  be provided or otherwise made available to, or used by, any
    32  other person.  No title to or ownership of the software is
    33  hereby transferred.
    34 "
    35 
    36 
    37 !
    38 
    39 documentation
    40 "
    41     The TabListEditor allows you to create, modify or just inspect
    42     tab lists for tab headers or note books.
    43 
    44     [start with:]
    45         TabItemEditor open
    46 
    47     [see also:]
    48         TabItem
    49         TabView
    50         NoteBookView
    51         UIPainter
    52 
    53     [author:]
    54         Claus Atzkern, eXept Software AG
    55         Thomas Zwick, eXept Software AG
    56 "
    57 
    58 
    59 ! !
    60 
    61 !TabListEditor class methodsFor:'instance creation'!
    62 
    63 openModalOnTabList: aTabList
    64     "Open a TabListEditor modal on aTabList"
    65     "self openModalOnTabList: (Array with: (TabItem label: 'Tab Item 1'))"
    66 
    67     ^self new openModalOnTabList: aTabList
    68 
    69 ! !
    70 
    71 !TabListEditor class methodsFor:'accessing'!
    72 
    73 resourceType
    74     "get the type of resource of the method generated by the TabListEditor"
    75 
    76     ^#tabList
    77 
    78 
    79 
    80 
    81 
    82 
    83 ! !
    84 
    85 !TabListEditor class methodsFor:'aspects'!
    86 
    87 aspects
    88     "get the aspects for the attributes of the tab list components"
    89 
    90     ^#(
    91         label
    92         translateLabel
    93         labelForegroundColor
    94         enabled
    95         editAgument
    96         accessCharacterPosition
    97         shortcutKey
    98         activeHelpKey
    99 
   100         majorKey
   101         minorKey
   102         createNewBuilder
   103 
   104         hasHorizontalScrollBar
   105         hasVerticalScrollBar
   106         miniScrollerHorizontal
   107         miniScrollerVertical
   108     )
   109 
   110 ! !
   111 
   112 !TabListEditor class methodsFor:'help specs'!
   113 
   114 helpSpec
   115     "This resource specification was automatically generated
   116      by the UIHelpTool of ST/X."
   117 
   118     "Do not manually edit this!! If it is corrupted,
   119      the UIHelpTool may not be able to read the specification."
   120 
   121     "
   122      UIHelpTool openOnClass:TabListEditor    
   123     "
   124 
   125     <resource: #help>
   126 
   127     ^ super helpSpec addPairsFrom:#(
   128 
   129 #addTabItem
   130 'Adds a new tab item.'
   131 
   132 #applicationProvidesLabel
   133 'If on, the label''s string is a selector returning a string or bitmap image, which is used as logo in the tab item.'
   134 
   135 #autoHideScrollBars
   136 'ScrollBars should be made invisible dynamically, if there is nothing to scroll.'
   137 
   138 #basicTab
   139 'Define the basic attributes.'
   140 
   141 #canSelect
   142 'Turns on/off whether the tab item is selectable.'
   143 
   144 #canvasTab
   145 'Define an application, which is started if the tab is pressed the first time.'
   146 
   147 #color
   148 'Defines the foreground color of the label. The default color derives from the style sheet.'
   149 
   150 #createNewBuilder
   151 'Create a new builder for the application; the application use its own aspects.'
   152 
   153 #detailTab
   154 'Define the optional/specific attributes.'
   155 
   156 #detailsAccelerator
   157 'Key to be pressed to select the tab item from the keyboard (accelerator key).'
   158 
   159 #detailsAccessCharaterPosition
   160 'Index of the access character position of the textual label (optional).'
   161 
   162 #detailsArgument
   163 'An optional argument stored with the tab item.'
   164 
   165 #fileCreateAspectMethod
   166 'Creates the aspect method for the tab list.'
   167 
   168 #fileLoad
   169 'Opens a dialog for selecting and loading a tab list spec from a class.'
   170 
   171 #fileNew
   172 'Creates a new tab list.'
   173 
   174 #fileSave
   175 'Saves current tab list.'
   176 
   177 #horizontalMiniScroller
   178 'Use a mini-scroller as horizontal scrollbar.'
   179 
   180 #horizontalScroller
   181 'Enable horizontal scrollability.'
   182 
   183 #label
   184 'Label of the tab item.'
   185 
   186 #majorKey
   187 'Name of the class to be started (application if empty); or app-selector returning application instance.'
   188 
   189 #minorKey
   190 'Message sent to the class which returns the window specification (default: #windowSpec).'
   191 
   192 #testPreview
   193 'Turns on/off preview of the tab list.'
   194 
   195 #translateLabel
   196 'If on, the label is translated using the applications language resources.'
   197 
   198 #verticalMiniScroller
   199 'Use a mini-scroller as vertical scrollbar.'
   200 
   201 #verticalScroller
   202 'Enable vertical scrollability.'
   203 
   204 )
   205 ! !
   206 
   207 !TabListEditor class methodsFor:'image specs'!
   208 
   209 newTabItemIcon
   210     "This resource specification was automatically generated
   211      by the ImageEditor of ST/X."
   212 
   213     "Do not manually edit this!!!! If it is corrupted,
   214      the ImageEditor may not be able to read the specification."
   215 
   216     "
   217      ImageEditor openOnClass:self andSelector:#newTabItemIcon
   218     "
   219 
   220     <resource: #image>
   221 
   222     ^Icon
   223         constantNamed:#'TabListEditor newTabItemIcon'
   224         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]
   225 ! !
   226 
   227 !TabListEditor class methodsFor:'interface specs'!
   228 
   229 basicSpec
   230     "This resource specification was automatically generated
   231      by the UIPainter of ST/X."
   232 
   233     "Do not manually edit this!! If it is corrupted,
   234      the UIPainter may not be able to read the specification."
   235 
   236     "
   237      UIPainter new openOnClass:TabListEditor andSelector:#basicSpec
   238      TabListEditor new openInterface:#basicSpec
   239     "
   240 
   241     <resource: #canvas>
   242 
   243     ^ 
   244      #(FullSpec
   245         name: basicSpec
   246         window: 
   247        (WindowSpec
   248           label: 'Basic'
   249           name: 'Basic'
   250           min: (Point 10 10)
   251           max: (Point 1280 1024)
   252           bounds: (Rectangle 0 0 429 240)
   253         )
   254         component: 
   255        (SpecCollection
   256           collection: (
   257            (LabelSpec
   258               label: 'Label:'
   259               name: 'labelLabel'
   260               layout: (AlignmentOrigin 98 0 26 0 1 0.5)
   261               translateLabel: true
   262               resizeForLabel: true
   263             )
   264            (InputFieldSpec
   265               name: 'label'
   266               layout: (LayoutFrame 100 0 15 0 -5 1.0 37 0)
   267               activeHelpKey: label
   268               tabable: true
   269               model: label
   270               group: inputGroup
   271               immediateAccept: true
   272               acceptOnReturn: false
   273               acceptOnTab: false
   274               acceptOnLostFocus: false
   275               acceptChannel: acceptChannel
   276               modifiedChannel: modifiedChannel
   277               acceptOnPointerLeave: false
   278             )
   279            (LabelSpec
   280               label: 'Accelerator:'
   281               name: 'shortcutKeyLabel'
   282               layout: (AlignmentOrigin 98 0 55 0 1 0.5)
   283               translateLabel: true
   284               resizeForLabel: true
   285             )
   286            (InputFieldSpec
   287               name: 'shortcutKey'
   288               layout: (LayoutFrame 100 0 44 0 -5 1.0 66 0)
   289               activeHelpKey: detailsAccelerator
   290               tabable: true
   291               model: shortcutKey
   292               group: inputGroup
   293               type: symbolOrNil
   294               immediateAccept: true
   295               acceptOnReturn: false
   296               acceptOnTab: false
   297               acceptOnLostFocus: false
   298               acceptChannel: acceptChannel
   299               modifiedChannel: modifiedChannel
   300               acceptOnPointerLeave: false
   301             )
   302            (LabelSpec
   303               label: 'Argument:'
   304               name: 'editAgumentLabel'
   305               layout: (AlignmentOrigin 98 0 84 0 1 0.5)
   306               translateLabel: true
   307               resizeForLabel: true
   308             )
   309            (InputFieldSpec
   310               name: 'editAgument'
   311               layout: (LayoutFrame 100 0 73 0 -5 1.0 95 0)
   312               activeHelpKey: detailsArgument
   313               tabable: true
   314               model: editAgument
   315               group: inputGroup
   316               immediateAccept: true
   317               acceptOnReturn: false
   318               acceptOnTab: false
   319               acceptOnLostFocus: false
   320               acceptChannel: acceptChannel
   321               modifiedChannel: modifiedChannel
   322               acceptOnPointerLeave: false
   323             )
   324            (LabelSpec
   325               label: 'Access Character Position:'
   326               name: 'accessCharacterPositionLabel'
   327               layout: (AlignmentOrigin 275 0 113 0 1 0.5)
   328               translateLabel: true
   329               resizeForLabel: true
   330             )
   331            (InputFieldSpec
   332               name: 'accessCharacterPosition'
   333               layout: (LayoutFrame 278 0 103 0 -5 1.0 125 0)
   334               activeHelpKey: detailsAccessCharaterPosition
   335               tabable: true
   336               model: accessCharacterPosition
   337               group: inputGroup
   338               type: number
   339               immediateAccept: true
   340               acceptOnReturn: false
   341               acceptOnTab: false
   342               acceptOnLostFocus: false
   343               acceptChannel: acceptChannel
   344               modifiedChannel: modifiedChannel
   345               acceptOnPointerLeave: false
   346             )
   347            (CheckBoxSpec
   348               label: 'Translate Label '
   349               name: 'translateLabel'
   350               layout: (LayoutFrame 96 0 135 0 308 0 161 0)
   351               activeHelpKey: translateLabel
   352               tabable: true
   353               model: translateLabel
   354               translateLabel: true
   355             )
   356            (CheckBoxSpec
   357               label: 'Application Provides Label '
   358               name: 'CheckBox1'
   359               layout: (LayoutFrame 96 0 161 0 308 0 187 0)
   360               activeHelpKey: applicationProvidesLabel
   361               tabable: true
   362               model: applicationProvidesLabel
   363               translateLabel: true
   364             )
   365            (LabelSpec
   366               label: 'Help Key:'
   367               name: 'activeHelp'
   368               layout: (AlignmentOrigin 98 0 203 0 1 0.5)
   369               translateLabel: true
   370               resizeForLabel: true
   371             )
   372            (InputFieldSpec
   373               name: 'activeHelpKey'
   374               layout: (LayoutFrame 100 0 192 0 -5 1.0 214 0)
   375               activeHelpKey: label
   376               tabable: true
   377               model: activeHelpKey
   378               group: inputGroup
   379               type: symbolOrNil
   380               immediateAccept: true
   381               acceptOnReturn: false
   382               acceptOnTab: false
   383               acceptOnLostFocus: false
   384               acceptChannel: acceptChannel
   385               modifiedChannel: modifiedChannel
   386               acceptOnPointerLeave: false
   387             )
   388            )
   389          
   390         )
   391       )
   392 !
   393 
   394 canvasSpec
   395     "This resource specification was automatically generated
   396      by the UIPainter of ST/X."
   397 
   398     "Do not manually edit this!! If it is corrupted,
   399      the UIPainter may not be able to read the specification."
   400 
   401     "
   402      UIPainter new openOnClass:TabListEditor andSelector:#canvasSpec
   403      TabListEditor new openInterface:#canvasSpec
   404     "
   405 
   406     <resource: #canvas>
   407 
   408     ^ 
   409      #(FullSpec
   410         name: canvasSpec
   411         window: 
   412        (WindowSpec
   413           label: 'Canvas'
   414           name: 'Canvas'
   415           min: (Point 10 10)
   416           max: (Point 1280 1024)
   417           bounds: (Rectangle 0 0 383 220)
   418         )
   419         component: 
   420        (SpecCollection
   421           collection: (
   422            (LabelSpec
   423               label: 'Class Name / Major Key:'
   424               name: 'majorKeyLabel'
   425               layout: (AlignmentOrigin 160 0 26 0 1 0.5)
   426               activeHelpKey: majorKey
   427               translateLabel: true
   428               resizeForLabel: true
   429             )
   430            (InputFieldSpec
   431               name: 'majorKeyField'
   432               layout: (LayoutFrame 161 0 15 0 -5 1.0 37 0)
   433               activeHelpKey: majorKey
   434               tabable: true
   435               model: majorKey
   436               group: inputGroup
   437               type: symbolOrNil
   438               immediateAccept: true
   439               acceptOnReturn: false
   440               acceptOnTab: false
   441               acceptOnLostFocus: false
   442               modifiedChannel: modifiedChannel
   443               acceptOnPointerLeave: false
   444             )
   445            (LabelSpec
   446               label: 'Selector / Minor Key:'
   447               name: 'minorKeyLabel'
   448               layout: (AlignmentOrigin 160 0 55 0 1 0.5)
   449               translateLabel: true
   450               resizeForLabel: true
   451             )
   452            (InputFieldSpec
   453               name: 'minorKeyField'
   454               layout: (LayoutFrame 161 0 44 0 -5 1.0 66 0)
   455               activeHelpKey: majorKey
   456               tabable: true
   457               model: minorKey
   458               group: inputGroup
   459               type: symbolOrNil
   460               immediateAccept: true
   461               acceptOnReturn: false
   462               acceptOnTab: false
   463               acceptOnLostFocus: false
   464               modifiedChannel: modifiedChannel
   465               acceptOnPointerLeave: false
   466             )
   467            (FramedBoxSpec
   468               label: 'Scroll Bars'
   469               name: 'FramedBox'
   470               layout: (LayoutFrame 0 0.0 119 0.0 0 1.0 218 0)
   471               labelPosition: topLeft
   472               translateLabel: true
   473               component: 
   474              (SpecCollection
   475                 collection: (
   476                  (HorizontalPanelViewSpec
   477                     name: 'HorizontalPanel1'
   478                     layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   479                     horizontalLayout: fitSpace
   480                     verticalLayout: fitSpace
   481                     horizontalSpace: 3
   482                     verticalSpace: 3
   483                     component: 
   484                    (SpecCollection
   485                       collection: (
   486                        (ViewSpec
   487                           name: 'Box1'
   488                           component: 
   489                          (SpecCollection
   490                             collection: (
   491                              (CheckBoxSpec
   492                                 label: 'Vertical'
   493                                 name: 'verticalScrollBarCheckBox'
   494                                 layout: (LayoutFrame 0 0.0 3 0 0 1.0 27 0)
   495                                 activeHelpKey: verticalScroller
   496                                 tabable: true
   497                                 model: hasVerticalScrollBar
   498                                 translateLabel: true
   499                               )
   500                              (CheckBoxSpec
   501                                 label: 'Mini'
   502                                 name: 'miniScrollerVerticalCheckBox'
   503                                 layout: (LayoutFrame 0 0.0 32 0 0 1.0 56 0)
   504                                 activeHelpKey: verticalMiniScroller
   505                                 tabable: true
   506                                 model: miniScrollerVertical
   507                                 translateLabel: true
   508                               )
   509                              )
   510                            
   511                           )
   512                           useDefaultExtent: true
   513                         )
   514                        (ViewSpec
   515                           name: 'Box2'
   516                           component: 
   517                          (SpecCollection
   518                             collection: (
   519                              (CheckBoxSpec
   520                                 label: 'Horizontal'
   521                                 name: 'horizontalScrollBarCheckBox'
   522                                 layout: (LayoutFrame 0 0.0 3 0 0 1.0 27 0)
   523                                 activeHelpKey: horizontalScroller
   524                                 tabable: true
   525                                 model: hasHorizontalScrollBar
   526                                 translateLabel: true
   527                               )
   528                              (CheckBoxSpec
   529                                 label: 'Mini'
   530                                 name: 'miniScrollerHorizontalCheckBox'
   531                                 layout: (LayoutFrame 0 0.0 32 0 0 1.0 56 0)
   532                                 activeHelpKey: horizontalMiniScroller
   533                                 tabable: true
   534                                 model: miniScrollerHorizontal
   535                                 translateLabel: true
   536                               )
   537                              )
   538                            
   539                           )
   540                           extent: (Point 113 61)
   541                         )
   542                        (ViewSpec
   543                           name: 'Box3'
   544                           component: 
   545                          (SpecCollection
   546                             collection: (
   547                              (LabelSpec
   548                                 label: 'Auto Hide:'
   549                                 name: 'Label1'
   550                                 layout: (LayoutFrame 0 0.0 6 0 0 1.0 23 0)
   551                                 translateLabel: true
   552                                 resizeForLabel: true
   553                                 adjust: left
   554                               )
   555                              (PopUpListSpec
   556                                 label: 'Default'
   557                                 name: 'PopUpList1'
   558                                 layout: (LayoutFrame 0 0.0 32 0 0 1.0 54 0)
   559                                 activeHelpKey: autoHideScrollBars
   560                                 tabable: true
   561                                 model: autoHideScrollBars
   562                                 menu: 
   563                                (Default
   564                                   On Off
   565                                 )
   566                                 useIndex: true
   567                               )
   568                              )
   569                            
   570                           )
   571                           extent: (Point 113 61)
   572                         )
   573                        )
   574                      
   575                     )
   576                   )
   577                  )
   578                
   579               )
   580             )
   581            (CheckBoxSpec
   582               label: 'Create New Builder'
   583               name: 'createNewBuilder'
   584               layout: (Point 161 75)
   585               activeHelpKey: createNewBuilder
   586               model: createNewBuilder
   587               translateLabel: true
   588             )
   589            )
   590          
   591         )
   592       )
   593 !
   594 
   595 detailSpec
   596     "This resource specification was automatically generated
   597      by the UIPainter of ST/X."
   598 
   599     "Do not manually edit this!! If it is corrupted,
   600      the UIPainter may not be able to read the specification."
   601 
   602     "
   603      UIPainter new openOnClass:TabListEditor andSelector:#detailSpec
   604      TabListEditor new openInterface:#detailSpec
   605     "
   606 
   607     <resource: #canvas>
   608 
   609     ^ 
   610      #(FullSpec
   611         name: detailSpec
   612         window: 
   613        (WindowSpec
   614           label: 'Details'
   615           name: 'Details'
   616           min: (Point 10 10)
   617           max: (Point 1280 1024)
   618           bounds: (Rectangle 0 0 358 107)
   619         )
   620         component: 
   621        (SpecCollection
   622           collection: (
   623            (CheckBoxSpec
   624               label: 'Can Select'
   625               name: 'enabled'
   626               layout: (Point 46 14)
   627               activeHelpKey: canSelect
   628               tabable: true
   629               model: enabled
   630               translateLabel: true
   631             )
   632            (LabelSpec
   633               label: 'Color:'
   634               name: 'ForegroundLabel'
   635               layout: (AlignmentOrigin 46 0 62 0 1 0.5)
   636               translateLabel: true
   637               resizeForLabel: true
   638               adjust: right
   639             )
   640            (ColorMenuSpec
   641               name: 'ForegroundColorMenu'
   642               layout: (LayoutFrame 48 0 50 0 -10 1.0 72 0)
   643               activeHelpKey: color
   644               model: labelForegroundColor
   645               labelsAreColored: false
   646             )
   647            )
   648          
   649         )
   650       )
   651 !
   652 
   653 windowSpec
   654     "This resource specification was automatically generated
   655      by the UIPainter of ST/X."
   656 
   657     "Do not manually edit this!! If it is corrupted,
   658      the UIPainter may not be able to read the specification."
   659 
   660     "
   661      UIPainter new openOnClass:TabListEditor andSelector:#windowSpec
   662      TabListEditor new openInterface:#windowSpec
   663      TabListEditor open
   664     "
   665 
   666     <resource: #canvas>
   667 
   668     ^ 
   669      #(#FullSpec
   670         #name: #windowSpec
   671         #window: 
   672        #(#WindowSpec
   673           #label: 'Tab List Editor'
   674           #name: 'Tab List Editor'
   675           #min: #(#Point 440 280)
   676           #max: #(#Point 1152 900)
   677           #bounds: #(#Rectangle 596 292 1132 661)
   678           #menu: #menu
   679         )
   680         #component: 
   681        #(#SpecCollection
   682           #collection: #(
   683            #(#MenuPanelSpec
   684               #name: 'menuToolbarView'
   685               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 34 0)
   686               #menu: #menuToolbar
   687               #showSeparatingLines: true
   688             )
   689            #(#VariableHorizontalPanelSpec
   690               #name: 'VariablePanel'
   691               #layout: #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -26 1.0)
   692               #component: 
   693              #(#SpecCollection
   694                 #collection: #(
   695                  #(#SelectionInListModelViewSpec
   696                     #attributes: 
   697                    #(#vpext
   698                       
   699                      #(#Array
   700                         #Array #Array
   701                         #Array #Array
   702                         #Array #Point
   703                         0.264414 1.0
   704                       )
   705                     )
   706                     #name: 'ListOfLabels'
   707                     #tabable: true
   708                     #model: #selectionHolder
   709                     #menu: #menuEdit
   710                     #hasHorizontalScrollBar: true
   711                     #hasVerticalScrollBar: true
   712                     #miniScrollerHorizontal: true
   713                     #listModel: #listOfTabs
   714                     #highlightMode: #line
   715                     #selectConditionSelector: #askForItemModification
   716                   )
   717                  #(#ViewSpec
   718                     #name: 'SpecView'
   719                     #level: -1
   720                     #component: 
   721                    #(#SpecCollection
   722                       #collection: #(
   723                        #(#NoteBookViewSpec
   724                           #name: 'NoteBook'
   725                           #layout: #(#LayoutFrame 1 0.0 0 0.0 0 1.0 -30 1.0)
   726                           #enableChannel: #hasSelectionHolder
   727                           #tabable: true
   728                           #model: #noteBookModel
   729                           #menu: #noteBookTabList
   730                           #useIndex: true
   731                           #keepCanvasAlive: true
   732                         )
   733                        #(#UISubSpecification
   734                           #name: 'subSpec'
   735                           #layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1)
   736                           #majorKey: #ToolApplicationModel
   737                           #minorKey: #windowSpecForCommit
   738                         )
   739                        #(#NoteBookViewSpec
   740                           #name: 'TestNoteBook'
   741                           #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   742                           #visibilityChannel: #testMode
   743                           #tabable: true
   744                           #menu: #testItemList
   745                           #useIndex: true
   746                         )
   747                        )
   748                      
   749                     )
   750                   )
   751                  )
   752                
   753               )
   754               #handles: #(#Any 0.24053 1.0)
   755             )
   756            #(#UISubSpecification
   757               #name: 'infoBarSubSpec'
   758               #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
   759               #majorKey: #ToolApplicationModel
   760               #minorKey: #windowSpecForInfoBar
   761             )
   762            )
   763          
   764         )
   765       )
   766 ! !
   767 
   768 !TabListEditor class methodsFor:'list specs'!
   769 
   770 noteBookTabList
   771     "This resource specification was automatically generated
   772      by the TabListEditor of ST/X."
   773 
   774     "Do not manually edit this!! If it is corrupted,
   775      the TabListEditor may not be able to read the specification."
   776 
   777     "
   778      TabListEditor new openOnClass:TabListEditor andSelector:#noteBookTabList
   779     "
   780 
   781     <resource: #tabList>
   782 
   783     ^     #(
   784        #(#TabItem
   785           #label: 'Basic'
   786           #activeHelpKey: #basicTab
   787           #minorKey: #basicSpec
   788         )
   789        #(#TabItem
   790           #label: 'Details'
   791           #activeHelpKey: #detailTab
   792           #minorKey: #detailSpec
   793         )
   794        #(#TabItem
   795           #label: 'Canvas'
   796           #activeHelpKey: #canvasTab
   797           #minorKey: #canvasSpec
   798         )
   799        )
   800      
   801       collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]
   802 ! !
   803 
   804 !TabListEditor class methodsFor:'menu specs'!
   805 
   806 menu
   807     "This resource specification was automatically generated
   808      by the MenuEditor of ST/X."
   809 
   810     "Do not manually edit this!! If it is corrupted,
   811      the MenuEditor may not be able to read the specification."
   812 
   813     "
   814      MenuEditor new openOnClass:TabListEditor andSelector:#menu
   815      (Menu new fromLiteralArrayEncoding:(TabListEditor menu)) startUp
   816     "
   817 
   818     <resource: #menu>
   819 
   820     ^
   821      
   822        #(#Menu
   823           
   824            #(
   825              #(#MenuItem
   826                 #label: 'About'
   827                 #activeHelpKey: #about
   828                 #labelImage: #(#ResourceRetriever nil #menuIcon)
   829                 #submenuChannel: #menuAbout
   830             )
   831              #(#MenuItem
   832                 #label: 'File'
   833                 #activeHelpKey: #file
   834                 #submenu: 
   835                  #(#Menu
   836                     
   837                      #(
   838                        #(#MenuItem
   839                           #label: 'New'
   840                           #value: #doNew
   841                           #activeHelpKey: #fileNew
   842                       )
   843                        #(#MenuItem
   844                           #label: '-'
   845                       )
   846                        #(#MenuItem
   847                           #label: 'Load...'
   848                           #translateLabel: true
   849                           #value: #doLoad
   850                           #activeHelpKey: #fileLoad
   851                       )
   852                        #(#MenuItem
   853                           #label: '-'
   854                       )
   855                        #(#MenuItem
   856                           #label: 'Save'
   857                           #value: #doSave
   858                           #activeHelpKey: #fileSave
   859                       )
   860                        #(#MenuItem
   861                           #label: 'Save As...'
   862                           #value: #doSaveAs
   863                           #activeHelpKey: #fileSave
   864                       )
   865                        #(#MenuItem
   866                           #label: '-'
   867                       )
   868                        #(#MenuItem
   869                           #label: 'Browse Class'
   870                           #value: #doBrowseClass
   871                           #activeHelpKey: #fileBrowseClass
   872                       )
   873                        #(#MenuItem
   874                           #label: '-'
   875                       )
   876                        #(#MenuItem
   877                           #label: 'Exit'
   878                           #value: #closeRequest
   879                           #activeHelpKey: #fileExit
   880                       )
   881                     ) nil
   882                     nil
   883                 )
   884             )
   885              #(#MenuItem
   886                 #label: 'Edit'
   887                 #activeHelpKey: #edit
   888                 #submenuChannel: #menuEdit
   889             )
   890              #(#MenuItem
   891                 #label: 'Add'
   892                 #activeHelpKey: #add
   893                 #submenu: 
   894                  #(#Menu
   895                     
   896                      #(
   897                        #(#MenuItem
   898                           #label: 'Tab Item'
   899                           #value: #doCreate
   900                           #activeHelpKey: #addTabItem
   901                           #labelImage: #(#ResourceRetriever nil #newTabItemIcon 'Tab Item')
   902                       )
   903                     ) nil
   904                     nil
   905                 )
   906             )
   907              #(#MenuItem
   908                 #label: 'Generate'
   909                 #activeHelpKey: #add
   910                 #submenu: 
   911                  #(#Menu
   912                     
   913                      #(
   914                        #(#MenuItem
   915                           #label: 'Aspect Method'
   916                           #value: #doGenerateAspectMethod
   917                           #activeHelpKey: #fileCreateAspectMethod
   918                           #enabled: #hasClassAndSelector
   919                       )
   920                     ) nil
   921                     nil
   922                 )
   923             )
   924              #(#MenuItem
   925                 #label: 'Test'
   926                 #activeHelpKey: #test
   927                 #submenu: 
   928                  #(#Menu
   929                     
   930                      #(
   931                        #(#MenuItem
   932                           #label: 'Preview'
   933                           #activeHelpKey: #testPreview
   934                           #enabled: #canToggleTestMode
   935                           #indication: #testMode
   936                       )
   937                     ) nil
   938                     nil
   939                 )
   940             )
   941              #(#MenuItem
   942                 #label: 'History'
   943                 #activeHelpKey: #history
   944                 #submenuChannel: #menuHistory
   945             )
   946              #(#MenuItem
   947                 #label: 'Help'
   948                 #startGroup: #right
   949                 #activeHelpKey: #help
   950                 #submenuChannel: #menuHelp
   951             )
   952           ) nil
   953           nil
   954       )
   955 !
   956 
   957 menuEdit
   958     "This resource specification was automatically generated
   959      by the MenuEditor of ST/X."
   960 
   961     "Do not manually edit this!! If it is corrupted,
   962      the MenuEditor may not be able to read the specification."
   963 
   964     "
   965      MenuEditor new openOnClass:TabListEditor andSelector:#menuEdit
   966      (Menu new fromLiteralArrayEncoding:(TabListEditor menuEdit)) startUp
   967     "
   968 
   969     <resource: #menu>
   970 
   971     ^ 
   972      #(#Menu
   973         #(
   974          #(#MenuItem
   975             #label: 'Cut'
   976             #value: #doCut
   977             #activeHelpKey: #editCut
   978             #enabled: #hasSelectionHolder
   979           )
   980          #(#MenuItem
   981             #label: 'Copy'
   982             #value: #doCopy
   983             #activeHelpKey: #editCopy
   984             #enabled: #hasSelectionHolder
   985           )
   986          #(#MenuItem
   987             #label: 'Paste'
   988             #value: #doPaste
   989             #activeHelpKey: #editPaste
   990             #enabled: #canPasteHolder
   991           )
   992          #(#MenuItem
   993             #label: 'Delete'
   994             #value: #doDelete
   995             #activeHelpKey: #editPaste
   996             #enabled: #hasSelectionHolder
   997           )
   998          #(#MenuItem
   999             #label: '-'
  1000           )
  1001          #(#MenuItem
  1002             #label: 'Move Up'
  1003             #value: #doMoveTabUpOrDown:
  1004             #activeHelpKey: #editMoveUp
  1005             #enabled: #canMoveTabItemUpOrDown
  1006             #argument: #up
  1007             #labelImage: #(#ResourceRetriever #Icon #upIcon 'Move Up')
  1008           )
  1009          #(#MenuItem
  1010             #label: 'Move Down'
  1011             #value: #doMoveTabUpOrDown:
  1012             #activeHelpKey: #editMoveDown
  1013             #enabled: #canMoveTabItemUpOrDown
  1014             #argument: #down
  1015             #labelImage: #(#ResourceRetriever #Icon #downIcon 'Move Down')
  1016           )
  1017          #(#MenuItem
  1018             #label: '-'
  1019             #isVisible: #hiddenAccelerator
  1020           )
  1021          #(#MenuItem
  1022             #label: 'Accept'
  1023             #translateLabel: true
  1024             #isVisible: #hiddenAccelerator
  1025             #value: #accept
  1026             #enabled: #enablingCommitButtonsHolder
  1027           )
  1028          )
  1029         nil
  1030         nil
  1031       )
  1032 !
  1033 
  1034 menuToolbar
  1035     "This resource specification was automatically generated
  1036      by the MenuEditor of ST/X."
  1037 
  1038     "Do not manually edit this!! If it is corrupted,
  1039      the MenuEditor may not be able to read the specification."
  1040 
  1041     "
  1042      MenuEditor new openOnClass:TabListEditor andSelector:#menuToolbar
  1043      (Menu new fromLiteralArrayEncoding:(TabListEditor menuToolbar)) startUp
  1044     "
  1045 
  1046     <resource: #menu>
  1047 
  1048     ^ 
  1049      #(Menu
  1050         (
  1051          (MenuItem
  1052             activeHelpKey: fileNew
  1053             label: 'New'
  1054             itemValue: doNew
  1055             translateLabel: true
  1056             isButton: true
  1057             labelImage: (ResourceRetriever ToolbarIconLibrary new22x22Icon)
  1058           )
  1059          (MenuItem
  1060             activeHelpKey: fileLoad
  1061             label: 'Load'
  1062             itemValue: doLoad
  1063             translateLabel: true
  1064             isButton: true
  1065             labelImage: (ResourceRetriever ToolbarIconLibrary loadFromMethodIcon)
  1066           )
  1067          (MenuItem
  1068             activeHelpKey: fileSave
  1069             label: 'Save'
  1070             itemValue: doSave
  1071             translateLabel: true
  1072             isButton: true
  1073             labelImage: (ResourceRetriever ToolbarIconLibrary saveAsMethodIcon)
  1074           )
  1075          (MenuItem
  1076             label: '-'
  1077           )
  1078          (MenuItem
  1079             activeHelpKey: editCut
  1080             enabled: hasSelectionHolder
  1081             label: 'Cut'
  1082             itemValue: doCut
  1083             translateLabel: true
  1084             isButton: true
  1085             labelImage: (ResourceRetriever ToolbarIconLibrary cutWidgetIcon)
  1086           )
  1087          (MenuItem
  1088             activeHelpKey: editCopy
  1089             enabled: hasSelectionHolder
  1090             label: 'Copy'
  1091             itemValue: doCopy
  1092             translateLabel: true
  1093             isButton: true
  1094             labelImage: (ResourceRetriever ToolbarIconLibrary copyWidgetIcon)
  1095           )
  1096          (MenuItem
  1097             activeHelpKey: editPaste
  1098             enabled: canPasteHolder
  1099             label: 'Paste'
  1100             itemValue: doPaste
  1101             translateLabel: true
  1102             isButton: true
  1103             labelImage: (ResourceRetriever ToolbarIconLibrary pasteWidgetIcon)
  1104           )
  1105          (MenuItem
  1106             activeHelpKey: editDelete
  1107             enabled: hasSelectionHolder
  1108             label: 'Delete'
  1109             itemValue: doDelete
  1110             translateLabel: true
  1111             isButton: true
  1112             isVisible: false
  1113             labelImage: (ResourceRetriever ToolbarIconLibrary delete22x22Icon)
  1114           )
  1115          (MenuItem
  1116             label: '-'
  1117           )
  1118          (MenuItem
  1119             activeHelpKey: addTabItem
  1120             label: 'Add Tab Item'
  1121             itemValue: doCreate
  1122             translateLabel: true
  1123             isButton: true
  1124             labelImage: (ResourceRetriever nil newTabItemIcon)
  1125           )
  1126          (MenuItem
  1127             label: ''
  1128           )
  1129          (MenuItem
  1130             activeHelpKey: editMoveUp
  1131             enabled: canMoveTabItemUpOrDown
  1132             label: 'Move Tab Up'
  1133             itemValue: doMoveTabUpOrDown:
  1134             translateLabel: true
  1135             isButton: true
  1136             startGroup: right
  1137             labelImage: (ResourceRetriever XPToolbarIconLibrary up22x22Icon)
  1138             argument: up
  1139           )
  1140          (MenuItem
  1141             activeHelpKey: editMoveDown
  1142             enabled: canMoveTabItemUpOrDown
  1143             label: 'Move Tab Down'
  1144             itemValue: doMoveTabUpOrDown:
  1145             translateLabel: true
  1146             isButton: true
  1147             startGroup: right
  1148             labelImage: (ResourceRetriever XPToolbarIconLibrary down22x22Icon)
  1149             argument: down
  1150           )
  1151          )
  1152         nil
  1153         nil
  1154       )
  1155 ! !
  1156 
  1157 !TabListEditor methodsFor:'aspects'!
  1158 
  1159 autoHideScrollBars
  1160     |holder|
  1161 
  1162     (holder := builder bindingAt:#autoHideScrollBars) isNil ifTrue:[
  1163         builder aspectAt:#autoHideScrollBars put:(holder := 1 asValue).
  1164         holder addDependent: self
  1165     ].
  1166     ^ holder.
  1167 !
  1168 
  1169 canMoveTabItemUpOrDown
  1170     ^ builder booleanValueAspectFor:#canMoveTabItemUpOrDown
  1171 !
  1172 
  1173 hasSelectionHolder
  1174     ^ builder booleanValueAspectFor:#hasSelectionHolder
  1175 !
  1176 
  1177 hiddenAccelerator
  1178     "used to set menu entries with an accelerator not visible to the operator
  1179     "
  1180     ^ false
  1181 !
  1182 
  1183 inputGroup
  1184 
  1185     |holder|
  1186 
  1187     (holder := builder bindingAt:#inputGroup) isNil ifTrue:[
  1188         builder aspectAt:#inputGroup put:(holder := EnterFieldGroup new)
  1189     ].
  1190     ^ holder.
  1191 
  1192 
  1193 !
  1194 
  1195 listOfTabs
  1196     ^ listOfTabs
  1197 !
  1198 
  1199 noteBookModel
  1200     |holder|
  1201 
  1202     (holder := builder bindingAt:#noteBookModel) isNil ifTrue:[
  1203         holder := 0 asValue.
  1204         builder aspectAt:#noteBookModel put:holder.
  1205     ].
  1206     ^ holder.
  1207 !
  1208 
  1209 noteBookTabList
  1210     "Generated by the TabListEditor"
  1211 
  1212     |list|
  1213 
  1214     (list := builder bindingAt:#noteBookTabList) isNil ifTrue:[
  1215         builder aspectAt:#noteBookTabList put:(list := self class noteBookTabList).
  1216     ].
  1217     ^ list
  1218 !
  1219 
  1220 selectionHolder
  1221     "holder which keeps the current selection
  1222     "
  1223     |holder|
  1224 
  1225     (holder := builder bindingAt:#selectionHolder) isNil ifTrue:[
  1226         holder := 0 asValue.
  1227         builder aspectAt:#selectionHolder put:holder.
  1228         holder addDependent:self.
  1229     ].
  1230     ^ holder
  1231 !
  1232 
  1233 testItemList
  1234     |holder|
  1235 
  1236     (holder := builder bindingAt:#testItemList) isNil ifTrue:[
  1237         holder := ValueHolder new.
  1238         builder aspectAt:#testItemList put:holder.
  1239     ].
  1240     ^ holder.
  1241 !
  1242 
  1243 testMode
  1244 
  1245     |holder|
  1246 
  1247     (holder := builder bindingAt:#testMode) isNil ifTrue:[
  1248         builder aspectAt:#testMode put:(holder := false asValue).
  1249         holder addDependent: self
  1250     ].
  1251     ^ holder
  1252 
  1253 ! !
  1254 
  1255 !TabListEditor methodsFor:'building'!
  1256 
  1257 buildFromResourceSpec:aListSpec
  1258     self buildFromTabList:aListSpec
  1259 !
  1260 
  1261 buildFromTabList: aTabList
  1262     "build from a aTabList"
  1263 
  1264     self selection:0.
  1265     listOfTabs removeAll.
  1266 
  1267     aTabList do:[:aTabItem| listOfTabs add: aTabItem ].
  1268     self clearModified.
  1269     listOfTabs notEmpty ifTrue:[ self selection:1 ].
  1270 !
  1271 
  1272 loadFromClass:aClass andSelector:aSelector
  1273     "build from class and selector"
  1274 
  1275     |cls spec|
  1276 
  1277     self assert:(aClass isNil or:[aClass isClass]).
  1278 
  1279     self testMode value: false.
  1280     self selection:0.
  1281 
  1282     "if opened on a tab list"
  1283     (aClass isNil and: [aSelector isNil and: [listOfTabs size > 0]]) ifFalse:[
  1284         listOfTabs removeAll.
  1285 
  1286         cls := aClass isBehavior ifTrue:[ aClass ] ifFalse:[ self resolveName:aClass].
  1287         specSelector := aSelector.
  1288 
  1289         cls notNil ifTrue:[
  1290             specSelector notNil ifTrue:[
  1291 
  1292                 (cls respondsTo: aSelector) ifTrue:[ 
  1293                     spec := cls perform: aSelector.
  1294                 ].
  1295                 spec size ~~ 0 ifTrue:[
  1296                     spec do:[:aTab|
  1297                         listOfTabs add:aTab.
  1298                     ].
  1299                     self addHistoryEntryForClass:cls selector:specSelector.
  1300                 ]
  1301             ]
  1302         ].
  1303 
  1304         self clearModified.
  1305     ].
  1306     listOfTabs notEmpty ifTrue:[ self selection:1 ].
  1307 ! !
  1308 
  1309 !TabListEditor methodsFor:'change & update'!
  1310 
  1311 update:something with:aParameter from:someObject
  1312     "one of my aspects has changed; update modified channel
  1313     "
  1314     |list|
  1315 
  1316     someObject = self selectionHolder ifTrue:[
  1317         ^ self selectionChanged
  1318     ].
  1319 
  1320     someObject = self testMode ifFalse:[              
  1321         ^ super update:something with:aParameter from:someObject.
  1322     ].
  1323 
  1324     someObject value ifTrue:[
  1325         self noteBookModel value:0.
  1326 
  1327         listOfTabs notEmpty ifTrue:[
  1328             list := listOfTabs collect:[:aTab| |tab|
  1329                 tab := aTab copy.
  1330                 tab setAttributesFromClass:specClass.
  1331                 tab
  1332             ]
  1333         ].
  1334         self selection:0.
  1335     ].
  1336     self testItemList value:list.
  1337     self updateInfoLabel.
  1338 
  1339 ! !
  1340 
  1341 !TabListEditor methodsFor:'queries'!
  1342 
  1343 canToggleTestMode
  1344     "checks whether testMode button is enabled"
  1345 
  1346     self testMode value ifTrue:[
  1347         ^ true
  1348     ].
  1349 
  1350     self enablingCommitButtonsHolder value ifFalse:[
  1351         ^ listOfTabs notEmpty
  1352     ].
  1353     ^ false
  1354 ! !
  1355 
  1356 !TabListEditor methodsFor:'selection'!
  1357 
  1358 selectedElement
  1359     |idx tab|
  1360 
  1361     idx := self selection.
  1362 
  1363     idx ~~ 0 ifTrue:[
  1364         (tab := listOfTabs at:idx ifAbsent:nil) notNil ifTrue:[
  1365             ^ tab
  1366         ].
  1367         self selection:0
  1368     ].
  1369     ^ nil
  1370 !
  1371 
  1372 selection
  1373     ^ self selectionHolder value ? 0
  1374 !
  1375 
  1376 selection:anIndex
  1377     self selectionHolder value:(anIndex ? 0).
  1378 !
  1379 
  1380 selectionChanged
  1381     |noteBookModel hasSelection|
  1382 
  1383     hasSelection  := self selection ~~ 0.
  1384     noteBookModel := self noteBookModel.
  1385 
  1386     hasSelection ifTrue:[
  1387         self testMode value:false.
  1388         noteBookModel value == 0 ifTrue:[noteBookModel value:1]
  1389     ] ifFalse:[
  1390         noteBookModel value:0
  1391     ].
  1392     self cancel.
  1393     self hasSelectionHolder value:hasSelection.
  1394     self canPasteHolder.
  1395 !
  1396 
  1397 setSelection:anIndex
  1398     |index|
  1399 
  1400     index := anIndex ? 0.
  1401     self selectionHolder value:index withoutNotifying:self
  1402 ! !
  1403 
  1404 !TabListEditor methodsFor:'startup / release'!
  1405 
  1406 initialize
  1407     "setup aspects used by column description specifications
  1408     "
  1409     super initialize.
  1410     listOfTabs := List new.
  1411 !
  1412 
  1413 openModalOnTabList: aTabList
  1414     "build a tab list from aTabList and open it modal"
  1415 
  1416     super openModalOnResourceSpec: aTabList
  1417 
  1418 ! !
  1419 
  1420 !TabListEditor methodsFor:'user actions'!
  1421 
  1422 accept
  1423     "accept changes
  1424     "
  1425     |tab idx asb|
  1426 
  1427     (tab := self selectedElement) notNil ifTrue:[
  1428         super accept.
  1429         aspects keysAndValuesDo:[:k :m| tab perform:(k , ':') asSymbol with:(m value) ].
  1430 
  1431         asb := self autoHideScrollBars value.
  1432         asb := asb ~~ 1 ifTrue:[asb == 2] ifFalse:[nil].
  1433         tab autoHideScrollBars:asb.
  1434     ].
  1435     self cancel.
  1436 !
  1437 
  1438 addTab:aTab
  1439     |idx|
  1440 
  1441     aTab notNil ifTrue:[
  1442         self testMode value: false.
  1443 
  1444         (idx := self selection) == 0 ifTrue:[
  1445             listOfTabs add:aTab.
  1446             self selection:(listOfTabs size).
  1447         ] ifFalse:[
  1448             listOfTabs add:aTab afterIndex:idx
  1449         ].
  1450         self setModified.
  1451     ].
  1452 !
  1453 
  1454 cancel
  1455     "cancel all changes"
  1456 
  1457     |tab idx asb|
  1458 
  1459     (     (idx := self selection) ~~ 0
  1460      and:[(tab := self selectedElement) notNil]
  1461     ) ifTrue:[
  1462         aspects keysAndValuesDo:[:k :m| m value:(tab perform:k) ].
  1463         listOfTabs at:idx put:tab.
  1464 
  1465         asb := tab autoHideScrollBars.
  1466         asb notNil ifTrue:[asb := asb == true ifTrue:[2] ifFalse:[3]]
  1467                   ifFalse:[asb := 1].
  1468 
  1469         self autoHideScrollBars value:asb.
  1470     ].
  1471     self canMoveTabItemUpOrDown value:(listOfTabs size > 1 and:[idx ~~ 0]).
  1472     self enablingCommitButtonsHolder value: false
  1473 !
  1474 
  1475 doCopy
  1476     "copy selected tab
  1477     "
  1478     |tab|
  1479 
  1480     (tab := self selectedElement) notNil ifTrue:[
  1481         self clipboard:tab.
  1482         self updateAllToolInstances.
  1483     ]
  1484 !
  1485 
  1486 doCreate
  1487     self addTab:(TabItem label:'TAB').
  1488 !
  1489 
  1490 doCut
  1491     "cut the selected tab; put to pasteBuffer
  1492     "
  1493     |tab|
  1494 
  1495     (tab := self selectedElement) notNil ifTrue:[
  1496         self clipboard:tab.
  1497         self doDelete.
  1498     ].
  1499 
  1500 !
  1501 
  1502 doDelete
  1503     "delete selected tab
  1504     "
  1505     |index size|
  1506 
  1507     (index := self selection) ~~ 0 ifTrue:[
  1508         self testMode value: false.
  1509 
  1510         (size := listOfTabs size) == 1 ifTrue:[
  1511             self selection:0
  1512         ] ifFalse:[
  1513             self setSelection:0
  1514         ].
  1515         listOfTabs removeIndex:index.
  1516         index < size ifFalse:[
  1517             index := index - 1
  1518         ].
  1519         self selection:index.
  1520         self updateAllToolInstances.
  1521         self setModified.
  1522     ].       
  1523 !
  1524 
  1525 doGenerateAspectMethod
  1526     "generate aspect method
  1527     "
  1528     |cls code|
  1529 
  1530     (specClass notNil and:[specSelector notNil])
  1531     ifFalse:
  1532     [
  1533         ^self information:'No class and selector defined!!'   
  1534     ].
  1535 
  1536     cls := self resolveName: specClass.
  1537 
  1538     (cls canUnderstand:specSelector) ifTrue:[
  1539         "/ method already exists, do not overwrite the method automaticaly
  1540 
  1541         ( YesNoBox title:'method '
  1542                          , (Text string:('#', specSelector) emphasis:#bold)
  1543                          , ' already exists!!'
  1544                  yesText:'overwrite'
  1545                   noText:'cancel'
  1546         ) confirm ifFalse:[
  1547             ^ self
  1548         ]
  1549     ].
  1550 
  1551     code := '!!' , cls name , ' methodsFor:''aspects''!!\\' ,
  1552             specSelector , '\' ,
  1553             '    "Generated by the TabListEditor"\' ,
  1554             '\' ,
  1555             '    |list|\' ,
  1556             '\' ,
  1557             '    (list := builder bindingAt:#' , specSelector , ') isNil ifTrue:[\' ,
  1558             '        builder aspectAt:#' , specSelector, ' put:(list := self class ', specSelector, ').\' ,
  1559             '    ].\' ,
  1560             '    ^ list\' ,
  1561             '!! !!\\'.
  1562 
  1563     (ReadStream on:(code withCRs)) fileIn
  1564 
  1565 
  1566 !
  1567 
  1568 doMoveTabUpOrDown:what
  1569     "step up or down
  1570     "
  1571     |tab idx sz|
  1572 
  1573     (listOfTabs size > 1 and:[(idx := self selection) ~~ 0]) ifFalse:[
  1574         ^ self
  1575     ].
  1576 
  1577     (tab := listOfTabs at:idx ifAbsent:nil) isNil ifTrue:[
  1578         ^ self selection:0
  1579     ].
  1580 
  1581     self setSelection:0.
  1582     listOfTabs removeIndex:idx.
  1583 
  1584     sz := listOfTabs size.
  1585 
  1586     what == #down ifTrue:[
  1587         idx := idx > sz ifTrue:[1] ifFalse:[idx + 1]
  1588     ] ifFalse:[
  1589         idx := idx == 1 ifTrue:[sz + 1] ifFalse:[idx - 1]
  1590     ].
  1591 
  1592     listOfTabs add:tab beforeIndex:idx.
  1593     self setSelection:idx.
  1594     self setModified.
  1595 !
  1596 
  1597 doPaste
  1598     "paste a tab
  1599     "
  1600     |tab|
  1601 
  1602     ((tab := self class clipboard) notNil and:[tab isKindOf:TabItem]) ifTrue:[
  1603         self addTab:(tab deepCopy).
  1604     ]
  1605 !
  1606 
  1607 doSave
  1608     "generate code for class and instance"
  1609 
  1610     |cls code spec category mthd list|
  1611 
  1612     (specClass notNil and:[specSelector notNil])
  1613     ifFalse:
  1614     [
  1615         ^self doSaveAs
  1616     ].
  1617 
  1618     cls := self resolveName: specClass.
  1619 
  1620     listOfTabs isEmpty ifTrue:[^self information:'No tab list defined!!'].
  1621 
  1622     spec  := WriteStream on:String new.
  1623     list := Array new:(listOfTabs size).
  1624     listOfTabs keysAndValuesDo:[:i :el|list at:i put:(el literalArrayEncoding)].
  1625 
  1626     UISpecification prettyPrintSpecArray:list on:spec indent:5.
  1627     spec := spec contents.
  1628 
  1629     "/ if that method already exists, do not overwrite the category
  1630 
  1631     category := 'list specs'.
  1632 
  1633     (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[
  1634         category := mthd category.
  1635     ].
  1636 
  1637     code := Character excla asString 
  1638             , cls name , ' class methodsFor:' , category storeString
  1639             , Character excla asString , '\\'
  1640 
  1641             , specSelector , '\'
  1642             , (self class codeGenerationComment replChar:$!! withString:'!!!!')
  1643             , '\\    "\'
  1644             , '     TabListEditor new openOnClass: self andSelector:#' , specSelector , '\'
  1645             , '    "\'.
  1646 
  1647     code := code 
  1648             , '\'
  1649             , '    <resource: #tabList>\\'
  1650             , '    ^' 
  1651             , '     ', spec, '\'
  1652             , '      collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]'
  1653             , '\'
  1654             , Character excla asString
  1655             , ' '
  1656             , Character excla asString
  1657             , '\'.
  1658 
  1659     code := code withCRs.
  1660     (ReadStream on:code) fileIn.
  1661 
  1662     (cls canUnderstand:specSelector) ifFalse:[
  1663         (YesNoBox confirm:'Generate aspect method?') ifTrue:[
  1664             self doGenerateAspectMethod
  1665         ]
  1666     ].
  1667 
  1668     self addHistoryEntryForClass:cls selector:specSelector.
  1669     self clearModified.
  1670     hasSaved  := true.
  1671 !
  1672 
  1673 openDocumentation
  1674    self openHTMLDocument:'tools/uipainter/TabListEditor.html'.
  1675 ! !
  1676 
  1677 !TabListEditor class methodsFor:'documentation'!
  1678 
  1679 version
  1680     ^ '$Header$'
  1681 ! !