[squeak-dev] The Trunk: Morphic-tpr.689.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Wed Sep 25 22:08:45 UTC 2013


Ouch! eviscerate, that's cruel! Don't forget it's live programming...
Despite what the ligue for protection of text composer might think, I am
delighted in advance for the vocabulary of next commits :)


2013/9/25 <commits at source.squeak.org>

> tim Rowledge uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-tpr.689.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-tpr.689
> Author: tpr
> Time: 25 September 2013, 2:55:33.002 pm
> UUID: e64f2569-492c-40a3-b75c-f7a637bb67a7
> Ancestors: Morphic-nice.688
>
> finally, eviscerate MultiTextComposer ready to remove it later.
> simplify NewParagraph>>composeAll,
> multiComposeLinesFrom:to:delta:into:priorLines:atY: &
> recomposeFrom:to:delta:.
> remove unsent old test method testNewComposeAll2
>
> =============== Diff against Morphic-nice.688 ===============
>
> Item was changed:
>   TextComposer subclass: #MultiTextComposer
>         instanceVariableNames: ''
>         classVariableNames: ''
>         poolDictionaries: 'TextConstants'
>         category: 'Morphic-Multilingual'!
> +
> + !MultiTextComposer commentStamp: 'tpr 9/25/2013 13:04' prior: 0!
> + This is now a null calss we are working on removing completely!
>
> Item was removed:
> - ----- Method:
> MultiTextComposer>>multiComposeLinesFrom:to:delta:into:priorLines:atY:textStyle:text:container:wantsColumnBreaks:
> (in category 'as yet unclassified') -----
> - multiComposeLinesFrom: argStart to: argStop delta: argDelta into:
> argLinesCollection priorLines: argPriorLines atY: argStartY textStyle:
> argTextStyle text: argText container: argContainer wantsColumnBreaks:
> argWantsColumnBreaks
> -
> -       wantsColumnBreaks := argWantsColumnBreaks.
> -       lines := argLinesCollection.
> -       theTextStyle := argTextStyle.
> -       theText := argText.
> -       theContainer := argContainer.
> -       deltaCharIndex := argDelta.
> -       currCharIndex := startCharIndex := argStart.
> -       stopCharIndex := argStop.
> -       prevLines := argPriorLines.
> -       currentY := argStartY.
> -       defaultLineHeight := theTextStyle lineGrid.
> -       maxRightX := theContainer left.
> -       possibleSlide := stopCharIndex < theText size and: [theContainer
> isMemberOf: Rectangle].
> -       nowSliding := false.
> -       prevIndex := 1.
> -       scanner := MultiCompositionScanner new text: theText textStyle:
> theTextStyle.
> -       scanner wantsColumnBreaks: wantsColumnBreaks.
> -       isFirstLine := true.
> -       self composeAllLines.
> -       isFirstLine ifTrue: ["No space in container or empty text"
> -               self
> -                       addNullLineWithIndex: startCharIndex
> -                       andRectangle: (theContainer topLeft extent:
> 0 at defaultLineHeight)
> -       ] ifFalse: [
> -               self fixupLastLineIfCR
> -       ].
> -       ^{lines asArray. maxRightX}
> -
> - !
>
> Item was changed:
>   ----- Method: NewParagraph>>composeAll (in category 'composition') -----
>   composeAll
> +       self composeLinesFrom: firstCharacterIndex to: text size delta: 0
> +                       into: OrderedCollection new priorLines: Array new
> atY: container top!
> -       text string isOctetString ifTrue: [
> -               ^ self composeLinesFrom: firstCharacterIndex to: text size
> delta: 0
> -                       into: OrderedCollection new priorLines: Array new
> atY: container top.
> -       ].
> -
> -       ^ self multiComposeLinesFrom: firstCharacterIndex to: text size
> delta: 0
> -               into: OrderedCollection new priorLines: Array new atY:
> container top.
> - !
>
> Item was changed:
>   ----- Method:
> NewParagraph>>multiComposeLinesFrom:to:delta:into:priorLines:atY: (in
> category 'composition') -----
>   multiComposeLinesFrom: start to: stop delta: delta into: lineColl
> priorLines: priorLines
>         atY: startingY
>         "While the section from start to stop has changed, composition may
> ripple all the way to the end of the text.  However in a rectangular
> container, if we ever find a line beginning with the same character as
> before (ie corresponding to delta in the old lines), then we can just copy
> the old lines from there to the end of the container, with adjusted indices
> and y-values"
>
>         | newResult |
>
> +       newResult := TextComposer new
> -       newResult := MultiTextComposer new
>                 multiComposeLinesFrom: start
>                 to: stop
>                 delta: delta
>                 into: lineColl
>                 priorLines: priorLines
>                 atY: startingY
>                 textStyle: textStyle
>                 text: text
>                 container: container
>                 wantsColumnBreaks: wantsColumnBreaks == true.
>         lines := newResult first asArray.
>         maxRightX := newResult second.
>         "maxRightX printString displayAt: 0 at 0."
>         ^maxRightX
>   !
>
> Item was changed:
>   ----- Method: NewParagraph>>recomposeFrom:to:delta: (in category
> 'composition') -----
>   recomposeFrom: start to: stop delta: delta
>         "Recompose this paragraph.  The altered portion is between start
> and stop.
>         Recomposition may continue to the end of the text, due to a ripple
> effect.
>         Delta is the amount by which the current text is longer than it was
>         when its current lines were composed."
>         | startLine newLines |
>         "Have to recompose line above in case a word-break was affected."
>         startLine := (self lineIndexOfCharacterIndex: start) - 1 max: 1.
>         [startLine > 1 and: [(lines at: startLine-1) top = (lines at:
> startLine) top]]
>                 whileTrue: [startLine := startLine - 1].  "Find leftmost
> of line pieces"
>         newLines := OrderedCollection new: lines size + 1.
>         1 to: startLine-1 do: [:i | newLines addLast: (lines at: i)].
> +       self composeLinesFrom: (lines at: startLine) first to: stop delta:
> delta
> -       text string isOctetString ifTrue: [
> -               ^ self composeLinesFrom: (lines at: startLine) first to:
> stop delta: delta
>                         into: newLines priorLines: lines
> +                       atY: (lines at: startLine) top!
> -                       atY: (lines at: startLine) top.
> -       ].
> -       self multiComposeLinesFrom: (lines at: startLine) first to: stop
> delta: delta
> -               into: newLines priorLines: lines
> -               atY: (lines at: startLine) top.
> - !
>
> Item was removed:
> - ----- Method: NewParagraph>>testNewComposeAll2 (in category
> 'composition') -----
> - testNewComposeAll2
> -       | newResult |
> -       newResult := TextComposer new
> -               composeLinesFrom: firstCharacterIndex
> -               to: text size
> -               delta: 0
> -               into: OrderedCollection new
> -               priorLines: Array new
> -               atY: container top
> -               textStyle: textStyle
> -               text: text
> -               container: container
> -               wantsColumnBreaks: false.
> -       ^{newResult. {lines. maxRightX}}
> - !
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130926/79bb9a88/attachment.htm


More information about the Squeak-dev mailing list