--- a/MCLEntry.st Sat Feb 11 17:52:33 1995 +0100
+++ b/MCLEntry.st Fri Feb 17 14:24:24 1995 +0100
@@ -1,4 +1,14 @@
-'From Smalltalk/X, Version:2.10.3 on 12-aug-1994 at 10:44:03 pm'!
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
Object subclass:#MultiColListEntry
instanceVariableNames:'strings tabSpec'
@@ -9,79 +19,48 @@
!MultiColListEntry class methodsFor:'documentation'!
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libwidg2/Attic/MCLEntry.st,v 1.4 1995-02-17 13:23:47 claus Exp $
+"
+!
+
documentation
"
Instances of MultiColListEntry can be used in place of strings
- of a list in a ListView or SelectionInListView.
+ as entries of the list in a ListView or SelectionInListView.
They allow data to be presented in table (or any other) form.
- See example in TabulatorSpecs documentation.
- Notice, that each entry can have its own (or a shared) tabulator specification.
-"
-! !
+ See example here and in TabulatorSpecs documentation.
+ Notice, that each entry can have its own tabulator specification;
+ although, usually all share a single spec.
+ Also, notice that each column may align different; making these
+ perfect elements to present table data.
-!MultiColListEntry methodsFor:'accessing'!
-
-colAt:index put:aString
- strings isNil ifTrue:[
- strings := OrderedCollection new:index
- ].
- strings grow:index.
- strings at:index put:aString
+ MultiColListEntry and TabulatorSpec were originally created to
+ support nice tabular display of file-lists in the FileBrowser;
+ you may many other uses ...
+"
!
-tabulatorSpecification:aTabSpec
- tabSpec := aTabSpec
-! !
-
-!MultiColListEntry methodsFor:'converting'!
-
-asString
- "return the receiver as a string with embedded tabs"
-
- |s sub tab|
-
- s := ''.
- tab := Character tab asString.
- 1 to:strings size do:[:subStringIndex |
- sub := strings at:subStringIndex.
- sub notNil ifTrue:[
- s := s , (strings at:subStringIndex).
- ].
- subStringIndex == strings size ifFalse:[
- s := s , tab
- ]
- ].
-
- ^ s
-! !
+examples
+"
+ 'putting multiColListEntries into a ListView
+ (instead of strings)'
-!MultiColListEntry methodsFor:'drawing'!
-
-displayOn:aGC x:x y:y
- |xPos subString tabPos w prevString|
-
- xPos := x.
- prevString := ''.
- strings keysAndValuesDo:[:index :subString |
- subString notNil ifTrue:[
- "
- find next tab
- "
- tabPos := tabSpec positionOfTab:index forString:subString on:aGC.
- tabPos isNil ifTrue:[
- "
- no tab - just continue where we are ...
- "
- xPos := xPos + (aGC font widthOf:prevString).
- ] ifFalse:[
- xPos := tabPos + x.
- ].
- aGC displayString:subString x:xPos y:y.
- prevString := subString.
- ]
- ].
-
- "
|v e myList tabs|
myList := OrderedCollection new.
@@ -115,8 +94,11 @@
v := ListView new.
v setList:myList expandTabs:false.
v open
- "
- "
+
+
+
+ 'many multiColListEntries in a scrollable ListView'
+
|v e myList tabs|
myList := OrderedCollection new.
@@ -137,8 +119,11 @@
v := ScrollableView for:ListView.
v setList:myList expandTabs:false.
v open
- "
- "
+
+
+
+ 'like above, but adds nice alignments'
+
|v e myList tabs|
myList := OrderedCollection new.
@@ -161,12 +146,19 @@
v := ScrollableView for:ListView.
v setList:myList expandTabs:false.
v open
- "
- "
+
+
+
+ 'specifying tabs in inches'
+
|v e myList tabs|
myList := OrderedCollection new.
+ tabs := TabulatorSpecification new.
+ tabs unit:#inch.
+ tabs positions:#(0 2 3.5 4 6 8 10 12).
+
e := MultiColListEntry new.
e colAt:1 put:'2'.
e colAt:2 put:'3.5'.
@@ -175,12 +167,118 @@
e colAt:5 put:'8'.
e colAt:6 put:'10'.
e colAt:7 put:'12'.
- e tabPositions:#(0 2 3.5 4 6 8 10 12); tabUnit:#inch.
+ e tabulatorSpecification:tabs.
+ myList add:e.
+
+ v := ScrollableView for:ListView.
+ v setList:myList expandTabs:false.
+ v open
+
+
+ 'if you have the columns available as a collection,
+ setup can be done easier'
+
+ |v e myList tabs|
+
+ myList := OrderedCollection new.
+
+ tabs := TabulatorSpecification new.
+ tabs unit:#inch.
+ tabs positions:#(0 2 3.5 4 6 8 10 12).
+
+ e := MultiColListEntry new.
+ e strings:#('2' '3.5' '4' '6' '8' '10' '12').
+ e tabulatorSpecification:tabs.
myList add:e.
v := ScrollableView for:ListView.
v setList:myList expandTabs:false.
v open
- "
+"
+! !
+
+!MultiColListEntry methodsFor:'accessing'!
+
+strings:aCollectionOfStrings
+ "replace all substrings"
+
+ strings := OrderedCollection withAll:aCollectionOfStrings.
+!
+
+colAt:index
+ "return the substring at column index"
+
+ index > strings size ifTrue:[^ nil].
+ ^ strings at:index
+!
+
+colAt:index put:aString
+ "replace the substring at column index"
+
+ strings isNil ifTrue:[
+ strings := OrderedCollection new:index
+ ].
+ strings grow:index.
+ strings at:index put:aString
+!
+
+tabulatorSpecification:aTabSpec
+ "set the tabulator spec"
+
+ tabSpec := aTabSpec
! !
+!MultiColListEntry methodsFor:'converting'!
+
+asString
+ "return the receiver as a string with embedded tabs"
+
+ |s sub tab
+ nSub "{ Class: SmallInteger }"|
+
+ s := ''.
+ tab := Character tab asString.
+ nSub := strings size.
+ 1 to:nSub do:[:subStringIndex |
+ sub := strings at:subStringIndex.
+ sub notNil ifTrue:[
+ s := s , sub.
+ ].
+ subStringIndex == strings size ifFalse:[
+ s := s , tab
+ ]
+ ].
+
+ ^ s
+! !
+
+!MultiColListEntry methodsFor:'drawing'!
+
+displayOn:aGC x:x y:y
+ "display the receiver on a GC"
+
+ |xPos subString tabPos w prevString|
+
+ xPos := x.
+ prevString := ''.
+ strings keysAndValuesDo:[:index :subString |
+ subString notNil ifTrue:[
+ "
+ find next tab
+ "
+ tabPos := tabSpec positionOfTab:index forString:subString on:aGC.
+ tabPos isNil ifTrue:[
+ "
+ no tab - just continue where we are ...
+ "
+ xPos := xPos + (aGC font widthOf:prevString).
+ ] ifFalse:[
+ xPos := tabPos + x.
+ ].
+ aGC displayString:subString x:xPos y:y.
+ prevString := subString.
+ ]
+ ].
+
+! !
+
--- a/MultiColListEntry.st Sat Feb 11 17:52:33 1995 +0100
+++ b/MultiColListEntry.st Fri Feb 17 14:24:24 1995 +0100
@@ -1,4 +1,14 @@
-'From Smalltalk/X, Version:2.10.3 on 12-aug-1994 at 10:44:03 pm'!
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
Object subclass:#MultiColListEntry
instanceVariableNames:'strings tabSpec'
@@ -9,79 +19,48 @@
!MultiColListEntry class methodsFor:'documentation'!
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libwidg2/MultiColListEntry.st,v 1.4 1995-02-17 13:23:47 claus Exp $
+"
+!
+
documentation
"
Instances of MultiColListEntry can be used in place of strings
- of a list in a ListView or SelectionInListView.
+ as entries of the list in a ListView or SelectionInListView.
They allow data to be presented in table (or any other) form.
- See example in TabulatorSpecs documentation.
- Notice, that each entry can have its own (or a shared) tabulator specification.
-"
-! !
+ See example here and in TabulatorSpecs documentation.
+ Notice, that each entry can have its own tabulator specification;
+ although, usually all share a single spec.
+ Also, notice that each column may align different; making these
+ perfect elements to present table data.
-!MultiColListEntry methodsFor:'accessing'!
-
-colAt:index put:aString
- strings isNil ifTrue:[
- strings := OrderedCollection new:index
- ].
- strings grow:index.
- strings at:index put:aString
+ MultiColListEntry and TabulatorSpec were originally created to
+ support nice tabular display of file-lists in the FileBrowser;
+ you may many other uses ...
+"
!
-tabulatorSpecification:aTabSpec
- tabSpec := aTabSpec
-! !
-
-!MultiColListEntry methodsFor:'converting'!
-
-asString
- "return the receiver as a string with embedded tabs"
-
- |s sub tab|
-
- s := ''.
- tab := Character tab asString.
- 1 to:strings size do:[:subStringIndex |
- sub := strings at:subStringIndex.
- sub notNil ifTrue:[
- s := s , (strings at:subStringIndex).
- ].
- subStringIndex == strings size ifFalse:[
- s := s , tab
- ]
- ].
-
- ^ s
-! !
+examples
+"
+ 'putting multiColListEntries into a ListView
+ (instead of strings)'
-!MultiColListEntry methodsFor:'drawing'!
-
-displayOn:aGC x:x y:y
- |xPos subString tabPos w prevString|
-
- xPos := x.
- prevString := ''.
- strings keysAndValuesDo:[:index :subString |
- subString notNil ifTrue:[
- "
- find next tab
- "
- tabPos := tabSpec positionOfTab:index forString:subString on:aGC.
- tabPos isNil ifTrue:[
- "
- no tab - just continue where we are ...
- "
- xPos := xPos + (aGC font widthOf:prevString).
- ] ifFalse:[
- xPos := tabPos + x.
- ].
- aGC displayString:subString x:xPos y:y.
- prevString := subString.
- ]
- ].
-
- "
|v e myList tabs|
myList := OrderedCollection new.
@@ -115,8 +94,11 @@
v := ListView new.
v setList:myList expandTabs:false.
v open
- "
- "
+
+
+
+ 'many multiColListEntries in a scrollable ListView'
+
|v e myList tabs|
myList := OrderedCollection new.
@@ -137,8 +119,11 @@
v := ScrollableView for:ListView.
v setList:myList expandTabs:false.
v open
- "
- "
+
+
+
+ 'like above, but adds nice alignments'
+
|v e myList tabs|
myList := OrderedCollection new.
@@ -161,12 +146,19 @@
v := ScrollableView for:ListView.
v setList:myList expandTabs:false.
v open
- "
- "
+
+
+
+ 'specifying tabs in inches'
+
|v e myList tabs|
myList := OrderedCollection new.
+ tabs := TabulatorSpecification new.
+ tabs unit:#inch.
+ tabs positions:#(0 2 3.5 4 6 8 10 12).
+
e := MultiColListEntry new.
e colAt:1 put:'2'.
e colAt:2 put:'3.5'.
@@ -175,12 +167,118 @@
e colAt:5 put:'8'.
e colAt:6 put:'10'.
e colAt:7 put:'12'.
- e tabPositions:#(0 2 3.5 4 6 8 10 12); tabUnit:#inch.
+ e tabulatorSpecification:tabs.
+ myList add:e.
+
+ v := ScrollableView for:ListView.
+ v setList:myList expandTabs:false.
+ v open
+
+
+ 'if you have the columns available as a collection,
+ setup can be done easier'
+
+ |v e myList tabs|
+
+ myList := OrderedCollection new.
+
+ tabs := TabulatorSpecification new.
+ tabs unit:#inch.
+ tabs positions:#(0 2 3.5 4 6 8 10 12).
+
+ e := MultiColListEntry new.
+ e strings:#('2' '3.5' '4' '6' '8' '10' '12').
+ e tabulatorSpecification:tabs.
myList add:e.
v := ScrollableView for:ListView.
v setList:myList expandTabs:false.
v open
- "
+"
+! !
+
+!MultiColListEntry methodsFor:'accessing'!
+
+strings:aCollectionOfStrings
+ "replace all substrings"
+
+ strings := OrderedCollection withAll:aCollectionOfStrings.
+!
+
+colAt:index
+ "return the substring at column index"
+
+ index > strings size ifTrue:[^ nil].
+ ^ strings at:index
+!
+
+colAt:index put:aString
+ "replace the substring at column index"
+
+ strings isNil ifTrue:[
+ strings := OrderedCollection new:index
+ ].
+ strings grow:index.
+ strings at:index put:aString
+!
+
+tabulatorSpecification:aTabSpec
+ "set the tabulator spec"
+
+ tabSpec := aTabSpec
! !
+!MultiColListEntry methodsFor:'converting'!
+
+asString
+ "return the receiver as a string with embedded tabs"
+
+ |s sub tab
+ nSub "{ Class: SmallInteger }"|
+
+ s := ''.
+ tab := Character tab asString.
+ nSub := strings size.
+ 1 to:nSub do:[:subStringIndex |
+ sub := strings at:subStringIndex.
+ sub notNil ifTrue:[
+ s := s , sub.
+ ].
+ subStringIndex == strings size ifFalse:[
+ s := s , tab
+ ]
+ ].
+
+ ^ s
+! !
+
+!MultiColListEntry methodsFor:'drawing'!
+
+displayOn:aGC x:x y:y
+ "display the receiver on a GC"
+
+ |xPos subString tabPos w prevString|
+
+ xPos := x.
+ prevString := ''.
+ strings keysAndValuesDo:[:index :subString |
+ subString notNil ifTrue:[
+ "
+ find next tab
+ "
+ tabPos := tabSpec positionOfTab:index forString:subString on:aGC.
+ tabPos isNil ifTrue:[
+ "
+ no tab - just continue where we are ...
+ "
+ xPos := xPos + (aGC font widthOf:prevString).
+ ] ifFalse:[
+ xPos := tabPos + x.
+ ].
+ aGC displayString:subString x:xPos y:y.
+ prevString := subString.
+ ]
+ ].
+
+! !
+
--- a/ParSpec.st Sat Feb 11 17:52:33 1995 +0100
+++ b/ParSpec.st Fri Feb 17 14:24:24 1995 +0100
@@ -1,4 +1,14 @@
-'From Smalltalk/X, Version:2.10.4 on 18-nov-1994 at 16:12:06'!
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
TabulatorSpecification subclass:#ParagraphSpecification
instanceVariableNames:'leftMargin rightMargin textAlignment'
@@ -7,6 +17,30 @@
category:'Views-Support'
!
+!ParagraphSpecification class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+ Instances of this class can be used to represent the tabs
+ and margins of a paragraph of text. Its a goody, not really
+ used currently.
+"
+! !
+
!ParagraphSpecification methodsFor:'accessing'!
leftMargin
--- a/ParagraphSpecification.st Sat Feb 11 17:52:33 1995 +0100
+++ b/ParagraphSpecification.st Fri Feb 17 14:24:24 1995 +0100
@@ -1,4 +1,14 @@
-'From Smalltalk/X, Version:2.10.4 on 18-nov-1994 at 16:12:06'!
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
TabulatorSpecification subclass:#ParagraphSpecification
instanceVariableNames:'leftMargin rightMargin textAlignment'
@@ -7,6 +17,30 @@
category:'Views-Support'
!
+!ParagraphSpecification class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+ Instances of this class can be used to represent the tabs
+ and margins of a paragraph of text. Its a goody, not really
+ used currently.
+"
+! !
+
!ParagraphSpecification methodsFor:'accessing'!
leftMargin
--- a/Ruler.st Sat Feb 11 17:52:33 1995 +0100
+++ b/Ruler.st Fri Feb 17 14:24:24 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.12 1995-02-06 00:57:29 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.13 1995-02-17 13:23:59 claus Exp $
'!
!Ruler class methodsFor:'documentation'!
@@ -42,15 +42,21 @@
version
"
-$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.12 1995-02-06 00:57:29 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.13 1995-02-17 13:23:59 claus Exp $
"
!
documentation
"
a shows some unit scale; See example use in DrawTool.
+
instance variables:
+ fgColor <Color> color to draw text and marks with
+ metric <Symbol> inch or mm
+ paperWidth <Number> width of paper
+ paperHeight <Number> height of paper
+ scale <Number> scale factor for zoom
showUnit <Boolean> if true, a unit string is displayed
"
!
--- a/TabSpec.st Sat Feb 11 17:52:33 1995 +0100
+++ b/TabSpec.st Fri Feb 17 14:24:24 1995 +0100
@@ -1,4 +1,14 @@
-'From Smalltalk/X, Version:2.10.3 on 12-aug-1994 at 10:44:09 pm'!
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
Object subclass:#TabulatorSpecification
instanceVariableNames:'tabUnit unitReference tabPositions tabTypes'
@@ -25,7 +35,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg2/Attic/TabSpec.st,v 1.3 1994-11-21 16:49:03 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Attic/TabSpec.st,v 1.4 1995-02-17 13:24:06 claus Exp $
"
!
@@ -34,8 +44,10 @@
This is a helper class for table widgets and tabular data in
lists.
A tabulatorSpecification keeps track of where the tabs are,
- and how they align. They are to be used un conjunction with
- MultiColumnListEntry or the upcoming tableWidget.
+ and how they align. They are to be used in conjunction with
+ MultiColumnListEntry or the upcoming TableWidget.
+ However, they may also be useful to represent tabs in a
+ paragraph of text.
"
!
--- a/TabSpecRuler.st Sat Feb 11 17:52:33 1995 +0100
+++ b/TabSpecRuler.st Fri Feb 17 14:24:24 1995 +0100
@@ -9,24 +9,30 @@
!TabSpecRuler class methodsFor:'documentation'!
+documentation
+"
+ this class is not yet finished.
+"
+!
+
examples
"
- |top head spec|
+ |top head spec|
- top := View new.
- top extent:300@100.
+ top := View new.
+ top extent:300@100.
- head := TabSpecRuler in:top.
- head width:1.0.
- head level:1.
+ head := TabSpecRuler in:top.
+ head width:1.0.
+ head level:1.
- spec := TabulatorSpecification new.
- spec unit:#inch.
- spec positions:#(0 1 2.5 3.5 4 5 ).
- spec align: #(#left #left #right #right #center #decimal ).
+ spec := TabulatorSpecification new.
+ spec unit:#inch.
+ spec positions:#(0 1 2.5 3.5 4 5 ).
+ spec align: #(#left #left #right #right #center #decimal ).
- head tabulatorSpecification:spec.
- top open.
+ head tabulatorSpecification:spec.
+ top open.
"
! !
@@ -44,10 +50,10 @@
"redraw a handle"
handleStyle isNil ifTrue:[
- self displayLineFromX:x rounded
- y:0
- toX:x rounded
- y:height - 1
+ self displayLineFromX:x rounded
+ y:0
+ toX:x rounded
+ y:height - 1
]
!
@@ -58,10 +64,10 @@
tabSpec isNil ifTrue:[^ self].
1 to:tabSpec size do:[:i |
- x := tabSpec positionOfTab:i on:self.
- x := x rounded.
+ x := tabSpec positionOfTab:i on:self.
+ x := x rounded.
- self drawHandleAtX:x type:(tabSpec typeOfTab:i).
+ self drawHandleAtX:x type:(tabSpec typeOfTab:i).
]
! !
--- a/TabulatorSpecification.st Sat Feb 11 17:52:33 1995 +0100
+++ b/TabulatorSpecification.st Fri Feb 17 14:24:24 1995 +0100
@@ -1,4 +1,14 @@
-'From Smalltalk/X, Version:2.10.3 on 12-aug-1994 at 10:44:09 pm'!
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
Object subclass:#TabulatorSpecification
instanceVariableNames:'tabUnit unitReference tabPositions tabTypes'
@@ -25,7 +35,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg2/TabulatorSpecification.st,v 1.3 1994-11-21 16:49:03 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/TabulatorSpecification.st,v 1.4 1995-02-17 13:24:06 claus Exp $
"
!
@@ -34,8 +44,10 @@
This is a helper class for table widgets and tabular data in
lists.
A tabulatorSpecification keeps track of where the tabs are,
- and how they align. They are to be used un conjunction with
- MultiColumnListEntry or the upcoming tableWidget.
+ and how they align. They are to be used in conjunction with
+ MultiColumnListEntry or the upcoming TableWidget.
+ However, they may also be useful to represent tabs in a
+ paragraph of text.
"
!
--- a/TextRuler.st Sat Feb 11 17:52:33 1995 +0100
+++ b/TextRuler.st Fri Feb 17 14:24:24 1995 +0100
@@ -1,4 +1,14 @@
-'From Smalltalk/X, Version:2.10.4 on 18-nov-1994 at 16:11:48'!
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
Ruler subclass:#TextRuler
instanceVariableNames:'leftMargin rightMargin spec moving settingTab'
@@ -13,23 +23,37 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-a Ruler for page layout showing tabs., margins etc.
-
-$Header: /cvs/stx/stx/libwidg2/TextRuler.st,v 1.8 1994-11-21 16:48:42 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/TextRuler.st,v 1.9 1995-02-17 13:24:17 claus Exp $
written oct 91 by claus
'!
!TextRuler class methodsFor:'documentation'!
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
documentation
"
This is a special ruler built for text processing
applications. Currently, it is not used in the system.
- It allows setting of margins, tabs and text-layout.
+ It will allow setting of margins, tabs and text-layout.
+
+ The implementation is not yet finished - take it as example
+ goody ...
TextRuler new open
"
-
! !
!TextRuler class methodsFor:'defaults'!
@@ -137,6 +161,8 @@
|x top form tab type tabStops tabAlign viewOrigin orgX orgY|
+ self clear.
+
super redraw.
viewOrigin := self viewOrigin.
--- a/ViewScroller.st Sat Feb 11 17:52:33 1995 +0100
+++ b/ViewScroller.st Fri Feb 17 14:24:24 1995 +0100
@@ -1,4 +1,14 @@
-'From Smalltalk/X, Version:2.10.4 on 18-nov-1994 at 14:53:43'!
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
View subclass:#ViewScroller
instanceVariableNames:'frame scrolledView'
@@ -9,6 +19,49 @@
!ViewScroller class methodsFor:'documentation'!
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ 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
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+ This wrapper view allows scrolling of views (in contrast to scrolling
+ of contents which can be done by any view).
+
+ Normally, scrolling is done by putting a view into a ScrollableView (which
+ simply wraps the scrollbars around) and have the scrollbars send scrollUp:/
+ scrollDown: etc. send to the scrolledView.
+ The default implementation of scrolling (in View) modifies the transformation,
+ and does a bit-copy of the contents with redraw of the exposed area.
+
+ However, there are situations, where you want to scroll a view itself.
+ For example, if you need many buttons in a panel, which do not fit.
+
+ This class provides the basic mechanism to implement this.
+ It is a wrapper, which implements scrolling by modifying the origin of its
+ single subview when asked to scroll. Thus, it can be put into a ScrollableView
+ like any other, but will move its subview when asked to scroll instead.
+ (i.e. reimplement all scroll messages by manipulating its subviews origin
+ instead of its contents' transformation offset)
+
+ The subview should have a constant extent, which will be taken for the
+ scrollbar position/height computation.
+ Since the subview is represented directly by the underlying window systems view
+ implementation, there may be a limit on the maximum size of that view. For
+ example, in X, dimensions may not be larger than 32767 pixels.
+"
+!
+
examples
"
scroll a panel of buttons:
@@ -25,7 +78,7 @@
panel := VerticalPanelView new.
panel horizontalLayout:#fit.
1 to:100 do:[:i |
- Button label:(i printString) in:panel
+ Button label:(i printString) in:panel
].
vscroller scrolledView:panel.
top open.
@@ -33,6 +86,8 @@
same, horizontally. Also change layout in panel for nicer look
and make panel adjust its height:
+ (since the buttons are defined to fill vertically, the vertical
+ scrollbar is useless here - its here as example; not for its function)
|top frame vscroller v panel|
@@ -47,7 +102,7 @@
panel verticalLayout:#fit.
panel horizontalLayout:#fit.
1 to:100 do:[:i |
- Button label:(i printString) in:panel
+ Button label:(i printString) in:panel
].
vscroller scrolledView:panel.
panel height:1.0.
@@ -79,38 +134,11 @@
textView2 scrolledView contents:('Make.proto' asFilename readStream contents).
1 to:100 do:[:i |
- Button label:(i printString) in:panel
+ Button label:(i printString) in:panel
].
vscroller scrolledView:panel.
top open.
"
-
-!
-
-documentation
-"
- This wrapper view allows scrolling of views (in contrast to scrolling
- of contents).
- Normally, scrolling is done by putting a view into a ScrollableView (which
- simply wraps the scrollbars around) and have the scrollbars send scrollUp:/
- scrollDown: etc. send to the scrolledView.
- The default implementation of scrolling (in View) modifies the viewOrigin,
- and does a bit-copy of the contents and redraw of the exposed area.
-
- However, there are situations, where you want to scroll a view itself.
- For example, if you need many buttons in a panel, which do not fit.
- This class provides the basic mechanism to implement this.
- It is a wrapper, which implements scrolling by modifying the origin of its
- single subview when asked to scroll. Thus, it can be put into a ScrollableView
- like any other, but will move its subview when asked to scroll instead.
-
- The subview should have a constant extent, which will be taken for the
- scrollbar position/height computation.
- Since the subview is represented directly by the underlying window systems view
- implementation, there may be a limit on the maximum size of that view. For
- example, in X, dimensions may not be larger than 32767 pixels.
-"
-
! !
!ViewScroller methodsFor:'queries-contents'!
@@ -149,15 +177,13 @@
count := nPixels.
(count > orgY) ifTrue:[
- count := orgY
+ count := orgY
].
(count <= 0) ifTrue:[^ self].
self originWillChange.
scrolledView origin:(viewOrigin x @ (orgY negated + count)).
self originChanged:(0 @ count negated).
-
-
!
scrollDown:nPixels
@@ -176,7 +202,7 @@
ih := self innerHeight.
((orgY + nPixels + ih) > hCont) ifTrue:[
- count := hCont - orgY - ih
+ count := hCont - orgY - ih
].
(count <= 0) ifTrue:[^ self].
@@ -185,7 +211,6 @@
scrolledView origin:viewOrigin.
self originChanged:(0 @ count).
-
!
scrollLeft:nPixels
@@ -200,16 +225,13 @@
count := nPixels.
(count > orgX) ifTrue:[
- count := orgX
+ count := orgX
].
(count <= 0) ifTrue:[^ self].
self originWillChange.
scrolledView origin:((orgX negated + count) @ viewOrigin y).
self originChanged:(count negated @ 0).
-
-
-
!
scrollRight:nPixels
@@ -228,7 +250,7 @@
iw := self innerWidth.
((orgX + nPixels + iw) > wCont) ifTrue:[
- count := wCont - orgX - iw
+ count := wCont - orgX - iw
].
(count <= 0) ifTrue:[^ self].
@@ -237,15 +259,14 @@
scrolledView origin:viewOrigin.
self originChanged:(count @ 0).
-
! !
!ViewScroller methodsFor:'accessing'!
scrolledView:aView
scrolledView notNil ifTrue:[
- self error:'can only scroll a single view'.
- ^ self
+ self error:'can only scroll a single view'.
+ ^ self
].
scrolledView := aView.
frame addSubView:aView.