TextRuler.st
changeset 20 bf516dd2433b
parent 11 793044d4bc90
child 28 ca403f4c5b86
equal deleted inserted replaced
19:79ab6bc98651 20:bf516dd2433b
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 Ruler subclass:#TextRuler
    13 Ruler subclass:#TextRuler
    14          instanceVariableNames:'leftMargin rightMargin tabStops tabTypes moving'
    14          instanceVariableNames:'leftMargin rightMargin tabSpec moving'
    15             classVariableNames:'LeftAlignForm RightAlignForm
    15             classVariableNames:'LeftAlignForm RightAlignForm
    16                                 AlignForm CenterForm LeftMarginForm
    16                                 AlignForm CenterForm LeftMarginForm
    17                                 RightMarginForm LeftTabForm RightTabForm
    17                                 RightMarginForm LeftTabForm RightTabForm
    18                                 CenterTabForm DecimalTabForm'
    18                                 CenterTabForm DecimalTabForm'
    19          poolDictionaries:''
    19          poolDictionaries:''
    24 COPYRIGHT (c) 1991 by Claus Gittinger
    24 COPYRIGHT (c) 1991 by Claus Gittinger
    25               All Rights Reserved
    25               All Rights Reserved
    26 
    26 
    27 a Ruler for page layout showing tabs., margins etc.
    27 a Ruler for page layout showing tabs., margins etc.
    28 
    28 
    29 $Header: /cvs/stx/stx/libwidg2/TextRuler.st,v 1.6 1994-08-05 01:24:10 claus Exp $
    29 $Header: /cvs/stx/stx/libwidg2/TextRuler.st,v 1.7 1994-08-23 23:44:32 claus Exp $
    30 written oct 91 by claus
    30 written oct 91 by claus
    31 '!
    31 '!
    32 
    32 
    33 !TextRuler class methodsFor:'defaults'!
    33 !TextRuler class methodsFor:'defaults'!
    34 
    34 
   336 !
   336 !
   337 
   337 
   338 redraw
   338 redraw
   339     "redraw margin & tab marks"
   339     "redraw margin & tab marks"
   340 
   340 
   341     |x top form tab type|
   341     |x top form tab type tabStops tabAlign|
   342 
   342 
   343     super redraw.
   343     super redraw.
   344 
   344 
   345     self paint:fgColor.
   345     self paint:fgColor.
   346     self background:viewBackground.
   346     self background:viewBackground.
   351     form := self class leftMarginForm.
   351     form := self class leftMarginForm.
   352     self displayOpaqueForm:form x:(x - (form width // 2))
   352     self displayOpaqueForm:form x:(x - (form width // 2))
   353                              y:(top - form height).
   353                              y:(top - form height).
   354     x := (self inchToPixel:rightMargin) rounded.
   354     x := (self inchToPixel:rightMargin) rounded.
   355     form := self class rightMarginForm.
   355     form := self class rightMarginForm.
   356     self displayOpaqueForm:form x:(x - (form width // 2))
   356     self displayOpaqueForm:form 
   357                              y:(top - form height).
   357                          x:(x - (form width // 2))
   358 
   358                          y:(top - form height).
       
   359 
       
   360     tabStops := tabSpec positions.
       
   361     tabAlign := tabSpec align.
   359     tabStops notNil ifTrue:[
   362     tabStops notNil ifTrue:[
   360         1 to:tabStops size do:[:tabNr |
   363         1 to:tabStops size do:[:tabNr |
   361             tab := tabStops at:tabNr.
   364             tab := tabStops at:tabNr.
   362             type := tabTypes at:tabNr.
   365             type := tabAlign at:tabNr.
   363             x := (self inchToPixel:tab) rounded.
   366             x := (tabSpec positionOfTab:tabNr on:self) rounded.
   364             (type == #left) ifTrue:[
   367             (type == #left) ifTrue:[
   365                 form := self class leftTabForm
   368                 form := self class leftTabForm
   366             ] ifFalse:[
   369             ] ifFalse:[
   367                 (type == #right) ifTrue:[
   370                 (type == #right) ifTrue:[
   368                     form := self class rightTabForm
   371                     form := self class rightTabForm
   374                             form := self class decimalTabForm
   377                             form := self class decimalTabForm
   375                         ]
   378                         ]
   376                     ]
   379                     ]
   377                 ]
   380                 ]
   378             ].
   381             ].
   379             self displayOpaqueForm:form x:(x - (form width // 2))
   382             self displayOpaqueForm:form 
   380                                         y:(top - form height)
   383 				 x:(x - (form width // 2))
       
   384                                  y:(top - form height)
   381         ]
   385         ]
   382     ]
   386     ]
   383 ! !
   387 ! !