TabListEditor.st
author Claus Gittinger <cg@exept.de>
Sat, 21 Jul 2012 18:58:03 +0200
changeset 2898 c7f6c498df6a
parent 2828 c5afe7613f98
child 3036 a685cbe8ae60
permissions -rw-r--r--
category of:15 methods
     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           #bounds: #(#Rectangle 596 292 1132 661)
   677           #menu: #menu
   678         )
   679         #component: 
   680        #(#SpecCollection
   681           #collection: #(
   682            #(#MenuPanelSpec
   683               #name: 'menuToolbarView'
   684               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 34 0)
   685               #menu: #menuToolbar
   686               #showSeparatingLines: true
   687             )
   688            #(#VariableHorizontalPanelSpec
   689               #name: 'VariablePanel'
   690               #layout: #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -26 1.0)
   691               #component: 
   692              #(#SpecCollection
   693                 #collection: #(
   694                  #(#SelectionInListModelViewSpec
   695                     #attributes: 
   696                    #(#vpext
   697                       
   698                      #(#Array
   699                         #Array #Array
   700                         #Array #Array
   701                         #Array #Point
   702                         0.264414 1.0
   703                       )
   704                     )
   705                     #name: 'ListOfLabels'
   706                     #tabable: true
   707                     #model: #selectionHolder
   708                     #menu: #menuEdit
   709                     #hasHorizontalScrollBar: true
   710                     #hasVerticalScrollBar: true
   711                     #miniScrollerHorizontal: true
   712                     #listModel: #listOfTabs
   713                     #highlightMode: #line
   714                     #selectConditionSelector: #askForItemModification
   715                   )
   716                  #(#ViewSpec
   717                     #name: 'SpecView'
   718                     #level: -1
   719                     #component: 
   720                    #(#SpecCollection
   721                       #collection: #(
   722                        #(#NoteBookViewSpec
   723                           #name: 'NoteBook'
   724                           #layout: #(#LayoutFrame 1 0.0 0 0.0 0 1.0 -30 1.0)
   725                           #enableChannel: #hasSelectionHolder
   726                           #tabable: true
   727                           #model: #noteBookModel
   728                           #menu: #noteBookTabList
   729                           #useIndex: true
   730                           #keepCanvasAlive: true
   731                         )
   732                        #(#UISubSpecification
   733                           #name: 'subSpec'
   734                           #layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1)
   735                           #majorKey: #ToolApplicationModel
   736                           #minorKey: #windowSpecForCommit
   737                         )
   738                        #(#NoteBookViewSpec
   739                           #name: 'TestNoteBook'
   740                           #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   741                           #visibilityChannel: #testMode
   742                           #tabable: true
   743                           #menu: #testItemList
   744                           #useIndex: true
   745                         )
   746                        )
   747                      
   748                     )
   749                   )
   750                  )
   751                
   752               )
   753               #handles: #(#Any 0.24053 1.0)
   754             )
   755            #(#UISubSpecification
   756               #name: 'infoBarSubSpec'
   757               #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
   758               #majorKey: #ToolApplicationModel
   759               #minorKey: #windowSpecForInfoBar
   760             )
   761            )
   762          
   763         )
   764       )
   765 ! !
   766 
   767 !TabListEditor class methodsFor:'list specs'!
   768 
   769 noteBookTabList
   770     "This resource specification was automatically generated
   771      by the TabListEditor of ST/X."
   772 
   773     "Do not manually edit this!! If it is corrupted,
   774      the TabListEditor may not be able to read the specification."
   775 
   776     "
   777      TabListEditor new openOnClass:TabListEditor andSelector:#noteBookTabList
   778     "
   779 
   780     <resource: #tabList>
   781 
   782     ^     #(
   783        #(#TabItem
   784           #label: 'Basic'
   785           #activeHelpKey: #basicTab
   786           #minorKey: #basicSpec
   787         )
   788        #(#TabItem
   789           #label: 'Details'
   790           #activeHelpKey: #detailTab
   791           #minorKey: #detailSpec
   792         )
   793        #(#TabItem
   794           #label: 'Canvas'
   795           #activeHelpKey: #canvasTab
   796           #minorKey: #canvasSpec
   797         )
   798        )
   799      
   800       collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]
   801 ! !
   802 
   803 !TabListEditor class methodsFor:'menu specs'!
   804 
   805 menu
   806     "This resource specification was automatically generated
   807      by the MenuEditor of ST/X."
   808 
   809     "Do not manually edit this!! If it is corrupted,
   810      the MenuEditor may not be able to read the specification."
   811 
   812     "
   813      MenuEditor new openOnClass:TabListEditor andSelector:#menu
   814      (Menu new fromLiteralArrayEncoding:(TabListEditor menu)) startUp
   815     "
   816 
   817     <resource: #menu>
   818 
   819     ^
   820      
   821        #(#Menu
   822           
   823            #(
   824              #(#MenuItem
   825                 #label: 'About'
   826                 #activeHelpKey: #about
   827                 #labelImage: #(#ResourceRetriever nil #menuIcon)
   828                 #submenuChannel: #menuAbout
   829             )
   830              #(#MenuItem
   831                 #label: 'File'
   832                 #activeHelpKey: #file
   833                 #submenu: 
   834                  #(#Menu
   835                     
   836                      #(
   837                        #(#MenuItem
   838                           #label: 'New'
   839                           #value: #doNew
   840                           #activeHelpKey: #fileNew
   841                       )
   842                        #(#MenuItem
   843                           #label: '-'
   844                       )
   845                        #(#MenuItem
   846                           #label: 'Load...'
   847                           #translateLabel: true
   848                           #value: #doLoad
   849                           #activeHelpKey: #fileLoad
   850                       )
   851                        #(#MenuItem
   852                           #label: '-'
   853                       )
   854                        #(#MenuItem
   855                           #label: 'Save'
   856                           #value: #doSave
   857                           #activeHelpKey: #fileSave
   858                       )
   859                        #(#MenuItem
   860                           #label: 'Save As...'
   861                           #value: #doSaveAs
   862                           #activeHelpKey: #fileSave
   863                       )
   864                        #(#MenuItem
   865                           #label: '-'
   866                       )
   867                        #(#MenuItem
   868                           #label: 'Browse Class'
   869                           #value: #doBrowseClass
   870                           #activeHelpKey: #fileBrowseClass
   871                       )
   872                        #(#MenuItem
   873                           #label: '-'
   874                       )
   875                        #(#MenuItem
   876                           #label: 'Exit'
   877                           #value: #closeRequest
   878                           #activeHelpKey: #fileExit
   879                       )
   880                     ) nil
   881                     nil
   882                 )
   883             )
   884              #(#MenuItem
   885                 #label: 'Edit'
   886                 #activeHelpKey: #edit
   887                 #submenuChannel: #menuEdit
   888             )
   889              #(#MenuItem
   890                 #label: 'Add'
   891                 #activeHelpKey: #add
   892                 #submenu: 
   893                  #(#Menu
   894                     
   895                      #(
   896                        #(#MenuItem
   897                           #label: 'Tab Item'
   898                           #value: #doCreate
   899                           #activeHelpKey: #addTabItem
   900                           #labelImage: #(#ResourceRetriever nil #newTabItemIcon 'Tab Item')
   901                       )
   902                     ) nil
   903                     nil
   904                 )
   905             )
   906              #(#MenuItem
   907                 #label: 'Generate'
   908                 #activeHelpKey: #add
   909                 #submenu: 
   910                  #(#Menu
   911                     
   912                      #(
   913                        #(#MenuItem
   914                           #label: 'Aspect Method'
   915                           #value: #doGenerateAspectMethod
   916                           #activeHelpKey: #fileCreateAspectMethod
   917                           #enabled: #hasClassAndSelector
   918                       )
   919                     ) nil
   920                     nil
   921                 )
   922             )
   923              #(#MenuItem
   924                 #label: 'Test'
   925                 #activeHelpKey: #test
   926                 #submenu: 
   927                  #(#Menu
   928                     
   929                      #(
   930                        #(#MenuItem
   931                           #label: 'Preview'
   932                           #activeHelpKey: #testPreview
   933                           #enabled: #canToggleTestMode
   934                           #indication: #testMode
   935                       )
   936                     ) nil
   937                     nil
   938                 )
   939             )
   940              #(#MenuItem
   941                 #label: 'History'
   942                 #activeHelpKey: #history
   943                 #submenuChannel: #menuHistory
   944             )
   945              #(#MenuItem
   946                 label: 'MENU_Help'
   947                 #startGroup: #right
   948                 #activeHelpKey: #help
   949                 #submenuChannel: #menuHelp
   950                 startGroup: conditionalRight
   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| 
  1268         self assert:(aTabItem isKindOf:TabItem).
  1269         listOfTabs add: aTabItem 
  1270     ].
  1271     self clearModified.
  1272     listOfTabs notEmpty ifTrue:[ self selection:1 ].
  1273 
  1274     "Modified: / 08-11-2010 / 13:57:27 / cg"
  1275 !
  1276 
  1277 loadFromClass:aClass andSelector:aSelector
  1278     "build from class and selector"
  1279 
  1280     |cls spec|
  1281 
  1282     self assert:(aClass isNil or:[aClass isClass]).
  1283 
  1284     self testMode value: false.
  1285     self selection:0.
  1286 
  1287     "if opened on a tab list"
  1288     (aClass isNil and: [aSelector isNil and: [listOfTabs size > 0]]) ifFalse:[
  1289         listOfTabs removeAll.
  1290 
  1291         cls := aClass isBehavior ifTrue:[ aClass ] ifFalse:[ self resolveName:aClass].
  1292         specSelector := aSelector.
  1293 
  1294         cls notNil ifTrue:[
  1295             specSelector notNil ifTrue:[
  1296 
  1297                 (cls respondsTo: aSelector) ifTrue:[ 
  1298                     spec := cls perform: aSelector.
  1299                 ].
  1300                 spec size ~~ 0 ifTrue:[
  1301                     spec do:[:aTabOrArray|
  1302                         |tab|
  1303 
  1304                         aTabOrArray isArray ifTrue:[  
  1305                             tab := aTabOrArray decodeAsLiteralArray
  1306                         ] ifFalse:[
  1307                             tab := aTabOrArray.
  1308                         ].
  1309                         self assert:(tab isKindOf:TabItem).
  1310                         listOfTabs add:tab.
  1311                     ].
  1312                     self addHistoryEntryForClass:cls selector:specSelector.
  1313                 ]
  1314             ]
  1315         ].
  1316 
  1317         self clearModified.
  1318     ].
  1319     listOfTabs notEmpty ifTrue:[ self selection:1 ].
  1320 
  1321     "Modified: / 08-11-2010 / 13:59:09 / cg"
  1322 ! !
  1323 
  1324 !TabListEditor methodsFor:'change & update'!
  1325 
  1326 update:something with:aParameter from:someObject
  1327     "one of my aspects has changed; update modified channel
  1328     "
  1329     |list|
  1330 
  1331     someObject = self selectionHolder ifTrue:[
  1332         ^ self selectionChanged
  1333     ].
  1334 
  1335     someObject = self testMode ifFalse:[              
  1336         ^ super update:something with:aParameter from:someObject.
  1337     ].
  1338 
  1339     someObject value ifTrue:[
  1340         self noteBookModel value:0.
  1341 
  1342         listOfTabs notEmpty ifTrue:[
  1343             list := listOfTabs collect:[:aTab| |tab|
  1344                 tab := aTab copy.
  1345                 tab setAttributesFromClass:specClass.
  1346                 tab
  1347             ]
  1348         ].
  1349         self selection:0.
  1350     ].
  1351     self testItemList value:list.
  1352     self updateInfoLabel.
  1353 
  1354 ! !
  1355 
  1356 !TabListEditor methodsFor:'queries'!
  1357 
  1358 canToggleTestMode
  1359     "checks whether testMode button is enabled"
  1360 
  1361     self testMode value ifTrue:[
  1362         ^ true
  1363     ].
  1364 
  1365     self enablingCommitButtonsHolder value ifFalse:[
  1366         ^ listOfTabs notEmpty
  1367     ].
  1368     ^ false
  1369 ! !
  1370 
  1371 !TabListEditor methodsFor:'selection'!
  1372 
  1373 selectedElement
  1374     |idx tab|
  1375 
  1376     idx := self selection.
  1377 
  1378     idx ~~ 0 ifTrue:[
  1379         (tab := listOfTabs at:idx ifAbsent:nil) notNil ifTrue:[
  1380             ^ tab
  1381         ].
  1382         self selection:0
  1383     ].
  1384     ^ nil
  1385 !
  1386 
  1387 selection
  1388     ^ self selectionHolder value ? 0
  1389 !
  1390 
  1391 selection:anIndex
  1392     self selectionHolder value:(anIndex ? 0).
  1393 !
  1394 
  1395 selectionChanged
  1396     |noteBookModel hasSelection|
  1397 
  1398     hasSelection  := self selection ~~ 0.
  1399     noteBookModel := self noteBookModel.
  1400 
  1401     hasSelection ifTrue:[
  1402         self testMode value:false.
  1403         noteBookModel value == 0 ifTrue:[noteBookModel value:1]
  1404     ] ifFalse:[
  1405         noteBookModel value:0
  1406     ].
  1407     self cancel.
  1408     self hasSelectionHolder value:hasSelection.
  1409     self canPasteHolder.
  1410 !
  1411 
  1412 setSelection:anIndex
  1413     |index|
  1414 
  1415     index := anIndex ? 0.
  1416     self selectionHolder value:index withoutNotifying:self
  1417 ! !
  1418 
  1419 !TabListEditor methodsFor:'startup / release'!
  1420 
  1421 initialize
  1422     "setup aspects used by column description specifications
  1423     "
  1424     super initialize.
  1425     listOfTabs := List new.
  1426 !
  1427 
  1428 openModalOnTabList: aTabList
  1429     "build a tab list from aTabList and open it modal"
  1430 
  1431     super openModalOnResourceSpec: aTabList
  1432 
  1433 ! !
  1434 
  1435 !TabListEditor methodsFor:'user actions'!
  1436 
  1437 accept
  1438     "accept changes
  1439     "
  1440     |tab idx asb|
  1441 
  1442     (tab := self selectedElement) notNil ifTrue:[
  1443         super accept.
  1444         aspects keysAndValuesDo:[:k :m| tab perform:(k , ':') asSymbol with:(m value) ].
  1445 
  1446         asb := self autoHideScrollBars value.
  1447         asb := asb ~~ 1 ifTrue:[asb == 2] ifFalse:[nil].
  1448         tab autoHideScrollBars:asb.
  1449     ].
  1450     self cancel.
  1451 !
  1452 
  1453 addTab:aTab
  1454     |idx|
  1455 
  1456     aTab notNil ifTrue:[
  1457         self assert:(aTab isKindOf:TabItem).
  1458         self testMode value: false.
  1459 
  1460         (idx := self selection) == 0 ifTrue:[
  1461             listOfTabs add:aTab.
  1462             self selection:(listOfTabs size).
  1463         ] ifFalse:[
  1464             listOfTabs add:aTab afterIndex:idx
  1465         ].
  1466         self setModified.
  1467     ].
  1468 
  1469     "Modified: / 08-11-2010 / 13:55:27 / cg"
  1470 !
  1471 
  1472 cancel
  1473     "cancel all changes"
  1474 
  1475     |tab idx asb|
  1476 
  1477     (     (idx := self selection) ~~ 0
  1478      and:[(tab := self selectedElement) notNil]
  1479     ) ifTrue:[
  1480         aspects keysAndValuesDo:[:k :m| m value:(tab perform:k) ].
  1481         listOfTabs at:idx put:tab.
  1482 
  1483         asb := tab autoHideScrollBars.
  1484         asb notNil ifTrue:[asb := asb == true ifTrue:[2] ifFalse:[3]]
  1485                   ifFalse:[asb := 1].
  1486 
  1487         self autoHideScrollBars value:asb.
  1488     ].
  1489     self canMoveTabItemUpOrDown value:(listOfTabs size > 1 and:[idx ~~ 0]).
  1490     self enablingCommitButtonsHolder value: false
  1491 !
  1492 
  1493 doCopy
  1494     "copy selected tab
  1495     "
  1496     |tab|
  1497 
  1498     (tab := self selectedElement) notNil ifTrue:[
  1499         self clipboard:tab.
  1500         self updateAllToolInstances.
  1501     ]
  1502 !
  1503 
  1504 doCreate
  1505     self addTab:(TabItem label:'TAB').
  1506 !
  1507 
  1508 doCut
  1509     "cut the selected tab; put to pasteBuffer
  1510     "
  1511     |tab|
  1512 
  1513     (tab := self selectedElement) notNil ifTrue:[
  1514         self clipboard:tab.
  1515         self doDelete.
  1516     ].
  1517 
  1518 !
  1519 
  1520 doDelete
  1521     "delete selected tab
  1522     "
  1523     |index size|
  1524 
  1525     (index := self selection) ~~ 0 ifTrue:[
  1526         self testMode value: false.
  1527 
  1528         (size := listOfTabs size) == 1 ifTrue:[
  1529             self selection:0
  1530         ] ifFalse:[
  1531             self setSelection:0
  1532         ].
  1533         listOfTabs removeIndex:index.
  1534         index < size ifFalse:[
  1535             index := index - 1
  1536         ].
  1537         self selection:index.
  1538         self updateAllToolInstances.
  1539         self setModified.
  1540     ].       
  1541 !
  1542 
  1543 doGenerateAspectMethod
  1544     "generate aspect method
  1545     "
  1546     |cls code|
  1547 
  1548     (specClass notNil and:[specSelector notNil])
  1549     ifFalse:
  1550     [
  1551         ^self information:'No class and selector defined!!'   
  1552     ].
  1553 
  1554     cls := self resolveName: specClass.
  1555 
  1556     (cls canUnderstand:specSelector) ifTrue:[
  1557         "/ method already exists, do not overwrite the method automaticaly
  1558 
  1559         ( YesNoBox title:'method '
  1560                          , (Text string:('#', specSelector) emphasis:#bold)
  1561                          , ' already exists!!'
  1562                  yesText:'overwrite'
  1563                   noText:'cancel'
  1564         ) confirm ifFalse:[
  1565             ^ self
  1566         ]
  1567     ].
  1568 
  1569     code := '!!' , cls name , ' methodsFor:''aspects''!!\\' ,
  1570             specSelector , '\' ,
  1571             '    "Generated by the TabListEditor"\' ,
  1572             '\' ,
  1573             '    |list|\' ,
  1574             '\' ,
  1575             '    (list := builder bindingAt:#' , specSelector , ') isNil ifTrue:[\' ,
  1576             '        builder aspectAt:#' , specSelector, ' put:(list := self class ', specSelector, ').\' ,
  1577             '    ].\' ,
  1578             '    ^ list\' ,
  1579             '!! !!\\'.
  1580 
  1581     (ReadStream on:(code withCRs)) fileIn
  1582 
  1583 
  1584 !
  1585 
  1586 doMoveTabUpOrDown:what
  1587     "step up or down
  1588     "
  1589     |tab idx sz|
  1590 
  1591     (listOfTabs size > 1 and:[(idx := self selection) ~~ 0]) ifFalse:[
  1592         ^ self
  1593     ].
  1594 
  1595     (tab := listOfTabs at:idx ifAbsent:nil) isNil ifTrue:[
  1596         ^ self selection:0
  1597     ].
  1598 
  1599     self setSelection:0.
  1600     listOfTabs removeIndex:idx.
  1601 
  1602     sz := listOfTabs size.
  1603 
  1604     what == #down ifTrue:[
  1605         idx := idx > sz ifTrue:[1] ifFalse:[idx + 1]
  1606     ] ifFalse:[
  1607         idx := idx == 1 ifTrue:[sz + 1] ifFalse:[idx - 1]
  1608     ].
  1609 
  1610     listOfTabs add:tab beforeIndex:idx.
  1611     self setSelection:idx.
  1612     self setModified.
  1613 !
  1614 
  1615 doPaste
  1616     "paste a tab
  1617     "
  1618     |tab|
  1619 
  1620     ((tab := self class clipboard) notNil and:[tab isKindOf:TabItem]) ifTrue:[
  1621         self addTab:(tab deepCopy).
  1622     ]
  1623 !
  1624 
  1625 doSave
  1626     "generate code for class and instance"
  1627 
  1628     |cls code spec category mthd list|
  1629 
  1630     (specClass notNil and:[specSelector notNil])
  1631     ifFalse:
  1632     [
  1633         ^self doSaveAs
  1634     ].
  1635 
  1636     cls := self resolveName: specClass.
  1637 
  1638     listOfTabs isEmpty ifTrue:[^self information:'No tab list defined!!'].
  1639 
  1640     spec  := WriteStream on:String new.
  1641     list := Array new:(listOfTabs size).
  1642     listOfTabs keysAndValuesDo:[:i :el|list at:i put:(el literalArrayEncoding)].
  1643 
  1644     UISpecification prettyPrintSpecArray:list on:spec indent:5.
  1645     spec := spec contents.
  1646 
  1647     "/ if that method already exists, do not overwrite the category
  1648 
  1649     category := 'list specs'.
  1650 
  1651     (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[
  1652         category := mthd category.
  1653     ].
  1654 
  1655     code := Character excla asString 
  1656             , cls name , ' class methodsFor:' , category storeString
  1657             , Character excla asString , '\\'
  1658 
  1659             , specSelector , '\'
  1660             , (self class codeGenerationComment replChar:$!! withString:'!!!!')
  1661             , '\\    "\'
  1662             , '     TabListEditor new openOnClass: self andSelector:#' , specSelector , '\'
  1663             , '    "\'.
  1664 
  1665     code := code 
  1666             , '\'
  1667             , '    <resource: #tabList>\\'
  1668             , '    ^' 
  1669             , '     ', spec, '\'
  1670             , '      collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]'
  1671             , '\'
  1672             , Character excla asString
  1673             , ' '
  1674             , Character excla asString
  1675             , '\'.
  1676 
  1677     code := code withCRs.
  1678     (ReadStream on:code) fileIn.
  1679 
  1680     (cls canUnderstand:specSelector) ifFalse:[
  1681         (YesNoBox confirm:(resources string:'Generate aspect method for tabList (#%1)?' with:specSelector)) ifTrue:[
  1682             self doGenerateAspectMethod
  1683         ]
  1684     ].
  1685 
  1686     self addHistoryEntryForClass:cls selector:specSelector.
  1687     self clearModified.
  1688     hasSaved  := true.
  1689 !
  1690 
  1691 openDocumentation
  1692    self openHTMLDocument:'tools/uipainter/TabListEditor.html'.
  1693 ! !
  1694 
  1695 !TabListEditor class methodsFor:'documentation'!
  1696 
  1697 version
  1698     ^ '$Header$'
  1699 !
  1700 
  1701 version_CVS
  1702     ^ '$Header$'
  1703 ! !