UIPainter.st
changeset 287 1ecabfd468dc
parent 282 bb88d92ae887
child 295 114befd1c369
equal deleted inserted replaced
286:23712b1d3f3d 287:1ecabfd468dc
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 
    13 
    14 ApplicationModel subclass:#UIPainter
    14 ApplicationModel subclass:#UIPainter
    15 	instanceVariableNames:'activeHelpTool layoutTool specTool treeView selectionPanel
    15 	instanceVariableNames:'treeView selectionPanel tabSelection specClass specSelector
    16 		tabSelection specClass specSelector specSuperclass aspects'
    16 		specSuperclass aspects layoutCanvas helpCanvas specCanvas'
    17 	classVariableNames:'IconStepUp IconStepOut IconStepIn IconStepDown'
    17 	classVariableNames:'IconStepUp IconStepOut IconStepIn IconStepDown'
    18 	poolDictionaries:''
    18 	poolDictionaries:''
    19 	category:'Interface-UIPainter'
    19 	category:'Interface-UIPainter'
    20 !
    20 !
    21 
    21 
   104     "return a dictionary filled with helpKey -> helptext associations.
   104     "return a dictionary filled with helpKey -> helptext associations.
   105      These are used by the activeHelp tool.
   105      These are used by the activeHelp tool.
   106     "
   106     "
   107   ^ super helpSpec addPairsFrom:#(
   107   ^ super helpSpec addPairsFrom:#(
   108 
   108 
   109 #alignSelectionCenterVer
   109 #moveSelectionLeft
   110 'align selected widgets vertical'
   110 'move selected widgets left while pressing the button'
   111 
   111 
   112 #alignSelectionLeft
   112 #setToDefaultWidth
   113 'align selected widgets to the left edge of the dominant widget ( underlined )'
   113 'set selected widgets to their default width'
   114 
   114 
   115 #alignSelectionRight
   115 #pasteBuffer
   116 'align selected widgets to the right edge of the dominant widget ( underlined )'
   116 'paste widgets at current mouse position'
   117 
   117 
   118 #alignSelectionLeftAndRight
   118 #galleryShown
   119 'align selected widgets to the right and left edge of the dominant widget ( underlined )'
   119 'show or hide gallery view'
   120 
   120 
   121 #alignSelectionTop
   121 #moveSelectionDown
   122 'align selected widgets to the top edge of the dominant widget ( underlined )'
   122 'move selected widgets down while pressing the button'
   123 
   123 
   124 #alignSelectionBottom
   124 #moveSelectionUp
   125 'align selected widgets to the bottom edge of the dominant widget ( underlined )'
   125 'move selected widgets up while pressing the button'
   126 
       
   127 #alignSelectionTopAndBottom
       
   128 'align selected widgets to the top and bottom edge of the dominant widget ( underlined )'
       
   129 
       
   130 #alignSelectionCenterVer
       
   131 'align selected widgets horizontal to the center of the dominant widget ( underlined )'
       
   132 
       
   133 #alignSelectionCenterHor
       
   134 'align selected widgets vertical to the center of the dominant widget ( underlined )'
       
   135 
   126 
   136 #spreadSelectionVer
   127 #spreadSelectionVer
   137 'vertical spacing between selected widgets is made the same'
   128 'vertical spacing between selected widgets is made the same'
   138 
   129 
       
   130 #menuChangeHierarchy
       
   131 'change hierarchy of the selected widget'
       
   132 
       
   133 #copyExtent
       
   134 'copy extent of the selected widget'
       
   135 
       
   136 #moveSelectionRight
       
   137 'move selected widgets right while pressing the button'
       
   138 
       
   139 #cancel
       
   140 'reread specification and layout'
       
   141 
       
   142 #pasteWithLayout
       
   143 'paste widgets without changing their layouts'
       
   144 
       
   145 #alignSelectionRight
       
   146 'align selected widgets to the right edge of the dominant widget'
       
   147 
       
   148 #alignSelectionLeftAndRight
       
   149 'align selected widgets to the right and left edge of the dominant widget'
       
   150 
       
   151 #pasteWidth
       
   152 'change width of all selected widgets to the last copied extent width'
       
   153 
       
   154 #alignSelectionTopAndBottom
       
   155 'align selected widgets to the top and bottom edge of the dominant widget'
       
   156 
       
   157 #copyLayout
       
   158 'copy layout of the selected widget'
       
   159 
       
   160 #painterShown
       
   161 'show or hide painter view'
       
   162 
       
   163 #pasteExtent
       
   164 'change extent of all selected widgets to the last copied extent'
       
   165 
       
   166 #pasteHeight
       
   167 'change height of all selected widgets to the last copied extent height'
       
   168 
       
   169 #accept
       
   170 'write back changes'
       
   171 
       
   172 #centerSelectionVer
       
   173 'center vertical horizontal in contained view'
       
   174 
       
   175 #centerSelectionHor
       
   176 'center widgets horizontal to their top widget'
       
   177 
       
   178 #menuAlignment
       
   179 'provides a set of alignment operation on the current selected widgets'
       
   180 
       
   181 #alignSelectionCenterVer
       
   182 'align selected widgets horizontal to the center of the dominant widget'
       
   183 
       
   184 #pasteLayout
       
   185 'change layout of all selected widgets to the last copied layout'
       
   186 
       
   187 #alignSelectionLeft
       
   188 'align selected widgets to the left edge of the dominant widget'
       
   189 
   139 #spreadSelectionHor
   190 #spreadSelectionHor
   140 'horizontal spacing between selected widgets is made the same'
   191 'horizontal spacing between selected widgets is made the same'
   141 
   192 
   142 #centerSelectionHor
   193 #alignSelectionBottom
   143 'center widgets horizontal to their top widget'
   194 'align selected widgets to the bottom edge of the dominant widget'
   144 
       
   145 #centerSelectionVer
       
   146 'center vertical horizontal in contained view'
       
   147 
   195 
   148 #setToDefaultExtent
   196 #setToDefaultExtent
   149 'set selected widgets to their default extent'
   197 'set selected widgets to their default extent'
   150 
   198 
   151 #setToDefaultWidth
   199 #alignSelectionCenterHor
   152 'set selected widgets to their default width'
   200 'align selected widgets vertical to the center of the dominant widget'
       
   201 
       
   202 #alignSelectionTop
       
   203 'align selected widgets to the top edge of the dominant widget'
   153 
   204 
   154 #setToDefaultHeight
   205 #setToDefaultHeight
   155 'set selected widgets to their default height'
   206 'set selected widgets to their default height'
   156 
   207 
   157 #copyExtent
       
   158 'copy extent of the selected widget'
       
   159 
       
   160 #pasteExtent
       
   161 'change extent of all selected widgets to the last copied extent'
       
   162 
       
   163 #pasteWidth
       
   164 'change width of all selected widgets to the last copied extent width'
       
   165 
       
   166 #pasteHeight
       
   167 'change height of all selected widgets to the last copied extent height'
       
   168 
       
   169 #copyLayout
       
   170 'copy layout of the selected widget'
       
   171 
       
   172 #pasteLayout
       
   173 'change layout of all selected widgets to the last copied layout'
       
   174 
       
   175 #pasteBuffer
       
   176 'paste widgets at current mouse position'
       
   177 
       
   178 #pasteWithLayout
       
   179 'paste widgets without changing their layouts'
       
   180 
       
   181 #accept
       
   182 'write back changes'
       
   183 
       
   184 #cancel
       
   185 'reread specification and layout'
       
   186 
       
   187 #galleryShown
       
   188 'show or hide gallery view'
       
   189 
       
   190 #painterShown
       
   191 'show or hide painter view'
       
   192 
       
   193 #moveSelectionLeft
       
   194 'move selected widgets left while pressing the button'
       
   195 
       
   196 #moveSelectionRight
       
   197 'move selected widgets right while pressing the button'
       
   198 
       
   199 #moveSelectionDown
       
   200 'move selected widgets down while pressing the button'
       
   201 
       
   202 #moveSelectionUp
       
   203 'move selected widgets up while pressing the button'
       
   204 
       
   205 #menuChangeHierarchy
       
   206 'change hierarchy of the selected widget'
       
   207 
       
   208 #menuAlignment
       
   209 'provides a set of alignment operation on the current selected widgets'
       
   210 
       
   211 
       
   212 
       
   213 )
   208 )
   214 
       
   215 
       
   216 
       
   217 
       
   218 ! !
   209 ! !
   219 
   210 
   220 !UIPainter class methodsFor:'icons'!
   211 !UIPainter class methodsFor:'icons'!
   221 
   212 
   222 iconAlignB
   213 iconAlignB
   338     ^
   329     ^
   339      
   330      
   340        #(#FullSpec
   331        #(#FullSpec
   341           #'window:' 
   332           #'window:' 
   342            #(#WindowSpec
   333            #(#WindowSpec
   343               #'name:' 'uIPainterView'
   334               #'name:' 'NameAndSelectorSpec'
   344               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   335               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   345               #'label:' 'Painter'
   336               #'label:' 'Painter'
   346               #'bounds:' #(#Rectangle 0 0 391 170)
   337               #'bounds:' #(#Rectangle 0 0 391 170)
   347           )
   338           )
   348           #'component:' 
   339           #'component:' 
   472                     #'name:' 'noteBook'
   463                     #'name:' 'noteBook'
   473                     #'layout:' #(#LayoutFrame 0 0.4 59 0.0 0 1.0 -55 1.0)
   464                     #'layout:' #(#LayoutFrame 0 0.4 59 0.0 0 1.0 -55 1.0)
   474                     #'enableChannel:' #enableChannel
   465                     #'enableChannel:' #enableChannel
   475                     #'tabable:' true
   466                     #'tabable:' true
   476                     #'menu:' #tabList
   467                     #'menu:' #tabList
   477                     #'style:' 
       
   478                      #(#FontDescription
       
   479                         #helvetica #medium
       
   480                         #roman #'10'
       
   481                     )
       
   482                     #'model:' #tabModel
   468                     #'model:' #tabModel
   483                     #'tabWidget:' #Window
   469                     #'tabWidget:' #Window
   484                     #'canvas:' #noteBookView
   470                     #'canvas:' #noteBookView
   485                 )
   471                 )
   486                  #(#HorizontalPanelViewSpec
   472                  #(#HorizontalPanelViewSpec
   662           
   648           
   663            #(
   649            #(
   664              #(#MenuItem
   650              #(#MenuItem
   665                 #'label:' 'align left'
   651                 #'label:' 'align left'
   666                 #'value:' #alignSelectionLeft
   652                 #'value:' #alignSelectionLeft
       
   653                 #'activeHelpKey:' #alignSelectionLeft
   667                 #'labelImage:' 
   654                 #'labelImage:' 
   668                  #(#ResourceRetriever
   655                  #(#ResourceRetriever
   669                     nil #iconAlignL
   656                     nil #iconAlignL
   670                 )
   657                 )
   671             )
   658             )
  1240 accept
  1227 accept
  1241     "accept changes done to the specification. The component assigned to the
  1228     "accept changes done to the specification. The component assigned to the
  1242      specification will change immediately dependant on the attributes derived
  1229      specification will change immediately dependant on the attributes derived
  1243      from the specification.
  1230      from the specification.
  1244     "
  1231     "
  1245     |layout|
  1232     |layout spec prop key layoutTool|
  1246 
  1233 
  1247     self isLayoutToolSelected ifTrue:[
  1234     self isLayoutToolSelected ifTrue:[
       
  1235         layoutTool := self layoutTool.
       
  1236 
  1248         (layout := layoutTool layout) notNil ifTrue:[
  1237         (layout := layoutTool layout) notNil ifTrue:[
  1249             layoutTool layoutType == #Extent ifTrue:[
  1238             layoutTool layoutType == #Extent ifTrue:[
  1250                 layoutTool layoutView == self painter topView ifTrue:[
  1239                 layoutTool layoutView == self painter topView ifTrue:[
  1251                     layoutTool layoutView extent:layout
  1240                     layoutTool layoutView extent:layout
  1252                 ] ifFalse:[
  1241                 ] ifFalse:[
  1255             ] ifFalse:[
  1244             ] ifFalse:[
  1256                 self painter setLayout:layout
  1245                 self painter setLayout:layout
  1257             ]
  1246             ]
  1258         ]
  1247         ]
  1259     ] ifFalse:[
  1248     ] ifFalse:[
       
  1249         spec := self specTool specification.
       
  1250 
  1260         self isHelpToolSelected ifTrue:[
  1251         self isHelpToolSelected ifTrue:[
  1261             activeHelpTool accept
  1252             self helpTool accept.
  1262         ].
  1253             key  := self helpTool helpKey.
  1263         self painter updateFromSpec:(specTool specification).
  1254             prop := treeView propertySelected.
       
  1255 
       
  1256             prop notNil ifTrue:[
       
  1257                 prop spec activeHelpKey:key
       
  1258             ].
       
  1259             spec activeHelpKey:key.
       
  1260         ] ifFalse:[
       
  1261             self painter updateFromSpec:spec.
       
  1262         ]
  1264     ].
  1263     ].
  1265     self modifiedChannel value:false.
  1264     self modifiedChannel value:false.
  1266 
       
  1267 !
  1265 !
  1268 
  1266 
  1269 cancel
  1267 cancel
  1270     "cancel all changes done to the specification; reread attributes from the
  1268     "cancel all changes done to the specification; reread attributes from the
  1271      assigned component
  1269      assigned component
  1272     "
  1270     "
       
  1271     |spec key|
       
  1272 
  1273     self isModified ifTrue:[
  1273     self isModified ifTrue:[
  1274         specTool specification:(self painter specForSelection).
  1274         (spec := self painter specForSelection) notNil ifTrue:[
  1275         self setViewInLayoutTool:(layoutTool layoutView).
  1275             key := spec activeHelpKey.
       
  1276         ].
       
  1277         self helpTool helpKey:key.
       
  1278         self specTool specification:spec.
       
  1279         self setViewInLayoutTool:(self layoutTool layoutView).
  1276         self modifiedChannel value:false.
  1280         self modifiedChannel value:false.
  1277     ]
  1281     ]
  1278 !
  1282 !
  1279 
  1283 
  1280 moveSelectionDown
  1284 moveSelectionDown
  1303     self painter moveSelectionUp
  1307     self painter moveSelectionUp
  1304 
  1308 
  1305 !
  1309 !
  1306 
  1310 
  1307 openEditMenu
  1311 openEditMenu
       
  1312     "opens a menu editor on current widget
       
  1313     "
  1308     |cls aspect editor|
  1314     |cls aspect editor|
  1309 
  1315 
  1310     specClass isNil ifTrue:[
  1316     specClass isNil ifTrue:[
  1311         ^ self information:'no application class defined yet'.
  1317         ^ self information:'no application class defined yet'.
  1312     ].
  1318     ].
  1316             ^ self information:'no application class defined yet'
  1322             ^ self information:'no application class defined yet'
  1317         ]
  1323         ]
  1318     ].
  1324     ].
  1319 
  1325 
  1320     cls notNil ifTrue:[
  1326     cls notNil ifTrue:[
  1321         (aspect := specTool specification menu) notNil ifTrue:[
  1327         (aspect := self specTool specification menu) notNil ifTrue:[
  1322             aspect := aspect asSymbol
  1328             aspect := aspect asSymbol
  1323         ] ifFalse:[
  1329         ] ifFalse:[
  1324             "/ cg: q&d hack ...
  1330             "/ cg: q&d hack ...
  1325 
  1331 
  1326             aspect := treeView propertySelected.
  1332             aspect := treeView propertySelected.
  1329                     aspect := nil.
  1335                     aspect := nil.
  1330                 ] do:[
  1336                 ] do:[
  1331                     aspect := aspect view asMenu.
  1337                     aspect := aspect view asMenu.
  1332                 ]
  1338                 ]
  1333             ].
  1339             ].
  1334 
       
  1335 "/            aspect isNil ifTrue:[
       
  1336 "/                self warn:'first enter (and confirm) the menus selector.'.
       
  1337 "/                ^ self.
       
  1338 "/            ].
       
  1339         ].
  1340         ].
  1340         
  1341         
  1341         editor := MenuEditor new.
  1342         editor := MenuEditor new.
  1342         editor masterApplication:self.
  1343         editor masterApplication:self.
  1343         editor activeHelpTool:(self activeHelpTool).
  1344         editor useHelpDictionary:(self helpTool dictionary).
  1344         editor openModalOnClass:cls andSelector:aspect.
  1345         editor openModalOnClass:cls andSelector:aspect.
       
  1346         self helpTool updateList.
  1345 
  1347 
  1346         editor selectorName ~= aspect ifTrue:[
  1348         editor selectorName ~= aspect ifTrue:[
  1347             editor didInstall ifTrue:[
  1349             editor didInstall ifTrue:[
  1348                 specTool specification menu:editor selectorName asSymbol.
  1350                 self specTool specification menu:editor selectorName asSymbol.
  1349                 self modifiedChannel value:true.
  1351                 self modifiedChannel value:true.
  1350                 self accept
  1352                 self accept
  1351             ]
  1353             ]
  1352         ].
  1354         ].
  1353     ]
  1355     ]
  1354 
  1356 
  1355     "Modified: 31.7.1997 / 14:26:13 / cg"
  1357     "Modified: 31.7.1997 / 14:26:13 / cg"
  1356 ! !
  1358 ! !
  1357 
  1359 
  1358 !UIPainter methodsFor:'active help'!
  1360 !UIPainter methodsFor:'active help'!
  1359 
       
  1360 activeHelpTool
       
  1361     "setup help tool
       
  1362     "
       
  1363     activeHelpTool isNil ifTrue:[
       
  1364         activeHelpTool := UIHelpTool new.
       
  1365         activeHelpTool helpSpecFrom:specClass.
       
  1366         activeHelpTool masterApplication:self.
       
  1367     ].
       
  1368     ^ activeHelpTool
       
  1369 !
       
  1370 
  1361 
  1371 showHelp:aHelpText for:view
  1362 showHelp:aHelpText for:view
  1372     "hook to allow an application to display active help
  1363     "hook to allow an application to display active help
  1373      texts in its own info area.
  1364      texts in its own info area.
  1374      This method may be redefined in a concrete application.
  1365      This method may be redefined in a concrete application.
  1446 !
  1437 !
  1447 
  1438 
  1448 noteBookView
  1439 noteBookView
  1449     "returns the notebook view; initialize components within the notebook
  1440     "returns the notebook view; initialize components within the notebook
  1450     "
  1441     "
  1451     |noteBook channel n1 n2|
  1442     |noteBook channel helpTool layoutTool specTool|
  1452 
  1443 
  1453     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
  1444     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
  1454         noteBook   := View new.
  1445         noteBook   := View new.
  1455         layoutTool := UILayoutTool new.
  1446         layoutTool := UILayoutTool new.
       
  1447         helpTool   := UIHelpTool   new.
       
  1448         helpTool helpSpecFrom:specClass.
  1456         specTool   := UISpecificationTool new.
  1449         specTool   := UISpecificationTool new.
  1457         channel    := self modifiedChannel.
  1450         channel    := self modifiedChannel.
  1458 
  1451 
  1459         layoutTool masterApplication:self.
  1452         layoutTool masterApplication:self.
  1460         specTool   masterApplication:self.
  1453         specTool   masterApplication:self.
  1461 
  1454         helpTool   masterApplication:self.
  1462         n1 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1455 
  1463         n2 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1456         layoutCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1464 
  1457         helpCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1465         n1 client:layoutTool.
  1458         specCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1466         specTool builder:(n2 client:specTool).
  1459 
       
  1460         layoutCanvas client:layoutTool.
       
  1461         helpCanvas   client:helpTool.
       
  1462         specTool builder:(specCanvas client:specTool).
  1467 
  1463 
  1468         layoutTool masterApplication:self.
  1464         layoutTool masterApplication:self.
  1469         specTool   masterApplication:self.
  1465         specTool   masterApplication:self.
       
  1466         helpTool   masterApplication:self.
       
  1467 
  1470         layoutTool modifiedHolder:channel.
  1468         layoutTool modifiedHolder:channel.
       
  1469         helpTool   modifiedHolder:channel.
  1471         specTool   modifiedHolder:channel.
  1470         specTool   modifiedHolder:channel.
       
  1471 
  1472         builder aspectAt:#noteBookView put:noteBook.
  1472         builder aspectAt:#noteBookView put:noteBook.
  1473     ].
  1473     ].
  1474     ^ noteBook
  1474     ^ noteBook
  1475 !
  1475 !
  1476 
  1476 
  1530 layoutChanged
  1530 layoutChanged
  1531     "called by the painter/canvas whenever the layout of the current selected
  1531     "called by the painter/canvas whenever the layout of the current selected
  1532      widget changed
  1532      widget changed
  1533     "
  1533     "
  1534     self isModified ifFalse:[
  1534     self isModified ifFalse:[
  1535         layoutTool update.
  1535         self layoutTool update.
  1536         self modifiedChannel value:false
  1536         self modifiedChannel value:false
  1537     ]
  1537     ]
  1538 !
  1538 !
  1539 
  1539 
  1540 propertyChanged
  1540 propertyChanged
  1542      widget changed
  1542      widget changed
  1543     "
  1543     "
  1544     |p|
  1544     |p|
  1545 
  1545 
  1546     (p := treeView propertySelected) notNil ifTrue:[
  1546     (p := treeView propertySelected) notNil ifTrue:[
  1547         specTool specification:(p spec copy).
  1547         self specTool specification:(p spec copy).
  1548         self setViewInLayoutTool:(p view).
  1548         self setViewInLayoutTool:(p view).
  1549         self modifiedChannel value:false
  1549         self modifiedChannel value:false
  1550     ] ifFalse:[
  1550     ] ifFalse:[
  1551         layoutTool layoutView notNil ifTrue:[
  1551         self layoutTool layoutView notNil ifTrue:[
  1552             self modifiedChannel value:false.
  1552             self modifiedChannel value:false.
  1553             self treeSelection
  1553             self treeSelection
  1554         ]
  1554         ]
  1555     ]
  1555     ]
  1556 !
  1556 !
  1636     "
  1636     "
  1637     aView beIndependent.
  1637     aView beIndependent.
  1638     aView unmap.
  1638     aView unmap.
  1639 !
  1639 !
  1640 
  1640 
  1641 painter
  1641 raiseTabView
  1642     "returns the painter/canvas view
  1642 
  1643     "
  1643     self isLayoutToolSelected ifTrue:[
  1644     ^ treeView canvas
  1644         layoutCanvas raise
       
  1645     ] ifFalse:[
       
  1646         self isHelpToolSelected ifTrue:[
       
  1647             helpCanvas raise
       
  1648         ] ifFalse:[
       
  1649             self specTool selection:tabSelection.
       
  1650             specCanvas raise
       
  1651         ]
       
  1652     ]
  1645 !
  1653 !
  1646 
  1654 
  1647 raiseUIView:aView
  1655 raiseUIView:aView
  1648     "raise the view which is an application or top view
  1656     "raise the view which is an application or top view
  1649     "
  1657     "
  1667     self painter 
  1675     self painter 
  1668             className:clsName 
  1676             className:clsName 
  1669             superclassName:superClassName
  1677             superclassName:superClassName
  1670             selector:(selector ? '').
  1678             selector:(selector ? '').
  1671 
  1679 
  1672     specClass := clsName.
  1680     self specClass:clsName.
  1673     specSelector := (selector ? '').
  1681     specSelector := (selector ? '').
  1674     specSuperclass := superClassName.
  1682     specSuperclass := superClassName.
  1675 
  1683 
  1676     "Modified: 24.6.1997 / 19:07:01 / cg"
  1684     "Modified: 24.6.1997 / 19:07:01 / cg"
  1677 !
  1685 !
  1678 
  1686 
  1679 setViewInLayoutTool:aView
  1687 setViewInLayoutTool:aView
  1680     "set view for layout tool
  1688     "set view for layout tool
  1681     "
  1689     "
  1682     self painter topView ~~ aView ifTrue:[
  1690     |type|
  1683         layoutTool layoutView:aView type:nil
  1691 
  1684     ] ifFalse:[
  1692     self painter topView == aView ifTrue:[
  1685         layoutTool layoutView:aView type:#Extent
  1693         type := #Extent
  1686     ].
  1694     ].
  1687 
  1695     self layoutTool layoutView:aView type:type
  1688 
  1696 
       
  1697 !
       
  1698 
       
  1699 specClass:aClass
       
  1700     specClass := aClass.
       
  1701     self helpTool helpSpecFrom:specClass.
       
  1702 ! !
       
  1703 
       
  1704 !UIPainter methodsFor:'private tools'!
       
  1705 
       
  1706 helpTool
       
  1707     "returns the help tool
       
  1708     "
       
  1709     helpCanvas isNil ifTrue:[
       
  1710         self noteBookView
       
  1711     ].
       
  1712     ^ helpCanvas application
       
  1713 !
       
  1714 
       
  1715 layoutTool
       
  1716     "returns the layout tool
       
  1717     "
       
  1718     layoutCanvas isNil ifTrue:[
       
  1719         self noteBookView
       
  1720     ].
       
  1721     ^ layoutCanvas application
       
  1722 !
       
  1723 
       
  1724 painter
       
  1725     "returns the painter/canvas view
       
  1726     "
       
  1727     ^ treeView canvas
       
  1728 !
       
  1729 
       
  1730 specTool
       
  1731     "returns the spec tool
       
  1732     "
       
  1733     specCanvas isNil ifTrue:[
       
  1734         self noteBookView
       
  1735     ].
       
  1736     ^ specCanvas application
  1689 ! !
  1737 ! !
  1690 
  1738 
  1691 !UIPainter methodsFor:'queries'!
  1739 !UIPainter methodsFor:'queries'!
  1692 
  1740 
  1693 hasSpecClass
  1741 hasSpecClass
  1711 
  1759 
  1712 isHelpToolSelected
  1760 isHelpToolSelected
  1713     "returns true if current selected tab in the noteBook is assigned
  1761     "returns true if current selected tab in the noteBook is assigned
  1714      to the 'Help' tool
  1762      to the 'Help' tool
  1715     "
  1763     "
  1716     ^ tabSelection = 'Help'
  1764     ^ tabSelection = UIHelpTool label
       
  1765 
  1717 !
  1766 !
  1718 
  1767 
  1719 isLayoutToolSelected
  1768 isLayoutToolSelected
  1720     "returns true if current selected tab in the noteBook is assigned
  1769     "returns true if current selected tab in the noteBook is assigned
  1721      to the 'Layout' tool
  1770      to the 'Layout' tool
  1722     "
  1771     "
  1723     ^ tabSelection = layoutTool class label
  1772     ^ tabSelection = UILayoutTool label
  1724 !
  1773 !
  1725 
  1774 
  1726 isModified
  1775 isModified
  1727     "returns true if current specification or layout is modified
  1776     "returns true if current specification or layout is modified
  1728     "
  1777     "
  1744 !
  1793 !
  1745 
  1794 
  1746 tabSelection:something
  1795 tabSelection:something
  1747     "the tab selection of the notebook changed
  1796     "the tab selection of the notebook changed
  1748     "
  1797     "
  1749     |raiseViewIdx|
       
  1750 
       
  1751     (something isNil or:[tabSelection = something]) ifTrue:[
  1798     (something isNil or:[tabSelection = something]) ifTrue:[
  1752         ^ self
  1799         ^ self
  1753     ].
  1800     ].
  1754 
  1801 
  1755     self isModified ifTrue:[
  1802     self isModified ifTrue:[
  1757             ^ self
  1804             ^ self
  1758         ].
  1805         ].
  1759         self accept
  1806         self accept
  1760     ].
  1807     ].
  1761 
  1808 
  1762     raiseViewIdx := 1.
       
  1763     tabSelection := something.
  1809     tabSelection := something.
  1764 
  1810     self raiseTabView.
  1765     self isLayoutToolSelected ifFalse:[
       
  1766         specTool selection:tabSelection.
       
  1767         raiseViewIdx := 2
       
  1768     ].
       
  1769     (self noteBookView subViews at:raiseViewIdx) raise.
       
  1770     self cancel.
  1811     self cancel.
  1771 !
  1812 !
  1772 
  1813 
  1773 treeSelection
  1814 treeSelection
  1774     "called whenever the selection of the treeview changed
  1815     "called whenever the selection of the treeview changed
  1794             spec := property spec copy.
  1835             spec := property spec copy.
  1795         ]
  1836         ]
  1796     ].
  1837     ].
  1797     tabComponent := builder componentAt:#noteBook.
  1838     tabComponent := builder componentAt:#noteBook.
  1798     self setViewInLayoutTool:view.
  1839     self setViewInLayoutTool:view.
  1799     specTool specification:spec.
  1840     self specTool specification:spec.
  1800 
  1841 
  1801     spec notNil ifTrue:[
  1842     spec notNil ifTrue:[
       
  1843         self helpTool helpKey:(spec activeHelpKey).
  1802         list := spec class slices collect:[:aSlice| aSlice first asString].
  1844         list := spec class slices collect:[:aSlice| aSlice first asString].
  1803         view notNil ifTrue:[list add:(layoutTool class label)].
  1845         list add:(UIHelpTool   label).
       
  1846         list add:(UILayoutTool label).
  1804         self tabList value:list.
  1847         self tabList value:list.
  1805         self showHelp:(spec class name) for:nil.
  1848         self showHelp:(spec class name) for:nil.
  1806         tabComponent enabled:true.
  1849         tabComponent enabled:true.
  1807 
  1850 
  1808         (tabSelection := tabComponent selection) isNil ifTrue:[
  1851         (tabSelection := tabComponent selection) isNil ifTrue:[
  1809             tabComponent setSelection:(tabSelection := list first)
  1852             tabComponent setSelection:(tabSelection := list first)
  1810         ].
  1853         ].
  1811         self isLayoutToolSelected ifTrue:[
  1854         self raiseTabView
  1812             (self noteBookView subViews at:1) raise
       
  1813         ] ifFalse:[
       
  1814             specTool selection:tabSelection.
       
  1815             (self noteBookView subViews at:2) raise
       
  1816         ]
       
  1817     ] ifFalse:[
  1855     ] ifFalse:[
       
  1856         self helpTool helpKey:nil.
  1818         tabComponent enabled:false.
  1857         tabComponent enabled:false.
  1819         self showHelp:'' for:nil.
  1858         self showHelp:'' for:nil.
  1820     ].
  1859     ].
  1821     self modifiedChannel value:false.
  1860     self modifiedChannel value:false.
  1822 
       
  1823 ! !
  1861 ! !
  1824 
  1862 
  1825 !UIPainter methodsFor:'startup / release'!
  1863 !UIPainter methodsFor:'startup / release'!
  1826 
  1864 
  1827 closeRequest
  1865 closeRequest
  1839     selectionPanel notNil ifTrue:[
  1877     selectionPanel notNil ifTrue:[
  1840         selectionPanel masterApplication:nil.
  1878         selectionPanel masterApplication:nil.
  1841         selectionPanel closeRequest
  1879         selectionPanel closeRequest
  1842     ].
  1880     ].
  1843     selectionPanel := nil.
  1881     selectionPanel := nil.
  1844     layoutTool     := nil.
       
  1845     treeView       := nil.
  1882     treeView       := nil.
  1846     activeHelpTool := nil.
       
  1847 
  1883 
  1848     super closeRequest.
  1884     super closeRequest.
  1849 
  1885 
  1850     "Modified: 28.7.1997 / 18:28:37 / cg"
  1886     "Modified: 28.7.1997 / 18:28:37 / cg"
  1851 !
  1887 !
  2076         (tmp := specSuperclass) isNil ifTrue:[tmp := 'ApplicationModel'].
  2112         (tmp := specSuperclass) isNil ifTrue:[tmp := 'ApplicationModel'].
  2077         aspects at:#superclassNameChannel put:tmp asValue.
  2113         aspects at:#superclassNameChannel put:tmp asValue.
  2078 
  2114 
  2079         (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[
  2115         (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[
  2080 
  2116 
  2081             specClass := (self aspectFor:#classNameChannel) value.
  2117             specClass    := (self aspectFor:#classNameChannel) value.
  2082             specSelector := (self aspectFor:#methodNameChannel) value.
  2118             specSelector := (self aspectFor:#methodNameChannel) value.
  2083             specSelector notNil ifTrue:[specSelector := specSelector asSymbol].
  2119             specSelector notNil ifTrue:[specSelector := specSelector asSymbol].
  2084             specSuperclass := (self aspectFor:#superclassNameChannel) value.
  2120             specSuperclass := (self aspectFor:#superclassNameChannel) value.
  2085 
  2121 
  2086             (again := self checkClassAndSelector not) ifFalse:[
  2122             (again := self checkClassAndSelector not) ifFalse:[
  2088                         superclassName:specSuperclass
  2124                         superclassName:specSuperclass
  2089                               selector:specSelector.
  2125                               selector:specSelector.
  2090             ]
  2126             ]
  2091         ]
  2127         ]
  2092 
  2128 
  2093     ] doWhile:[again]
  2129     ] doWhile:[again].
  2094 
  2130 
  2095     "Modified: 17.6.1997 / 14:42:02 / cg"
  2131     self specClass:specClass.
  2096 ! !
  2132 ! !
  2097 
  2133 
  2098 !UIPainter methodsFor:'user interaction - move'!
  2134 !UIPainter methodsFor:'user interaction - move'!
  2099 
  2135 
  2100 doStepDown
  2136 doStepDown
  2244 !
  2280 !
  2245 
  2281 
  2246 doInstallHelp
  2282 doInstallHelp
  2247     "install help text
  2283     "install help text
  2248     "
  2284     "
  2249     activeHelpTool notNil ifTrue:[
  2285     self helpTool installHelpSpecInto:specClass
  2250         activeHelpTool installHelpSpecInto:specClass
       
  2251     ] ifFalse:[
       
  2252         self information:'no help text defined'
       
  2253     ]    
       
  2254 !
  2286 !
  2255 
  2287 
  2256 doInstallSpec
  2288 doInstallSpec
  2257     "install window specification
  2289     "install window specification
  2258     "
  2290     "