[Pkg] The Trunk: Graphics-nice.259.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Oct 9 00:23:54 UTC 2013

Nicolas Cellier uploaded a new version of Graphics to project The Trunk:

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

Name: Graphics-nice.259
Author: nice
Time: 9 October 2013, 2:22:45.576 am
UUID: a92ad067-a511-48ae-bc9d-4098853e499f
Ancestors: Graphics-nice.258

DisplayScanner does not require a lineHeight inst. var., it can be a temporary.

=============== Diff against Graphics-nice.258 ===============

Item was changed:
  CharacterScanner subclass: #DisplayScanner
+ 	instanceVariableNames: 'bitBlt lineY foregroundColor backgroundColor fillBlt paragraphColor morphicOffset ignoreColorChanges'
- 	instanceVariableNames: 'bitBlt lineY foregroundColor backgroundColor fillBlt lineHeight paragraphColor morphicOffset ignoreColorChanges'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Graphics-Text'!
+ !DisplayScanner commentStamp: 'nice 10/9/2013 02:22' prior: 0!
- !DisplayScanner commentStamp: 'nice 10/6/2013 23:26' prior: 0!
  A DisplayScanner displays characters on Screen or other Form with help of a BitBlt.
  Instance Variables
  	backgroundColor:		<Color>
  	bitBlt:		<BitBlt>
  	fillBlt:		<BitBlt>
  	foregroundColor:		<Color>
  	ignoreColorChanges:		<Boolean>
- 	lineHeight:		<Number>
  	lineY:		<Number>
  	morphicOffset:		<Point>
  	paragraphColor:		<Color>
  	- the background color for displaying text.
  	Note that this can be set to Color transparent, in which case no background is displayed.
  	- the object which knows how to copy bits from one Form (the font glyph data) to another (the destination Form)
  	- another object for copying form bits, initialized for displaying the background.
  	- the foreground color for displaying text
  	- indicates that any change of color specified in text attributes shall be ignored.
  	This is used for displaying text in a shadow mode, when dragging text for example.
- lineHeight
- 	- the total line height from top to bottom, including inter-line spacing
  	- the distance between destination form top and current line top
  	- an offset for positionning the embedded morphs.
  	- the default foreground color for displaying text in absence of other text attributes specification 

Item was changed:
  ----- Method: DisplayScanner>>displayLine:offset:leftInRun: (in category 'scanning') -----
  displayLine: textLine offset: offset leftInRun: leftInRun
  	"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 is the # of characters left to scan in the current run; when 0, it is time to call setStopConditions."
+ 	| stopCondition nowLeftInRun startIndex string lastPos lineHeight |
- 	| stopCondition nowLeftInRun startIndex string lastPos |
  	line := textLine.
  	morphicOffset := offset.
  	lineY := line top + offset y.
  	lineHeight := line lineHeight.
  	rightMargin := line rightMargin + offset x.
  	lastIndex := line first.
  	leftInRun <= 0 ifTrue: [self setStopConditions].
  	leftMargin := (line leftMarginForAlignment: alignment) + offset x.
  	destX := leftMargin.
  	fillBlt == nil ifFalse:
  		["Not right"
  		fillBlt destX: line left destY: lineY
  			width: line width left height: lineHeight; copyBits].
  	lastIndex := line first.
  	leftInRun <= 0
  		ifTrue: [nowLeftInRun := text runLengthFor: lastIndex]
  		ifFalse: [nowLeftInRun := leftInRun].
  	destY := lineY + line baseline - font ascent.
  	runStopIndex := lastIndex + (nowLeftInRun - 1) min: line last.
  	spaceCount := 0.
  	string := text string.
  		"remember where this portion of the line starts"
  		startIndex := lastIndex.
  		lastPos := destX at destY.
  		"find the end of this portion of the line"
  		stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
  						in: string rightX: rightMargin stopConditions: stopConditions
  						kern: kern.
  		"display that portion of the line"
  		lastIndex >= startIndex ifTrue:[
  			font displayString: string on: bitBlt 
  				from: startIndex 
  	"XXXX: The following is an interesting bug. All stopConditions exept #endOfRun
  		have lastIndex past the last character displayed. #endOfRun sets it *on* the character.
  		If we display up until lastIndex then we will also display invisible characters like
  		CR and tab. This problem should be fixed in the scanner (i.e., position lastIndex
  		consistently) but I don't want to deal with the fallout right now so we keep the
  		fix minimally invasive."
  				to: (stopCondition == #endOfRun ifTrue:[lastIndex] ifFalse:[lastIndex-1]) 
  				at: lastPos kern: kern].
  		"handle the stop condition"
  		"see setStopConditions for stopping conditions for displaying."
  		self perform: stopCondition
  	] whileFalse.
  	^ runStopIndex - lastIndex   "Number of characters remaining in the current run"!

More information about the Packages mailing list