TextRuler.st
changeset 3150 e3a55f15ef7e
parent 269 167651794a77
child 4770 6634b540fea2
equal deleted inserted replaced
3149:66df7168e377 3150:e3a55f15ef7e
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     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 
       
    13 "{ Package: 'stx:libwidg2' }"
    12 
    14 
    13 Ruler subclass:#TextRuler
    15 Ruler subclass:#TextRuler
    14 	 instanceVariableNames:'leftMargin rightMargin spec moving settingTab'
    16 	 instanceVariableNames:'leftMargin rightMargin spec moving settingTab'
    15 	 classVariableNames:'LeftAlignForm RightAlignForm AlignForm CenterForm LeftMarginForm
    17 	 classVariableNames:'LeftAlignForm RightAlignForm AlignForm CenterForm LeftMarginForm
    16 		RightMarginForm LeftTabForm RightTabForm CenterTabForm
    18 		RightMarginForm LeftTabForm RightTabForm CenterTabForm
    47     TextRuler new open
    49     TextRuler new open
    48 "
    50 "
    49 !
    51 !
    50 
    52 
    51 version
    53 version
    52     ^ '$Header: /cvs/stx/stx/libwidg2/TextRuler.st,v 1.14 1996-12-20 11:19:23 cg Exp $'
    54     ^ '$Header: /cvs/stx/stx/libwidg2/TextRuler.st,v 1.15 2006-11-13 16:11:31 cg Exp $'
    53 ! !
    55 ! !
    54 
    56 
    55 !TextRuler class methodsFor:'defaults'!
    57 !TextRuler class methodsFor:'defaults'!
    56 
    58 
    57 rightMarginForm
    59 rightMarginForm
   169 
   171 
   170     top := height - (font height) - (font ascent).
   172     top := height - (font height) - (font ascent).
   171 
   173 
   172     x := (self inchToPixel:leftMargin) rounded.
   174     x := (self inchToPixel:leftMargin) rounded.
   173     form := self class leftMarginForm.
   175     form := self class leftMarginForm.
   174     self displayForm:form 
   176     self displayForm:form
   175 		   x:(x - (form width // 2) - orgX)
   177 		   x:(x - (form width // 2) - orgX)
   176 		   y:(top - form height - orgY).
   178 		   y:(top - form height - orgY).
   177 
   179 
   178     x := (self inchToPixel:rightMargin) rounded.
   180     x := (self inchToPixel:rightMargin) rounded.
   179     form := self class rightMarginForm.
   181     form := self class rightMarginForm.
   180     self displayForm:form 
   182     self displayForm:form
   181 		   x:(x - (form width // 2) - orgX)
   183 		   x:(x - (form width // 2) - orgX)
   182 		   y:(top - form height - orgY).
   184 		   y:(top - form height - orgY).
   183 
   185 
   184     spec notNil ifTrue:[
   186     spec notNil ifTrue:[
   185 	tabStops := spec positions.
   187 	tabStops := spec positions.
   202 				form := self class decimalTabForm
   204 				form := self class decimalTabForm
   203 			    ]
   205 			    ]
   204 			]
   206 			]
   205 		    ]
   207 		    ]
   206 		].
   208 		].
   207 		self displayForm:form 
   209 		self displayForm:form
   208 			       x:(x - (form width // 2) - orgX)
   210 			       x:(x - (form width // 2) - orgX)
   209 			       y:(top - form height - orgY)
   211 			       y:(top - form height - orgY)
   210 	    ]
   212 	    ]
   211 	]
   213 	]
   212     ]
   214     ]
   232 	form := self class rightMarginForm
   234 	form := self class rightMarginForm
   233     ].
   235     ].
   234 
   236 
   235     x := (self inchToPixel:this) rounded - (form width // 2).
   237     x := (self inchToPixel:this) rounded - (form width // 2).
   236     viewOrigin := self viewOrigin.
   238     viewOrigin := self viewOrigin.
   237     self displayForm:form 
   239     self displayForm:form
   238 		   x:x + viewOrigin x
   240 		   x:x + viewOrigin x
   239 		   y:(top - form height - viewOrigin y).
   241 		   y:(top - form height - viewOrigin y).
   240 
   242 
   241     "
   243     "
   242      if it covers any other, redraw them
   244      if it covers any other, redraw them
   269 	x := (self inchToPixel:rightMargin) rounded.
   271 	x := (self inchToPixel:rightMargin) rounded.
   270 	form := self class rightMarginForm
   272 	form := self class rightMarginForm
   271     ].
   273     ].
   272 
   274 
   273     viewOrigin := self viewOrigin.
   275     viewOrigin := self viewOrigin.
   274     self displayForm:form 
   276     self displayForm:form
   275 		   x:(x - (form width // 2) - viewOrigin x)
   277 		   x:(x - (form width // 2) - viewOrigin x)
   276 		   y:(top - form height - viewOrigin y).
   278 		   y:(top - form height - viewOrigin y).
   277 
   279 
   278 ! !
   280 ! !
   279 
   281 
   439 
   441 
   440 "/    lineSpacingField := EditField in:panel3.
   442 "/    lineSpacingField := EditField in:panel3.
   441 
   443 
   442 
   444 
   443     leftMargin := 0.0.
   445     leftMargin := 0.0.
   444     rightMargin := 8.5 
   446     rightMargin := 8.5
   445 
   447 
   446     "TextRuler new open"
   448     "TextRuler new open"
   447 ! !
   449 ! !
   448