--- a/BlockValue.st Sat Jan 27 16:06:13 1996 +0100
+++ b/BlockValue.st Sat Jan 27 19:36:37 1996 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -23,7 +23,7 @@
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -51,77 +51,78 @@
"
checkToggle 3 shows the value of toggle1 AND toggle2
- |val1 val2 both box|
+ |val1 val2 both box|
- val1 := false asValue.
- val2 := false asValue.
- both := BlockValue
- with:[:v1 :v2 |
- Transcript showCr:'evaluating ...'.
- v1 value and:[v2 value]
- ]
- arguments:(Array with:val1 with:val2).
+ val1 := false asValue.
+ val2 := false asValue.
+ both := BlockValue
+ with:[:v1 :v2 |
+ Transcript showCr:'evaluating ...'.
+ v1 value and:[v2 value]
+ ]
+ arguments:(Array with:val1 with:val2).
- box := Dialog new.
- box addCheckBox:'one' on:val1.
- box addCheckBox:'two' on:val2.
- box addHorizontalLine.
- box addCheckBox:'both' on:both.
- box open
+ box := Dialog new.
+ box addCheckBox:'one' on:val1.
+ box addCheckBox:'two' on:val2.
+ box addHorizontalLine.
+ box addCheckBox:'both' on:both.
+ box open
the same, using a convenient instance creation message:
- |val1 val2 both box|
+ |val1 val2 both box|
- val1 := false asValue.
- val2 := false asValue.
- both := BlockValue forLogical:val1 and:val2.
+ val1 := false asValue.
+ val2 := false asValue.
+ both := BlockValue forLogical:val1 and:val2.
- box := Dialog new.
- box addCheckBox:'one' on:val1.
- box addCheckBox:'two' on:val2.
- box addHorizontalLine.
- box addCheckBox:'both' on:both.
- box open
+ box := Dialog new.
+ box addCheckBox:'one' on:val1.
+ box addCheckBox:'two' on:val2.
+ box addHorizontalLine.
+ box addCheckBox:'both' on:both.
+ box open
logical or:
- |val1 val2 both box|
+ |val1 val2 both box|
- val1 := false asValue.
- val2 := false asValue.
- both := BlockValue forLogical:val1 or:val2.
+ val1 := false asValue.
+ val2 := false asValue.
+ both := BlockValue forLogical:val1 or:val2.
- box := Dialog new.
- box addCheckBox:'one' on:val1.
- box addCheckBox:'two' on:val2.
- box addHorizontalLine.
- box addCheckBox:'both' on:both.
- box open
+ box := Dialog new.
+ box addCheckBox:'one' on:val1.
+ box addCheckBox:'two' on:val2.
+ box addHorizontalLine.
+ box addCheckBox:'both' on:both.
+ box open
example use: enabling an element depending on two others:
- |val1 val2 enabler val3 box|
+ |val1 val2 enabler val3 box|
- val1 := false asValue.
- val2 := false asValue.
- val3 := false asValue.
- enabler := BlockValue forLogical:val1 and:val2.
+ val1 := false asValue.
+ val2 := false asValue.
+ val3 := false asValue.
+ enabler := BlockValue forLogical:val1 and:val2.
- box := Dialog new.
- box addCheckBox:'one' on:val1.
- box addCheckBox:'two' on:val2.
- box addHorizontalLine.
- (box addCheckBox:'three' on:val3) enableChannel:enabler.
- box open
+ box := Dialog new.
+ box addCheckBox:'one' on:val1.
+ box addCheckBox:'two' on:val2.
+ box addHorizontalLine.
+ (box addCheckBox:'three' on:val3) enableChannel:enabler.
+ box open
"
! !
!BlockValue class methodsFor:'initialization'!
initialize
- NeverComputed := Object new.
-
+ NeverComputed isNil ifTrue:[
+ NeverComputed := Object new.
+ ]
! !
!BlockValue class methodsFor:'instance creation'!
@@ -130,8 +131,8 @@
"return a new BlockValue computing the logical AND of its args"
^ (super new)
- setBlock:[:a :b | a value and:[b value]]
- arguments:(Array with:arg1 with:arg2)
+ setBlock:[:a :b | a value and:[b value]]
+ arguments:(Array with:arg1 with:arg2)
"Created: 16.12.1995 / 19:20:14 / cg"
!
@@ -140,8 +141,8 @@
"return a new BlockValue computing the logical OR of its args"
^ (super new)
- setBlock:[:a :b | a value or:[b value]]
- arguments:(Array with:arg1 with:arg2)
+ setBlock:[:a :b | a value or:[b value]]
+ arguments:(Array with:arg1 with:arg2)
"Created: 16.12.1995 / 19:20:14 / cg"
!
@@ -174,9 +175,9 @@
dependOn:someObject
arguments isNil ifTrue:[
- arguments := Array with:someObject
+ arguments := Array with:someObject
] ifFalse:[
- arguments := arguments copyWith:someObject
+ arguments := arguments copyWith:someObject
].
someObject addDependent:self
@@ -185,7 +186,7 @@
evaluate
arguments isNil ifTrue:[
- ^ block value
+ ^ block value
].
^ block valueWithArguments:(arguments asArray)
@@ -195,7 +196,7 @@
setBlock:aBlock
block := aBlock.
arguments notNil ifTrue:[
- self release
+ self release
].
arguments := nil.
cachedValue := NeverComputed.
@@ -207,11 +208,11 @@
setBlock:aBlock arguments:aCollectionOfArguments
block := aBlock.
arguments notNil ifTrue:[
- self release
+ self release
].
arguments := aCollectionOfArguments.
arguments do:[:arg |
- arg addDependent:self
+ arg addDependent:self
].
cachedValue := NeverComputed.
@@ -230,7 +231,7 @@
value
cachedValue == NeverComputed ifTrue:[
- cachedValue := self evaluate
+ cachedValue := self evaluate
].
^ cachedValue
@@ -246,7 +247,7 @@
oldValue := cachedValue.
cachedValue := self evaluate.
oldValue ~~ cachedValue ifTrue:[
- self changed:#value
+ self changed:#value
].
"Created: 16.12.1995 / 19:22:54 / cg"
@@ -257,7 +258,7 @@
release
arguments notNil ifTrue:[
- arguments do:[:arg | arg removeDependent:self].
+ arguments do:[:arg | arg removeDependent:self].
].
"Modified: 16.12.1995 / 19:21:11 / cg"
@@ -266,6 +267,6 @@
!BlockValue class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/BlockValue.st,v 1.3 1996-01-26 18:29:54 ah Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/BlockValue.st,v 1.4 1996-01-27 18:36:36 cg Exp $'
! !
BlockValue initialize!
--- a/Icon.st Sat Jan 27 16:06:13 1996 +0100
+++ b/Icon.st Sat Jan 27 19:36:37 1996 +0100
@@ -22,7 +22,7 @@
!Icon class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Icon.st,v 1.5 1995-11-11 16:04:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Icon.st,v 1.6 1996-01-27 18:36:37 cg Exp $'
!
documentation
@@ -88,7 +88,9 @@
!
initialize
- KnownIcons := IdentityDictionary new
+ KnownIcons isNil ifTrue:[
+ KnownIcons := IdentityDictionary new
+ ]
"
Icon initialize