The Trunk: Graphics-nice.80.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.80.mcz

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

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

Name: Graphics-nice.80
Author: nice
Time: 19 October 2009, 11:30:04 am
UUID: 93dd7163-98f2-1c4e-8cd9-d9d18bfed44d
Ancestors: Graphics-nice.79

use #fasterKeys

=============== Diff against Graphics-nice.79 ===============

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]) fasterKeys sort
- ^ (TextConstants select: [:thang | thang isKindOf: TextStyle]) keys asSortedArray
 
  !

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 fasterKeys
- keys := decoder keys asArray
  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]) fasterKeys asSortedCollection!
- ^ (TextConstants select: [:each | each isKindOf: TextStyle]) keys asSortedCollection!