Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.245.mcz ==================== Summary ==================== Name: Graphics-nice.245 Author: nice Time: 2 October 2013, 10:34:50.346 pm UUID: 6074e17f-0000-4aea-9005-5ee23179da88 Ancestors: Graphics-nice.244 Move more MVC specific protocol of CharacterScanner from Graphics to ST80. =============== Diff against Graphics-nice.244 =============== Item was removed: - ----- Method: CharacterBlockScanner>>characterPointSetX: (in category 'private') ----- - characterPointSetX: xVal - characterPoint := xVal @ characterPoint y! Item was removed: - ----- Method: CharacterScanner>>initializeFromParagraph:clippedBy: (in category 'private') ----- - initializeFromParagraph: aParagraph clippedBy: clippingRectangle - - text := aParagraph text. - textStyle := aParagraph textStyle. - ! Item was removed: - ----- Method: CompositionScanner>>composeLine:fromCharacterIndex:inParagraph: (in category 'scanning') ----- - 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 stopConditions: stopConditions - kern: kern. - "See setStopConditions for stopping conditions for composing." - self perform: stopCondition] whileFalse. - - ^line - lineHeight: lineHeight + textStyle leading - baseline: baseline + textStyle leading! Item was removed: - ----- Method: CompositionScanner>>forParagraph: (in category 'intialize-release') ----- - forParagraph: aParagraph - "Initialize the receiver for scanning the given paragraph." - - self - initializeFromParagraph: aParagraph - clippedBy: aParagraph clippingRectangle. - ! Item was removed: - ----- Method: DisplayScanner>>displayLines:in:clippedBy: (in category 'MVC-compatibility') ----- - 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 := paragraphColor := 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 | - line := aParagraph lines at: lineIndex. - 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 := runX := 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. - [ - startIndex := lastIndex. - lastPos := destX@destY. - stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex - in: string rightX: rightMargin stopConditions: stopConditions - kern: kern. - lastIndex >= startIndex ifTrue:[ - font displayString: string on: bitBlt - from: startIndex to: lastIndex at: lastPos kern: kern]. - "see setStopConditions for stopping conditions for displaying." - self perform: stopCondition - ] whileFalse. - fillBlt == nil ifFalse: - [fillBlt destX: destX destY: lineY width: visibleRectangle right-destX height: lineHeight; copyBits]. - lineY := lineY + lineHeight]]! Item was removed: - ----- Method: DisplayScanner>>initializeFromParagraph:clippedBy: (in category 'MVC-compatibility') ----- - initializeFromParagraph: aParagraph clippedBy: clippingRectangle - - super initializeFromParagraph: aParagraph clippedBy: clippingRectangle. - bitBlt := BitBlt asGrafPort toForm: aParagraph destinationForm. - bitBlt sourceX: 0; width: 0. "Init BitBlt so that the first call to a primitive will not fail" - bitBlt combinationRule: - ((Display depth = 1) - ifTrue: - [aParagraph rule] - ifFalse: - [Form paint]). - bitBlt colorMap: - (Bitmap with: 0 "Assumes 1-bit deep fonts" - with: (bitBlt destForm pixelValueFor: aParagraph foregroundColor)). - bitBlt clipRect: clippingRectangle! |
Free forum by Nabble | Edit this page |