The Trunk: Graphics-pre.420.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-pre.420.mcz

commits-2
Patrick Rein uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-pre.420.mcz

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

Name: Graphics-pre.420
Author: pre
Time: 8 October 2019, 4:17:02.051422 pm
UUID: a0f378bc-6224-5948-b36d-4f4dbf9346b9
Ancestors: Graphics-pre.419

Fixes an issue with rendering embedded forms in TextMorphs which are children of TransformMorphs. Adds two comments documenting involved details of the classes.

=============== Diff against Graphics-pre.419 ===============

Item was changed:
  ----- Method: BitBltDisplayScanner>>displayString:from:to:at: (in category 'displaying') -----
  displayString: string from: startIndex to: stopIndex at: aPoint
+
+ font
+ displayString: string
+ on: bitBlt
- font displayString: string on: bitBlt
  from: startIndex
  to: stopIndex
+ at: aPoint
+ kern: kern!
- at: aPoint kern: kern!

Item was changed:
  CharacterScanner subclass: #DisplayScanner
  instanceVariableNames: 'lineY foregroundColor backgroundColor defaultTextColor paragraphColor morphicOffset ignoreColorChanges lastDisplayableIndex stopConditionsMustBeReset'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Graphics-Text'!
 
+ !DisplayScanner commentStamp: 'pre 10/8/2019 16:16' prior: 0!
- !DisplayScanner commentStamp: 'nice 10/11/2013 23:45' prior: 0!
  A DisplayScanner is an abstract class for displaying characters.
  It is splitting text into elementary chunks of displayable String/Font pairs (see scanning protocol).
  Subclasses responsibility is to handle the effective rendering of these chunks on various backends.
 
  Instance Variables
  backgroundColor: <Color>
  defaultTextColor: <Color>
  foregroundColor: <Color>
  ignoreColorChanges: <Boolean>
  lastDisplayableIndex: <Integer>
  lineY: <Number>
  morphicOffset: <Point>
  stopConditionsMustBeReset: <Boolean>
 
  backgroundColor
  - the background color for displaying next chunk of text.
  Note that this can be set to Color transparent, in which case no background is displayed.
 
  defaultTextColor
  - the default foreground color for displaying text in absence of other text attributes specification
 
  foregroundColor
  - the foreground color for displaying next chunk of text
 
  ignoreColorChanges
  - 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.
 
  lastDisplayableIndex
  - the index of last character to be displayed.
  A different index than lastIndex is required in order to avoid display of control characters.
  This variable must be updated by the stop condition at each inner scan loop.
 
  lineY
  - the distance between destination form top and current line top
 
  morphicOffset
+ - an offset for displaying the lines passed from morphic to the scanner (via NewParagraph>>#displayOn:using:at:)
- - an offset for positionning the embedded morphs.
- THE EXACT SPECIFICATION YET REMAINS TO BE WRITTEN
 
  stopConditionsMustBeReset
  - indicates that it's necessary to call setStopConditions in next scan loop.
 
  Notes:
  In order to correctly set the lastDisplayableIndex, the display scanner performs the stopCondition BEFORE displaying the string being scanned.
  This explains why the stopCondition must not reset the font immediately, but differ this reset AFTER the display, thanks to stopConditionsMustBeReset.
  !

Item was changed:
  ----- Method: DisplayScanner>>embeddedObject (in category 'stop conditions') -----
  embeddedObject
 
+ "We have to set the last displayed index to a value smaller than last index
+ in order to prevent the text anchor placeholder character to be printed. For
+ details see end of DisplayScanner>>#displayLine:offset:leftInRun:"
- "TODO: document the reason for this decrement --pre"
  lastDisplayableIndex := lastIndex - 1.
  ^ super embeddedObject!

Item was changed:
  ----- Method: DisplayScanner>>placeEmbeddedObject:inlineGiven: (in category 'private') -----
  placeEmbeddedObject: anchoredMorphOrForm inlineGiven: textAnchorProperties
 
  | alignedPositionY position |
  alignedPositionY := self verticallyAlignEmbeddedObject: anchoredMorphOrForm given: textAnchorProperties.
+ position := (destX + textAnchorProperties padding left) @ alignedPositionY.
- position := ((destX + textAnchorProperties padding left) @ alignedPositionY) - morphicOffset.
  anchoredMorphOrForm isMorph
+ ifTrue: [
+ "We have to remove the offset passed to us from morphic as this embedded morph
+ will only be rendered later on. We now only set the position. --pre"
+ anchoredMorphOrForm layoutPosition: position - morphicOffset]
+ ifFalse: ["we assume this to be a form"
- ifTrue: [ anchoredMorphOrForm position: position]
- ifFalse: ["we assume this to be a form"
  self displayEmbeddedForm: anchoredMorphOrForm at: position].
  !