The Trunk: Graphics-nice.81.mcz

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

The Trunk: Graphics-nice.81.mcz

commits-2
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.81.mcz

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

Name: Graphics-nice.81
Author: nice
Time: 21 October 2009, 12:24:02 pm
UUID: 51e318b5-e2ac-42ac-8b15-ac8faf6a6363
Ancestors: Graphics-nice.80

Use #keys rather than #fasterKeys
Note that pattern (x keys asArray sort) could as well be written (x keys sort) now that keys returns an Array...
This #asArray is here solely for cross-dialect/fork compatibility.

=============== Diff against Graphics-nice.80 ===============

Item was changed:
  ----- Method: TextStyle class>>knownTextStyles (in category 'TextConstants access') -----
  knownTextStyles
  "Answer the names of the known text styles, sorted in alphabetical order"
 
  "TextStyle knownTextStyles"
+ ^ (TextConstants select: [:thang | thang isKindOf: TextStyle]) keys asArray sort
- ^ (TextConstants select: [:thang | thang isKindOf: TextStyle]) fasterKeys sort
 
  !

Item was changed:
  ----- Method: TextStyle class>>decodeStyleName: (in category 'utilities') -----
  decodeStyleName: styleName
  "Given a string styleName, return a collection with:
 
  * [1] the probable Squeak emphasis code, which is a bit combination of:
  1 bold
  2 italic
  4 underlined
  8 narrow
  16 strikeout
 
  * [2] the base style name without the modifiers (can be empty)
  * [3] the modifiers in the order they were found
  * [4] the codes for those modifiers, in the same order
  "
  | decoder keys modifiers modifierCodes baseName styleCode matchedKey |
 
  decoder := self styleDecoder.
 
  modifiers := OrderedCollection new.
  modifierCodes := OrderedCollection new.
+ keys := decoder keys asArray
- keys := decoder fasterKeys
  sort: [:a :b | a size > b size].
  styleCode := 0.
  baseName := styleName asString.
  [matchedKey := keys
  detect: [:k | baseName endsWith: k]
  ifNone: [].
  matchedKey notNil]
  whileTrue: [| last code |
  last := baseName size - matchedKey size.
  last > 0
  ifTrue: [('- ' includes: (baseName at: last))
  ifTrue: [last := last - 1]].
  baseName := baseName copyFrom: 1 to: last.
  code := decoder at: matchedKey.
  styleCode := styleCode + code.
  modifiers addFirst: matchedKey.
  modifierCodes addFirst: code.
  ].
  ^ {styleCode. baseName. modifiers. modifierCodes }!

Item was changed:
  ----- Method: StrikeFont class>>familyNames (in category 'accessing') -----
  familyNames
+ ^ (TextConstants select: [:each | each isKindOf: TextStyle]) keys asArray sort!
- ^ (TextConstants select: [:each | each isKindOf: TextStyle]) fasterKeys asSortedCollection!