home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / LANGUAGE / SMALTALK / TEXTBOOK / PTBVW25 (.txt) < prev    next >
Text File  |  1997-04-22  |  8KB  |  229 lines

  1. Memorandum of Smalltalk Textbook for VisualWorks Release 2.5
  2.  
  3. ------------------------------------------------------------
  4. All Textbooks (Appendices)
  5.  
  6. "----- Please read (file-in) 'oldview.st' in 'compat'. -----"
  7.  
  8. ------------------------------------------------------------
  9. Textbook 03 (Appendix 01)
  10.  
  11. "----- Please read (file-in) Patch of Appendices for VW2.5. -----"
  12.  
  13. ------------------------------------------------------------
  14. Textbook 11
  15.  
  16. "----- This may be wrong. -----"
  17. | anImage tileImage |
  18. anImage := Image
  19.                 extent: 100 @ 100
  20.                 depth: Screen default colorDepth
  21.                 palette: Screen default colorPalette.
  22. tileImage := Image fromUser.
  23. anImage
  24.         tile: anImage bounds
  25.         from: Point zero
  26.         in: tileImage
  27.         rule: RasterOp over.
  28. EngiDisplayModel openOn: anImage
  29.  
  30. "----- This is better than the above. -----"
  31. | tileImage anImage |
  32. tileImage := Image fromUser.
  33. anImage := Image
  34.                 extent: 100 @ 100
  35.                 depth: tileImage depth
  36.                 palette: tileImage palette.
  37. anImage
  38.         tile: anImage bounds
  39.         from: Point zero
  40.         in: tileImage
  41.         rule: RasterOp over.
  42. EngiDisplayModel openOn: anImage
  43.  
  44. ------------------------------------------------------------
  45. Textbook 15
  46.  
  47. "----- It is possible that the following program does not work. -----"
  48.  
  49. | dictionary fonts labels values answer |
  50. dictionary := Dictionary new.
  51. fonts := Screen default defaultFontPolicy availableFonts.
  52. fonts
  53.         do: 
  54.                 [:font | 
  55.                 | family size |
  56.                 family := font family.
  57.                 size := font pixelSize.
  58.                 size > 0
  59.                         ifTrue:
  60.                                 [(dictionary includesKey: family)
  61.                                         ifFalse: [dictionary
  62.                                                         at: family
  63.                                                         put: OrderedCollection new].
  64.                                 (dictionary at: family) add: size]].
  65. labels := OrderedCollection new.
  66. values := OrderedCollection new.
  67. dictionary associations asSortedCollection
  68.         do: 
  69.                 [:association | 
  70.                 | family strings answers menu |
  71.                 family := association key.
  72.                 strings := OrderedCollection new.
  73.                 answers := OrderedCollection new.
  74.                 association value
  75.                         do: 
  76.                                 [:size | 
  77.                                 strings add: size printString.
  78.                                 answers add: family -> size].
  79.                 menu := PopUpMenu labelArray: strings values: answers.
  80.                 labels add: family.
  81.                 values add: menu].
  82. answer := (PopUpMenu labelArray: labels values: values) startUp.
  83. answer = 0 ifFalse: [fonts
  84.                 do: 
  85.                         [:font | 
  86.                         | family size |
  87.                         family := answer key.
  88.                         size := answer value.
  89.                         (font family = family and: [font pixelSize = size])
  90.                                 ifTrue: 
  91.                                         [answer := FontDescription new.
  92.                                         answer family: family.
  93.                                         answer pixelSize: size.
  94.                                         ^answer]]].
  95. ^nil
  96.  
  97. ------------------------------------------------------------
  98. Textbook 17
  99.  
  100. "----- This program does not work. -----"
  101. | fontDescription characterAttributes textAttributes
  102.   deviceFont composedText activeWindow displayBlock |
  103. fontDescription := FontDescription new.
  104. fontDescription family: 'times'.
  105. fontDescription pixelSize: 18.
  106. characterAttributes := CharacterAttributes newWithDefaultAttributes.
  107. characterAttributes setDefaultQuery: fontDescription.
  108. textAttributes := TextAttributes default.
  109. textAttributes setCharacterAttributes: characterAttributes.
  110. deviceFont := Screen default defaultFontPolicy
  111.                         findFont: textAttributes defaultFont.
  112. textAttributes lineGrid: deviceFont height.
  113. textAttributes baseline: deviceFont ascent.
  114. activeWindow := ScheduledControllers activeController view.
  115. displayBlock := 
  116.         [activeWindow clear.
  117.         composedText := ComposedText
  118.                                 withText: 'Smalltalk' asText
  119.                                 style: textAttributes.
  120.         composedText displayOn: activeWindow graphicsContext.
  121.         activeWindow sensor waitClickButton].
  122. displayBlock value.
  123. fontDescription boldness: 0.7.
  124. displayBlock value.
  125. fontDescription italic: true.
  126. displayBlock value.
  127. fontDescription underline: true.
  128. displayBlock value.
  129. fontDescription outline: true.
  130. displayBlock value.
  131. fontDescription shadow: true.
  132. displayBlock value.
  133. fontDescription setWidth: 0.7.
  134. displayBlock value.
  135. fontDescription color: ColorValue red.
  136. displayBlock value.
  137. activeWindow display
  138.  
  139. "----- Here is the correct program. -----"
  140. | fontDescription characterAttributes textAttributes
  141.   deviceFont composedText activeWindow displayBlock |
  142. fontDescription := FontDescription new.
  143. fontDescription family: 'times'.
  144. fontDescription pixelSize: 18.
  145. characterAttributes := CharacterAttributes newWithDefaultAttributes.
  146. characterAttributes setDefaultQuery: fontDescription.
  147. textAttributes := TextAttributes default.
  148. textAttributes setCharacterAttributes: characterAttributes.
  149. deviceFont := Screen default defaultFontPolicy
  150.                         findFont: textAttributes defaultFont.
  151. textAttributes lineGrid: deviceFont height.
  152. textAttributes baseline: deviceFont ascent.
  153. activeWindow := ScheduledControllers activeController view.
  154. displayBlock := 
  155.         [activeWindow clear.
  156.         Screen default defaultFontPolicy
  157.                 searchForFont: fontDescription
  158.                 allowance: 9.
  159.         composedText := ComposedText
  160.                                 withText: 'Smalltalk' asText
  161.                                 style: textAttributes.
  162.         composedText displayOn: activeWindow graphicsContext.
  163.         activeWindow sensor waitClickButton].
  164. displayBlock value.
  165. fontDescription boldness: 0.7.
  166. displayBlock value.
  167. fontDescription italic: true.
  168. displayBlock value.
  169. fontDescription underline: true.
  170. displayBlock value.
  171. fontDescription outline: true.
  172. displayBlock value.
  173. fontDescription shadow: true.
  174. displayBlock value.
  175. fontDescription setWidth: 0.7.
  176. displayBlock value.
  177. fontDescription color: ColorValue red.
  178. displayBlock value.
  179. activeWindow display
  180.  
  181. ------------------------------------------------------------
  182. Textbook 19 (Appendix 09)
  183.  
  184. "----- Please read (file-in) Patch of Appendices for VW2.5. -----"
  185.  
  186. ------------------------------------------------------------
  187. Textbook 20 (Appendix 10)
  188.  
  189. "----- Please read (file-in) Patch of Appendices for VW2.5. -----"
  190.  
  191. ------------------------------------------------------------
  192. Textbook 22 (Appendix 11)
  193.  
  194. "----- Please read (file-in) Patch of Appendices for VW2.5. -----"
  195.  
  196. ------------------------------------------------------------
  197. Textbook 23
  198.  
  199. "----- This expression does not work. -----"
  200. OpenLookPolicy installLookPreferences
  201.  
  202. OpenLookPolicy existed in VisualWorks Release 1.0,
  203. but it is gone in VisualWorks Release 2.5.
  204.  
  205. ------------------------------------------------------------
  206. Textbook 26
  207.  
  208. "----- <VisualWorks Release 1.0> -----"
  209. 1 systemRockBottomPriority
  210. 2 systemBackgroundPriority
  211. 3 userBackgroundPriority
  212. 4 userSchedulingPriority
  213. 5 userInterruptPriority
  214. 6 lowIOPriority
  215. 7 highIOPriority
  216. 8 timingPriority
  217.  
  218. "----- <VisualWorks Release 2.5> -----"
  219. 1 systemRockBottomPriority
  220. 10 systemBackgroundPriority
  221. 30 userBackgroundPriority
  222. 50 userSchedulingPriority
  223. 70 userInterruptPriority
  224. 90 lowIOPriority
  225. 98 highIOPriority
  226. 100 timingPriority
  227.  
  228. ------------------------------------------------------------
  229.