--- a/GraphColumn.st Fri Nov 10 07:20:31 2006 +0100
+++ b/GraphColumn.st Mon Nov 13 17:11:31 2006 +0100
@@ -1,3 +1,5 @@
+"{ Package: 'stx:libwidg2' }"
+
Model subclass:#GraphColumn
instanceVariableNames:'aspects functionYblock'
classVariableNames:''
@@ -15,12 +17,12 @@
[author:]
- Claus Atzkern
+ Claus Atzkern
[see also:]
- GraphColumnView
- GraphColumnView2D
- GraphColumnView3D
+ GraphColumnView
+ GraphColumnView2D
+ GraphColumnView3D
"
! !
@@ -40,7 +42,7 @@
lineStyleFor:aStyle
"returns the valid style for a style; supported styles
are:
- #dashed and #solid
+ #dashed and #solid
"
^ aStyle == #dashed ifFalse:[#solid] ifTrue:[#dashed]
@@ -68,32 +70,32 @@
<resource: #menu>
^
-
+
#(#Menu
-
- #(
- #(#MenuItem
- #'label:' 'Style'
- #'argument:' #'lineStyle:'
- #'submenuChannel:' #'styleMenuSelector:'
- )
- #(#MenuItem
- #'label:' 'Size'
- #'argument:' #'lineWidth:'
- #'submenuChannel:' #'widthMenuSelector:'
- )
- #(#MenuItem
- #'label:' 'Color'
- #'argument:' #'foregroundColor:'
- #'submenuChannel:' #'colorMenuSelector:'
- )
- #(#MenuItem
- #'label:' 'Zoom Y'
- #'argument:' #'zoomY:'
- #'submenuChannel:' #'zoomMenuSelector:'
- )
- ) nil
- nil
+
+ #(
+ #(#MenuItem
+ #'label:' 'Style'
+ #'argument:' #'lineStyle:'
+ #'submenuChannel:' #'styleMenuSelector:'
+ )
+ #(#MenuItem
+ #'label:' 'Size'
+ #'argument:' #'lineWidth:'
+ #'submenuChannel:' #'widthMenuSelector:'
+ )
+ #(#MenuItem
+ #'label:' 'Color'
+ #'argument:' #'foregroundColor:'
+ #'submenuChannel:' #'colorMenuSelector:'
+ )
+ #(#MenuItem
+ #'label:' 'Zoom Y'
+ #'argument:' #'zoomY:'
+ #'submenuChannel:' #'zoomMenuSelector:'
+ )
+ ) nil
+ nil
)
!
@@ -105,20 +107,20 @@
height := 10.
#( #solid #dashed ) do:[:style|
- bitmap := Form width:width height:height depth:1.
- bitmap paint:(Color colorId:1).
- bitmap fillRectangleX:0 y:0 width:width height:height.
+ bitmap := Form width:width height:height depth:1.
+ bitmap paint:(Color colorId:1).
+ bitmap fillRectangleX:0 y:0 width:width height:height.
- bitmap paint:(Color colorId:0).
- bitmap fillRectangleX:0 y:0 width:width height:height.
- bitmap paint:(Color colorId:1).
- bitmap lineWidth:2.
- bitmap lineStyle:style.
- bitmap displayLineFromX:2 y:(height // 2) toX:width-2 y:(height // 2).
- item := MenuItem labeled:bitmap.
- item value:aSelector.
- item argument:style.
- menu addItem:item.
+ bitmap paint:(Color colorId:0).
+ bitmap fillRectangleX:0 y:0 width:width height:height.
+ bitmap paint:(Color colorId:1).
+ bitmap lineWidth:2.
+ bitmap lineStyle:style.
+ bitmap displayLineFromX:2 y:(height // 2) toX:width-2 y:(height // 2).
+ item := MenuItem labeled:bitmap.
+ item value:aSelector.
+ item argument:style.
+ menu addItem:item.
].
^ menu
@@ -135,22 +137,22 @@
width := 40.
#( 1 2 3 4 5 6 ) do:[:height|
- bitmap := Form width:width height:height depth:1.
- bitmap paint:(Color colorId:1).
- bitmap fillRectangleX:0 y:0 width:width height:height.
+ bitmap := Form width:width height:height depth:1.
+ bitmap paint:(Color colorId:1).
+ bitmap fillRectangleX:0 y:0 width:width height:height.
- item := MenuItem labeled:bitmap.
- item value:aSelector.
- item argument:height.
- menu addItem:item.
+ item := MenuItem labeled:bitmap.
+ item value:aSelector.
+ item argument:height.
+ menu addItem:item.
].
item := MenuItem labeled:'other ..'.
item value:[:arg :panel||n|
- n := Number fromString:(Dialog request:'size:') onError:nil.
+ n := Number fromString:(Dialog request:'size:') onError:nil.
- n notNil ifTrue:[
- panel receiver perform:aSelector with:n
- ]
+ n notNil ifTrue:[
+ panel receiver perform:aSelector with:n
+ ]
].
menu addItem:item.
^ menu
@@ -170,22 +172,22 @@
width := 40.
#( 25 50 75 nil 100 nil 150 200 nil ) do:[:zY|
- zY notNil ifTrue:[
- item := MenuItem labeled:(zY printString, ' %' ).
- item value:aSelector.
- item argument:(zY / 100).
- ] ifFalse:[
- item := MenuItem labeled:'-'.
- ].
- menu addItem:item.
+ zY notNil ifTrue:[
+ item := MenuItem labeled:(zY printString, ' %' ).
+ item value:aSelector.
+ item argument:(zY / 100).
+ ] ifFalse:[
+ item := MenuItem labeled:'-'.
+ ].
+ menu addItem:item.
].
item := MenuItem labeled:'other ..'.
item value:[:arg :panel||n|
- n := Number fromString:(Dialog request:'zoom %:') onError:nil.
+ n := Number fromString:(Dialog request:'zoom %:') onError:nil.
- n notNil ifTrue:[
- panel receiver perform:aSelector with:(n / 100)
- ]
+ n notNil ifTrue:[
+ panel receiver perform:aSelector with:(n / 100)
+ ]
].
menu addItem:item.
^ menu
@@ -353,7 +355,7 @@
default style is used (#solid).
Supported styles are:
- #solid or #dashed
+ #solid or #dashed
"
^ aspects at:#lineStyle ifAbsent:#solid
!
@@ -363,7 +365,7 @@
in case of a non valid style, the default style is used (#solid).
Supported styles are:
- #solid or #dashed
+ #solid or #dashed
"
self aspectAt:#lineStyle put:(self class lineStyleFor:aStyle)
!
@@ -409,7 +411,7 @@
|col|
col := (aCollection size ~~ 0) ifTrue:[aCollection]
- ifFalse:[nil].
+ ifFalse:[nil].
self aspectAt:#hLineList put:col
!
@@ -419,7 +421,7 @@
defined, the default style is used (#solid).
Supported styles are:
- #solid or #dashed
+ #solid or #dashed
"
^ aspects at:#hLineStyle ifAbsent:#solid
!
@@ -429,7 +431,7 @@
or in case of a non valid style, the default style is used (#solid).
Supported styles are:
- #solid or #dashed.
+ #solid or #dashed.
"
self aspectAt:#hLineStyle put:(self class lineStyleFor:aStyle)
@@ -491,7 +493,7 @@
|col|
col := (aCollection size ~~ 0) ifTrue:[aCollection]
- ifFalse:[nil].
+ ifFalse:[nil].
self withoutNotificationAspectAt:#hLineList put:col
!
@@ -502,7 +504,7 @@
No change notification is raised.
Supported styles are:
- #solid or #dashed.
+ #solid or #dashed.
"
self withoutNotificationAspectAt:#hLineStyle put:(self class lineStyleFor:aStyle)
@@ -524,7 +526,7 @@
No change notification is raised.
Supported styles are:
- #solid or #dashed
+ #solid or #dashed
"
self withoutNotificationAspectAt:#lineStyle put:(self class lineStyleFor:aStyle)
@@ -551,7 +553,7 @@
No change notification is raised.
"
self withoutNotificationAspectAt:#relativeXaxis
- put:(self numberFrom:aValue onError:[0.5])
+ put:(self numberFrom:aValue onError:[0.5])
!
@@ -570,7 +572,7 @@
!
setShown:aState
- "set the visibility state of the column;
+ "set the visibility state of the column;
no notification is raised
"
self withoutNotificationAspectAt:#shown put:aState
@@ -581,7 +583,7 @@
no notification is raised
"
self withoutNotificationAspectAt:#transY
- put:(self integerFrom:aValue onError:[0])
+ put:(self integerFrom:aValue onError:[0])
!
setZoomY:aFactor
@@ -616,10 +618,10 @@
oldValue := aspects at:aKey ifAbsent:nil.
oldValue ~= aValue ifTrue:[
- aValue isNil ifTrue:[aspects removeKey:aKey]
- ifFalse:[aspects at:aKey put:aValue].
+ aValue isNil ifTrue:[aspects removeKey:aKey]
+ ifFalse:[aspects at:aKey put:aValue].
- self changed:aKey with:oldValue
+ self changed:aKey with:oldValue
]
!
@@ -630,9 +632,9 @@
|oldAspects|
aDictionaryOrNil == aspects ifFalse:[
- oldAspects := aspects.
- self setAspects:aDictionaryOrNil.
- self changed:#aspects with:oldAspects.
+ oldAspects := aspects.
+ self setAspects:aDictionaryOrNil.
+ self changed:#aspects with:oldAspects.
]
!
@@ -641,16 +643,16 @@
nil, the default aspects are set
"
aDictionaryOrNil isNil ifTrue:[
- aspects := IdentityDictionary new.
+ aspects := IdentityDictionary new.
- aspects at:#hLineWidth put:1.
- aspects at:#lineWidth put:1.
- aspects at:#scaleY put:1.
- aspects at:#zoomY put:1.
- aspects at:#transY put:0.
- aspects at:#relativeXaxis put:0.5.
+ aspects at:#hLineWidth put:1.
+ aspects at:#lineWidth put:1.
+ aspects at:#scaleY put:1.
+ aspects at:#zoomY put:1.
+ aspects at:#transY put:0.
+ aspects at:#relativeXaxis put:0.5.
] ifFalse:[
- aspects := aDictionaryOrNil
+ aspects := aDictionaryOrNil
]
!
@@ -658,7 +660,7 @@
"set an aspect without a change notification
"
aValue notNil ifTrue:[ aspects at:aKey put:aValue ]
- ifFalse:[ aspects removeKey:aKey ifAbsent:nil ]
+ ifFalse:[ aspects removeKey:aKey ifAbsent:nil ]
! !
!GraphColumn methodsFor:'conversion'!
@@ -669,8 +671,8 @@
|v|
aValue isNumber ifTrue:[
- ^ aValue isInteger ifTrue:[aValue]
- ifFalse:[(aValue asFloat) rounded] "/ no fractions
+ ^ aValue isInteger ifTrue:[aValue]
+ ifFalse:[(aValue asFloat) rounded] "/ no fractions
].
^ aBlock value
@@ -682,8 +684,8 @@
the result of the block is returned
"
aValue isNumber ifTrue:[
- ^ aValue isInteger ifTrue:[aValue]
- ifFalse:[aValue asFloat] "/ no fractions
+ ^ aValue isInteger ifTrue:[aValue]
+ ifFalse:[aValue asFloat] "/ no fractions
].
^ aBlock value
! !
@@ -729,5 +731,5 @@
!GraphColumn class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumn.st,v 1.3 1998-02-13 13:51:54 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumn.st,v 1.4 2006-11-13 16:11:29 cg Exp $'
! !