bad hack: allow for gridParameters to specify fg & bg
colors of grid-pattern.
--- a/ObjectView.st Tue Jun 22 09:41:04 2004 +0200
+++ b/ObjectView.st Fri Jun 25 11:54:53 2004 +0200
@@ -1501,7 +1501,8 @@
the numbers are interpreted."
|mmH mmV params showDocumentBoundary gridW gridH
- bigStepH bigStepV littleStepH littleStepV hires devPixmap colorMap|
+ bigStepH bigStepV littleStepH littleStepV hires
+ devPixmap colorMap fg bg|
mmH := self horizontalPixelPerMillimeter.
mmV := self verticalPixelPerMillimeter.
@@ -1514,6 +1515,14 @@
littleStepH := params at:3.
littleStepV := params at:4.
showDocumentBoundary := params at:7.
+ fg := Black.
+ bg := White.
+ params size >= 8 ifTrue:[
+ bg := params at:8.
+ params size >= 9 ifTrue:[
+ fg := params at:9.
+ ].
+ ].
transformation notNil ifTrue:[
mmH := mmH * transformation scale x.
@@ -1552,7 +1561,7 @@
].
gridPixmap := Form width:gridW height:gridH depth:1.
- gridPixmap colorMap:(Array with:White with:Black).
+ gridPixmap colorMap:(Array with:bg with:fg).
gridPixmap clear.
gridPixmap paint:(Color colorId:1).
@@ -1667,13 +1676,15 @@
which control the appearance of the grid-pattern.
the elements are:
- bigStepH number of pixels horizontally between 2 major steps
- bigStepV number of pixels vertically between 2 major steps
- littleStepH number of pixels horizontally between 2 minor steps
- littleStepV number of pixels vertically between 2 minor steps
- gridAlignH number of pixels for horizontal grid align (pointer snap)
- gridAlignV number of pixels for vertical grid align (pointer snap)
- docBounds true, if document boundary should be shown
+ bigStepH number of pixels horizontally between 2 major steps
+ bigStepV number of pixels vertically between 2 major steps
+ littleStepH number of pixels horizontally between 2 minor steps
+ littleStepV number of pixels vertically between 2 minor steps
+ gridAlignH number of pixels for horizontal grid align (pointer snap)
+ gridAlignV number of pixels for vertical grid align (pointer snap)
+ docBounds true, if document boundary should be shown
+ bgColor grid bg-color [optional]
+ fgColor grid fg-color [optional]
if littleStepH/V are nil, only bigSteps are drawn.
"
@@ -1698,14 +1709,14 @@
steps.
"
(scaleMetric == #mm) ifTrue:[
- "dots every mm; lines every cm"
- bigStepH := mmH * 10.0.
- bigStepV := mmV * 10.0.
- (transformation notNil
- and:[transformation scale <= 0.5]) ifFalse:[
- littleStepH := mmH.
- littleStepV := mmV
- ]
+ "dots every mm; lines every cm"
+ bigStepH := mmH * 10.0.
+ bigStepV := mmV * 10.0.
+ (transformation notNil
+ and:[transformation scale <= 0.5]) ifFalse:[
+ littleStepH := mmH.
+ littleStepV := mmV
+ ]
].
"
inch grid: small steps every 1/8th inch, big step every half inch
@@ -1713,22 +1724,22 @@
or even turn them off completely.
"
(scaleMetric == #inch) ifTrue:[
- "dots every eights inch; lines every half inch"
- bigStepH := mmH * (25.4 / 2).
- bigStepV := mmV * (25.4 / 2).
- (transformation notNil
- and:[transformation scale <= 0.5]) ifTrue:[
- transformation scale > 0.2 ifTrue:[
- littleStepH := mmH * (25.4 / 4).
- littleStepV := mmV * (25.4 / 4)
- ]
- ] ifFalse:[
- littleStepH := mmH * (25.4 / 8).
- littleStepV := mmV * (25.4 / 8)
- ]
+ "dots every eights inch; lines every half inch"
+ bigStepH := mmH * (25.4 / 2).
+ bigStepV := mmV * (25.4 / 2).
+ (transformation notNil
+ and:[transformation scale <= 0.5]) ifTrue:[
+ transformation scale > 0.2 ifTrue:[
+ littleStepH := mmH * (25.4 / 4).
+ littleStepV := mmV * (25.4 / 4)
+ ]
+ ] ifFalse:[
+ littleStepH := mmH * (25.4 / 8).
+ littleStepV := mmV * (25.4 / 8)
+ ]
].
- arr := Array new:8.
+ arr := Array new:9.
arr at:1 put:bigStepH.
arr at:2 put:bigStepV.
arr at:3 put:littleStepH.
@@ -1736,6 +1747,8 @@
arr at:5 put:littleStepH.
arr at:6 put:littleStepV.
arr at:7 put:false.
+ arr at:8 put:White.
+ arr at:9 put:Black.
^ arr
!
@@ -1752,9 +1765,17 @@
called after any change in the grid. It (re)creates the gridPixmap,
clears the view and redraws all visible objects."
+ |params bg|
+
gridPixmap := nil.
shown ifTrue:[
- self viewBackground:White.
+ params := self gridParameters.
+ bg := White.
+ params size >= 8 ifTrue:[
+ bg := params at:8.
+ ].
+
+ self viewBackground:bg.
self clearView.
].
@@ -3325,5 +3346,5 @@
!ObjectView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.102 2004-05-28 12:32:40 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.103 2004-06-25 09:54:53 ca Exp $'
! !