The Trunk: MorphicExtras-nice.123.mcz

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

The Trunk: MorphicExtras-nice.123.mcz

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

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

Name: MorphicExtras-nice.123
Author: nice
Time: 6 October 2013, 6:46:51.35 pm
UUID: 87efaf6e-b5ba-41bb-920c-14a039fed508
Ancestors: MorphicExtras-nice.122

Remove unnecessary runX inst var from CanvasCharacterScanner (written but never read).
Also remove fillBlt neither read nor written.
Add kern to paddedSpace: handling must be uniform in all CharacterScanner family in order to avoid glitches.

=============== Diff against MorphicExtras-nice.122 ===============

Item was changed:
  CharacterScanner subclass: #CanvasCharacterScanner
+ instanceVariableNames: 'canvas foregroundColor lineY defaultTextColor'
- instanceVariableNames: 'canvas fillBlt foregroundColor runX lineY defaultTextColor'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'MorphicExtras-Support'!
 
  !CanvasCharacterScanner commentStamp: '<historical>' prior: 0!
  A displaying scanner which draws its output to a Morphic canvas.!

Item was changed:
  ----- Method: CanvasCharacterScanner>>displayLine:offset:leftInRun: (in category 'scanning') -----
  displayLine: textLine offset: offset leftInRun: leftInRun
  "largely copied from DisplayScanner's routine"
 
  | nowLeftInRun startLoc startIndex stopCondition |
  line := textLine.
  foregroundColor ifNil: [foregroundColor := Color black].
  leftMargin := (line leftMarginForAlignment: alignment) + offset x.
  rightMargin := line rightMargin + offset x.
  lineY := line top + offset y.
  lastIndex := textLine first.
  nowLeftInRun := leftInRun <= 0
  ifTrue:
  [self setStopConditions. "also sets the font"
  text runLengthFor: lastIndex]
  ifFalse: [leftInRun].
+ destX := leftMargin.
- runX := destX := leftMargin.
  runStopIndex := lastIndex + (nowLeftInRun - 1) min: line last.
  spaceCount := 0.
  [
  "remember where this portion of the line starts"
  startLoc := destX @ destY.
  startIndex := lastIndex.
 
  "find the end of this portion of the line"
  stopCondition := self
  scanCharactersFrom: lastIndex
  to: runStopIndex
  in: text string
  rightX: rightMargin
  stopConditions: stopConditions
  kern: kern. "displaying: false"
 
  "display that portion of the line"
  canvas
  drawString: text string
  from: startIndex
  to: lastIndex
  at: startLoc
  font: font
  color: foregroundColor.
 
  "handle the stop condition"
  self perform: stopCondition
  ] whileFalse.
  ^runStopIndex - lastIndex!

Item was changed:
  ----- Method: CanvasCharacterScanner>>endOfRun (in category 'stop conditions') -----
  endOfRun
  "The end of a run in the display case either means that there is actually
  a change in the style (run code) to be associated with the string or the
  end of this line has been reached."
  | runLength |
 
  lastIndex = line last ifTrue: [^true].
- runX := destX.
  runLength := text runLengthFor: (lastIndex := lastIndex + 1).
  runStopIndex := lastIndex + (runLength - 1) min: line last.
  self setStopConditions.
  ^ false!

Item was changed:
  ----- Method: CanvasCharacterScanner>>paddedSpace (in category 'stop conditions') -----
  paddedSpace
  "Each space is a stop condition when the alignment is right justified.
  Padding must be added to the base width of the space according to
  which space in the line this space is and according to the amount of
  space that remained at the end of the line when it was composed."
 
+ destX := destX + spaceWidth + kern + (line justifiedPadFor: spaceCount font: font).
- destX := destX + spaceWidth + (line justifiedPadFor: spaceCount font: font).
  lastIndex := lastIndex + 1.
  pendingKernX := 0.
  ^ false!