[Pkg] The Trunk: Graphics-nice.89.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Nov 16 14:13:40 UTC 2009
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.89.mcz
==================== Summary ====================
Name: Graphics-nice.89
Author: nice
Time: 16 November 2009, 3:13:21 am
UUID: 5846cce1-f5ee-e440-bd95-7344a51acf85
Ancestors: Graphics-nice.88
Hack to handle crlf pair composition and display
=============== Diff against Graphics-nice.88 ===============
Item was changed:
----- Method: CharacterBlockScanner>>cr (in category 'stop conditions') -----
cr
"Answer a CharacterBlock that specifies the current location of the mouse
relative to a carriage return stop condition that has just been
encountered. The ParagraphEditor convention is to denote selections by
CharacterBlocks, sometimes including the carriage return (cursor is at
the end) and sometimes not (cursor is in the middle of the text)."
((characterIndex ~= nil
and: [characterIndex > text size])
or: [(line last = text size)
and: [(destY + line lineHeight) < characterPoint y]])
ifTrue: ["When off end of string, give data for next character"
destY := destY + line lineHeight.
lastCharacter := nil.
characterPoint := (nextLeftMargin ifNil: [leftMargin]) @ destY.
+ (lastIndex < text size and: [(text at: lastIndex) = CR and: [(text at: lastIndex+1) = Character lf]])
+ ifTrue: [lastIndex := lastIndex + 2]
+ ifFalse: [lastIndex := lastIndex + 1].
- lastIndex := lastIndex + 1.
self lastCharacterExtentSetX: 0.
^ true].
lastCharacter := CR.
characterPoint := destX @ destY.
self lastCharacterExtentSetX: rightMargin - destX.
^true!
Item was changed:
----- Method: CharacterScanner class>>initialize (in category 'class initialization') -----
initialize
"
CharacterScanner initialize
"
| a |
a := Array new: 258.
a at: 1 + 1 put: #embeddedObject.
a at: Tab asciiValue + 1 put: #tab.
a at: CR asciiValue + 1 put: #cr.
+ a at: Character lf asciiValue + 1 put: #cr.
a at: EndOfRun put: #endOfRun.
a at: CrossedX put: #crossedX.
NilCondition := a copy.
DefaultStopConditions := a copy.
PaddedSpaceCondition := a copy.
PaddedSpaceCondition at: Space asciiValue + 1 put: #paddedSpace.
SpaceCondition := a copy.
SpaceCondition at: Space asciiValue + 1 put: #space.
!
Item was changed:
----- Method: DisplayScanner>>cr (in category 'stop conditions') -----
cr
"When a carriage return is encountered, simply increment the pointer
into the paragraph."
+ pendingKernX := 0.
+ (lastIndex < text size and: [(text at: lastIndex) = CR and: [(text at: lastIndex+1) = Character lf]])
+ ifTrue: [lastIndex := lastIndex + 2]
+ ifFalse: [lastIndex := lastIndex + 1].
- lastIndex:= lastIndex + 1.
^false!
Item was changed:
----- Method: CompositionScanner>>cr (in category 'stop conditions') -----
cr
"Answer true. Set up values for the text line interval currently being
composed."
pendingKernX := 0.
+ (lastIndex < text size and: [(text at: lastIndex) = CR and: [(text at: lastIndex+1) = Character lf]]) ifTrue: [lastIndex := lastIndex + 1].
line stop: lastIndex.
spaceX := destX.
line paddingWidth: rightMargin - spaceX.
^true!
More information about the Packages
mailing list