TxTextMorph based on new text model

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

TxTextMorph based on new text model

Denis Kudriashov
Hello.

I upload new version of TxText with new TxTextMorph which can show TxTextModel (http://www.smalltalkhub.com/#!/~sig/TxText ). See class side examples.

Implementation details:

TxTextMorph has textLayout instance variable which contains full precomputed information to draw text on screen. TxTextLayout contains collection of TxTextLine. TxTextLine contains collection of span objects (from text model) and offset with extent required for drawing lines (with right align for example).
There are TxTextLayoutStrategy hierarchy responsible for building specific text layout objects:
  • TxSimpleTextLayoutStrategy build layout with actual text lines which text model contains
  • TxWrapTextStrategy build layout with lines which satisfied preferredExtent (given from text morph bounds)
When text morph accepts new text model It asks layoutStrategy to build new layout. Then align selector applyed to layout. So text can be placed left to right, centered or right to left.

Morph drawing method very simple:

TxTextMorph>>drawOn: aCanvas   
    textLayout drawTextOn: aCanvas at: self position

TxTextLayout>>drawTextOn: aCanvas at: aPoint   
    | topOffset linePosition |
    topOffset := 0.
    lines do: [:eachLine |
        linePosition := aPoint x @ (aPoint y + topOffset).
        eachLine drawOn: aCanvas at: linePosition.
        topOffset := topOffset + eachLine height.
    ]

TxTextLine>>drawOn: aCanvas at: aPoint

    spans do: [:each |
        each drawOn: aCanvas at: aPoint + offset
    ]

At the end TxCharactersSpan draw contents on canvas:

TxCharactersSpan >>drawOn: aCanvas at: aPoint
    aCanvas
        drawString: characters
        at: aPoint
        font: (self getAttribute: TxFontAttribute)
        color: (self getAttribute: TxColorAttribute)

And with Athens api text attributes can be not hardcoded:

TxCharactersSpan >>drawAthensOn: aCanvas at: aPoint
    attributes applyOn: aCanvas.
    aCanvas pathTransform translateX: aPoint x Y: aPoint y.
    aCanvas drawString: characters

Questions:

Now text alignment (like centering) is property of TxTextMorph. So it global property of full text layout.
But how such attribute can be applied to specific line?

TxModel is list of spans. And each span object contains characters with same text attributes like font or color. Text alignment can be such attribute too. Do you think it should be attribute of all spans from single line? Or it should be only attribute of TxLineSeparator span? What your idea?

Future:

Next plan: cursor navigation, text selection and editing features. And of course tests, sorry I not start with tests now.

I wait your comments , ideas and questions. Maybe you don't like my approach. I want to know why.
I really want clean and object solution for text stuff in pharo.

Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Igor Stasenko
Wow..
this is a huge progress!
Sorry i was busy with other stuff and had no time to look at your code.


On 13 January 2013 20:54, Denis Kudriashov <[hidden email]> wrote:

> Hello.
>
> I upload new version of TxText with new TxTextMorph which can show
> TxTextModel (http://www.smalltalkhub.com/#!/~sig/TxText ). See class side
> examples.
>
> Implementation details:
>
> TxTextMorph has textLayout instance variable which contains full precomputed
> information to draw text on screen. TxTextLayout contains collection of
> TxTextLine. TxTextLine contains collection of span objects (from text model)
> and offset with extent required for drawing lines (with right align for
> example).
> There are TxTextLayoutStrategy hierarchy responsible for building specific
> text layout objects:
>
> TxSimpleTextLayoutStrategy build layout with actual text lines which text
> model contains
> TxWrapTextStrategy build layout with lines which satisfied preferredExtent
> (given from text morph bounds)
>
> When text morph accepts new text model It asks layoutStrategy to build new
> layout. Then align selector applyed to layout. So text can be placed left to
> right, centered or right to left.
>
> Morph drawing method very simple:
>
> TxTextMorph>>drawOn: aCanvas
>     textLayout drawTextOn: aCanvas at: self position
>
> TxTextLayout>>drawTextOn: aCanvas at: aPoint
>     | topOffset linePosition |
>     topOffset := 0.
>     lines do: [:eachLine |
>         linePosition := aPoint x @ (aPoint y + topOffset).
>         eachLine drawOn: aCanvas at: linePosition.
>         topOffset := topOffset + eachLine height.
>     ]
>
> TxTextLine>>drawOn: aCanvas at: aPoint
>
>     spans do: [:each |
>         each drawOn: aCanvas at: aPoint + offset
>     ]
>
> At the end TxCharactersSpan draw contents on canvas:
>
> TxCharactersSpan >>drawOn: aCanvas at: aPoint
>     aCanvas
>         drawString: characters
>         at: aPoint
>         font: (self getAttribute: TxFontAttribute)
>         color: (self getAttribute: TxColorAttribute)
>
> And with Athens api text attributes can be not hardcoded:
>
> TxCharactersSpan >>drawAthensOn: aCanvas at: aPoint
>     attributes applyOn: aCanvas.
>     aCanvas pathTransform translateX: aPoint x Y: aPoint y.
>     aCanvas drawString: characters
>
> Questions:
>
> Now text alignment (like centering) is property of TxTextMorph. So it global
> property of full text layout.
> But how such attribute can be applied to specific line?
>
> TxModel is list of spans. And each span object contains characters with same
> text attributes like font or color. Text alignment can be such attribute
> too. Do you think it should be attribute of all spans from single line? Or
> it should be only attribute of TxLineSeparator span? What your idea?
>

Well, there is two approaches: a per-line attribute can be a special
span at the beginning at
line, or it can be an attribute. Both has pros and cons, however.
In case of span, it needs to be dealt properly with text editing/navigation.
In case of attribute(s), this attribute is really per line (or better
to say, per paragraph)
and putting it into each span seems like superfluous.

IMO, i would go for a simplest model: the capability like text
alignment (left/center/right)
per line, is kind of overkill for our little world.
I mean, it would be nice to have, but look at our tools: where are
they used? Nowhere.
So i would not focus on it right now, and having a global attribute
seems like a good solution right now.

> Future:
>
> Next plan: cursor navigation, text selection and editing features. And of
> course tests, sorry I not start with tests now.
>
don't forget about tests.
We started writing a model by implementing tests first, because we
didn't wanted
an implementation to dictate how things should be used.

> I wait your comments , ideas and questions. Maybe you don't like my
> approach. I want to know why.
> I really want clean and object solution for text stuff in pharo.
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Stéphane Ducasse
Igor

do not think that because our tools do not use anything, we do not need good text support.
Moose is struggling with the limits of the current textmodel.

We should offer solutions to people not just to edit methods.

Stef

On Jan 13, 2013, at 9:51 PM, Igor Stasenko wrote:

> Wow..
> this is a huge progress!
> Sorry i was busy with other stuff and had no time to look at your code.
>
>
> On 13 January 2013 20:54, Denis Kudriashov <[hidden email]> wrote:
>> Hello.
>>
>> I upload new version of TxText with new TxTextMorph which can show
>> TxTextModel (http://www.smalltalkhub.com/#!/~sig/TxText ). See class side
>> examples.
>>
>> Implementation details:
>>
>> TxTextMorph has textLayout instance variable which contains full precomputed
>> information to draw text on screen. TxTextLayout contains collection of
>> TxTextLine. TxTextLine contains collection of span objects (from text model)
>> and offset with extent required for drawing lines (with right align for
>> example).
>> There are TxTextLayoutStrategy hierarchy responsible for building specific
>> text layout objects:
>>
>> TxSimpleTextLayoutStrategy build layout with actual text lines which text
>> model contains
>> TxWrapTextStrategy build layout with lines which satisfied preferredExtent
>> (given from text morph bounds)
>>
>> When text morph accepts new text model It asks layoutStrategy to build new
>> layout. Then align selector applyed to layout. So text can be placed left to
>> right, centered or right to left.
>>
>> Morph drawing method very simple:
>>
>> TxTextMorph>>drawOn: aCanvas
>>    textLayout drawTextOn: aCanvas at: self position
>>
>> TxTextLayout>>drawTextOn: aCanvas at: aPoint
>>    | topOffset linePosition |
>>    topOffset := 0.
>>    lines do: [:eachLine |
>>        linePosition := aPoint x @ (aPoint y + topOffset).
>>        eachLine drawOn: aCanvas at: linePosition.
>>        topOffset := topOffset + eachLine height.
>>    ]
>>
>> TxTextLine>>drawOn: aCanvas at: aPoint
>>
>>    spans do: [:each |
>>        each drawOn: aCanvas at: aPoint + offset
>>    ]
>>
>> At the end TxCharactersSpan draw contents on canvas:
>>
>> TxCharactersSpan >>drawOn: aCanvas at: aPoint
>>    aCanvas
>>        drawString: characters
>>        at: aPoint
>>        font: (self getAttribute: TxFontAttribute)
>>        color: (self getAttribute: TxColorAttribute)
>>
>> And with Athens api text attributes can be not hardcoded:
>>
>> TxCharactersSpan >>drawAthensOn: aCanvas at: aPoint
>>    attributes applyOn: aCanvas.
>>    aCanvas pathTransform translateX: aPoint x Y: aPoint y.
>>    aCanvas drawString: characters
>>
>> Questions:
>>
>> Now text alignment (like centering) is property of TxTextMorph. So it global
>> property of full text layout.
>> But how such attribute can be applied to specific line?
>>
>> TxModel is list of spans. And each span object contains characters with same
>> text attributes like font or color. Text alignment can be such attribute
>> too. Do you think it should be attribute of all spans from single line? Or
>> it should be only attribute of TxLineSeparator span? What your idea?
>>
>
> Well, there is two approaches: a per-line attribute can be a special
> span at the beginning at
> line, or it can be an attribute. Both has pros and cons, however.
> In case of span, it needs to be dealt properly with text editing/navigation.
> In case of attribute(s), this attribute is really per line (or better
> to say, per paragraph)
> and putting it into each span seems like superfluous.
>
> IMO, i would go for a simplest model: the capability like text
> alignment (left/center/right)
> per line, is kind of overkill for our little world.
> I mean, it would be nice to have, but look at our tools: where are
> they used? Nowhere.
> So i would not focus on it right now, and having a global attribute
> seems like a good solution right now.
>
>> Future:
>>
>> Next plan: cursor navigation, text selection and editing features. And of
>> course tests, sorry I not start with tests now.
>>
> don't forget about tests.
> We started writing a model by implementing tests first, because we
> didn't wanted
> an implementation to dictate how things should be used.
>
>> I wait your comments , ideas and questions. Maybe you don't like my
>> approach. I want to know why.
>> I really want clean and object solution for text stuff in pharo.
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>


Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Stéphane Ducasse
In reply to this post by Denis Kudriashov
thanks denis for pushing that!!!!

Stef


> Hello.
>
> I upload new version of TxText with new TxTextMorph which can show TxTextModel (http://www.smalltalkhub.com/#!/~sig/TxText ). See class side examples.
>
> Implementation details:
>
> TxTextMorph has textLayout instance variable which contains full precomputed information to draw text on screen. TxTextLayout contains collection of TxTextLine. TxTextLine contains collection of span objects (from text model) and offset with extent required for drawing lines (with right align for example).
> There are TxTextLayoutStrategy hierarchy responsible for building specific text layout objects:
> • TxSimpleTextLayoutStrategy build layout with actual text lines which text model contains
> • TxWrapTextStrategy build layout with lines which satisfied preferredExtent (given from text morph bounds)
> When text morph accepts new text model It asks layoutStrategy to build new layout. Then align selector applyed to layout. So text can be placed left to right, centered or right to left.
>
> Morph drawing method very simple:
>
> TxTextMorph>>drawOn: aCanvas    
>     textLayout drawTextOn: aCanvas at: self position
>
> TxTextLayout>>drawTextOn: aCanvas at: aPoint    
>     | topOffset linePosition |
>     topOffset := 0.
>     lines do: [:eachLine |
>         linePosition := aPoint x @ (aPoint y + topOffset).
>         eachLine drawOn: aCanvas at: linePosition.
>         topOffset := topOffset + eachLine height.
>     ]
>
> TxTextLine>>drawOn: aCanvas at: aPoint
>
>     spans do: [:each |
>         each drawOn: aCanvas at: aPoint + offset
>     ]
>
> At the end TxCharactersSpan draw contents on canvas:
>
> TxCharactersSpan >>drawOn: aCanvas at: aPoint
>     aCanvas
>         drawString: characters
>         at: aPoint
>         font: (self getAttribute: TxFontAttribute)
>         color: (self getAttribute: TxColorAttribute)
>
> And with Athens api text attributes can be not hardcoded:
>
> TxCharactersSpan >>drawAthensOn: aCanvas at: aPoint
>     attributes applyOn: aCanvas.
>     aCanvas pathTransform translateX: aPoint x Y: aPoint y.
>     aCanvas drawString: characters
>
> Questions:
>
> Now text alignment (like centering) is property of TxTextMorph. So it global property of full text layout.
> But how such attribute can be applied to specific line?
>
> TxModel is list of spans. And each span object contains characters with same text attributes like font or color. Text alignment can be such attribute too. Do you think it should be attribute of all spans from single line? Or it should be only attribute of TxLineSeparator span? What your idea?
>
> Future:
>
> Next plan: cursor navigation, text selection and editing features. And of course tests, sorry I not start with tests now.
>
> I wait your comments , ideas and questions. Maybe you don't like my approach. I want to know why.
> I really want clean and object solution for text stuff in pharo.
>


Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Camillo Bruni-3
I added a new jenkins job:

https://ci.inria.fr/rmod/job/TxText/

currently inactive/broken, we will dive into it tomorrow ;)


On 2013-01-13, at 22:26, Stéphane Ducasse <[hidden email]> wrote:

> thanks denis for pushing that!!!!
>
> Stef
>
>
>> Hello.
>>
>> I upload new version of TxText with new TxTextMorph which can show TxTextModel (http://www.smalltalkhub.com/#!/~sig/TxText ). See class side examples.
>>
>> Implementation details:
>>
>> TxTextMorph has textLayout instance variable which contains full precomputed information to draw text on screen. TxTextLayout contains collection of TxTextLine. TxTextLine contains collection of span objects (from text model) and offset with extent required for drawing lines (with right align for example).
>> There are TxTextLayoutStrategy hierarchy responsible for building specific text layout objects:
>> • TxSimpleTextLayoutStrategy build layout with actual text lines which text model contains
>> • TxWrapTextStrategy build layout with lines which satisfied preferredExtent (given from text morph bounds)
>> When text morph accepts new text model It asks layoutStrategy to build new layout. Then align selector applyed to layout. So text can be placed left to right, centered or right to left.
>>
>> Morph drawing method very simple:
>>
>> TxTextMorph>>drawOn: aCanvas    
>>    textLayout drawTextOn: aCanvas at: self position
>>
>> TxTextLayout>>drawTextOn: aCanvas at: aPoint    
>>    | topOffset linePosition |
>>    topOffset := 0.
>>    lines do: [:eachLine |
>>        linePosition := aPoint x @ (aPoint y + topOffset).
>>        eachLine drawOn: aCanvas at: linePosition.
>>        topOffset := topOffset + eachLine height.
>>    ]
>>
>> TxTextLine>>drawOn: aCanvas at: aPoint
>>
>>    spans do: [:each |
>>        each drawOn: aCanvas at: aPoint + offset
>>    ]
>>
>> At the end TxCharactersSpan draw contents on canvas:
>>
>> TxCharactersSpan >>drawOn: aCanvas at: aPoint
>>    aCanvas
>>        drawString: characters
>>        at: aPoint
>>        font: (self getAttribute: TxFontAttribute)
>>        color: (self getAttribute: TxColorAttribute)
>>
>> And with Athens api text attributes can be not hardcoded:
>>
>> TxCharactersSpan >>drawAthensOn: aCanvas at: aPoint
>>    attributes applyOn: aCanvas.
>>    aCanvas pathTransform translateX: aPoint x Y: aPoint y.
>>    aCanvas drawString: characters
>>
>> Questions:
>>
>> Now text alignment (like centering) is property of TxTextMorph. So it global property of full text layout.
>> But how such attribute can be applied to specific line?
>>
>> TxModel is list of spans. And each span object contains characters with same text attributes like font or color. Text alignment can be such attribute too. Do you think it should be attribute of all spans from single line? Or it should be only attribute of TxLineSeparator span? What your idea?
>>
>> Future:
>>
>> Next plan: cursor navigation, text selection and editing features. And of course tests, sorry I not start with tests now.
>>
>> I wait your comments , ideas and questions. Maybe you don't like my approach. I want to know why.
>> I really want clean and object solution for text stuff in pharo.
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Camillo Bruni-3
Denis, could you create a ConfigurationOfTxText?
That would greatly simplify the creation of a build job on jenkins!

On 2013-01-13, at 22:39, Camillo Bruni <[hidden email]> wrote:

> I added a new jenkins job:
>
> https://ci.inria.fr/rmod/job/TxText/
>
> currently inactive/broken, we will dive into it tomorrow ;)
>
>
> On 2013-01-13, at 22:26, Stéphane Ducasse <[hidden email]> wrote:
>
>> thanks denis for pushing that!!!!
>>
>> Stef
>>
>>
>>> Hello.
>>>
>>> I upload new version of TxText with new TxTextMorph which can show TxTextModel (http://www.smalltalkhub.com/#!/~sig/TxText ). See class side examples.
>>>
>>> Implementation details:
>>>
>>> TxTextMorph has textLayout instance variable which contains full precomputed information to draw text on screen. TxTextLayout contains collection of TxTextLine. TxTextLine contains collection of span objects (from text model) and offset with extent required for drawing lines (with right align for example).
>>> There are TxTextLayoutStrategy hierarchy responsible for building specific text layout objects:
>>> • TxSimpleTextLayoutStrategy build layout with actual text lines which text model contains
>>> • TxWrapTextStrategy build layout with lines which satisfied preferredExtent (given from text morph bounds)
>>> When text morph accepts new text model It asks layoutStrategy to build new layout. Then align selector applyed to layout. So text can be placed left to right, centered or right to left.
>>>
>>> Morph drawing method very simple:
>>>
>>> TxTextMorph>>drawOn: aCanvas    
>>>   textLayout drawTextOn: aCanvas at: self position
>>>
>>> TxTextLayout>>drawTextOn: aCanvas at: aPoint    
>>>   | topOffset linePosition |
>>>   topOffset := 0.
>>>   lines do: [:eachLine |
>>>       linePosition := aPoint x @ (aPoint y + topOffset).
>>>       eachLine drawOn: aCanvas at: linePosition.
>>>       topOffset := topOffset + eachLine height.
>>>   ]
>>>
>>> TxTextLine>>drawOn: aCanvas at: aPoint
>>>
>>>   spans do: [:each |
>>>       each drawOn: aCanvas at: aPoint + offset
>>>   ]
>>>
>>> At the end TxCharactersSpan draw contents on canvas:
>>>
>>> TxCharactersSpan >>drawOn: aCanvas at: aPoint
>>>   aCanvas
>>>       drawString: characters
>>>       at: aPoint
>>>       font: (self getAttribute: TxFontAttribute)
>>>       color: (self getAttribute: TxColorAttribute)
>>>
>>> And with Athens api text attributes can be not hardcoded:
>>>
>>> TxCharactersSpan >>drawAthensOn: aCanvas at: aPoint
>>>   attributes applyOn: aCanvas.
>>>   aCanvas pathTransform translateX: aPoint x Y: aPoint y.
>>>   aCanvas drawString: characters
>>>
>>> Questions:
>>>
>>> Now text alignment (like centering) is property of TxTextMorph. So it global property of full text layout.
>>> But how such attribute can be applied to specific line?
>>>
>>> TxModel is list of spans. And each span object contains characters with same text attributes like font or color. Text alignment can be such attribute too. Do you think it should be attribute of all spans from single line? Or it should be only attribute of TxLineSeparator span? What your idea?
>>>
>>> Future:
>>>
>>> Next plan: cursor navigation, text selection and editing features. And of course tests, sorry I not start with tests now.
>>>
>>> I wait your comments , ideas and questions. Maybe you don't like my approach. I want to know why.
>>> I really want clean and object solution for text stuff in pharo.
>>>
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Denis Kudriashov
Yes.
I want to do it. But today I busy. Tomorrow I hope I can make it.
I actually want to split package to TxText-Model, TxText-Layout, TxText-UI, TxTextTests-Model, TxTextTests-Layout

2013/1/15 Camillo Bruni <[hidden email]>
Denis, could you create a ConfigurationOfTxText?
That would greatly simplify the creation of a build job on jenkins!

On 2013-01-13, at 22:39, Camillo Bruni <[hidden email]> wrote:

> I added a new jenkins job:
>
> https://ci.inria.fr/rmod/job/TxText/
>
> currently inactive/broken, we will dive into it tomorrow ;)
>
>
> On 2013-01-13, at 22:26, Stéphane Ducasse <[hidden email]> wrote:
>
>> thanks denis for pushing that!!!!
>>
>> Stef
>>
>>
>>> Hello.
>>>
>>> I upload new version of TxText with new TxTextMorph which can show TxTextModel (http://www.smalltalkhub.com/#!/~sig/TxText ). See class side examples.
>>>
>>> Implementation details:
>>>
>>> TxTextMorph has textLayout instance variable which contains full precomputed information to draw text on screen. TxTextLayout contains collection of TxTextLine. TxTextLine contains collection of span objects (from text model) and offset with extent required for drawing lines (with right align for example).
>>> There are TxTextLayoutStrategy hierarchy responsible for building specific text layout objects:
>>>     • TxSimpleTextLayoutStrategy build layout with actual text lines which text model contains
>>>     • TxWrapTextStrategy build layout with lines which satisfied preferredExtent (given from text morph bounds)
>>> When text morph accepts new text model It asks layoutStrategy to build new layout. Then align selector applyed to layout. So text can be placed left to right, centered or right to left.
>>>
>>> Morph drawing method very simple:
>>>
>>> TxTextMorph>>drawOn: aCanvas
>>>   textLayout drawTextOn: aCanvas at: self position
>>>
>>> TxTextLayout>>drawTextOn: aCanvas at: aPoint
>>>   | topOffset linePosition |
>>>   topOffset := 0.
>>>   lines do: [:eachLine |
>>>       linePosition := aPoint x @ (aPoint y + topOffset).
>>>       eachLine drawOn: aCanvas at: linePosition.
>>>       topOffset := topOffset + eachLine height.
>>>   ]
>>>
>>> TxTextLine>>drawOn: aCanvas at: aPoint
>>>
>>>   spans do: [:each |
>>>       each drawOn: aCanvas at: aPoint + offset
>>>   ]
>>>
>>> At the end TxCharactersSpan draw contents on canvas:
>>>
>>> TxCharactersSpan >>drawOn: aCanvas at: aPoint
>>>   aCanvas
>>>       drawString: characters
>>>       at: aPoint
>>>       font: (self getAttribute: TxFontAttribute)
>>>       color: (self getAttribute: TxColorAttribute)
>>>
>>> And with Athens api text attributes can be not hardcoded:
>>>
>>> TxCharactersSpan >>drawAthensOn: aCanvas at: aPoint
>>>   attributes applyOn: aCanvas.
>>>   aCanvas pathTransform translateX: aPoint x Y: aPoint y.
>>>   aCanvas drawString: characters
>>>
>>> Questions:
>>>
>>> Now text alignment (like centering) is property of TxTextMorph. So it global property of full text layout.
>>> But how such attribute can be applied to specific line?
>>>
>>> TxModel is list of spans. And each span object contains characters with same text attributes like font or color. Text alignment can be such attribute too. Do you think it should be attribute of all spans from single line? Or it should be only attribute of TxLineSeparator span? What your idea?
>>>
>>> Future:
>>>
>>> Next plan: cursor navigation, text selection and editing features. And of course tests, sorry I not start with tests now.
>>>
>>> I wait your comments , ideas and questions. Maybe you don't like my approach. I want to know why.
>>> I really want clean and object solution for text stuff in pharo.
>>>
>>
>>
>



Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Camillo Bruni-3

On 2013-01-15, at 12:44, Denis Kudriashov <[hidden email]> wrote:

> Yes.
> I want to do it. But today I busy. Tomorrow I hope I can make it.

no hurry :) I set up the jenkins build, it will trigger as soon as you push the configuration :)

> I actually want to split package to TxText-Model, TxText-Layout, TxText-UI,
> TxTextTests-Model, TxTextTests-Layout

nice!
Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Denis Kudriashov
Hello.

I publish configuration at TxText repository based on proposed repackaging.

2013/1/15 Camillo Bruni <[hidden email]>

On 2013-01-15, at 12:44, Denis Kudriashov <[hidden email]> wrote:

> Yes.
> I want to do it. But today I busy. Tomorrow I hope I can make it.

no hurry :) I set up the jenkins build, it will trigger as soon as you push the configuration :)

> I actually want to split package to TxText-Model, TxText-Layout, TxText-UI,
> TxTextTests-Model, TxTextTests-Layout

nice!

Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Stéphane Ducasse
This is really nice.
Tristan started to look at what you are doing because we proposed him to enhance textModel as part of an internship with us.

Stef

On Jan 18, 2013, at 9:30 PM, Denis Kudriashov wrote:

> Hello.
>
> I publish configuration at TxText repository based on proposed repackaging.
>
> 2013/1/15 Camillo Bruni <[hidden email]>
>
> On 2013-01-15, at 12:44, Denis Kudriashov <[hidden email]> wrote:
>
> > Yes.
> > I want to do it. But today I busy. Tomorrow I hope I can make it.
>
> no hurry :) I set up the jenkins build, it will trigger as soon as you push the configuration :)
>
> > I actually want to split package to TxText-Model, TxText-Layout, TxText-UI,
> > TxTextTests-Model, TxTextTests-Layout
>
> nice!
>


Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Denis Kudriashov
I uploaded new version with refactored layout code and new tests.

TxText tests now uses Mocketry framework. I very hope you will enjoy it. Mock objects to me is main tool to design and implement flexible object systems. And Mocketry simplifies mock objects technique very much.
See announcement about new version of Mocketry.

Best regards
Denis

2013/1/19 Stéphane Ducasse <[hidden email]>
This is really nice.
Tristan started to look at what you are doing because we proposed him to enhance textModel as part of an internship with us.

Stef

On Jan 18, 2013, at 9:30 PM, Denis Kudriashov wrote:

> Hello.
>
> I publish configuration at TxText repository based on proposed repackaging.
>
> 2013/1/15 Camillo Bruni <[hidden email]>
>
> On 2013-01-15, at 12:44, Denis Kudriashov <[hidden email]> wrote:
>
> > Yes.
> > I want to do it. But today I busy. Tomorrow I hope I can make it.
>
> no hurry :) I set up the jenkins build, it will trigger as soon as you push the configuration :)
>
> > I actually want to split package to TxText-Model, TxText-Layout, TxText-UI,
> > TxTextTests-Model, TxTextTests-Layout
>
> nice!
>



Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Sean P. DeNigris
Administrator
In reply to this post by Denis Kudriashov
Denis Kudriashov wrote
I upload new version of TxText with new TxTextMorph
Denis, thank you for taking this on! This is so important. There are many times in my experiments with reinventing the tools when I've gotten confused and frustrated by the way text / editors work and chosen to revert to a more standard way of doing things.

Two things:
1. Have you read about the experiments from VPRI? There is even an active essay where you can see each rule being applied individually
2. Have you considered growth as text is typed in? The current "hold the width and grow down" approach is very poor in certain applications. There was a "growable" version that increased to a maximum length, but it was very hacky due to the complexity of hooking into the existing objects. My point is, it would be great to be able to plugin different strategies here.

Thanks for tackling this urgent and complicated topic!
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Denis Kudriashov
Hello

2013/1/23 Sean P. DeNigris <[hidden email]>
Denis Kudriashov wrote
> I upload new version of TxText with new TxTextMorph

Denis, thank you for taking this on! This is /so/ important. There are many
times in my experiments with reinventing the tools when I've gotten confused
and frustrated by the way text / editors work and chosen to revert to a more
standard way of doing things.

Same for me  :)


Two things:
1. Have you read about the experiments from VPRI? There is even an active
essay where you can see each rule being applied individually

I don't. Do you have link?
 
2. Have you considered growth as text is typed in? The current "hold the
width and grow down" approach is very poor in certain applications. There
was a "growable" version that increased to a maximum length, but it was very
hacky due to the complexity of hooking into the existing objects. My point
is, it would be great to be able to plugin different strategies here.

I really want it too. And I think it is already exists.There are two layout strateges: TxNativeTextLayoutStrategy (renamed from Simple) and TxWrapTextStrategy. First gives text autosize behaviour. TxTextMorph increases width accordingly to text line growth. Second strategy restricts visible text line by morph width. So morph can increase only height and text lines are wrapped by given restriction. It is easy to implement strategy which will wrap text by max line characters count.
But now all stuff is just about text displaying. No editing, no selection and no cursor navigation yet. I will try make it real step by step. Be free to join me :)
 

Thanks for tackling this urgent and complicated topic!
Sean


And thank's Igor and Camillo. They start this project.
 


--
View this message in context: http://forum.world.st/TxTextMorph-based-on-new-text-model-tp4663219p4664903.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Sean P. DeNigris
Administrator
In reply to this post by Denis Kudriashov
> I don't. Do you have link?

Here is the paper: http://www.vpri.org/pdf/m2010002_lobjects.pdf
And you can download the image with the actual active essay from http://tinlizzie.org/lesserphic2/Text%20Field%20for%20LObject.zip
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Stéphane Ducasse
In reply to this post by Sean P. DeNigris

On Jan 23, 2013, at 1:34 PM, Sean P. DeNigris wrote:

> Thanks for tackling this urgent and complicated topic!

+ 1000

Stef


Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Denis Kudriashov
In reply to this post by Sean P. DeNigris
Hello

2013/1/24 DeNigris Sean <[hidden email]>
> I don't. Do you have link?

Here is the paper: http://www.vpri.org/pdf/m2010002_lobjects.pdf
And you can download the image with the actual active essay from http://tinlizzie.org/lesserphic2/Text%20Field%20for%20LObject.zip

I read paper and play with image. And I have not good impression about this work.

First they present text with real objects for each letter. Each letter is actually big object with x, y, predecessor, successor and other attributes. How much memory such model required?
Do you think that presenting any letter with real object (not just character) is sufficient for modern computers? I think not. Of course such model significantly simplified all logic around text layout stuff. But I think it is too expensive.

Another thing which I always not agree is introduction scripting languages inside smalltalk. In paper all layout logic (and editing too) programmed by "system of rules" in special scripting language (very similar to smalltalk). If you look deeply you will see that rules call other rules with same way methods call other methods in basic smalltalk code. So I don't see any value of rules idea expressed with special scripts.
In spite of my non positive opinion I like what they do inside rules. It is really simple and understandable code. Maybe I will try reuse something.

Best regards,
Denis
Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Stéphane Ducasse
This was experimental. Do not lose your time with it. Now you know that you should continue :)
This was to prove that "kids" could define even texteditor with simple rules.

Stef


> Here is the paper: http://www.vpri.org/pdf/m2010002_lobjects.pdf
> And you can download the image with the actual active essay from http://tinlizzie.org/lesserphic2/Text%20Field%20for%20LObject.zip
>
> I read paper and play with image. And I have not good impression about this work.
>
> First they present text with real objects for each letter. Each letter is actually big object with x, y, predecessor, successor and other attributes. How much memory such model required?
> Do you think that presenting any letter with real object (not just character) is sufficient for modern computers? I think not. Of course such model significantly simplified all logic around text layout stuff. But I think it is too expensive.
>
> Another thing which I always not agree is introduction scripting languages inside smalltalk. In paper all layout logic (and editing too) programmed by "system of rules" in special scripting language (very similar to smalltalk). If you look deeply you will see that rules call other rules with same way methods call other methods in basic smalltalk code. So I don't see any value of rules idea expressed with special scripts.
> In spite of my non positive opinion I like what they do inside rules. It is really simple and understandable code. Maybe I will try reuse something.
>
> Best regards,
> Denis





Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Sean P. DeNigris
Administrator
In reply to this post by Denis Kudriashov
Denis Kudriashov wrote
I like what they do inside rules. It is
really simple and understandable code. Maybe I will try reuse something.
Very good. I am not suggesting we copy the exact approach, just learn any lessons so we don't have to repeat the mistakes of the past.

Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Igor Stasenko
In reply to this post by Stéphane Ducasse
On 28 January 2013 19:37, Stéphane Ducasse <[hidden email]> wrote:
> This was experimental. Do not lose your time with it. Now you know that you should continue :)
> This was to prove that "kids" could define even texteditor with simple rules.
>
that 'script' called DSL :)

so, yes.. you can write text editor with 10 lines of DSL code..
+ 100+ lines of code for DSL parser
+ numerous hours for developers to master your DSL before they can
understand/change the code :)

> Stef
>
>
>> Here is the paper: http://www.vpri.org/pdf/m2010002_lobjects.pdf
>> And you can download the image with the actual active essay from http://tinlizzie.org/lesserphic2/Text%20Field%20for%20LObject.zip
>>
>> I read paper and play with image. And I have not good impression about this work.
>>
>> First they present text with real objects for each letter. Each letter is actually big object with x, y, predecessor, successor and other attributes. How much memory such model required?
>> Do you think that presenting any letter with real object (not just character) is sufficient for modern computers? I think not. Of course such model significantly simplified all logic around text layout stuff. But I think it is too expensive.
>>
>> Another thing which I always not agree is introduction scripting languages inside smalltalk. In paper all layout logic (and editing too) programmed by "system of rules" in special scripting language (very similar to smalltalk). If you look deeply you will see that rules call other rules with same way methods call other methods in basic smalltalk code. So I don't see any value of rules idea expressed with special scripts.
>> In spite of my non positive opinion I like what they do inside rules. It is really simple and understandable code. Maybe I will try reuse something.
>>
>> Best regards,
>> Denis
>
>
>
>
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: TxTextMorph based on new text model

Denis Kudriashov
Hi

2013/1/29 Igor Stasenko <[hidden email]>
On 28 January 2013 19:37, Stéphane Ducasse <[hidden email]> wrote:
> This was experimental. Do not lose your time with it. Now you know that you should continue :)
> This was to prove that "kids" could define even texteditor with simple rules.
>
that 'script' called DSL :)

so, yes.. you can write text editor with 10 lines of DSL code..
+ 100+ lines of code for DSL parser
+ numerous hours for developers to master your DSL before they can
understand/change the code :)


I think you all agree that smalltalk is powerfull enough to be DSL for any domain/problem. No needs for special syntax
 
> Stef
>
>
>> Here is the paper: http://www.vpri.org/pdf/m2010002_lobjects.pdf
>> And you can download the image with the actual active essay from http://tinlizzie.org/lesserphic2/Text%20Field%20for%20LObject.zip
>>
>> I read paper and play with image. And I have not good impression about this work.
>>
>> First they present text with real objects for each letter. Each letter is actually big object with x, y, predecessor, successor and other attributes. How much memory such model required?
>> Do you think that presenting any letter with real object (not just character) is sufficient for modern computers? I think not. Of course such model significantly simplified all logic around text layout stuff. But I think it is too expensive.
>>
>> Another thing which I always not agree is introduction scripting languages inside smalltalk. In paper all layout logic (and editing too) programmed by "system of rules" in special scripting language (very similar to smalltalk). If you look deeply you will see that rules call other rules with same way methods call other methods in basic smalltalk code. So I don't see any value of rules idea expressed with special scripts.
>> In spite of my non positive opinion I like what they do inside rules. It is really simple and understandable code. Maybe I will try reuse something.
>>
>> Best regards,
>> Denis
>
>
>
>
>



--
Best regards,
Igor Stasenko.


12