The Trunk: ST80-nice.163.mcz

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

The Trunk: ST80-nice.163.mcz

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

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

Name: ST80-nice.163
Author: nice
Time: 22 October 2013, 9:04:02.289 pm
UUID: b8804c9d-9783-4dc3-bc79-31d06a1ae6b7
Ancestors: ST80-nice.162

Avoid passing stopConditions and kern inst. var. down the message chain.

=============== Diff against ST80-nice.162 ===============

Item was changed:
  ----- Method: BitBltDisplayScanner>>displayLines:in:clippedBy: (in category '*ST80-Support') -----
  displayLines: linesInterval in: aParagraph clippedBy: visibleRectangle
  "The central display routine. The call on the primitive
  (scanCharactersFrom:to:in:rightX:) will be interrupted according to an
  array of stop conditions passed to the scanner at which time the code to
  handle the stop condition is run and the call on the primitive continued
  until a stop condition returns true (which means the line has
  terminated)."
  | leftInRun |
  "leftInRun is the # of characters left to scan in the current run;
  when 0, it is time to call 'self setStopConditions'"
  morphicOffset := 0@0.
  leftInRun := 0.
  self initializeFromParagraph: aParagraph clippedBy: visibleRectangle.
  ignoreColorChanges := false.
  foregroundColor := defaultTextColor := aParagraph foregroundColor.
  backgroundColor := aParagraph backgroundColor.
  aParagraph backgroundColor isTransparent
  ifTrue: [fillBlt := nil]
  ifFalse: [fillBlt := bitBlt copy.  "Blt to fill spaces, tabs, margins"
  fillBlt sourceForm: nil; sourceOrigin: 0@0.
  fillBlt fillColor: aParagraph backgroundColor].
  rightMargin := aParagraph rightMarginForDisplay.
  lineY := aParagraph topAtLineIndex: linesInterval first.
  bitBlt destForm deferUpdatesIn: visibleRectangle while: [
  linesInterval do:
  [:lineIndex |
  | string startIndex lastPos runLength stopCondition baselineY lineHeight stop |
  line := aParagraph lines at: lineIndex.
  lastDisplayableIndex := lastIndex := line first.
  leftInRun <= 0
  ifTrue: [self setStopConditions.  "also sets the font, alignment and emphasisCode"
  leftInRun := text runLengthFor: line first].
  leftMargin := aParagraph leftMarginForDisplayForLine: lineIndex alignment: alignment.
  destX := leftMargin.
  lineHeight := line lineHeight.
  fillBlt == nil ifFalse:
  [fillBlt destX: visibleRectangle left destY: lineY
  width: visibleRectangle width height: lineHeight; copyBits].
  baselineY := lineY + line baseline.
  destY := baselineY - font ascent.  "Should have happened in setFont"
  runLength := leftInRun.
  runStopIndex := lastIndex + (runLength - 1) min: line last.
  leftInRun := leftInRun - (runStopIndex - lastIndex + 1).
  spaceCount := 0.
  string := text string.
  self handleIndentation.
  [
  "Reset the stopping conditions of this displaying loop, and also the font."
  stopConditionsMustBeReset
  ifTrue:[self setStopConditions].
  startIndex := lastIndex.
  lastPos := destX@destY.
  stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
+ in: string rightX: rightMargin.
- in: string rightX: rightMargin stopConditions: stopConditions
- kern: kern.
  stop := self perform: stopCondition.
  lastDisplayableIndex >= startIndex ifTrue:[
  font displayString: string on: bitBlt
  from: startIndex to: lastDisplayableIndex at: lastPos kern: kern].
  stop
  ] whileFalse.
  fillBlt == nil ifFalse:
  [fillBlt destX: destX destY: lineY width: visibleRectangle right-destX height: lineHeight; copyBits].
  lineY := lineY + lineHeight]]!

Item was changed:
  ----- Method: CharacterBlockScannerForMVC>>buildCharacterBlockIn: (in category 'private') -----
  buildCharacterBlockIn: para
  "This method is used by the MVC version only."
 
  | lineIndex runLength lineStop stopCondition |
  "handle nullText"
  (para numberOfLines = 0 or: [text size = 0])
  ifTrue: [^ CharacterBlock new stringIndex: 1  "like being off end of string"
  text: para text
  topLeft: (para leftMarginForDisplayForLine: 1 alignment: (alignment ifNil:[textStyle alignment]))
  @ para compositionRectangle top
  extent: 0 @ textStyle lineGrid].
  "find the line"
  lineIndex := para lineIndexOfTop: characterPoint y.
  destY := para topAtLineIndex: lineIndex.
  line := para lines at: lineIndex.
  lastIndex := line first.
  rightMargin := para rightMarginForDisplay.
  self setStopConditions.  " also loads the font, alignment and all emphasis attributes "
 
  (lineIndex = para numberOfLines and:
  [(destY + line lineHeight) < characterPoint y])
  ifTrue: ["if beyond lastLine, force search to last character"
  self characterPointSetX: rightMargin]
  ifFalse: [characterPoint y < (para compositionRectangle) top
  ifTrue: ["force search to first line"
  characterPoint := (para compositionRectangle) topLeft].
  characterPoint x > rightMargin
  ifTrue: [self characterPointSetX: rightMargin]].
  destX := leftMargin := para leftMarginForDisplayForLine: lineIndex alignment: alignment.
  nextLeftMargin:= para leftMarginForDisplayForLine: lineIndex+1 alignment: alignment.
  runLength := text runLengthFor: line first.
  lineStop := characterIndex "scanning for index"
  ifNil: [ line last ]. "scanning for point"
  runStopIndex := lastIndex + (runLength - 1) min: lineStop.
  lastCharacterWidth := 0.
  spaceCount := 0.
  self handleIndentation.
 
  [stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
+ in: text string rightX: characterPoint x.
- in: text string rightX: characterPoint x
- stopConditions: stopConditions kern: kern.
  "see setStopConditions for stopping conditions for character block operations."
  self perform: stopCondition] whileFalse.
 
  ^characterIndex == nil
  ifTrue: ["characterBlockAtPoint"
  ^ CharacterBlock new stringIndex: lastIndex text: text
  topLeft: characterPoint + (font descentKern @ 0)
  extent: lastCharacterWidth @ line lineHeight]
  ifFalse: ["characterBlockForIndex"
  ^ CharacterBlock new stringIndex: lastIndex text: text
  topLeft: characterPoint + ((font descentKern) - kern @ 0)
  extent: lastCharacterWidth @ line lineHeight]!

Item was changed:
  ----- Method: CompositionScanner>>composeLine:fromCharacterIndex:inParagraph: (in category '*ST80-Support') -----
  composeLine: lineIndex fromCharacterIndex: startIndex inParagraph: aParagraph
  "Answer an instance of TextLineInterval that represents the next line in the paragraph."
  | runLength stopCondition |
  destX := spaceX := leftMargin := aParagraph leftMarginForCompositionForLine: lineIndex.
  destY := 0.
  rightMargin := aParagraph rightMarginForComposition.
  leftMargin >= rightMargin ifTrue: [self error: 'No room between margins to compose'].
  lastIndex := startIndex. "scanning sets last index"
  lineHeight := textStyle lineGrid.  "may be increased by setFont:..."
  baseline := textStyle baseline.
  self setStopConditions. "also sets font"
  self handleIndentation.
  runLength := text runLengthFor: startIndex.
  runStopIndex := (lastIndex := startIndex) + (runLength - 1).
  line := TextLineInterval
  start: lastIndex
  stop: 0
  internalSpaces: 0
  paddingWidth: 0.
  nextIndexAfterLineBreak := spaceCount := 0.
  lastBreakIsNotASpace := false.
 
  [stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
+ in: text string rightX: rightMargin.
- in: text string rightX: rightMargin stopConditions: stopConditions
- kern: kern.
  "See setStopConditions for stopping conditions for composing."
  self perform: stopCondition] whileFalse.
 
  ^line
  lineHeight: lineHeight + textStyle leading
  baseline: baseline + textStyle leading!