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