UIPainterView.st
changeset 121 96d6feeeb049
parent 119 39acd704ad51
child 128 9779b7459a1c
equal deleted inserted replaced
120:d83c307f3bf5 121:96d6feeeb049
    63 !UIPainterView class methodsFor:'defaults'!
    63 !UIPainterView class methodsFor:'defaults'!
    64 
    64 
    65 defaultMenuMessage   
    65 defaultMenuMessage   
    66     "This message is the default yo be sent to the menuHolder to get a menu
    66     "This message is the default yo be sent to the menuHolder to get a menu
    67     "
    67     "
    68     ^ #menu
    68     ^ #showMiddleButtonMenu
    69 
    69 
    70 
    70 
    71 ! !
    71 ! !
    72 
    72 
    73 !UIPainterView class methodsFor:'menu specs'!
    73 !UIPainterView class methodsFor:'menu specs'!
   990     ]
   990     ]
   991 ! !
   991 ! !
   992 
   992 
   993 !UIPainterView methodsFor:'menus'!
   993 !UIPainterView methodsFor:'menus'!
   994 
   994 
   995 menu
       
   996     "returns middle-button menu dependent on the selection
       
   997     "
       
   998     |menu canPaste|
       
   999 
       
  1000     self enabled ifFalse:[^ nil ].
       
  1001     menu := MenuPanel fromSpec:(self class menu) receiver:self.
       
  1002 
       
  1003     canPaste := self canPaste:(self getSelection).
       
  1004 
       
  1005     selection isNil ifTrue:[
       
  1006         menu disableAll
       
  1007     ] ifFalse:[
       
  1008         canPaste := (canPaste and:[self canPasteInto:selection])
       
  1009     ].
       
  1010     menu enabledAt:#paste put:[|can|
       
  1011         can := self canPaste:(self getSelection).
       
  1012         selection isNil ifTrue:[can]
       
  1013                        ifFalse:[(can and:[self canPasteInto:selection])]
       
  1014     ].
       
  1015 
       
  1016     menu enabledAt:#undo put:(undoHistory notEmpty).
       
  1017   ^ menu
       
  1018 
       
  1019 
       
  1020 
       
  1021 !
       
  1022 
       
  1023 showFontPanel
   995 showFontPanel
  1024     |action theFont fontPanel|
   996     |action theFont fontPanel|
  1025 
   997 
  1026     fontPanel := FontPanel new. 
   998     fontPanel := FontPanel new. 
  1027 
   999 
  1034             self changeFont:theFont
  1006             self changeFont:theFont
  1035         ]
  1007         ]
  1036     ]
  1008     ]
  1037 
  1009 
  1038     "Modified: 10.4.1997 / 10:06:15 / cg"
  1010     "Modified: 10.4.1997 / 10:06:15 / cg"
       
  1011 !
       
  1012 
       
  1013 showMiddleButtonMenu
       
  1014     "show the middle button menu; this returns nil
       
  1015     "
       
  1016     |menu canPaste|
       
  1017 
       
  1018     self enabled ifFalse:[
       
  1019         ^ nil
       
  1020     ].
       
  1021     menu := MenuPanel fromSpec:(self class menu) receiver:self.
       
  1022 
       
  1023     canPaste := self canPaste:(self getSelection).
       
  1024 
       
  1025     selection isNil ifTrue:[
       
  1026         menu disableAll
       
  1027     ] ifFalse:[
       
  1028         canPaste := (canPaste and:[self canPasteInto:selection])
       
  1029     ].
       
  1030     menu enabledAt:#paste put:[|can|
       
  1031         can := self canPaste:(self getSelection).
       
  1032         selection isNil ifTrue:[can]
       
  1033                        ifFalse:[(can and:[self canPasteInto:selection])]
       
  1034     ].
       
  1035 
       
  1036     menu enabledAt:#undo put:(undoHistory notEmpty).
       
  1037     menu startUp.
       
  1038   ^ nil
       
  1039 
       
  1040 
       
  1041 
  1039 ! !
  1042 ! !
  1040 
  1043 
  1041 !UIPainterView methodsFor:'misc'!
  1044 !UIPainterView methodsFor:'misc'!
  1042 
  1045 
  1043 changeFont:aFontDescription
  1046 changeFont:aFontDescription
  1736 
  1739 
  1737 for:aPainter
  1740 for:aPainter
  1738     "initialize for a painter
  1741     "initialize for a painter
  1739     "
  1742     "
  1740     painter := aPainter.
  1743     painter := aPainter.
       
  1744     disabledChanged := false.
  1741     self list:(OrderedCollection new).
  1745     self list:(OrderedCollection new).
  1742     propertyList := OrderedCollection new.
  1746     propertyList := OrderedCollection new.
  1743     self selection:#().
  1747     self selection:#().
  1744     disabledChanged := false.
       
  1745     painter := aPainter.
       
  1746     self addDependent:painter.
  1748     self addDependent:painter.
  1747 
  1749 
  1748 ! !
  1750 ! !
  1749 
  1751 
  1750 !UIPainterView::ListHolder methodsFor:'private'!
  1752 !UIPainterView::ListHolder methodsFor:'private'!