TabulatorSpecification.st
changeset 4986 0ae76174b28a
parent 4477 b7e2eb4be837
equal deleted inserted replaced
4985:818d298db0df 4986:0ae76174b28a
     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 "{ Package: 'stx:libwidg2' }"
    12 "{ Package: 'stx:libwidg2' }"
       
    13 
       
    14 "{ NameSpace: Smalltalk }"
    13 
    15 
    14 Model subclass:#TabulatorSpecification
    16 Model subclass:#TabulatorSpecification
    15 	instanceVariableNames:'tabUnit unitReference tabPositions tabTypes'
    17 	instanceVariableNames:'tabUnit unitReference tabPositions tabTypes'
    16 	classVariableNames:''
    18 	classVariableNames:''
    17 	poolDictionaries:''
    19 	poolDictionaries:''
   446 
   448 
   447 pixelsPerUnitOn:aGC
   449 pixelsPerUnitOn:aGC
   448     "return the number of device pixels one unit of my tabs
   450     "return the number of device pixels one unit of my tabs
   449      takes on aGC"
   451      takes on aGC"
   450 
   452 
   451     |device mm|
   453     |gcDevice mm|
   452 
   454 
   453     tabUnit isNil ifTrue:[
   455     tabUnit isNil ifTrue:[
   454         tabUnit := #col
   456         tabUnit := #col
   455     ].
   457     ].
   456     tabUnit == #relative ifTrue:[
   458     tabUnit == #relative ifTrue:[
   457         ^ unitReference width
   459         ^ unitReference width
   458     ].
   460     ].
   459     tabUnit == #col ifTrue:[
   461     tabUnit == #col ifTrue:[
   460         ^ aGC font width
   462         ^ aGC font width
   461     ].
   463     ].
   462     device := aGC graphicsDevice.
   464     gcDevice := aGC graphicsDevice.
   463     tabUnit == #inch ifTrue:[
   465     tabUnit == #inch ifTrue:[
   464         ^ device horizontalPixelPerInch
   466         ^ gcDevice horizontalPixelPerInch
   465     ].
   467     ].
   466     mm := device horizontalPixelPerMillimeter.
   468     mm := gcDevice horizontalPixelPerMillimeter.
   467     tabUnit == #mm ifTrue:[
   469     tabUnit == #mm ifTrue:[
   468         ^ mm
   470         ^ mm
   469     ].
   471     ].
   470     tabUnit == #cm ifTrue:[
   472     tabUnit == #cm ifTrue:[
   471         ^ mm * 10
   473         ^ mm * 10
   543 ! !
   545 ! !
   544 
   546 
   545 !TabulatorSpecification class methodsFor:'documentation'!
   547 !TabulatorSpecification class methodsFor:'documentation'!
   546 
   548 
   547 version
   549 version
   548     ^ '$Header: /cvs/stx/stx/libwidg2/TabulatorSpecification.st,v 1.16 2014-01-27 16:06:18 stefan Exp $'
   550     ^ '$Header$'
   549 ! !
   551 ! !
   550 
   552