TabItemEditor.st
changeset 526 7a4749b25748
parent 514 5ac07e96e448
child 530 badaac1d45e7
equal deleted inserted replaced
525:3c59244da8c8 526:7a4749b25748
    76     ^
    76     ^
    77      
    77      
    78        #(#FullSpec
    78        #(#FullSpec
    79           #'window:' 
    79           #'window:' 
    80            #(#WindowSpec
    80            #(#WindowSpec
    81               #'name:' 'Class & Selector'
    81               #'name:' 'Tab Item Editor'
    82               #'layout:' #(#LayoutFrame 219 0 193 0 584 0 319 0)
    82               #'layout:' #(#LayoutFrame 419 0 371 0 784 0 497 0)
    83               #'label:' 'Class & Selector'
    83               #'label:' 'Tab Item Editor'
    84               #'min:' #(#Point 10 10)
    84               #'min:' #(#Point 10 10)
    85               #'max:' #(#Point 1152 900)
    85               #'max:' #(#Point 1152 900)
    86               #'bounds:' #(#Rectangle 219 193 585 320)
    86               #'bounds:' #(#Rectangle 419 371 785 498)
    87               #'usePreferredExtent:' false
    87               #'usePreferredExtent:' false
    88           )
    88           )
    89           #'component:' 
    89           #'component:' 
    90            #(#SpecCollection
    90            #(#SpecCollection
    91               #'collection:' 
    91               #'collection:' 
    92                #(
    92                #(
    93                  #(#LabelSpec
    93                  #(#LabelSpec
    94                     #'name:' 'DefineClassAndSelector'
    94                     #'name:' 'DefineClassAndSelector'
    95                     #'layout:' #(#Point 2 10)
    95                     #'layout:' #(#Point 2 10)
    96                     #'label:' 'Define Class And Selector'
    96                     #'label:' 'Define class and selector:'
    97                     #'adjust:' #left
    97                     #'adjust:' #left
    98                     #'resizeForLabel:' true
    98                     #'resizeForLabel:' true
    99                 )
    99                 )
   100                  #(#LabelSpec
   100                  #(#LabelSpec
   101                     #'name:' 'ClassLabel'
   101                     #'name:' 'ClassLabel'
   226      
   226      
   227        #(#FullSpec
   227        #(#FullSpec
   228           #'window:' 
   228           #'window:' 
   229            #(#WindowSpec
   229            #(#WindowSpec
   230               #'name:' 'TabItem Editor'
   230               #'name:' 'TabItem Editor'
   231               #'layout:' #(#LayoutFrame 219 0 193 0 687 0 521 0)
   231               #'layout:' #(#LayoutFrame 512 0 124 0 980 0 452 0)
   232               #'label:' 'TabItem Editor'
   232               #'label:' 'TabItem Editor'
   233               #'min:' #(#Point 10 10)
   233               #'min:' #(#Point 10 10)
   234               #'max:' #(#Point 1152 900)
   234               #'max:' #(#Point 1152 900)
   235               #'bounds:' #(#Rectangle 219 193 688 522)
   235               #'bounds:' #(#Rectangle 512 124 981 453)
   236               #'menu:' #menu
   236               #'menu:' #menu
   237               #'usePreferredExtent:' false
   237               #'usePreferredExtent:' false
   238           )
   238           )
   239           #'component:' 
   239           #'component:' 
   240            #(#SpecCollection
   240            #(#SpecCollection
   242                #(
   242                #(
   243                  #(#MenuPanelSpec
   243                  #(#MenuPanelSpec
   244                     #'name:' 'menuToolbarView'
   244                     #'name:' 'menuToolbarView'
   245                     #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 34 0)
   245                     #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 34 0)
   246                     #'menu:' #menuToolbar
   246                     #'menu:' #menuToolbar
       
   247                     #'showSeparatingLines:' true
   247                 )
   248                 )
   248                  #(#VariableHorizontalPanelSpec
   249                  #(#VariableHorizontalPanelSpec
   249                     #'name:' 'VariablePanel'
   250                     #'name:' 'VariablePanel'
   250                     #'layout:' #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -22 1.0)
   251                     #'layout:' #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -22 1.0)
   251                     #'component:' 
   252                     #'component:' 
   305                                                #(#ActionButtonSpec
   306                                                #(#ActionButtonSpec
   306                                                   #'name:' 'acceptButton'
   307                                                   #'name:' 'acceptButton'
   307                                                   #'label:' 'OK'
   308                                                   #'label:' 'OK'
   308                                                   #'model:' #accept
   309                                                   #'model:' #accept
   309                                                   #'enableChannel:' #modifiedChannel
   310                                                   #'enableChannel:' #modifiedChannel
   310                                                   #'extent:' #(#Point 168 24)
   311                                                   #'extent:' #(#Point 169 24)
   311                                               )
   312                                               )
   312                                             )
   313                                             )
   313                                         )
   314                                         )
   314                                         #'horizontalLayout:' #fitSpace
   315                                         #'horizontalLayout:' #fitSpace
   315                                         #'verticalLayout:' #fitSpace
   316                                         #'verticalLayout:' #fitSpace
   341               )
   342               )
   342           )
   343           )
   343       )
   344       )
   344 ! !
   345 ! !
   345 
   346 
   346 !TabItemEditor class methodsFor:'menus'!
   347 !TabItemEditor class methodsFor:'menu specs'!
   347 
   348 
   348 menu
   349 menu
   349     "this window spec was automatically generated by the ST/X MenuEditor"
   350     "this window spec was automatically generated by the ST/X MenuEditor"
   350 
   351 
   351     "do not manually edit this - the builder may not be able to
   352     "do not manually edit this - the builder may not be able to
   361     ^
   362     ^
   362      
   363      
   363        #(#Menu
   364        #(#Menu
   364           
   365           
   365            #(
   366            #(
       
   367              #(#MenuItem
       
   368                 #'label:' 'About'
       
   369                 #'labelImage:' #(#ResourceRetriever nil #icon)
       
   370                 #'submenuChannel:' #menuAbout
       
   371             )
   366              #(#MenuItem
   372              #(#MenuItem
   367                 #'label:' 'File'
   373                 #'label:' 'File'
   368                 #'submenu:' 
   374                 #'submenu:' 
   369                  #(#Menu
   375                  #(#Menu
   370                     
   376                     
   371                      #(
   377                      #(
   372                        #(#MenuItem
   378                        #(#MenuItem
   373                           #'label:' 'New'
   379                           #'label:' 'New'
   374                           #'value:' #doNew
   380                           #'value:' #doNew
   375                           #'labelImage:' #(#ResourceRetriever nil #newIcon 'New')
       
   376                       )
   381                       )
   377                        #(#MenuItem
   382                        #(#MenuItem
   378                           #'label:' '-'
   383                           #'label:' '-'
   379                       )
   384                       )
   380                        #(#MenuItem
   385                        #(#MenuItem
   387                       )
   392                       )
   388                        #(#MenuItem
   393                        #(#MenuItem
   389                           #'label:' 'Save'
   394                           #'label:' 'Save'
   390                           #'value:' #doInstallSpec
   395                           #'value:' #doInstallSpec
   391                           #'enabled:' #isNotModified
   396                           #'enabled:' #isNotModified
   392                           #'labelImage:' #(#ResourceRetriever nil #saveIcon 'Save')
       
   393                       )
   397                       )
   394                        #(#MenuItem
   398                        #(#MenuItem
   395                           #'label:' '='
   399                           #'label:' '-'
   396                       )
   400                       )
   397                        #(#MenuItem
   401                        #(#MenuItem
   398                           #'label:' 'Define Class And Selector...'
   402                           #'label:' 'Define Class And Selector...'
   399                           #'value:' #doDefineClassAndSelector
   403                           #'value:' #doDefineClassAndSelector
   400                       )
       
   401                        #(#MenuItem
       
   402                           #'label:' '-'
       
   403                       )
   404                       )
   404                        #(#MenuItem
   405                        #(#MenuItem
   405                           #'label:' 'Create Aspect Method'
   406                           #'label:' 'Create Aspect Method'
   406                           #'value:' #doInstallAspect
   407                           #'value:' #doInstallAspect
   407                           #'enabled:' #hasClassAndSelector
   408                           #'enabled:' #hasClassAndSelector
   408                       )
   409                       )
   409                        #(#MenuItem
   410                        #(#MenuItem
   410                           #'label:' '='
   411                           #'label:' '-'
   411                       )
   412                       )
   412                        #(#MenuItem
   413                        #(#MenuItem
   413                           #'label:' 'Exit'
   414                           #'label:' 'Exit'
   414                           #'value:' #closeRequest
   415                           #'value:' #closeRequest
   415                           #'enabled:' #isNotModified
   416                           #'enabled:' #isNotModified
   421              #(#MenuItem
   422              #(#MenuItem
   422                 #'label:' 'Edit'
   423                 #'label:' 'Edit'
   423                 #'submenuChannel:' #menuEdit
   424                 #'submenuChannel:' #menuEdit
   424             )
   425             )
   425              #(#MenuItem
   426              #(#MenuItem
       
   427                 #'label:' 'Add'
       
   428                 #'submenu:' 
       
   429                  #(#Menu
       
   430                     
       
   431                      #(
       
   432                        #(#MenuItem
       
   433                           #'label:' 'Tab Item'
       
   434                           #'labelImage:' #(#ResourceRetriever nil #newLabelIcon 'Tab Item')
       
   435                       )
       
   436                     ) nil
       
   437                     nil
       
   438                 )
       
   439             )
       
   440              #(#MenuItem
   426                 #'label:' 'History'
   441                 #'label:' 'History'
   427                 #'submenuChannel:' #menuHistory
   442                 #'submenuChannel:' #menuHistory
   428             )
   443             )
   429              #(#MenuItem
   444              #(#MenuItem
   430                 #'label:' 'Help'
   445                 #'label:' 'Help'
   470             )
   485             )
   471              #(#MenuItem
   486              #(#MenuItem
   472                 #'label:' '-'
   487                 #'label:' '-'
   473             )
   488             )
   474              #(#MenuItem
   489              #(#MenuItem
   475                 #'label:' 'Create Tab'
   490                 #'label:' 'Move Up'
   476                 #'value:' #doCreateTab
   491                 #'value:' #'doMoveTabUpOrDown:'
   477                 #'enabled:' #isNotModified
   492                 #'enabled:' #canMoveTabUpOrDown
   478                 #'labelImage:' #(#ResourceRetriever #MenuEditor #menuItemImage 'Create Tab')
   493                 #'argument:' #up
       
   494                 #'labelImage:' #(#ResourceRetriever #ToolApplicationModel #upIcon 'Move Up')
       
   495             )
       
   496              #(#MenuItem
       
   497                 #'label:' 'Move Down'
       
   498                 #'value:' #'doMoveTabUpOrDown:'
       
   499                 #'enabled:' #canMoveTabUpOrDown
       
   500                 #'argument:' #down
       
   501                 #'labelImage:' #(#ResourceRetriever #ToolApplicationModel #downIcon 'Move Down')
   479             )
   502             )
   480           ) nil
   503           ) nil
   481           nil
   504           nil
   482       )
   505       )
   483 !
   506 !
   557 ! !
   580 ! !
   558 
   581 
   559 !TabItemEditor class methodsFor:'resources'!
   582 !TabItemEditor class methodsFor:'resources'!
   560 
   583 
   561 newLabelIcon
   584 newLabelIcon
   562     "ImageEditor openOnClass:self andSelector:#newLabelIcon"
   585     "Generated by the Image Editor"
       
   586     "
       
   587     ImageEditor openOnClass:self andSelector:#newLabelIcon
       
   588     "
   563 
   589 
   564     <resource: #image>
   590     <resource: #image>
   565     ^(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[17 17 16 0 0 0 0 0 0 17 17 17 17 16 17 17 17 17 17 32 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 18 32 2 32 34 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 32 2 32 34 48 17 17 16 17 16 18 34 34 34 34 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 0 2 0 2 48 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 18 2 2 2 2 48 17 17 17 17 16 18 0 2 0 2 48 17 17 17 17 16 18 2 2 0 2 48 17 17 17 17 16 18 2 2 2 2 48 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 35 51 51 51 51 48 17 17 17 17 16 0 0 0 0 0 0 17 17]) ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color grey:66.9978); add:(Color grey:49.9962); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9992 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9992 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9992); add:(Color red:0.0 green:49.9992 blue:49.9992); add:(Color red:49.9992 green:49.9992 blue:0.0); add:(Color red:49.9992 green:0.0 blue:49.9992); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[7 255 192 7 255 192 7 255 192 7 255 192 7 255 192 7 255 192 7 255 192 7 255 192 7 255 195 7 255 192 7 255 192 7 255 192 7 255 192 7 255 195 7 255 193 7 255 192 7 255 195 7 255 192 7 255 195 7 255 192 7 255 192 7 255 193]) ; yourself); yourself
   591 
   566 
   592     ^Icon
   567 
   593         constantNamed:#'TabItemEditor newLabelIcon'
   568 ! !
   594         ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDP@@@@@@@@DQDQDQ@QDQDQDR@QDQDQDAH"H"H"LADQDQDPD"@BHBH0DQDQDQ@R@"HB@#@QDQDQDAHBH HBLADQDQDPD"@BHBH0DQDPDQ@RH"H"H#@QDQDQDAHBH HBLADQDQDPD H"@ H0DQDQDQ@R@"HB@#@QDQDQDAH@@ @BLADQDQDPD"H"H"H0DQDQDQ@RH"H"H#@QDQDQDAHB@ HBLADQDQDPD @B@@H0DQDQDQ@R@ H@@#@QDQDQDAHB@ HBLADQDQDPD"H"H"H0DQDQDQ@RH"H"H#@QDQDQDBL3L3L3LADQDQDP@@@@@@@@DQDb'); colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color grey:66.9978); add:(Color grey:49.9962); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9977 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9977 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9977); add:(Color red:0.0 green:49.9977 blue:49.9977); add:(Color red:49.9977 green:49.9977 blue:0.0); add:(Color red:49.9977 green:0.0 blue:49.9977); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A??@A??@A??@A??@A??@A??@A??@A??@A??CA??@A??@A??@A??@A??CA??AA??@A??CA??@A??CA??@A??@A??A'); yourself); yourself]! !
   569 
   595 
   570 !TabItemEditor methodsFor:'accessing'!
   596 !TabItemEditor methodsFor:'accessing'!
   571 
   597 
   572 className
   598 className
   573     ^ className
   599     ^ className
   835 !TabItemEditor methodsFor:'startup / release'!
   861 !TabItemEditor methodsFor:'startup / release'!
   836 
   862 
   837 closeRequest
   863 closeRequest
   838 
   864 
   839     hasChanged ifTrue:[
   865     hasChanged ifTrue:[
   840         ( YesNoBox title:'tab description was modified!!'
   866         ( YesNoBox title:'Tab spec was modified!!'
   841                  yesText:'waste it and proceed'
   867                  yesText:'Waste it and proceed'
   842                   noText:'cancel'
   868                   noText:'Cancel'
   843         ) confirm ifFalse:[
   869         ) confirm ifFalse:[
   844             ^ self
   870             ^ self
   845         ].
   871         ].
   846         hasChanged := false.
   872         hasChanged := false.
   847     ].
   873     ].
  1057             , '     TabItemEditor new openOnClass:' , className name , ' andSelector:#' , selector , '\'
  1083             , '     TabItemEditor new openOnClass:' , className name , ' andSelector:#' , selector , '\'
  1058             , '    "\'.
  1084             , '    "\'.
  1059 
  1085 
  1060     code := code 
  1086     code := code 
  1061             , '\'
  1087             , '\'
  1062             , '    <resource: #tabItem>\\'
  1088             , '    <resource: #tabList>\\'
  1063             , '    ^\' 
  1089             , '    ^\' 
  1064             , '     ', spec, '\'
  1090             , '     ', spec, '\'
  1065             , '      collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]'
  1091             , '      collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]'
  1066             , '\'
  1092             , '\'
  1067             , Character excla asString
  1093             , Character excla asString
  1070             , '\\'.
  1096             , '\\'.
  1071 
  1097 
  1072     code := code withCRs.
  1098     code := code withCRs.
  1073     (ReadStream on:code) fileIn.
  1099     (ReadStream on:code) fileIn.
  1074     hasChanged := false.
  1100     hasChanged := false.
       
  1101     self addToHistory:(className name, ' ', selector) -> #loadFromMessage:.
  1075 
  1102 
  1076     (className canUnderstand:selector) ifFalse:[
  1103     (className canUnderstand:selector) ifFalse:[
  1077         (YesNoBox confirm:'install aspect method') ifTrue:[
  1104         (YesNoBox confirm:'install aspect method') ifTrue:[
  1078             self doInstallAspect
  1105             self doInstallAspect
  1079         ]
  1106         ]