UIPainter.st
changeset 152 2261aa2fa21d
parent 149 e652608690b1
child 155 575239b7ad0b
equal deleted inserted replaced
151:8768bf518383 152:2261aa2fa21d
    96     ^ Image fromFile:'b_alignTB.xbm'
    96     ^ Image fromFile:'b_alignTB.xbm'
    97 
    97 
    98 ! !
    98 ! !
    99 
    99 
   100 !UIPainter class methodsFor:'interface specs'!
   100 !UIPainter class methodsFor:'interface specs'!
   101 
       
   102 XXwindowSpec
       
   103     "this window spec was automatically generated by the ST/X UIPainter"
       
   104 
       
   105     "do not manually edit this - the painter/builder may not be able to
       
   106      handle the specification if its corrupted."
       
   107 
       
   108     "
       
   109      UIPainter new openOnClass:UIPainter andSelector:#windowSpec
       
   110      UIPainter new openInterface:#windowSpec
       
   111     "
       
   112     "UIPainter open"
       
   113 
       
   114     <resource: #canvas>
       
   115 
       
   116     ^
       
   117      
       
   118        #(#FullSpec
       
   119           #'window:' 
       
   120            #(#WindowSpec
       
   121               #'name:' 'uIPainterView'
       
   122               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   123               #'label:' 'Tree-View'
       
   124               #'bounds:' #(#Rectangle 0 0 478 429)
       
   125           )
       
   126           #'component:' 
       
   127            #(#SpecCollection
       
   128               #'collection:' 
       
   129                #(
       
   130                  #(#MenuPanelSpec
       
   131                     #'name:' 'menuPullDown'
       
   132                     #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 24 0)
       
   133                     #'tabable:' true
       
   134                     #'menu:' #menuPullDown
       
   135                 )
       
   136                  #(#MenuPanelSpec
       
   137                     #'name:' 'menuAlignment'
       
   138                     #'layout:' #(#LayoutFrame 0 0.0 29 0 233 0 54 0)
       
   139                     #'tabable:' true
       
   140                     #'menu:' #menuAlignment
       
   141                     #'showSeparatingLines:' true
       
   142                 )
       
   143                  #(#PanelViewSpec
       
   144                     #'name:' 'panelViewButtons'
       
   145                     #'layout:' #(#LayoutFrame -125 1.0 25 0.0 0 1.0 57 0.0)
       
   146                     #'component:' 
       
   147                      #(#SpecCollection
       
   148                         #'collection:' 
       
   149                          #(
       
   150                            #(#ActionButtonSpec
       
   151                               #'name:' 'moveLeft'
       
   152                               #'label:' ''
       
   153                               #'translateLabel:' true
       
   154                               #'labelChannel:' #'LABELb_moveLeft.xbm'
       
   155                               #'tabable:' true
       
   156                               #'defaultable:' true
       
   157                               #'model:' #moveSelectionLeft
       
   158                               #'isTriggerOnDown:' true
       
   159                               #'enableChannel:' #enableChannel
       
   160                               #'autoRepeat:' false
       
   161                               #'extent:' #(#Point 26 24)
       
   162                           )
       
   163                            #(#ActionButtonSpec
       
   164                               #'name:' 'moveRight'
       
   165                               #'label:' ''
       
   166                               #'translateLabel:' true
       
   167                               #'labelChannel:' #'LABELb_moveRight.xbm'
       
   168                               #'tabable:' true
       
   169                               #'defaultable:' true
       
   170                               #'model:' #moveSelectionRight
       
   171                               #'isTriggerOnDown:' true
       
   172                               #'enableChannel:' #enableChannel
       
   173                               #'autoRepeat:' false
       
   174                               #'extent:' #(#Point 26 24)
       
   175                           )
       
   176                            #(#ActionButtonSpec
       
   177                               #'name:' 'moveUp'
       
   178                               #'label:' ''
       
   179                               #'translateLabel:' true
       
   180                               #'labelChannel:' #'LABELb_moveUp.xbm'
       
   181                               #'tabable:' true
       
   182                               #'defaultable:' true
       
   183                               #'model:' #moveSelectionUp
       
   184                               #'isTriggerOnDown:' true
       
   185                               #'enableChannel:' #enableChannel
       
   186                               #'autoRepeat:' false
       
   187                               #'extent:' #(#Point 26 24)
       
   188                           )
       
   189                            #(#ActionButtonSpec
       
   190                               #'name:' 'moveDown'
       
   191                               #'label:' ''
       
   192                               #'translateLabel:' true
       
   193                               #'labelChannel:' #'LABELb_moveDown.xbm'
       
   194                               #'tabable:' true
       
   195                               #'defaultable:' true
       
   196                               #'model:' #moveSelectionDown
       
   197                               #'isTriggerOnDown:' true
       
   198                               #'enableChannel:' #enableChannel
       
   199                               #'autoRepeat:' false
       
   200                               #'extent:' #(#Point 26 24)
       
   201                           )
       
   202                         )
       
   203                     )
       
   204                     #'level:' 1
       
   205                     #'horizontalLayout:' #fitSpace
       
   206                     #'verticalLayout:' #fitSpace
       
   207                     #'horizontalSpace:' 4
       
   208                     #'verticalSpace:' 4
       
   209                 )
       
   210                  #(#SequenceViewSpec
       
   211                     #'name:' 'objectTree'
       
   212                     #'layout:' #(#LayoutFrame 0 0.0 59 0.0 0 0.35 0 1.0)
       
   213                     #'enableChannel:' #enableChannel
       
   214                     #'tabable:' true
       
   215                     #'menu:' #objectListMenu
       
   216                     #'model:' #objectList
       
   217                     #'hasHorizontalScrollBar:' true
       
   218                     #'hasVerticalScrollBar:' true
       
   219                     #'miniScrollerHorizontal:' true
       
   220                     #'isMultiSelect:' true
       
   221                     #'doubleClickSelector:' #doubleClick
       
   222                     #'useIndex:' true
       
   223                 )
       
   224                  #(#NoteBookViewSpec
       
   225                     #'name:' 'noteBook'
       
   226                     #'layout:' #(#LayoutFrame 0 0.35 59 0.0 0 1.0 -30 1.0)
       
   227                     #'enableChannel:' #enableChannel
       
   228                     #'tabable:' true
       
   229                     #'menu:' #tabList
       
   230                     #'style:' 
       
   231                      #(#FontDescription
       
   232                         #helvetica #medium
       
   233                         #roman #'10'
       
   234                     )
       
   235                     #'model:' #tabModel
       
   236                     #'tabWidget:' #Window
       
   237                     #'canvas:' #noteBookView
       
   238                 )
       
   239                  #(#HorizontalPanelViewSpec
       
   240                     #'name:' 'modifyPanel'
       
   241                     #'layout:' #(#LayoutFrame 0 0.35 -30 1.0 0 1.0 0 1.0)
       
   242                     #'component:' 
       
   243                      #(#SpecCollection
       
   244                         #'collection:' 
       
   245                          #(
       
   246                            #(#ActionButtonSpec
       
   247                               #'name:' 'cancelButton'
       
   248                               #'label:' 'cancel'
       
   249                               #'tabable:' true
       
   250                               #'model:' #cancel
       
   251                               #'isTriggerOnDown:' false
       
   252                               #'enableChannel:' #modifiedChannel
       
   253                               #'autoRepeat:' false
       
   254                               #'extent:' #(#Point 151 24)
       
   255                           )
       
   256                            #(#ActionButtonSpec
       
   257                               #'name:' 'acceptButton'
       
   258                               #'label:' 'ok'
       
   259                               #'tabable:' true
       
   260                               #'model:' #accept
       
   261                               #'isTriggerOnDown:' false
       
   262                               #'enableChannel:' #modifiedChannel
       
   263                               #'autoRepeat:' false
       
   264                               #'extent:' #(#Point 151 24)
       
   265                           )
       
   266                         )
       
   267                     )
       
   268                     #'level:' 0
       
   269                     #'horizontalLayout:' #fitSpace
       
   270                     #'verticalLayout:' #fitSpace
       
   271                     #'horizontalSpace:' 3
       
   272                     #'verticalSpace:' 3
       
   273                 )
       
   274               )
       
   275           )
       
   276       )
       
   277 !
       
   278 
   101 
   279 menuAlignment
   102 menuAlignment
   280     ^ #(#Menu #(
   103     ^ #(#Menu #(
   281                 #(#MenuItem
   104                 #(#MenuItem
   282                         #'label:' 'align left'
   105                         #'label:' 'align left'
   419                                  #(#MenuItem
   242                                  #(#MenuItem
   420                                         #'label:' 'install spec'
   243                                         #'label:' 'install spec'
   421                                         #'value:' #doInstallSpec
   244                                         #'value:' #doInstallSpec
   422                                   )
   245                                   )
   423                                  #(#MenuItem
   246                                  #(#MenuItem
       
   247                                         #'label:' 'install help spec'
       
   248                                         #'value:' #doInstallHelp
       
   249                                   )
       
   250                                  #(#MenuItem
   424                                         #'label:' 'install aspects'
   251                                         #'label:' 'install aspects'
   425                                         #'value:' #doInstallAspects
   252                                         #'value:' #doInstallAspects
   426                                   )
   253                                   )
   427                                  #(#MenuItem
   254                                  #(#MenuItem
   428                                         #'label:' 'windowSpec'
   255                                         #'label:' 'windowSpec'
   435                                 #(#MenuItem
   262                                 #(#MenuItem
   436                                         #'label:' 'start application'
   263                                         #'label:' 'start application'
   437                                         #'value:' #doStartApplication
   264                                         #'value:' #doStartApplication
   438                                  )
   265                                  )
   439                                 )
   266                                 )
   440                                 #( 1 2 1)
   267                                 #( 1 3 1)
   441                                 nil
   268                                 nil
   442                           )
   269                           )
   443          )
   270          )
   444         #(#MenuItem
   271         #(#MenuItem
   445                 #'label:' 'test'
   272                 #'label:' 'test'
   771 !UIPainter methodsFor:'active help'!
   598 !UIPainter methodsFor:'active help'!
   772 
   599 
   773 activeHelpTool
   600 activeHelpTool
   774     "automatically generated by UIPainter ..."
   601     "automatically generated by UIPainter ..."
   775 
   602 
       
   603     |cls|
       
   604 
   776     activeHelpTool isNil ifTrue:[
   605     activeHelpTool isNil ifTrue:[
   777         activeHelpTool := UIHelpTool new
   606         activeHelpTool := UIHelpTool new.
       
   607 
       
   608         specClass notNil ifTrue:[
       
   609             specClass isBehavior ifFalse:[
       
   610                 cls := Smalltalk at:specClass asSymbol
       
   611             ] ifTrue:[
       
   612                 cls := specClass
       
   613             ].
       
   614 
       
   615             (cls respondsTo:#helpSpec) ifTrue:[
       
   616                 activeHelpTool dictionary:(cls helpSpec).
       
   617            ]
       
   618         ].
   778     ].
   619     ].
   779     ^ activeHelpTool
   620     ^ activeHelpTool
   780 !
   621 !
   781 
   622 
   782 showHelp:aHelpText for:view
   623 showHelp:aHelpText for:view
   787      bubble with the help text."
   628      bubble with the help text."
   788 
   629 
   789     |l|
   630     |l|
   790 
   631 
   791     (l := self builder componentAt:#helpInfo) notNil ifTrue:[
   632     (l := self builder componentAt:#helpInfo) notNil ifTrue:[
       
   633         aHelpText replaceAll:(Character cr) by:(Character space).
   792         l label:aHelpText.
   634         l label:aHelpText.
   793         ^ true.
   635       ^ true.
   794     ].
   636     ].
   795     ^ false
   637     ^ false
   796 
   638 
   797 
   639 
   798 ! !
   640 ! !
   851     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
   693     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
   852         noteBook   := View origin:0.0 @0.0 corner:1.0@1.0.
   694         noteBook   := View origin:0.0 @0.0 corner:1.0@1.0.
   853         layoutTool := UIPropertyView for:#Dimension     in:noteBook.
   695         layoutTool := UIPropertyView for:#Dimension     in:noteBook.
   854         specView   := UIPropertyView for:#Specification in:noteBook.
   696         specView   := UIPropertyView for:#Specification in:noteBook.
   855         channel    := self modifiedChannel.
   697         channel    := self modifiedChannel.
       
   698         layoutTool masterApplication:self.
       
   699         specView   masterApplication:self.
   856         layoutTool modifiedHolder:channel.
   700         layoutTool modifiedHolder:channel.
   857         specView   modifiedHolder:channel.
   701         specView   modifiedHolder:channel.
   858         builder aspectAt:#noteBookView put:noteBook.
   702         builder aspectAt:#noteBookView put:noteBook.
   859     ].
   703     ].
   860     ^ noteBook
   704     ^ noteBook
  1354     code := self painter generateAspectMethods.
  1198     code := self painter generateAspectMethods.
  1355     (ReadStream on:code) fileIn.
  1199     (ReadStream on:code) fileIn.
  1356 
  1200 
  1357 !
  1201 !
  1358 
  1202 
       
  1203 doInstallHelp
       
  1204     |dict cls src|
       
  1205 
       
  1206     specClass isNil ifTrue:[
       
  1207         ^ self information:'no class defined'
       
  1208     ].
       
  1209     specClass isBehavior ifFalse:[
       
  1210         cls := Smalltalk at:specClass asSymbol
       
  1211     ] ifTrue:[
       
  1212         cls := specClass
       
  1213     ].
       
  1214 
       
  1215     cls isNil ifTrue:[
       
  1216         ^ self information:'no class yet'.
       
  1217     ].
       
  1218 
       
  1219     activeHelpTool isNil ifTrue:[
       
  1220         ^ self information:'no help text defined'
       
  1221     ].    
       
  1222     dict := activeHelpTool dictionary.
       
  1223 
       
  1224     src := '' writeStream.
       
  1225     src nextPutAll:'helpSpec
       
  1226     "return a dictionary filled with helpKey -> helptext associations.
       
  1227      These are used by the activeHelp tool."
       
  1228 
       
  1229     |dict|
       
  1230 
       
  1231     dict := super helpSpec.
       
  1232 '.
       
  1233 
       
  1234     dict keysAndValuesDo:[:key :txt |
       
  1235         |t|
       
  1236 
       
  1237         t := txt asString.
       
  1238         (t endsWith:Character cr) ifTrue:[t := t copyWithoutLast:1].
       
  1239         src nextPutLine:'    dict at:' , key storeString , ' put:' , t storeString , '.'.
       
  1240     ].
       
  1241     src nextPutLine:'    ^ dict'.
       
  1242     src := src contents.
       
  1243     Compiler compile:src forClass:cls class inCategory:'help specs'
       
  1244 !
       
  1245 
  1359 doInstallSpec
  1246 doInstallSpec
  1360     |code|
  1247     |code|
  1361 
  1248 
  1362     (specClass isNil or:[specSelector isNil]) ifTrue:[
  1249     (specClass isNil or:[specSelector isNil]) ifTrue:[
  1363         self defineClassAndSelector
  1250         self defineClassAndSelector