NoteBookView.st
changeset 4841 749f28290578
parent 4790 5310af42022f
child 4856 e30db8df7505
equal deleted inserted replaced
4839:756bfb17f17f 4841:749f28290578
  3798 !NoteBookView::Tab methodsFor:'drawing'!
  3798 !NoteBookView::Tab methodsFor:'drawing'!
  3799 
  3799 
  3800 displayOn:aGC inset:inset direction:aDirection textRightInset:aTextRightInset
  3800 displayOn:aGC inset:inset direction:aDirection textRightInset:aTextRightInset
  3801     "redraw this tab"
  3801     "redraw this tab"
  3802 
  3802 
  3803     |dispObj lft wdt top hgt x y|
  3803     |dispObj lft wdt top hgt x y mustClip|
       
  3804 
       
  3805     mustClip := false.    
  3804 
  3806 
  3805     "/ REDRAW LABEL
  3807     "/ REDRAW LABEL
  3806     (aGC isEnabled and:[self isEnabled]) ifTrue:[
  3808     (aGC isEnabled and:[self isEnabled]) ifTrue:[
  3807         dispObj := printableLabel.
  3809         dispObj := printableLabel.
  3808     ] ifFalse:[
  3810     ] ifFalse:[
  3812             ]
  3814             ]
  3813         ]
  3815         ]
  3814     ].
  3816     ].
  3815 
  3817 
  3816     (aDirection == #top or:[aDirection == #bottom]) ifTrue:[
  3818     (aDirection == #top or:[aDirection == #bottom]) ifTrue:[
       
  3819         "/ horizontal drawing    
  3817         wdt := layout width - inset - inset - aTextRightInset.
  3820         wdt := layout width - inset - inset - aTextRightInset.
  3818         wdt > 4 ifFalse:[^ self].
  3821         wdt > 4 ifFalse:[^ self].
  3819         lft := layout left  + inset.
  3822         lft := layout left  + inset.
  3820 
  3823 
  3821         x := (wdt - extent x) // 2.
  3824         x := (wdt - extent x) // 2.
  3822         x < 0 ifTrue:[
  3825         x < 0 ifTrue:[
  3823             dispObj := '...'.
  3826             dispObj isString ifTrue:[
       
  3827                 "/ dispObj := '...'.
       
  3828                 "/ dispObj := (dispObj copyTo:3),'...'.
       
  3829             ].        
  3824             x := 0.
  3830             x := 0.
       
  3831             mustClip := true.    
  3825         ].
  3832         ].
  3826         x := x + lft.
  3833         x := x + lft.
  3827         y := layout top  + ((layout height - inset - extent y - 1) // 2).
  3834         y := layout top  + ((layout height - inset - extent y - 1) // 2).
  3828 
  3835 
  3829         aDirection == #top ifTrue:[ y := y + inset ].
  3836         aDirection == #top ifTrue:[ y := y + inset ].
  3830 
  3837 
  3831         y := y + (dispObj ascentOn:aGC).
  3838         y := y + (dispObj ascentOn:aGC).
  3832         dispObj displayOn:aGC x:x y:y.
  3839         mustClip ifTrue:[
  3833         ^ self
  3840             aGC clippedTo:layout do:[
  3834     ].
  3841                 dispObj displayOn:aGC x:x y:y.
  3835 
  3842             ]        
  3836     hgt := layout height - inset - inset - aTextRightInset.
  3843         ] ifFalse:[        
  3837     hgt > 4 ifFalse:[^ self].
  3844             dispObj displayOn:aGC x:x y:y.
  3838     top := layout top + inset.
  3845         ]
  3839 
  3846     ] ifFalse:[
  3840     y := (hgt - extent x) // 2.
  3847         "/ vertical drawing    
  3841     y < 0 ifTrue:[
  3848         hgt := layout height - inset - inset - aTextRightInset.
  3842         dispObj := '...'.
  3849         hgt > 4 ifFalse:[^ self].
  3843         y := 0.
  3850         top := layout top + inset.
  3844     ].
  3851 
  3845     y := y + top.
  3852         y := (hgt - extent x) // 2.
  3846     x := layout left + ((layout width  - inset - extent y +2) // 2).
  3853         y < 0 ifTrue:[
  3847 
  3854             dispObj := '...'.
  3848     aDirection == #left ifTrue:[ x := x + inset ].
  3855             y := 0.
  3849 
  3856         ].
  3850     dispObj isImageOrForm ifFalse:[
  3857         y := y + top.
  3851         dispObj isString ifTrue:[ 
  3858         x := layout left + ((layout width  - inset - extent y +2) // 2).
  3852             x := x + aGC font descent.
  3859 
  3853         ].
  3860         aDirection == #left ifTrue:[ x := x + inset ].
  3854         "/ workaround for a bug in display-with-angle,
  3861 
  3855         "/ iff displayed string is a labelAndIcon.
  3862         dispObj isImageOrForm ifFalse:[
  3856         "/ (In this case, display is always opaque, and the current
  3863             dispObj isString ifTrue:[ 
  3857         "/  backgroundPaint color is used to fill the underlying rectangle)
  3864                 x := x + aGC font descent.
  3858         "/
  3865             ].
  3859         aGC backgroundPaint:aGC backgroundColor.
  3866             "/ workaround for a bug in display-with-angle,
  3860         aGC displayString:dispObj x:x y:y angle:90.
  3867             "/ iff displayed string is a labelAndIcon.
  3861     ] ifTrue:[
  3868             "/ (In this case, display is always opaque, and the current
  3862         (dispObj rotated:90) displayOn:aGC x:x y:y.
  3869             "/  backgroundPaint color is used to fill the underlying rectangle)
  3863     ].
  3870             "/
       
  3871             aGC backgroundPaint:aGC backgroundColor.
       
  3872             aGC displayString:dispObj x:x y:y angle:90.
       
  3873         ] ifTrue:[
       
  3874             (dispObj rotated:90) displayOn:aGC x:x y:y.
       
  3875         ].
       
  3876     ]
  3864 ! !
  3877 ! !
  3865 
  3878 
  3866 !NoteBookView::Tab methodsFor:'private'!
  3879 !NoteBookView::Tab methodsFor:'private'!
  3867 
  3880 
  3868 getPrintableLabelFor:aGC
  3881 getPrintableLabelFor:aGC