UIPainter.st
changeset 118 bc196200ea8b
parent 114 93cd25c62a68
child 121 96d6feeeb049
--- a/UIPainter.st	Thu May 22 15:07:13 1997 +0200
+++ b/UIPainter.st	Fri May 23 16:06:33 1997 +0200
@@ -51,9 +51,99 @@
     ^ 'Dimension'
 ! !
 
+!UIPainter class methodsFor:'icons'!
+
+iconAlignB
+    ^ Image fromFile:'b_alignB.xbm'
+
+!
+
+iconAlignCenterH
+    ^ Image fromFile:'b_alignCH.xbm'
+
+!
+
+iconAlignCenterV
+    ^ Image fromFile:'b_alignCV.xbm'
+
+!
+
+iconAlignL
+    ^ Image fromFile:'b_alignL.xbm'
+!
+
+iconAlignLR
+    ^ Image fromFile:'b_alignLR.xbm'
+
+!
+
+iconAlignR
+    ^ Image fromFile:'b_alignR.xbm'
+
+!
+
+iconAlignT
+    ^ Image fromFile:'b_alignT.xbm'
+
+!
+
+iconAlignTB
+    ^ Image fromFile:'b_alignTB.xbm'
+
+! !
+
 !UIPainter class methodsFor:'interface specs'!
 
-menuSpec
+menuAlignment
+    ^ #(#Menu #(
+                #(#MenuItem
+                        #'label:' 'align left'
+                        #'value:' #alignSelectionLeft
+                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignL )
+                 )
+                #(#MenuItem
+                        #'label:' 'align right'
+                        #'value:' #alignSelectionRight
+                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignR )
+                 )
+                #(#MenuItem
+                        #'label:' 'align left & right'
+                        #'value:' #alignSelectionLeftAndRight
+                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignLR )
+                 )
+                #(#MenuItem
+                        #'label:' 'align top'
+                        #'value:' #alignSelectionTop
+                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignT )
+                 )
+                #(#MenuItem
+                        #'label:' 'align bottom'
+                        #'value:' #alignSelectionBottom
+                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignB )
+                 )
+                #(#MenuItem
+                        #'label:' 'align top & bottom'
+                        #'value:' #alignSelectionTopAndBottom
+                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignTB )
+                 )
+                #(#MenuItem
+                        #'label:' 'align centered horizontal'
+                        #'value:' #alignSelectionCenterHor
+                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignCenterH )
+                 )
+                #(#MenuItem
+                        #'label:' 'align centered vertical'
+                        #'value:' #alignSelectionCenterVer
+                        #'labelImage:' #( ResourceRetriever UIPainter iconAlignCenterV )
+                 )
+                )
+               #( 4 2 )
+               nil
+        )
+
+!
+
+menuPullDown
     ^ #(#Menu #(
         #(#MenuItem
                 #'label:' 'file'
@@ -231,6 +321,7 @@
          )
         #(#MenuItem
                 #'label:' 'test'
+                #'nameKey:' #test
                 #'value:' #test
                 #'submenu:'
                         #(#Menu #(
@@ -428,7 +519,7 @@
                            #(#SequenceViewSpec
                               #'name:' 'selectionInList'
                               #'layout:' #(#LayoutFrame 0 0.0 40 0.0 0 0.35 0 1.0)
-                              #'enableChannel:' #canModify
+                              #'enableChannel:' #enableChannel
                               #'menu:' #objectListMenu
                               #'model:' #objectList
                               #'callbacksSpec:' 
@@ -443,217 +534,58 @@
                           )
                            #(#PanelViewSpec
                               #'name:' 'panelViewButtons'
-                              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 40 0.0)
+                              #'layout:' #(#LayoutFrame -130 1.0 0 0.0 0 1.0 35 0.0)
                               #'component:' 
                                #(#SpecCollection
                                   #'collection:' 
                                    #(
-                                     #(#HorizontalPanelViewSpec
-                                        #'name:' 'hrzPanelViewAlignH'
-                                        #'component:' 
-                                         #(#SpecCollection
-                                            #'collection:' 
-                                             #(
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'alignLeft'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_alignL.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #alignSelectionLeft
-                                                  #'hasCharacterOrientedLabel:' false
-                                                  #'isTriggerOnDown:' false
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' false
-                                                  #'extent:' #(#Point 24 24)
-                                              )
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'alignRight'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_alignR.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #alignSelectionRight
-                                                  #'hasCharacterOrientedLabel:' false
-                                                  #'isTriggerOnDown:' false
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' false
-                                                  #'extent:' #(#Point 24 24)
-                                              )
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'alignHorizontal'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_alignLR.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #alignSelectionLeftAndRight
-                                                  #'hasCharacterOrientedLabel:' false
-                                                  #'isTriggerOnDown:' false
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' false
-                                                  #'extent:' #(#Point 24 24)
-                                              )
-                                            )
-                                        )
-                                        #'level:' 0
-                                        #'horizontalLayout:' #center
-                                        #'verticalLayout:' #center
-                                        #'horizontalSpace:' 3
-                                        #'verticalSpace:' 3
-                                        #'extent:' #(#Point 84 30)
+                                     #(#ActionButtonSpec
+                                        #'name:' 'moveLeft'
+                                        #'label:' ''
+                                        #'translateLabel:' true
+                                        #'labelChannel:' #'LABELb_moveLeft.xbm'
+                                        #'defaultable:' true
+                                        #'model:' #moveSelectionLeft
+                                        #'isTriggerOnDown:' true
+                                        #'enableChannel:' #enableChannel
+                                        #'autoRepeat:' true
+                                        #'extent:' #(#Point 26 24)
+                                    )
+                                     #(#ActionButtonSpec
+                                        #'name:' 'moveRight'
+                                        #'label:' ''
+                                        #'translateLabel:' true
+                                        #'labelChannel:' #'LABELb_moveRight.xbm'
+                                        #'defaultable:' true
+                                        #'model:' #moveSelectionRight
+                                        #'isTriggerOnDown:' true
+                                        #'enableChannel:' #enableChannel
+                                        #'autoRepeat:' true
+                                        #'extent:' #(#Point 26 24)
                                     )
-                                     #(#HorizontalPanelViewSpec
-                                        #'name:' 'hrzPanelViewAlignV'
-                                        #'component:' 
-                                         #(#SpecCollection
-                                            #'collection:' 
-                                             #(
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'alignBottom'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_alignB.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #alignSelectionBottom
-                                                  #'isTriggerOnDown:' false
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' false
-                                                  #'extent:' #(#Point 24 24)
-                                              )
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'alignTop'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_alignT.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #alignSelectionTop
-                                                  #'isTriggerOnDown:' false
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' false
-                                                  #'extent:' #(#Point 24 24)
-                                              )
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'alignVertical'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_alignTB.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #alignSelectionTopAndBottom
-                                                  #'isTriggerOnDown:' false
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' false
-                                                  #'extent:' #(#Point 24 24)
-                                              )
-                                            )
-                                        )
-                                        #'level:' 0
-                                        #'horizontalLayout:' #center
-                                        #'verticalLayout:' #center
-                                        #'horizontalSpace:' 3
-                                        #'verticalSpace:' 3
-                                        #'extent:' #(#Point 84 30)
+                                     #(#ActionButtonSpec
+                                        #'name:' 'moveUp'
+                                        #'label:' ''
+                                        #'translateLabel:' true
+                                        #'labelChannel:' #'LABELb_moveUp.xbm'
+                                        #'defaultable:' true
+                                        #'model:' #moveSelectionUp
+                                        #'isTriggerOnDown:' true
+                                        #'enableChannel:' #enableChannel
+                                        #'autoRepeat:' true
+                                        #'extent:' #(#Point 26 24)
                                     )
-                                     #(#HorizontalPanelViewSpec
-                                        #'name:' 'hrzPanelViewCenter'
-                                        #'component:' 
-                                         #(#SpecCollection
-                                            #'collection:' 
-                                             #(
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'centerHorizontal'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_alignCH.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #alignSelectionCenterHor
-                                                  #'isTriggerOnDown:' false
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' false
-                                                  #'extent:' #(#Point 25 24)
-                                              )
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'centerVertical'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_alignCV.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #alignSelectionCenterVer
-                                                  #'isTriggerOnDown:' false
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' false
-                                                  #'extent:' #(#Point 25 24)
-                                              )
-                                            )
-                                        )
-                                        #'level:' 0
-                                        #'horizontalLayout:' #center
-                                        #'verticalLayout:' #center
-                                        #'horizontalSpace:' 3
-                                        #'verticalSpace:' 3
-                                        #'extent:' #(#Point 59 30)
-                                    )
-                                     #(#HorizontalPanelViewSpec
-                                        #'name:' 'hrzPanelViewMove'
-                                        #'component:' 
-                                         #(#SpecCollection
-                                            #'collection:' 
-                                             #(
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'moveLeft'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_moveLeft.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #moveSelectionLeft
-                                                  #'isTriggerOnDown:' true
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' true
-                                                  #'extent:' #(#Point 26 24)
-                                              )
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'moveRight'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_moveRight.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #moveSelectionRight
-                                                  #'isTriggerOnDown:' true
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' true
-                                                  #'extent:' #(#Point 26 24)
-                                              )
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'moveUp'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_moveUp.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #moveSelectionUp
-                                                  #'isTriggerOnDown:' true
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' true
-                                                  #'extent:' #(#Point 26 24)
-                                              )
-                                               #(#ActionButtonSpec
-                                                  #'name:' 'moveDown'
-                                                  #'label:' ''
-                                                  #'translateLabel:' true
-                                                  #'labelChannel:' #'LABELb_moveDown.xbm'
-                                                  #'defaultable:' true
-                                                  #'model:' #moveSelectionDown
-                                                  #'isTriggerOnDown:' true
-                                                  #'enableChannel:' #canModify
-                                                  #'autoRepeat:' true
-                                                  #'extent:' #(#Point 26 24)
-                                              )
-                                            )
-                                        )
-                                        #'level:' 0
-                                        #'horizontalLayout:' #center
-                                        #'verticalLayout:' #center
-                                        #'horizontalSpace:' 3
-                                        #'verticalSpace:' 3
-                                        #'extent:' #(#Point 119 30)
+                                     #(#ActionButtonSpec
+                                        #'name:' 'moveDown'
+                                        #'label:' ''
+                                        #'translateLabel:' true
+                                        #'labelChannel:' #'LABELb_moveDown.xbm'
+                                        #'defaultable:' true
+                                        #'model:' #moveSelectionDown
+                                        #'isTriggerOnDown:' true
+                                        #'enableChannel:' #enableChannel
+                                        #'autoRepeat:' true
+                                        #'extent:' #(#Point 26 24)
                                     )
                                   )
                               )
@@ -673,7 +605,7 @@
                               #'useIndex:' false
                               #'fitLastRow:' true
                               #'moveSelectedRow:' true
-                              #'enableChannel:' #canModify
+                              #'enableChannel:' #enableChannel
                               #'level:' 0
                               #'canvas:' #noteBookView
                           )
@@ -710,13 +642,24 @@
                               #'horizontalSpace:' 3
                               #'verticalSpace:' 3
                           )
+                           #(#MenuPanelSpec
+                              #'name:' 'menuPanel1'
+                              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 -226 1.0 25 0)
+                              #'menu:' #menuAlignment
+                              #'showSeparatingLines:' true
+                              #'verticalLayout:' false
+                              #'fitFirstPanel:' true
+                          )
                         )
                     )
                 )
                  #(#MenuPanelSpec
                     #'name:' 'menuBar1'
                     #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 24 0)
-                    #'menu:' #pullDownMenu
+                    #'menu:' #menuPullDown
+                    #'showSeparatingLines:' false
+                    #'verticalLayout:' false
+                    #'fitFirstPanel:' true
                 )
               )
           )
@@ -756,23 +699,41 @@
 
 !UIPainter methodsFor:'aspects'!
 
-canModify
-    "automatically generated by UIPainter ..."
-
-    |holder|
+doubleClick
+    objectList selectGroup
+!
 
-    (holder := builder bindingAt:#canModify) isNil ifTrue:[
-        holder := AspectAdaptor new subject:(self painter); forAspect:#canModify.
-        builder aspectAt:#canModify put:holder.
-    ].
-    ^ holder
-
-
-
+enableChannel
+    "true if modifications are allowed otherwise running test
+    "
+  ^ self painter enableChannel
 !
 
-doubleClick
-    objectList selectGroup
+menuAlignment
+    |menu channel|
+
+    channel := self enableChannel.
+
+    menu := Menu new.
+    menu fromLiteralArrayEncoding:(self class menuAlignment).
+    menu receiver:self.
+    menu menuItems do:[:anItem| anItem enabled:channel].
+  ^ menu
+!
+
+menuPullDown
+    |menu channel|
+
+    channel := self enableChannel.
+
+    menu := Menu new.
+    menu fromLiteralArrayEncoding:(self class menuPullDown).
+    menu receiver:self.
+
+    menu menuItems do:[:anItem| 
+        anItem nameKey ~~ #test ifTrue:[anItem enabled:channel]
+    ].
+  ^ menu
 !
 
 modifiedChannel
@@ -820,15 +781,6 @@
 
 !
 
-pullDownMenu
-    |menu painter|
-
-    menu := Menu new.
-    menu fromLiteralArrayEncoding:(self class menuSpec).
-    menu receiver:self.
-  ^ menu
-!
-
 tabList
     "automatically generated by UIPainter ..."
 
@@ -953,10 +905,6 @@
 
 painter
     ^ objectList painter
-!
-
-workView
-    ^ self painter
 ! !
 
 !UIPainter methodsFor:'selection'!