home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BURKS 2
/
BURKS_AUG97.ISO
/
BURKS
/
LANGUAGE
/
SMALTALK
/
TEXTBOOK
/
PTBVW25
(
.txt
)
< prev
next >
Wrap
Text File
|
1997-04-22
|
8KB
|
229 lines
Memorandum of Smalltalk Textbook for VisualWorks Release 2.5
------------------------------------------------------------
All Textbooks (Appendices)
"----- Please read (file-in) 'oldview.st' in 'compat'. -----"
------------------------------------------------------------
Textbook 03 (Appendix 01)
"----- Please read (file-in) Patch of Appendices for VW2.5. -----"
------------------------------------------------------------
Textbook 11
"----- This may be wrong. -----"
| anImage tileImage |
anImage := Image
extent: 100 @ 100
depth: Screen default colorDepth
palette: Screen default colorPalette.
tileImage := Image fromUser.
anImage
tile: anImage bounds
from: Point zero
in: tileImage
rule: RasterOp over.
EngiDisplayModel openOn: anImage
"----- This is better than the above. -----"
| tileImage anImage |
tileImage := Image fromUser.
anImage := Image
extent: 100 @ 100
depth: tileImage depth
palette: tileImage palette.
anImage
tile: anImage bounds
from: Point zero
in: tileImage
rule: RasterOp over.
EngiDisplayModel openOn: anImage
------------------------------------------------------------
Textbook 15
"----- It is possible that the following program does not work. -----"
| dictionary fonts labels values answer |
dictionary := Dictionary new.
fonts := Screen default defaultFontPolicy availableFonts.
fonts
do:
[:font |
| family size |
family := font family.
size := font pixelSize.
size > 0
ifTrue:
[(dictionary includesKey: family)
ifFalse: [dictionary
at: family
put: OrderedCollection new].
(dictionary at: family) add: size]].
labels := OrderedCollection new.
values := OrderedCollection new.
dictionary associations asSortedCollection
do:
[:association |
| family strings answers menu |
family := association key.
strings := OrderedCollection new.
answers := OrderedCollection new.
association value
do:
[:size |
strings add: size printString.
answers add: family -> size].
menu := PopUpMenu labelArray: strings values: answers.
labels add: family.
values add: menu].
answer := (PopUpMenu labelArray: labels values: values) startUp.
answer = 0 ifFalse: [fonts
do:
[:font |
| family size |
family := answer key.
size := answer value.
(font family = family and: [font pixelSize = size])
ifTrue:
[answer := FontDescription new.
answer family: family.
answer pixelSize: size.
^answer]]].
^nil
------------------------------------------------------------
Textbook 17
"----- This program does not work. -----"
| fontDescription characterAttributes textAttributes
deviceFont composedText activeWindow displayBlock |
fontDescription := FontDescription new.
fontDescription family: 'times'.
fontDescription pixelSize: 18.
characterAttributes := CharacterAttributes newWithDefaultAttributes.
characterAttributes setDefaultQuery: fontDescription.
textAttributes := TextAttributes default.
textAttributes setCharacterAttributes: characterAttributes.
deviceFont := Screen default defaultFontPolicy
findFont: textAttributes defaultFont.
textAttributes lineGrid: deviceFont height.
textAttributes baseline: deviceFont ascent.
activeWindow := ScheduledControllers activeController view.
displayBlock :=
[activeWindow clear.
composedText := ComposedText
withText: 'Smalltalk' asText
style: textAttributes.
composedText displayOn: activeWindow graphicsContext.
activeWindow sensor waitClickButton].
displayBlock value.
fontDescription boldness: 0.7.
displayBlock value.
fontDescription italic: true.
displayBlock value.
fontDescription underline: true.
displayBlock value.
fontDescription outline: true.
displayBlock value.
fontDescription shadow: true.
displayBlock value.
fontDescription setWidth: 0.7.
displayBlock value.
fontDescription color: ColorValue red.
displayBlock value.
activeWindow display
"----- Here is the correct program. -----"
| fontDescription characterAttributes textAttributes
deviceFont composedText activeWindow displayBlock |
fontDescription := FontDescription new.
fontDescription family: 'times'.
fontDescription pixelSize: 18.
characterAttributes := CharacterAttributes newWithDefaultAttributes.
characterAttributes setDefaultQuery: fontDescription.
textAttributes := TextAttributes default.
textAttributes setCharacterAttributes: characterAttributes.
deviceFont := Screen default defaultFontPolicy
findFont: textAttributes defaultFont.
textAttributes lineGrid: deviceFont height.
textAttributes baseline: deviceFont ascent.
activeWindow := ScheduledControllers activeController view.
displayBlock :=
[activeWindow clear.
Screen default defaultFontPolicy
searchForFont: fontDescription
allowance: 9.
composedText := ComposedText
withText: 'Smalltalk' asText
style: textAttributes.
composedText displayOn: activeWindow graphicsContext.
activeWindow sensor waitClickButton].
displayBlock value.
fontDescription boldness: 0.7.
displayBlock value.
fontDescription italic: true.
displayBlock value.
fontDescription underline: true.
displayBlock value.
fontDescription outline: true.
displayBlock value.
fontDescription shadow: true.
displayBlock value.
fontDescription setWidth: 0.7.
displayBlock value.
fontDescription color: ColorValue red.
displayBlock value.
activeWindow display
------------------------------------------------------------
Textbook 19 (Appendix 09)
"----- Please read (file-in) Patch of Appendices for VW2.5. -----"
------------------------------------------------------------
Textbook 20 (Appendix 10)
"----- Please read (file-in) Patch of Appendices for VW2.5. -----"
------------------------------------------------------------
Textbook 22 (Appendix 11)
"----- Please read (file-in) Patch of Appendices for VW2.5. -----"
------------------------------------------------------------
Textbook 23
"----- This expression does not work. -----"
OpenLookPolicy installLookPreferences
OpenLookPolicy existed in VisualWorks Release 1.0,
but it is gone in VisualWorks Release 2.5.
------------------------------------------------------------
Textbook 26
"----- <VisualWorks Release 1.0> -----"
1 systemRockBottomPriority
2 systemBackgroundPriority
3 userBackgroundPriority
4 userSchedulingPriority
5 userInterruptPriority
6 lowIOPriority
7 highIOPriority
8 timingPriority
"----- <VisualWorks Release 2.5> -----"
1 systemRockBottomPriority
10 systemBackgroundPriority
30 userBackgroundPriority
50 userSchedulingPriority
70 userInterruptPriority
90 lowIOPriority
98 highIOPriority
100 timingPriority
------------------------------------------------------------