tim Rowledge uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-tpr.120.mcz
==================== Summary ====================
Name: MorphicExtras-tpr.120
Author: tpr
Time: 30 September 2013, 4:11:52.606 pm
UUID: 532f584d-ee41-4783-b9eb-ddf00d760fa7
Ancestors: MorphicExtras-nice.119
Change from TextComposer characterForColumnBreak to Character characterForColumnBreak
=============== Diff against MorphicExtras-nice.119 ===============
Item was changed:
----- Method: TextPlusMorph>>addColumnBreak (in category 'as yet unclassified') -----
addColumnBreak
| ed old new break |
ed := self editor.
old := ed selection.
+ break := Character characterForColumnBreak asString.
- break := TextComposer characterForColumnBreak asString.
break := Text string: break attributes: {}.
new := old ,break.
ed replaceSelectionWith: new.
self releaseParagraphReally.
self layoutChanged.
!
tim Rowledge uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-tpr.120.mcz
==================== Summary ====================
Name: MorphicExtras-tpr.120
Author: tpr
Time: 30 September 2013, 4:11:52.606 pm
UUID: 532f584d-ee41-4783-b9eb-ddf00d760fa7
Ancestors: MorphicExtras-nice.119
Change from TextComposer characterForColumnBreak to Character characterForColumnBreak
=============== Diff against MorphicExtras-nice.119 ===============
Item was changed:
----- Method: TextPlusMorph>>addColumnBreak (in category 'as yet unclassified') -----
addColumnBreak
| ed old new break |
ed := self editor.
old := ed selection.
+ break := Character characterForColumnBreak asString.
- break := TextComposer characterForColumnBreak asString.
break := Text string: break attributes: {}.
new := old ,break.
ed replaceSelectionWith: new.
self releaseParagraphReally.
self layoutChanged.
!
tim Rowledge uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-tpr.120.mcz
==================== Summary ====================
Name: MorphicExtras-tpr.120
Author: tpr
Time: 30 September 2013, 4:11:52.606 pm
UUID: 532f584d-ee41-4783-b9eb-ddf00d760fa7
Ancestors: MorphicExtras-nice.119
Change from TextComposer characterForColumnBreak to Character characterForColumnBreak
=============== Diff against MorphicExtras-nice.119 ===============
Item was changed:
----- Method: TextPlusMorph>>addColumnBreak (in category 'as yet unclassified') -----
addColumnBreak
| ed old new break |
ed := self editor.
old := ed selection.
+ break := Character characterForColumnBreak asString.
- break := TextComposer characterForColumnBreak asString.
break := Text string: break attributes: {}.
new := old ,break.
ed replaceSelectionWith: new.
self releaseParagraphReally.
self layoutChanged.
!
tim Rowledge uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-tpr.537.mcz
==================== Summary ====================
Name: Collections-tpr.537
Author: tpr
Time: 30 September 2013, 4:06:41.402 pm
UUID: b3a96179-9642-40b1-93f3-3f1d82f3e256
Ancestors: Collections-fbs.536
Add Character class>>characterForColumnBreak - to replace TextComposer equivalent. See Mantis 4814
=============== Diff against Collections-fbs.536 ===============
Item was added:
+ ----- Method: Character class>>characterForColumnBreak (in category 'accessing untypeable characters') -----
+ characterForColumnBreak
+ "use a newPage to split columns in character scanners"
+ ^self newPage!
tim Rowledge uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-tpr.537.mcz
==================== Summary ====================
Name: Collections-tpr.537
Author: tpr
Time: 30 September 2013, 4:06:41.402 pm
UUID: b3a96179-9642-40b1-93f3-3f1d82f3e256
Ancestors: Collections-fbs.536
Add Character class>>characterForColumnBreak - to replace TextComposer equivalent. See Mantis 4814
=============== Diff against Collections-fbs.536 ===============
Item was added:
+ ----- Method: Character class>>characterForColumnBreak (in category 'accessing untypeable characters') -----
+ characterForColumnBreak
+ "use a newPage to split columns in character scanners"
+ ^self newPage!
tim Rowledge uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-tpr.537.mcz
==================== Summary ====================
Name: Collections-tpr.537
Author: tpr
Time: 30 September 2013, 4:06:41.402 pm
UUID: b3a96179-9642-40b1-93f3-3f1d82f3e256
Ancestors: Collections-fbs.536
Add Character class>>characterForColumnBreak - to replace TextComposer equivalent. See Mantis 4814
=============== Diff against Collections-fbs.536 ===============
Item was added:
+ ----- Method: Character class>>characterForColumnBreak (in category 'accessing untypeable characters') -----
+ characterForColumnBreak
+ "use a newPage to split columns in character scanners"
+ ^self newPage!
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.240.mcz
==================== Summary ====================
Name: Graphics-nice.240
Author: nice
Time: 29 September 2013, 11:37:28.204 pm
UUID: 8723c89d-2584-4aa3-bfb2-a863df2ee81d
Ancestors: Graphics-nice.239
Remove the inst. var. lastCharacter of CharacterBlockScanner, because it is not a state.
=============== Diff against Graphics-nice.239 ===============
Item was changed:
CharacterScanner subclass: #CharacterBlockScanner
+ instanceVariableNames: 'characterPoint characterIndex lastCharacterExtent lastSpaceOrTabExtent nextLeftMargin specialWidth'
- instanceVariableNames: 'characterPoint characterIndex lastCharacter lastCharacterExtent lastSpaceOrTabExtent nextLeftMargin specialWidth'
classVariableNames: ''
poolDictionaries: ''
category: 'Graphics-Text'!
!CharacterBlockScanner commentStamp: '<historical>' prior: 0!
My instances are used to scan text to compute the CharacterBlock for a character specified by its index in the text or its proximity to the cursor location.!
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].
self lastCharacterExtentSetX: 0.
^ true].
- lastCharacter := CR.
characterPoint := destX @ destY.
self lastCharacterExtentSetX: rightMargin - destX.
^true!
Item was changed:
----- Method: CharacterBlockScanner>>crossedX (in category 'stop conditions') -----
crossedX
"Text display has wrapping. The scanner just found a character past the x
location of the cursor. We know that the cursor is pointing at a character
or before one."
+ | currentX lastCharacter |
- | currentX |
characterIndex == nil ifFalse: [
"If the last character of the last line is a space,
and it crosses the right margin, then locating
the character block after it is impossible without this hack."
characterIndex > text size ifTrue: [
lastIndex := characterIndex.
characterPoint := (nextLeftMargin ifNil: [leftMargin]) @ (destY + line lineHeight).
^true]].
characterPoint x <= (destX + (lastCharacterExtent x // 2))
+ ifTrue: [characterPoint := destX @ destY.
- ifTrue: [lastCharacter := (text at: lastIndex).
- characterPoint := destX @ destY.
^true].
lastIndex >= line last
+ ifTrue: [characterPoint := destX @ destY.
- ifTrue: [lastCharacter := (text at: line last).
- characterPoint := destX @ destY.
^true].
"Pointing past middle of a character, return the next character."
lastIndex := lastIndex + 1.
lastCharacter := text at: lastIndex.
currentX := destX + lastCharacterExtent x + kern.
self lastCharacterExtentSetX: (font widthOf: lastCharacter).
characterPoint := currentX @ destY.
lastCharacter = Space ifFalse: [^ true].
"Yukky if next character is space or tab."
alignment = Justified ifTrue:
[self lastCharacterExtentSetX:
(lastCharacterExtent x + (line justifiedPadFor: (spaceCount + 1) font: font))].
^ true!
Item was changed:
----- Method: CharacterBlockScanner>>endOfRun (in category 'stop conditions') -----
endOfRun
"Before arriving at the cursor location, the selection has encountered an
end of run. Answer false if the selection continues, true otherwise. Set
up indexes for building the appropriate CharacterBlock."
+ | runLength lineStop lastCharacter |
- | runLength lineStop |
(((characterIndex ~~ nil and:
[runStopIndex < characterIndex and: [runStopIndex < text size]])
or: [characterIndex == nil and: [lastIndex < line last]]) or: [
((lastIndex < line last)
and: [((text at: lastIndex) leadingChar ~= (text at: lastIndex+1) leadingChar)
and: [lastIndex ~= characterIndex]])])
ifTrue: ["We're really at the end of a real run."
runLength := (text runLengthFor: (lastIndex := lastIndex + 1)).
characterIndex ~~ nil
ifTrue: [lineStop := characterIndex "scanning for index"]
ifFalse: [lineStop := line last "scanning for point"].
(runStopIndex := lastIndex + (runLength - 1)) > lineStop
ifTrue: [runStopIndex := lineStop].
self setStopConditions.
^false].
lastCharacter := text at: lastIndex.
characterPoint := destX @ destY.
((lastCharacter = Space and: [alignment = Justified])
or: [lastCharacter = Tab and: [lastSpaceOrTabExtent notNil]])
ifTrue: [lastCharacterExtent := lastSpaceOrTabExtent].
characterIndex ~~ nil
ifTrue: ["If scanning for an index and we've stopped on that index,
then we back destX off by the width of the character stopped on
(it will be pointing at the right side of the character) and return"
runStopIndex = characterIndex
ifTrue: [self characterPointSetX: destX - lastCharacterExtent x.
^true].
"Otherwise the requested index was greater than the length of the
string. Return string size + 1 as index, indicate further that off the
string by setting character to nil and the extent to 0."
lastIndex := lastIndex + 1.
- lastCharacter := nil.
self lastCharacterExtentSetX: 0.
^true].
"Scanning for a point and either off the end of the line or off the end of the string."
runStopIndex = text size
ifTrue: ["off end of string"
lastIndex := lastIndex + 1.
- lastCharacter := nil.
self lastCharacterExtentSetX: 0.
^true].
"just off end of line without crossing x"
lastIndex := lastIndex + 1.
^true!