The Inbox: Collections-ct.920.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Collections-ct.920.mcz

commits-2
A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-ct.920.mcz

==================== Summary ====================

Name: Collections-ct.920
Author: ct
Time: 4 November 2020, 8:01:59.526134 pm
UUID: 1a9e498f-42f5-c047-9aa5-baadcfbcb734
Ancestors: Collections-mt.919

Proposal: Honor scaleFactor for default spacings in text constants. With this change, tabs in every text editor are finally displayed hi-dpi-sensitive.

Note that I found this method rather by incident than by expertise! I strongly advise against merging this into the Trunk without prior review by someone who has a bit more knowledge of this domain than me. ;-) Is this the right place for such a change, or should we patch the senders of every constant instead?

Requires System-ct.1188.

=============== Diff against Collections-mt.919 ===============

Item was changed:
  ----- Method: Text class>>initTextConstants (in category 'class initialization') -----
  initTextConstants
  "Initialize constants shared by classes associated with text display, e.g.,
  Space, Tab, Cr, Bs, ESC."
  "1/24/96 sw: in exasperation and confusion, changed cmd-g mapping from 231 to 232 to see if I could gain any relief?!!"
 
 
  | letter varAndValue tempArray width |
  "CtrlA..CtrlZ, Ctrla..Ctrlz"
  letter := $A.
    #( 212 230 228 196 194 226 241 243 214 229 200 217 246
  245 216 202 210 239 211 240 197 198 209 215 242 231
  1 166 228 132 130 12 232 179 150 165 136 153 182
  14 15 138 17 18 19 11 21 134 145 151 178 167 ) do:
  [:kbd |
  TextConstants at: ('Ctrl', letter asSymbol) asSymbol put: kbd asCharacter.
  letter := letter == $Z ifTrue: [$a] ifFalse: [(letter asciiValue + 1) asCharacter]].
 
  varAndValue := #(
  Space 32
  Tab 9
  CR 13
  Enter 3
  BS 8
  BS2 158
  ESC 160
  Clear 173
  ).
 
  varAndValue size odd ifTrue: [self error: 'unpaired text constant'].
  (2 to: varAndValue size by: 2) do:
  [:i | TextConstants at: (varAndValue at: i - 1) put: (varAndValue at: i) asCharacter].
 
+ varAndValue := {
+ #CtrlDigits. #(159 144 143 128 127 129 131 180 149 135).
+ #CtrlOpenBrackets. #(201 7 218 249 219 15).
- varAndValue := #(
- CtrlDigits (159 144 143 128 127 129 131 180 149 135)
- CtrlOpenBrackets (201 7 218 249 219 15)
  "lparen gottn by ctrl-:= = 201; should be 213 but can't type that on Mac"
 
  "values for alignment"
+ #LeftFlush. 0.
+ #RightFlush. 1.
+ #Centered. 2.
+ #Justified. 3.
- LeftFlush 0
- RightFlush 1
- Centered 2
- Justified 3
 
  "subscripts for a marginTabsArray tuple"
+ #LeftMarginTab. 1.
+ #RightMarginTab. 2.
- LeftMarginTab 1
- RightMarginTab 2
 
  "font faces"
+ #Basal. 0.
+ #Bold. 1.
+ #Italic. 2.
- Basal 0
- Bold 1
- Italic 2
 
  "in case font doesn't have a width for space character"
  "some plausible numbers-- are they the right ones?"
+ #DefaultSpace. (4 * RealEstateAgent scaleFactor) rounded.
+ #DefaultTab. (24 * RealEstateAgent scaleFactor) rounded.
+ #DefaultLineGrid. (16 * RealEstateAgent scaleFactor) rounded.
+ #DefaultBaseline. (12 * RealEstateAgent scaleFactor) rounded.
+ #DefaultFontFamilySize. 3 "basal, bold, italic"
+ }.
- DefaultSpace 4
- DefaultTab 24
- DefaultLineGrid 16
- DefaultBaseline 12
- DefaultFontFamilySize 3 "basal, bold, italic"
- ).
 
  varAndValue size odd ifTrue: [self error: 'unpaired text constant'].
  (2 to: varAndValue size by: 2) do:
  [:i | TextConstants at: (varAndValue at: i - 1) put: (varAndValue at: i)].
 
  TextConstants at: #DefaultRule put: Form over.
  TextConstants at: #DefaultMask put: Color black.
 
  width := Display width max: 720.
  tempArray := Array new: width // DefaultTab.
  1 to: tempArray size do:
  [:i | tempArray at: i put: DefaultTab * i].
  TextConstants at: #DefaultTabsArray put: tempArray.
  tempArray := Array new: (width // DefaultTab) // 2.
  1 to: tempArray size do:
  [:i | tempArray at: i put: (Array with: (DefaultTab*i) with: (DefaultTab*i))].
  TextConstants at: #DefaultMarginTabsArray put: tempArray.
 
  "Text initTextConstants "!