Proposal: Morphs in Text

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

Re: Proposal: Morphs in Text

Patrick R.
Hi Karl,

I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.

## General Occlusion Bug

I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
found TextContainer and the class comment which explains the feature. Then I constructed
the following example:

o := Morph new.
tm := TextMorph new
        contents: 'This is a very long text with a lot of characters
spanning multiple lines overall and throughout the
place in order to trigger the occlusion thing';
        yourself.
m := RectangleMorph new.
m position: tm topLeft + (10@10).
tm occlusionsOnOff.
o addMorph: tm.
o addMorph: m.
o openInWorld.

I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
it expects container to behave like a rectangle.

However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
TextContainer as it describes the individual rectangles in which the text can be set. One solution is
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
without tm having an owner which does not work...).

To make this more robust I would propose:
1.) When activating occlusion we also set the wrapFlag
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.

## Text Anchor Related

Maybe this is more what you were thinking about Karl: I found that when having the above example
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
you can see in the attachment (the first morph in the third line is the anchored morph, the second one
is the m from the example above). The second part of the third line does not adhere to the offset of the
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
Sent: Monday, July 1, 2019 11:44:34 AM
To: Chris Muller
Cc: The general-purpose Squeak developers list
Subject: Re: [squeak-dev] Proposal: Morphs in Text

One big issue with the drag and drop is that it is often not clear which morph one drop into.
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
enable to accepting the drop.

But drag and drop are probably a separate issue from text anchors constructed from
code. Just don't break it to badly  :-)


Best,
Karl



Best.
Karl



On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
> I'm a little late here.
> TextMorph does not really need TextAnchor I think.
> You can just drop morphs on the text and select avoid occlusions in the menu.
> What are the use of text anchors instead just dropped in morphs ?
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.

I was wondering about the 'avoid occlusions' but spent all my focus on
the alignment testing, thanks for testing that too!

We should not break that.  I like this new alignment capability, but
classic DTP text-handling is one of Squeak's most impressive
capabilities.  Hopefully an easy fix..?


 - Chris



screenshot-tm.png (107K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Chris Muller-3
Hi Patrick,

I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.

## General Occlusion Bug

I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
found TextContainer and the class comment which explains the feature. Then I constructed
the following example:

o := Morph new.
tm := TextMorph new
        contents: 'This is a very long text with a lot of characters
spanning multiple lines overall and throughout the
place in order to trigger the occlusion thing';
        yourself.
m := RectangleMorph new.
m position: tm topLeft + (10@10).
tm occlusionsOnOff.
o addMorph: tm.
o addMorph: m.
o openInWorld.

I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
it expects container to behave like a rectangle.

Squeak 3.7 was the last release we included "The Worlds of Squeak" demo project that showed off its capabilities, including its powerful text-handling.  One of my favorite demos to show people was typing into that upper-left bubble (under "Squeak Rulez") and watch:

    - text being inserted flowing into the next morphs!
    - even along that spline!
    - and into that lower box with an embedded Morph that demonstrating occlusion avoidance!

dtp-level-text-handling.png

Selecting that yellow ellipse in the lower-right box and dragging it around forces the text to reformat around the shape of the ellipse (e.g., not even just a simple rectangle!).

Isn't it incredible?!  3.8 was the first release we stopped including this, so little surprise that we broke it, but I do hope we you get this fixed up again so that a cool demo like this at least could be done in 5.3 if we wanted.

Best,
  Chris


 

However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
TextContainer as it describes the individual rectangles in which the text can be set. One solution is
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
without tm having an owner which does not work...).

To make this more robust I would propose:
1.) When activating occlusion we also set the wrapFlag
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.

## Text Anchor Related

Maybe this is more what you were thinking about Karl: I found that when having the above example
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
you can see in the attachment (the first morph in the third line is the anchored morph, the second one
is the m from the example above). The second part of the third line does not adhere to the offset of the
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
Sent: Monday, July 1, 2019 11:44:34 AM
To: Chris Muller
Cc: The general-purpose Squeak developers list
Subject: Re: [squeak-dev] Proposal: Morphs in Text

One big issue with the drag and drop is that it is often not clear which morph one drop into.
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
enable to accepting the drop.

But drag and drop are probably a separate issue from text anchors constructed from
code. Just don't break it to badly  :-)


Best,
Karl



Best.
Karl



On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
> I'm a little late here.
> TextMorph does not really need TextAnchor I think.
> You can just drop morphs on the text and select avoid occlusions in the menu.
> What are the use of text anchors instead just dropped in morphs ?
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.

I was wondering about the 'avoid occlusions' but spent all my focus on
the alignment testing, thanks for testing that too!

We should not break that.  I like this new alignment capability, but
classic DTP text-handling is one of Squeak's most impressive
capabilities.  Hopefully an easy fix..?


 - Chris



Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Karl Ramberg
In reply to this post by Patrick R.
I did some more testing and found the drag and drop of morph on text in windows practically non functional.
So I don't think you could break anything :-)

Best,
Karl


On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]> wrote:
Hi Karl,

I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.

## General Occlusion Bug

I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
found TextContainer and the class comment which explains the feature. Then I constructed
the following example:

o := Morph new.
tm := TextMorph new
        contents: 'This is a very long text with a lot of characters
spanning multiple lines overall and throughout the
place in order to trigger the occlusion thing';
        yourself.
m := RectangleMorph new.
m position: tm topLeft + (10@10).
tm occlusionsOnOff.
o addMorph: tm.
o addMorph: m.
o openInWorld.

I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
it expects container to behave like a rectangle.

However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
TextContainer as it describes the individual rectangles in which the text can be set. One solution is
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
without tm having an owner which does not work...).

To make this more robust I would propose:
1.) When activating occlusion we also set the wrapFlag
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.

## Text Anchor Related

Maybe this is more what you were thinking about Karl: I found that when having the above example
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
you can see in the attachment (the first morph in the third line is the anchored morph, the second one
is the m from the example above). The second part of the third line does not adhere to the offset of the
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
Sent: Monday, July 1, 2019 11:44:34 AM
To: Chris Muller
Cc: The general-purpose Squeak developers list
Subject: Re: [squeak-dev] Proposal: Morphs in Text

One big issue with the drag and drop is that it is often not clear which morph one drop into.
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
enable to accepting the drop.

But drag and drop are probably a separate issue from text anchors constructed from
code. Just don't break it to badly  :-)


Best,
Karl



Best.
Karl



On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
> I'm a little late here.
> TextMorph does not really need TextAnchor I think.
> You can just drop morphs on the text and select avoid occlusions in the menu.
> What are the use of text anchors instead just dropped in morphs ?
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.

I was wondering about the 'avoid occlusions' but spent all my focus on
the alignment testing, thanks for testing that too!

We should not break that.  I like this new alignment capability, but
classic DTP text-handling is one of Squeak's most impressive
capabilities.  Hopefully an easy fix..?


 - Chris



Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Chris Muller-4
Hi Karl, I'm not sure what or how you tested, but "drag and drop of
morph on text in windows" works fine when the appropriate handlers are
set up (#mouseEnter:, etc.).

You can see it in action if you're willing to load Maui into a trunk
image (from SqueakMap).  It has a class MauiTextEditor, which is just
a subclass of PluggableTextMorph with the handlers.

    MauiTextEditor new openInWorld

type some text,
grab any Morph and, while holding Shift,
drag it into the text window.

An outline of the proposed position is shown, when you let go, the
morph is dropped and embedded as a character.  Works with clipboard, etc.

 - Chris


 - Chris

On Wed, Jul 3, 2019 at 3:36 PM karl ramberg <[hidden email]> wrote:

>
> I did some more testing and found the drag and drop of morph on text in windows practically non functional.
> So I don't think you could break anything :-)
>
> Best,
> Karl
>
>
> On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]> wrote:
>>
>> Hi Karl,
>>
>> I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.
>>
>> ## General Occlusion Bug
>>
>> I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
>> found TextContainer and the class comment which explains the feature. Then I constructed
>> the following example:
>>
>> o := Morph new.
>> tm := TextMorph new
>>         contents: 'This is a very long text with a lot of characters
>> spanning multiple lines overall and throughout the
>> place in order to trigger the occlusion thing';
>>         yourself.
>> m := RectangleMorph new.
>> m position: tm topLeft + (10@10).
>> tm occlusionsOnOff.
>> o addMorph: tm.
>> o addMorph: m.
>> o openInWorld.
>>
>> I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
>> it expects container to behave like a rectangle.
>>
>> However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
>> TextContainer as it describes the individual rectangles in which the text can be set. One solution is
>> to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
>> without tm having an owner which does not work...).
>>
>> To make this more robust I would propose:
>> 1.) When activating occlusion we also set the wrapFlag
>> 2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.
>>
>> ## Text Anchor Related
>>
>> Maybe this is more what you were thinking about Karl: I found that when having the above example
>> plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
>> you can see in the attachment (the first morph in the third line is the anchored morph, the second one
>> is the m from the example above). The second part of the third line does not adhere to the offset of the
>> first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)
>>
>> Bests
>> Patrick
>> ________________________________________
>> From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
>> Sent: Monday, July 1, 2019 11:44:34 AM
>> To: Chris Muller
>> Cc: The general-purpose Squeak developers list
>> Subject: Re: [squeak-dev] Proposal: Morphs in Text
>>
>> One big issue with the drag and drop is that it is often not clear which morph one drop into.
>> There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
>> enable to accepting the drop.
>>
>> But drag and drop are probably a separate issue from text anchors constructed from
>> code. Just don't break it to badly  :-)
>>
>>
>> Best,
>> Karl
>>
>>
>>
>> Best.
>> Karl
>>
>>
>>
>> On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
>> > I'm a little late here.
>> > TextMorph does not really need TextAnchor I think.
>> > You can just drop morphs on the text and select avoid occlusions in the menu.
>> > What are the use of text anchors instead just dropped in morphs ?
>> > I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.
>>
>> I was wondering about the 'avoid occlusions' but spent all my focus on
>> the alignment testing, thanks for testing that too!
>>
>> We should not break that.  I like this new alignment capability, but
>> classic DTP text-handling is one of Squeak's most impressive
>> capabilities.  Hopefully an easy fix..?
>>
>>
>>  - Chris
>>

Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

marcel.taeumel
Maybe Karl refers to the default behavior of TextMorph or PluggableTextMorph?

If you subclass PluggableTextMorph, TextMorph, TextEditor etc. you can add any additional stuff such as through Morphic's generic event handling.

Best,
Marcel

Am 03.07.2019 22:58:21 schrieb Chris Muller <[hidden email]>:

Hi Karl, I'm not sure what or how you tested, but "drag and drop of
morph on text in windows" works fine when the appropriate handlers are
set up (#mouseEnter:, etc.).

You can see it in action if you're willing to load Maui into a trunk
image (from SqueakMap). It has a class MauiTextEditor, which is just
a subclass of PluggableTextMorph with the handlers.

MauiTextEditor new openInWorld

type some text,
grab any Morph and, while holding Shift,
drag it into the text window.

An outline of the proposed position is shown, when you let go, the
morph is dropped and embedded as a character. Works with clipboard, etc.

- Chris


- Chris

On Wed, Jul 3, 2019 at 3:36 PM karl ramberg wrote:
>
> I did some more testing and found the drag and drop of morph on text in windows practically non functional.
> So I don't think you could break anything :-)
>
> Best,
> Karl
>
>
> On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick wrote:
>>
>> Hi Karl,
>>
>> I agree that the drag and drop handling of TextMorphs is somewhat complex by now. While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.
>>
>> ## General Occlusion Bug
>>
>> I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
>> found TextContainer and the class comment which explains the feature. Then I constructed
>> the following example:
>>
>> o := Morph new.
>> tm := TextMorph new
>> contents: 'This is a very long text with a lot of characters
>> spanning multiple lines overall and throughout the
>> place in order to trigger the occlusion thing';
>> yourself.
>> m := RectangleMorph new.
>> m position: tm topLeft + (10@10).
>> tm occlusionsOnOff.
>> o addMorph: tm.
>> o addMorph: m.
>> o openInWorld.
>>
>> I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
>> it expects container to behave like a rectangle.
>>
>> However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
>> TextContainer as it describes the individual rectangles in which the text can be set. One solution is
>> to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
>> without tm having an owner which does not work...).
>>
>> To make this more robust I would propose:
>> 1.) When activating occlusion we also set the wrapFlag
>> 2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.
>>
>> ## Text Anchor Related
>>
>> Maybe this is more what you were thinking about Karl: I found that when having the above example
>> plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
>> you can see in the attachment (the first morph in the third line is the anchored morph, the second one
>> is the m from the example above). The second part of the third line does not adhere to the offset of the
>> first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)
>>
>> Bests
>> Patrick
>> ________________________________________
>> From: Squeak-dev on behalf of karl ramberg
>> Sent: Monday, July 1, 2019 11:44:34 AM
>> To: Chris Muller
>> Cc: The general-purpose Squeak developers list
>> Subject: Re: [squeak-dev] Proposal: Morphs in Text
>>
>> One big issue with the drag and drop is that it is often not clear which morph one drop into.
>> There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
>> enable to accepting the drop.
>>
>> But drag and drop are probably a separate issue from text anchors constructed from
>> code. Just don't break it to badly :-)
>>
>>
>> Best,
>> Karl
>>
>>
>>
>> Best.
>> Karl
>>
>>
>>
>> On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <>> wrote:
>> > I'm a little late here.
>> > TextMorph does not really need TextAnchor I think.
>> > You can just drop morphs on the text and select avoid occlusions in the menu.
>> > What are the use of text anchors instead just dropped in morphs ?
>> > I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.
>>
>> I was wondering about the 'avoid occlusions' but spent all my focus on
>> the alignment testing, thanks for testing that too!
>>
>> We should not break that. I like this new alignment capability, but
>> classic DTP text-handling is one of Squeak's most impressive
>> capabilities. Hopefully an easy fix..?
>>
>>
>> - Chris
>>



Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

marcel.taeumel
In reply to this post by Chris Muller-3
> Isn't it incredible?!  3.8 was the first release we stopped including this, so little surprise that we broke it, but I do hope we you get this fixed up again so that a cool demo like this at 
> least could be done in 5.3 if we wanted.

We should write more tests. :-) Such examples are nice to learn from. Yet, they cannot replace automated testing. There have been several bugs in the recent past despite objects (or games or apps) being in the release image to reveal them.

Best,
Marcel

Am 03.07.2019 21:32:15 schrieb Chris Muller <[hidden email]>:

Hi Patrick,

I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.

## General Occlusion Bug

I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
found TextContainer and the class comment which explains the feature. Then I constructed
the following example:

o := Morph new.
tm := TextMorph new
        contents: 'This is a very long text with a lot of characters
spanning multiple lines overall and throughout the
place in order to trigger the occlusion thing';
        yourself.
m := RectangleMorph new.
m position: tm topLeft + (10@10).
tm occlusionsOnOff.
o addMorph: tm.
o addMorph: m.
o openInWorld.

I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
it expects container to behave like a rectangle.

Squeak 3.7 was the last release we included "The Worlds of Squeak" demo project that showed off its capabilities, including its powerful text-handling.  One of my favorite demos to show people was typing into that upper-left bubble (under "Squeak Rulez") and watch:

    - text being inserted flowing into the next morphs!
    - even along that spline!
    - and into that lower box with an embedded Morph that demonstrating occlusion avoidance!



Selecting that yellow ellipse in the lower-right box and dragging it around forces the text to reformat around the shape of the ellipse (e.g., not even just a simple rectangle!).

Isn't it incredible?!  3.8 was the first release we stopped including this, so little surprise that we broke it, but I do hope we you get this fixed up again so that a cool demo like this at least could be done in 5.3 if we wanted.

Best,
  Chris


 

However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
TextContainer as it describes the individual rectangles in which the text can be set. One solution is
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
without tm having an owner which does not work...).

To make this more robust I would propose:
1.) When activating occlusion we also set the wrapFlag
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.

## Text Anchor Related

Maybe this is more what you were thinking about Karl: I found that when having the above example
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
you can see in the attachment (the first morph in the third line is the anchored morph, the second one
is the m from the example above). The second part of the third line does not adhere to the offset of the
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
Sent: Monday, July 1, 2019 11:44:34 AM
To: Chris Muller
Cc: The general-purpose Squeak developers list
Subject: Re: [squeak-dev] Proposal: Morphs in Text

One big issue with the drag and drop is that it is often not clear which morph one drop into.
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
enable to accepting the drop.

But drag and drop are probably a separate issue from text anchors constructed from
code. Just don't break it to badly  :-)


Best,
Karl



Best.
Karl



On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
> I'm a little late here.
> TextMorph does not really need TextAnchor I think.
> You can just drop morphs on the text and select avoid occlusions in the menu.
> What are the use of text anchors instead just dropped in morphs ?
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.

I was wondering about the 'avoid occlusions' but spent all my focus on
the alignment testing, thanks for testing that too!

We should not break that.  I like this new alignment capability, but
classic DTP text-handling is one of Squeak's most impressive
capabilities.  Hopefully an easy fix..?


 - Chris



Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Patrick R.
The bug can also be triggered in 3.7... The main problem is that there is no logic to ensure that the wrapFlag is set when avoid occlusion is on.

I'll see to a proposed fix in the next days.

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]> on behalf of Taeumel, Marcel
Sent: Thursday, July 4, 2019 8:23:55 AM
To: Chris Muller; Robert via Squeak-dev
Subject: Re: [squeak-dev] Proposal: Morphs in Text

> Isn't it incredible?!  3.8 was the first release we stopped including this, so little surprise that we broke it, but I do hope we you get this fixed up again so that a cool demo like this at
> least could be done in 5.3 if we wanted.

We should write more tests. :-) Such examples are nice to learn from. Yet, they cannot replace automated testing. There have been several bugs in the recent past despite objects (or games or apps) being in the release image to reveal them.

Best,
Marcel

Am 03.07.2019 21:32:15 schrieb Chris Muller <[hidden email]>:

Hi Patrick,

I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.

## General Occlusion Bug

I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
found TextContainer and the class comment which explains the feature. Then I constructed
the following example:

o := Morph new.
tm := TextMorph new
        contents: 'This is a very long text with a lot of characters
spanning multiple lines overall and throughout the
place in order to trigger the occlusion thing';
        yourself.
m := RectangleMorph new.
m position: tm topLeft + (10@10).
tm occlusionsOnOff.
o addMorph: tm.
o addMorph: m.
o openInWorld.

I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
it expects container to behave like a rectangle.

Squeak 3.7 was the last release we included "The Worlds of Squeak" demo project that showed off its capabilities, including its powerful text-handling.  One of my favorite demos to show people was typing into that upper-left bubble (under "Squeak Rulez") and watch:

    - text being inserted flowing into the next morphs!
    - even along that spline!
    - and into that lower box with an embedded Morph that demonstrating occlusion avoidance!

[dtp-level-text-handling.png]

Selecting that yellow ellipse in the lower-right box and dragging it around forces the text to reformat around the shape of the ellipse (e.g., not even just a simple rectangle!).

Isn't it incredible?!  3.8 was the first release we stopped including this, so little surprise that we broke it, but I do hope we you get this fixed up again so that a cool demo like this at least could be done in 5.3 if we wanted.

Best,
  Chris




However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
TextContainer as it describes the individual rectangles in which the text can be set. One solution is
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
without tm having an owner which does not work...).

To make this more robust I would propose:
1.) When activating occlusion we also set the wrapFlag
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.

## Text Anchor Related

Maybe this is more what you were thinking about Karl: I found that when having the above example
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
you can see in the attachment (the first morph in the third line is the anchored morph, the second one
is the m from the example above). The second part of the third line does not adhere to the offset of the
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]<mailto:[hidden email]>> on behalf of karl ramberg <[hidden email]<mailto:[hidden email]>>
Sent: Monday, July 1, 2019 11:44:34 AM
To: Chris Muller
Cc: The general-purpose Squeak developers list
Subject: Re: [squeak-dev] Proposal: Morphs in Text

One big issue with the drag and drop is that it is often not clear which morph one drop into.
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
enable to accepting the drop.

But drag and drop are probably a separate issue from text anchors constructed from
code. Just don't break it to badly  :-)


Best,
Karl



Best.
Karl



On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]><mailto:[hidden email]<mailto:[hidden email]>>> wrote:
> I'm a little late here.
> TextMorph does not really need TextAnchor I think.
> You can just drop morphs on the text and select avoid occlusions in the menu.
> What are the use of text anchors instead just dropped in morphs ?
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.

I was wondering about the 'avoid occlusions' but spent all my focus on
the alignment testing, thanks for testing that too!

We should not break that.  I like this new alignment capability, but
classic DTP text-handling is one of Squeak's most impressive
capabilities.  Hopefully an easy fix..?


 - Chris


Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

K K Subbu
On 04/07/19 12:28 PM, Rein, Patrick wrote:
> The bug can also be triggered in 3.7... The main problem is that there is no logic to ensure that the wrapFlag is set when avoid occlusion is on.
>
> I'll see to a proposed fix in the next days.
Patrick,

Isn't this too strong a condition? Will pre-formatted text like code or
poems not be eligible for occlusion?

Regards .. Subbu

Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Karl Ramberg
In reply to this post by Chris Muller-4
I tested drag and drop of morphs into a "bare" TextMorph and that works quite nice.
But trying to drop stuff into the text in a Workspace and or a ScrollingText is not easy to enable.
I'm sure it is possible to set up, but had no luck with it.

Best,
Karl



On Wed, Jul 3, 2019 at 10:58 PM Chris Muller <[hidden email]> wrote:
Hi Karl, I'm not sure what or how you tested, but "drag and drop of
morph on text in windows" works fine when the appropriate handlers are
set up (#mouseEnter:, etc.).

You can see it in action if you're willing to load Maui into a trunk
image (from SqueakMap).  It has a class MauiTextEditor, which is just
a subclass of PluggableTextMorph with the handlers.

    MauiTextEditor new openInWorld

type some text,
grab any Morph and, while holding Shift,
drag it into the text window.

An outline of the proposed position is shown, when you let go, the
morph is dropped and embedded as a character.  Works with clipboard, etc.

 - Chris


 - Chris

On Wed, Jul 3, 2019 at 3:36 PM karl ramberg <[hidden email]> wrote:
>
> I did some more testing and found the drag and drop of morph on text in windows practically non functional.
> So I don't think you could break anything :-)
>
> Best,
> Karl
>
>
> On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]> wrote:
>>
>> Hi Karl,
>>
>> I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.
>>
>> ## General Occlusion Bug
>>
>> I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
>> found TextContainer and the class comment which explains the feature. Then I constructed
>> the following example:
>>
>> o := Morph new.
>> tm := TextMorph new
>>         contents: 'This is a very long text with a lot of characters
>> spanning multiple lines overall and throughout the
>> place in order to trigger the occlusion thing';
>>         yourself.
>> m := RectangleMorph new.
>> m position: tm topLeft + (10@10).
>> tm occlusionsOnOff.
>> o addMorph: tm.
>> o addMorph: m.
>> o openInWorld.
>>
>> I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
>> it expects container to behave like a rectangle.
>>
>> However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
>> TextContainer as it describes the individual rectangles in which the text can be set. One solution is
>> to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
>> without tm having an owner which does not work...).
>>
>> To make this more robust I would propose:
>> 1.) When activating occlusion we also set the wrapFlag
>> 2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.
>>
>> ## Text Anchor Related
>>
>> Maybe this is more what you were thinking about Karl: I found that when having the above example
>> plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
>> you can see in the attachment (the first morph in the third line is the anchored morph, the second one
>> is the m from the example above). The second part of the third line does not adhere to the offset of the
>> first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)
>>
>> Bests
>> Patrick
>> ________________________________________
>> From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
>> Sent: Monday, July 1, 2019 11:44:34 AM
>> To: Chris Muller
>> Cc: The general-purpose Squeak developers list
>> Subject: Re: [squeak-dev] Proposal: Morphs in Text
>>
>> One big issue with the drag and drop is that it is often not clear which morph one drop into.
>> There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
>> enable to accepting the drop.
>>
>> But drag and drop are probably a separate issue from text anchors constructed from
>> code. Just don't break it to badly  :-)
>>
>>
>> Best,
>> Karl
>>
>>
>>
>> Best.
>> Karl
>>
>>
>>
>> On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
>> > I'm a little late here.
>> > TextMorph does not really need TextAnchor I think.
>> > You can just drop morphs on the text and select avoid occlusions in the menu.
>> > What are the use of text anchors instead just dropped in morphs ?
>> > I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.
>>
>> I was wondering about the 'avoid occlusions' but spent all my focus on
>> the alignment testing, thanks for testing that too!
>>
>> We should not break that.  I like this new alignment capability, but
>> classic DTP text-handling is one of Squeak's most impressive
>> capabilities.  Hopefully an easy fix..?
>>
>>
>>  - Chris
>>



Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Karl Ramberg
In reply to this post by Patrick R.
The code in NewParagraph>>adjustRightX is broken.
It seem to expect a container that is a Rectangle and not a TextContainer.
This method must be made to work with TextContainer.

NewParagraph>>adjustRightX
| shrink |
shrink := container right - maxRightX.
lines do: [:line | line paddingWidth: (line paddingWidth - shrink)].
container := container withRight: maxRightX + self caretWidth.

Best,
Karl


On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]> wrote:
Hi Karl,

I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.

## General Occlusion Bug

I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
found TextContainer and the class comment which explains the feature. Then I constructed
the following example:

o := Morph new.
tm := TextMorph new
        contents: 'This is a very long text with a lot of characters
spanning multiple lines overall and throughout the
place in order to trigger the occlusion thing';
        yourself.
m := RectangleMorph new.
m position: tm topLeft + (10@10).
tm occlusionsOnOff.
o addMorph: tm.
o addMorph: m.
o openInWorld.

I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
it expects container to behave like a rectangle.

However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
TextContainer as it describes the individual rectangles in which the text can be set. One solution is
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
without tm having an owner which does not work...).

To make this more robust I would propose:
1.) When activating occlusion we also set the wrapFlag
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.

## Text Anchor Related

Maybe this is more what you were thinking about Karl: I found that when having the above example
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
you can see in the attachment (the first morph in the third line is the anchored morph, the second one
is the m from the example above). The second part of the third line does not adhere to the offset of the
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
Sent: Monday, July 1, 2019 11:44:34 AM
To: Chris Muller
Cc: The general-purpose Squeak developers list
Subject: Re: [squeak-dev] Proposal: Morphs in Text

One big issue with the drag and drop is that it is often not clear which morph one drop into.
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
enable to accepting the drop.

But drag and drop are probably a separate issue from text anchors constructed from
code. Just don't break it to badly  :-)


Best,
Karl



Best.
Karl



On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
> I'm a little late here.
> TextMorph does not really need TextAnchor I think.
> You can just drop morphs on the text and select avoid occlusions in the menu.
> What are the use of text anchors instead just dropped in morphs ?
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.

I was wondering about the 'avoid occlusions' but spent all my focus on
the alignment testing, thanks for testing that too!

We should not break that.  I like this new alignment capability, but
classic DTP text-handling is one of Squeak's most impressive
capabilities.  Hopefully an easy fix..?


 - Chris



Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Karl Ramberg


On Thu, Jul 4, 2019 at 8:50 PM karl ramberg <[hidden email]> wrote:
The code in NewParagraph>>adjustRightX is broken.
It seem to expect a container that is a Rectangle and not a TextContainer.
This method must be made to work with TextContainer.

NewParagraph>>adjustRightX
| shrink |
shrink := container right - maxRightX.
lines do: [:line | line paddingWidth: (line paddingWidth - shrink)].
container := container withRight: maxRightX + self caretWidth.

Best,
Karl

NewParagraph seems to sometimes have Rectangle as container  and sometimes a TextContainer.
I'm not sure what to do about that...

Best,
Karl


On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]> wrote:
Hi Karl,

I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.

## General Occlusion Bug

I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
found TextContainer and the class comment which explains the feature. Then I constructed
the following example:

o := Morph new.
tm := TextMorph new
        contents: 'This is a very long text with a lot of characters
spanning multiple lines overall and throughout the
place in order to trigger the occlusion thing';
        yourself.
m := RectangleMorph new.
m position: tm topLeft + (10@10).
tm occlusionsOnOff.
o addMorph: tm.
o addMorph: m.
o openInWorld.

I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
it expects container to behave like a rectangle.

However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
TextContainer as it describes the individual rectangles in which the text can be set. One solution is
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
without tm having an owner which does not work...).

To make this more robust I would propose:
1.) When activating occlusion we also set the wrapFlag
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.

## Text Anchor Related

Maybe this is more what you were thinking about Karl: I found that when having the above example
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
you can see in the attachment (the first morph in the third line is the anchored morph, the second one
is the m from the example above). The second part of the third line does not adhere to the offset of the
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
Sent: Monday, July 1, 2019 11:44:34 AM
To: Chris Muller
Cc: The general-purpose Squeak developers list
Subject: Re: [squeak-dev] Proposal: Morphs in Text

One big issue with the drag and drop is that it is often not clear which morph one drop into.
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
enable to accepting the drop.

But drag and drop are probably a separate issue from text anchors constructed from
code. Just don't break it to badly  :-)


Best,
Karl



Best.
Karl



On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
> I'm a little late here.
> TextMorph does not really need TextAnchor I think.
> You can just drop morphs on the text and select avoid occlusions in the menu.
> What are the use of text anchors instead just dropped in morphs ?
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.

I was wondering about the 'avoid occlusions' but spent all my focus on
the alignment testing, thanks for testing that too!

We should not break that.  I like this new alignment capability, but
classic DTP text-handling is one of Squeak's most impressive
capabilities.  Hopefully an easy fix..?


 - Chris



Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Bob Arning-2
I think it's not really broken - adjustRightX is only used when wrapFlag is false, which is probably not the originally intended use for TextContainers. You could add a method or two to TextContainer to see if it would work when not wrappping.

On 7/4/19 4:00 PM, karl ramberg wrote:


On Thu, Jul 4, 2019 at 8:50 PM karl ramberg <[hidden email]> wrote:
The code in NewParagraph>>adjustRightX is broken.
It seem to expect a container that is a Rectangle and not a TextContainer.
This method must be made to work with TextContainer.

NewParagraph>>adjustRightX
| shrink |
shrink := container right - maxRightX.
lines do: [:line | line paddingWidth: (line paddingWidth - shrink)].
container := container withRight: maxRightX + self caretWidth.

Best,
Karl

NewParagraph seems to sometimes have Rectangle as container  and sometimes a TextContainer.
I'm not sure what to do about that...

Best,
Karl


On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]> wrote:
Hi Karl,

I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.

## General Occlusion Bug

I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
found TextContainer and the class comment which explains the feature. Then I constructed
the following example:

o := Morph new.
tm := TextMorph new
        contents: 'This is a very long text with a lot of characters
spanning multiple lines overall and throughout the
place in order to trigger the occlusion thing';
        yourself.
m := RectangleMorph new.
m position: tm topLeft + (10@10).
tm occlusionsOnOff.
o addMorph: tm.
o addMorph: m.
o openInWorld.

I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
it expects container to behave like a rectangle.

However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
TextContainer as it describes the individual rectangles in which the text can be set. One solution is
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
without tm having an owner which does not work...).

To make this more robust I would propose:
1.) When activating occlusion we also set the wrapFlag
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.

## Text Anchor Related

Maybe this is more what you were thinking about Karl: I found that when having the above example
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
you can see in the attachment (the first morph in the third line is the anchored morph, the second one
is the m from the example above). The second part of the third line does not adhere to the offset of the
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
Sent: Monday, July 1, 2019 11:44:34 AM
To: Chris Muller
Cc: The general-purpose Squeak developers list
Subject: Re: [squeak-dev] Proposal: Morphs in Text

One big issue with the drag and drop is that it is often not clear which morph one drop into.
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
enable to accepting the drop.

But drag and drop are probably a separate issue from text anchors constructed from
code. Just don't break it to badly  :-)


Best,
Karl



Best.
Karl



On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
> I'm a little late here.
> TextMorph does not really need TextAnchor I think.
> You can just drop morphs on the text and select avoid occlusions in the menu.
> What are the use of text anchors instead just dropped in morphs ?
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.

I was wondering about the 'avoid occlusions' but spent all my focus on
the alignment testing, thanks for testing that too!

We should not break that.  I like this new alignment capability, but
classic DTP text-handling is one of Squeak's most impressive
capabilities.  Hopefully an easy fix..?


 - Chris



    



Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Karl Ramberg
I looked at the code and I'm really not sure what to do.
I don't think understand what is going on in the code, and what is supposed to go on.

Best,
Karl


On Thu, Jul 4, 2019 at 10:33 PM Bob Arning <[hidden email]> wrote:
I think it's not really broken - adjustRightX is only used when wrapFlag is false, which is probably not the originally intended use for TextContainers. You could add a method or two to TextContainer to see if it would work when not wrappping.

On 7/4/19 4:00 PM, karl ramberg wrote:


On Thu, Jul 4, 2019 at 8:50 PM karl ramberg <[hidden email]> wrote:
The code in NewParagraph>>adjustRightX is broken.
It seem to expect a container that is a Rectangle and not a TextContainer.
This method must be made to work with TextContainer.

NewParagraph>>adjustRightX
| shrink |
shrink := container right - maxRightX.
lines do: [:line | line paddingWidth: (line paddingWidth - shrink)].
container := container withRight: maxRightX + self caretWidth.

Best,
Karl

NewParagraph seems to sometimes have Rectangle as container  and sometimes a TextContainer.
I'm not sure what to do about that...

Best,
Karl


On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]> wrote:
Hi Karl,

I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.

## General Occlusion Bug

I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and
found TextContainer and the class comment which explains the feature. Then I constructed
the following example:

o := Morph new.
tm := TextMorph new
        contents: 'This is a very long text with a lot of characters
spanning multiple lines overall and throughout the
place in order to trigger the occlusion thing';
        yourself.
m := RectangleMorph new.
m position: tm topLeft + (10@10).
tm occlusionsOnOff.
o addMorph: tm.
o addMorph: m.
o openInWorld.

I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as
it expects container to behave like a rectangle.

However, the root cause seems to be that #adjustRightX does not make sense when having a fixed
TextContainer as it describes the individual rectangles in which the text can be set. One solution is
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout
without tm having an owner which does not work...).

To make this more robust I would propose:
1.) When activating occlusion we also set the wrapFlag
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.

## Text Anchor Related

Maybe this is more what you were thinking about Karl: I found that when having the above example
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue
you can see in the attachment (the first morph in the third line is the anchored morph, the second one
is the m from the example above). The second part of the third line does not adhere to the offset of the
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)

Bests
Patrick
________________________________________
From: Squeak-dev <[hidden email]> on behalf of karl ramberg <[hidden email]>
Sent: Monday, July 1, 2019 11:44:34 AM
To: Chris Muller
Cc: The general-purpose Squeak developers list
Subject: Re: [squeak-dev] Proposal: Morphs in Text

One big issue with the drag and drop is that it is often not clear which morph one drop into.
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually
enable to accepting the drop.

But drag and drop are probably a separate issue from text anchors constructed from
code. Just don't break it to badly  :-)


Best,
Karl



Best.
Karl



On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]<mailto:[hidden email]>> wrote:
> I'm a little late here.
> TextMorph does not really need TextAnchor I think.
> You can just drop morphs on the text and select avoid occlusions in the menu.
> What are the use of text anchors instead just dropped in morphs ?
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.

I was wondering about the 'avoid occlusions' but spent all my focus on
the alignment testing, thanks for testing that too!

We should not break that.  I like this new alignment capability, but
classic DTP text-handling is one of Squeak's most impressive
capabilities.  Hopefully an easy fix..?


 - Chris



    




Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

patrick.rein
To quote my earlier proposal:

To make this more robust I would propose: 

1.) When activating occlusion we also set the wrapFlag 

2.) We do not try to avoid occlusions as long as the morph does not have an owner yet. 


adjustX adjusts the Paragraph bounds to the rightmost character. This does not make sense for TextContainers as they dictate the rightmost point for layouting. (Even if you make that work, there are other such constraints (I tried it :))). Thus when having a TextContainer the wrapFlag should always be set to true.

At the same time it is right that pre-formatted text should also work with occlusion ideally. but this goes beyond the initial bug we are trying to fix here (at least that was my impression).

Bests
Patrick

⁣BlueMail for Android herunterladen ​

Am 6. Juli 2019, 19:55, um 19:55, karl ramberg <[hidden email]> schrieb:

>I looked at the code and I'm really not sure what to do.
>I don't think understand what is going on in the code, and what is
>supposed
>to go on.
>
>Best,
>Karl
>
>
>On Thu, Jul 4, 2019 at 10:33 PM Bob Arning <[hidden email]>
>wrote:
>
>> I think it's not really broken - adjustRightX is only used when
>wrapFlag
>> is false, which is probably not the originally intended use for
>> TextContainers. You could add a method or two to TextContainer to see
>if it
>> would work when not wrappping.
>>
>> On 7/4/19 4:00 PM, karl ramberg wrote:
>>
>>
>>
>> On Thu, Jul 4, 2019 at 8:50 PM karl ramberg <[hidden email]>
>wrote:
>>
>>> The code in NewParagraph>>adjustRightX is broken.
>>> It seem to expect a container that is a Rectangle and not a
>TextContainer.
>>> This method must be made to work with TextContainer.
>>>
>>> NewParagraph>>adjustRightX
>>> | shrink |
>>> shrink := container right - maxRightX.
>>> lines do: [:line | line paddingWidth: (line paddingWidth - shrink)].
>>> container := container withRight: maxRightX + self caretWidth.
>>>
>>> Best,
>>> Karl
>>>
>>
>> NewParagraph seems to sometimes have Rectangle as container  and
>sometimes
>> a TextContainer.
>> I'm not sure what to do about that...
>>
>> Best,
>> Karl
>>
>>>
>>>
>>> On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]>
>wrote:
>>>
>>>> Hi Karl,
>>>>
>>>> I agree that the drag and drop handling of TextMorphs is somewhat
>>>> complex by now.  While looking into the issue I found two kinds of
>issues:
>>>> some more general ones and one related to layouting.
>>>>
>>>> ## General Occlusion Bug
>>>>
>>>> I have to admit that I was not aware of the avoid occlusions
>feature. I
>>>> dug into it a little and
>>>> found TextContainer and the class comment which explains the
>feature.
>>>> Then I constructed
>>>> the following example:
>>>>
>>>> o := Morph new.
>>>> tm := TextMorph new
>>>>         contents: 'This is a very long text with a lot of
>characters
>>>> spanning multiple lines overall and throughout the
>>>> place in order to trigger the occlusion thing';
>>>>         yourself.
>>>> m := RectangleMorph new.
>>>> m position: tm topLeft + (10@10).
>>>> tm occlusionsOnOff.
>>>> o addMorph: tm.
>>>> o addMorph: m.
>>>> o openInWorld.
>>>>
>>>> I tried it in trunk and Squeak 3.8 and in both it results in errors
>in
>>>> NewParagraph>>#adjustRightX as
>>>> it expects container to behave like a rectangle.
>>>>
>>>> However, the root cause seems to be that #adjustRightX does not
>make
>>>> sense when having a fixed
>>>> TextContainer as it describes the individual rectangles in which
>the
>>>> text can be set. One solution is
>>>> to set `tm wrapFlag: true` before turning avoidOcclusions on
>(otherwise
>>>> #wrapFlag triggers a relayout
>>>> without tm having an owner which does not work...).
>>>>
>>>> To make this more robust I would propose:
>>>> 1.) When activating occlusion we also set the wrapFlag
>>>> 2.) We do not try to avoid occlusions as long as the morph does not
>have
>>>> an owner yet.
>>>>
>>>> ## Text Anchor Related
>>>>
>>>> Maybe this is more what you were thinking about Karl: I found that
>when
>>>> having the above example
>>>> plus an anchored morph which is layouted inline most things work
>fine.
>>>> Except for the layout issue
>>>> you can see in the attachment (the first morph in the third line is
>the
>>>> anchored morph, the second one
>>>> is the m from the example above). The second part of the third line
>does
>>>> not adhere to the offset of the
>>>> first part of the line. @Karl: Did you refer to that? (Not sure how
>to
>>>> fix this yet...)
>>>>
>>>> Bests
>>>> Patrick
>>>> ________________________________________
>>>> From: Squeak-dev <[hidden email]> on
>>>> behalf of karl ramberg <[hidden email]>
>>>> Sent: Monday, July 1, 2019 11:44:34 AM
>>>> To: Chris Muller
>>>> Cc: The general-purpose Squeak developers list
>>>> Subject: Re: [squeak-dev] Proposal: Morphs in Text
>>>>
>>>> One big issue with the drag and drop is that it is often not clear
>which
>>>> morph one drop into.
>>>> There are so many layers of morphs in a text window so it gets
>confusing
>>>> to know which morph to actually
>>>> enable to accepting the drop.
>>>>
>>>> But drag and drop are probably a separate issue from text anchors
>>>> constructed from
>>>> code. Just don't break it to badly  :-)
>>>>
>>>>
>>>> Best,
>>>> Karl
>>>>
>>>>
>>>>
>>>> Best.
>>>> Karl
>>>>
>>>>
>>>>
>>>> On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]
>>>> <mailto:[hidden email]>> wrote:
>>>> > I'm a little late here.
>>>> > TextMorph does not really need TextAnchor I think.
>>>> > You can just drop morphs on the text and select avoid occlusions
>in
>>>> the menu.
>>>> > What are the use of text anchors instead just dropped in morphs ?
>>>> > I filed in TextAnchorPlacement change set and it interferes
>somewhat
>>>> with the avoid occlusions functions.
>>>>
>>>> I was wondering about the 'avoid occlusions' but spent all my focus
>on
>>>> the alignment testing, thanks for testing that too!
>>>>
>>>> We should not break that.  I like this new alignment capability,
>but
>>>> classic DTP text-handling is one of Squeak's most impressive
>>>> capabilities.  Hopefully an easy fix..?
>>>>
>>>>
>>>>  - Chris
>>>>
>>>>
>>
>>
>>
>
>
>------------------------------------------------------------------------


Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Hannes Hirzel
Hello

what happened to Patrick's  proposals?

"
1.) When activating occlusion we also set the wrapFlag

2.) We do not try to avoid occlusions as long as the morph does not
have an owner yet.
"

Kind regards
Hannes

On 7/7/19, Patrick Rein <[hidden email]> wrote:

> To quote my earlier proposal:
>
> To make this more robust I would propose:
>
> 1.) When activating occlusion we also set the wrapFlag
>
> 2.) We do not try to avoid occlusions as long as the morph does not have an
> owner yet.
>
>
> adjustX adjusts the Paragraph bounds to the rightmost character. This does
> not make sense for TextContainers as they dictate the rightmost point for
> layouting. (Even if you make that work, there are other such constraints (I
> tried it :))). Thus when having a TextContainer the wrapFlag should always
> be set to true.
>
> At the same time it is right that pre-formatted text should also work with
> occlusion ideally. but this goes beyond the initial bug we are trying to fix
> here (at least that was my impression).
>
> Bests
> Patrick
>
> ⁣BlueMail for Android herunterladen ​
>
> Am 6. Juli 2019, 19:55, um 19:55, karl ramberg <[hidden email]>
> schrieb:
>>I looked at the code and I'm really not sure what to do.
>>I don't think understand what is going on in the code, and what is
>>supposed
>>to go on.
>>
>>Best,
>>Karl
>>
>>
>>On Thu, Jul 4, 2019 at 10:33 PM Bob Arning <[hidden email]>
>>wrote:
>>
>>> I think it's not really broken - adjustRightX is only used when
>>wrapFlag
>>> is false, which is probably not the originally intended use for
>>> TextContainers. You could add a method or two to TextContainer to see
>>if it
>>> would work when not wrappping.
>>>
>>> On 7/4/19 4:00 PM, karl ramberg wrote:
>>>
>>>
>>>
>>> On Thu, Jul 4, 2019 at 8:50 PM karl ramberg <[hidden email]>
>>wrote:
>>>
>>>> The code in NewParagraph>>adjustRightX is broken.
>>>> It seem to expect a container that is a Rectangle and not a
>>TextContainer.
>>>> This method must be made to work with TextContainer.
>>>>
>>>> NewParagraph>>adjustRightX
>>>> | shrink |
>>>> shrink := container right - maxRightX.
>>>> lines do: [:line | line paddingWidth: (line paddingWidth - shrink)].
>>>> container := container withRight: maxRightX + self caretWidth.
>>>>
>>>> Best,
>>>> Karl
>>>>
>>>
>>> NewParagraph seems to sometimes have Rectangle as container  and
>>sometimes
>>> a TextContainer.
>>> I'm not sure what to do about that...
>>>
>>> Best,
>>> Karl
>>>
>>>>
>>>>
>>>> On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]>
>>wrote:
>>>>
>>>>> Hi Karl,
>>>>>
>>>>> I agree that the drag and drop handling of TextMorphs is somewhat
>>>>> complex by now.  While looking into the issue I found two kinds of
>>issues:
>>>>> some more general ones and one related to layouting.
>>>>>
>>>>> ## General Occlusion Bug
>>>>>
>>>>> I have to admit that I was not aware of the avoid occlusions
>>feature. I
>>>>> dug into it a little and
>>>>> found TextContainer and the class comment which explains the
>>feature.
>>>>> Then I constructed
>>>>> the following example:
>>>>>
>>>>> o := Morph new.
>>>>> tm := TextMorph new
>>>>>         contents: 'This is a very long text with a lot of
>>characters
>>>>> spanning multiple lines overall and throughout the
>>>>> place in order to trigger the occlusion thing';
>>>>>         yourself.
>>>>> m := RectangleMorph new.
>>>>> m position: tm topLeft + (10@10).
>>>>> tm occlusionsOnOff.
>>>>> o addMorph: tm.
>>>>> o addMorph: m.
>>>>> o openInWorld.
>>>>>
>>>>> I tried it in trunk and Squeak 3.8 and in both it results in errors
>>in
>>>>> NewParagraph>>#adjustRightX as
>>>>> it expects container to behave like a rectangle.
>>>>>
>>>>> However, the root cause seems to be that #adjustRightX does not
>>make
>>>>> sense when having a fixed
>>>>> TextContainer as it describes the individual rectangles in which
>>the
>>>>> text can be set. One solution is
>>>>> to set `tm wrapFlag: true` before turning avoidOcclusions on
>>(otherwise
>>>>> #wrapFlag triggers a relayout
>>>>> without tm having an owner which does not work...).
>>>>>
>>>>> To make this more robust I would propose:
>>>>> 1.) When activating occlusion we also set the wrapFlag
>>>>> 2.) We do not try to avoid occlusions as long as the morph does not
>>have
>>>>> an owner yet.
>>>>>
>>>>> ## Text Anchor Related
>>>>>
>>>>> Maybe this is more what you were thinking about Karl: I found that
>>when
>>>>> having the above example
>>>>> plus an anchored morph which is layouted inline most things work
>>fine.
>>>>> Except for the layout issue
>>>>> you can see in the attachment (the first morph in the third line is
>>the
>>>>> anchored morph, the second one
>>>>> is the m from the example above). The second part of the third line
>>does
>>>>> not adhere to the offset of the
>>>>> first part of the line. @Karl: Did you refer to that? (Not sure how
>>to
>>>>> fix this yet...)
>>>>>
>>>>> Bests
>>>>> Patrick
>>>>> ________________________________________
>>>>> From: Squeak-dev <[hidden email]> on
>>>>> behalf of karl ramberg <[hidden email]>
>>>>> Sent: Monday, July 1, 2019 11:44:34 AM
>>>>> To: Chris Muller
>>>>> Cc: The general-purpose Squeak developers list
>>>>> Subject: Re: [squeak-dev] Proposal: Morphs in Text
>>>>>
>>>>> One big issue with the drag and drop is that it is often not clear
>>which
>>>>> morph one drop into.
>>>>> There are so many layers of morphs in a text window so it gets
>>confusing
>>>>> to know which morph to actually
>>>>> enable to accepting the drop.
>>>>>
>>>>> But drag and drop are probably a separate issue from text anchors
>>>>> constructed from
>>>>> code. Just don't break it to badly  :-)
>>>>>
>>>>>
>>>>> Best,
>>>>> Karl
>>>>>
>>>>>
>>>>>
>>>>> Best.
>>>>> Karl
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]
>>>>> <mailto:[hidden email]>> wrote:
>>>>> > I'm a little late here.
>>>>> > TextMorph does not really need TextAnchor I think.
>>>>> > You can just drop morphs on the text and select avoid occlusions
>>in
>>>>> the menu.
>>>>> > What are the use of text anchors instead just dropped in morphs ?
>>>>> > I filed in TextAnchorPlacement change set and it interferes
>>somewhat
>>>>> with the avoid occlusions functions.
>>>>>
>>>>> I was wondering about the 'avoid occlusions' but spent all my focus
>>on
>>>>> the alignment testing, thanks for testing that too!
>>>>>
>>>>> We should not break that.  I like this new alignment capability,
>>but
>>>>> classic DTP text-handling is one of Squeak's most impressive
>>>>> capabilities.  Hopefully an easy fix..?
>>>>>
>>>>>
>>>>>  - Chris
>>>>>
>>>>>
>>>
>>>
>>>
>>
>>
>>------------------------------------------------------------------------
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Morphs in Text

Hannes Hirzel
P.S. Is the change set I need to file in still the one from the mail of
Patrick Rein, Jun 28, 2019 at 2:40 PM?



On 8/22/19, H. Hirzel <[hidden email]> wrote:

> Hello
>
> what happened to Patrick's  proposals?
>
> "
> 1.) When activating occlusion we also set the wrapFlag
>
> 2.) We do not try to avoid occlusions as long as the morph does not
> have an owner yet.
> "
>
> Kind regards
> Hannes
>
> On 7/7/19, Patrick Rein <[hidden email]> wrote:
>> To quote my earlier proposal:
>>
>> To make this more robust I would propose:
>>
>> 1.) When activating occlusion we also set the wrapFlag
>>
>> 2.) We do not try to avoid occlusions as long as the morph does not have
>> an
>> owner yet.
>>
>>
>> adjustX adjusts the Paragraph bounds to the rightmost character. This
>> does
>> not make sense for TextContainers as they dictate the rightmost point for
>> layouting. (Even if you make that work, there are other such constraints
>> (I
>> tried it :))). Thus when having a TextContainer the wrapFlag should
>> always
>> be set to true.
>>
>> At the same time it is right that pre-formatted text should also work
>> with
>> occlusion ideally. but this goes beyond the initial bug we are trying to
>> fix
>> here (at least that was my impression).
>>
>> Bests
>> Patrick
>>
>> ⁣BlueMail for Android herunterladen ​
>>
>> Am 6. Juli 2019, 19:55, um 19:55, karl ramberg <[hidden email]>
>> schrieb:
>>>I looked at the code and I'm really not sure what to do.
>>>I don't think understand what is going on in the code, and what is
>>>supposed
>>>to go on.
>>>
>>>Best,
>>>Karl
>>>
>>>
>>>On Thu, Jul 4, 2019 at 10:33 PM Bob Arning <[hidden email]>
>>>wrote:
>>>
>>>> I think it's not really broken - adjustRightX is only used when
>>>wrapFlag
>>>> is false, which is probably not the originally intended use for
>>>> TextContainers. You could add a method or two to TextContainer to see
>>>if it
>>>> would work when not wrappping.
>>>>
>>>> On 7/4/19 4:00 PM, karl ramberg wrote:
>>>>
>>>>
>>>>
>>>> On Thu, Jul 4, 2019 at 8:50 PM karl ramberg <[hidden email]>
>>>wrote:
>>>>
>>>>> The code in NewParagraph>>adjustRightX is broken.
>>>>> It seem to expect a container that is a Rectangle and not a
>>>TextContainer.
>>>>> This method must be made to work with TextContainer.
>>>>>
>>>>> NewParagraph>>adjustRightX
>>>>> | shrink |
>>>>> shrink := container right - maxRightX.
>>>>> lines do: [:line | line paddingWidth: (line paddingWidth - shrink)].
>>>>> container := container withRight: maxRightX + self caretWidth.
>>>>>
>>>>> Best,
>>>>> Karl
>>>>>
>>>>
>>>> NewParagraph seems to sometimes have Rectangle as container  and
>>>sometimes
>>>> a TextContainer.
>>>> I'm not sure what to do about that...
>>>>
>>>> Best,
>>>> Karl
>>>>
>>>>>
>>>>>
>>>>> On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <[hidden email]>
>>>wrote:
>>>>>
>>>>>> Hi Karl,
>>>>>>
>>>>>> I agree that the drag and drop handling of TextMorphs is somewhat
>>>>>> complex by now.  While looking into the issue I found two kinds of
>>>issues:
>>>>>> some more general ones and one related to layouting.
>>>>>>
>>>>>> ## General Occlusion Bug
>>>>>>
>>>>>> I have to admit that I was not aware of the avoid occlusions
>>>feature. I
>>>>>> dug into it a little and
>>>>>> found TextContainer and the class comment which explains the
>>>feature.
>>>>>> Then I constructed
>>>>>> the following example:
>>>>>>
>>>>>> o := Morph new.
>>>>>> tm := TextMorph new
>>>>>>         contents: 'This is a very long text with a lot of
>>>characters
>>>>>> spanning multiple lines overall and throughout the
>>>>>> place in order to trigger the occlusion thing';
>>>>>>         yourself.
>>>>>> m := RectangleMorph new.
>>>>>> m position: tm topLeft + (10@10).
>>>>>> tm occlusionsOnOff.
>>>>>> o addMorph: tm.
>>>>>> o addMorph: m.
>>>>>> o openInWorld.
>>>>>>
>>>>>> I tried it in trunk and Squeak 3.8 and in both it results in errors
>>>in
>>>>>> NewParagraph>>#adjustRightX as
>>>>>> it expects container to behave like a rectangle.
>>>>>>
>>>>>> However, the root cause seems to be that #adjustRightX does not
>>>make
>>>>>> sense when having a fixed
>>>>>> TextContainer as it describes the individual rectangles in which
>>>the
>>>>>> text can be set. One solution is
>>>>>> to set `tm wrapFlag: true` before turning avoidOcclusions on
>>>(otherwise
>>>>>> #wrapFlag triggers a relayout
>>>>>> without tm having an owner which does not work...).
>>>>>>
>>>>>> To make this more robust I would propose:
>>>>>> 1.) When activating occlusion we also set the wrapFlag
>>>>>> 2.) We do not try to avoid occlusions as long as the morph does not
>>>have
>>>>>> an owner yet.
>>>>>>
>>>>>> ## Text Anchor Related
>>>>>>
>>>>>> Maybe this is more what you were thinking about Karl: I found that
>>>when
>>>>>> having the above example
>>>>>> plus an anchored morph which is layouted inline most things work
>>>fine.
>>>>>> Except for the layout issue
>>>>>> you can see in the attachment (the first morph in the third line is
>>>the
>>>>>> anchored morph, the second one
>>>>>> is the m from the example above). The second part of the third line
>>>does
>>>>>> not adhere to the offset of the
>>>>>> first part of the line. @Karl: Did you refer to that? (Not sure how
>>>to
>>>>>> fix this yet...)
>>>>>>
>>>>>> Bests
>>>>>> Patrick
>>>>>> ________________________________________
>>>>>> From: Squeak-dev <[hidden email]> on
>>>>>> behalf of karl ramberg <[hidden email]>
>>>>>> Sent: Monday, July 1, 2019 11:44:34 AM
>>>>>> To: Chris Muller
>>>>>> Cc: The general-purpose Squeak developers list
>>>>>> Subject: Re: [squeak-dev] Proposal: Morphs in Text
>>>>>>
>>>>>> One big issue with the drag and drop is that it is often not clear
>>>which
>>>>>> morph one drop into.
>>>>>> There are so many layers of morphs in a text window so it gets
>>>confusing
>>>>>> to know which morph to actually
>>>>>> enable to accepting the drop.
>>>>>>
>>>>>> But drag and drop are probably a separate issue from text anchors
>>>>>> constructed from
>>>>>> code. Just don't break it to badly  :-)
>>>>>>
>>>>>>
>>>>>> Best,
>>>>>> Karl
>>>>>>
>>>>>>
>>>>>>
>>>>>> Best.
>>>>>> Karl
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <[hidden email]
>>>>>> <mailto:[hidden email]>> wrote:
>>>>>> > I'm a little late here.
>>>>>> > TextMorph does not really need TextAnchor I think.
>>>>>> > You can just drop morphs on the text and select avoid occlusions
>>>in
>>>>>> the menu.
>>>>>> > What are the use of text anchors instead just dropped in morphs ?
>>>>>> > I filed in TextAnchorPlacement change set and it interferes
>>>somewhat
>>>>>> with the avoid occlusions functions.
>>>>>>
>>>>>> I was wondering about the 'avoid occlusions' but spent all my focus
>>>on
>>>>>> the alignment testing, thanks for testing that too!
>>>>>>
>>>>>> We should not break that.  I like this new alignment capability,
>>>but
>>>>>> classic DTP text-handling is one of Squeak's most impressive
>>>>>> capabilities.  Hopefully an easy fix..?
>>>>>>
>>>>>>
>>>>>>  - Chris
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>------------------------------------------------------------------------
>>
>>
>>
>



Question_which_changeSet_for_TextMorph_Screenshot_2019-08-22.png (72K) Download Attachment
12