gzz-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gzz] PEG textnodeview_locate_cursor--humppake


From: Tuomas Lukka
Subject: Re: [Gzz] PEG textnodeview_locate_cursor--humppake
Date: Thu, 14 Aug 2003 12:21:39 +0300
User-agent: Mutt/1.5.4i

On Thu, Aug 14, 2003 at 10:39:11AM +0300, Asko Soukka wrote:
> ===========================================================================================
> PEG textnodeview_locate_cursor--humppake: Locating cursor in textnodeview 
> with broken lines
> ===========================================================================================

Language twids below. I hope you don't mind, I just think that
PEGs are a good opportunity for learning about writing. 

> Mudyc asked me to think how text cursor could be located within

*the* text cursor

> TextNodeView (currently ``org.fenfire.view.TextNodeView``). 

*a* TextNodeView


> This PEG
> describes my solution proposal: 

"my proposal", or "a proposed solution" or "my proposal for [solving] this"

> two new methods for TextNodeView. One
> returning the cursor position according to coordinates within
> TextNodeView and another returning the coordinates of the cursor
> according to it's position (often referred as offset) within the text.

This is not a complete sentence. OTOH, the abstract does 
not necessarily need so much detail.

> Issues
> ======
> 
> Who knows position of cursors?

I don't understand what this issue really means.

Which meaning of the word "cursor" and which meaning
of the word "position" are you referring to? Both
have a lot of meanings in our context.


>       RESOLVED: The position is usually stored within demo
>         application. A spesific Cursor class may be used
>         (``org.fengire.view.lava.Cursor``).
>         
>       NOTE: The term `position` means here only cursor's offset
>         within the text string.

Better say that above. For example,

"Who is responsible for managing text cursor positions?"

> But there is also a method ``getCursorOffset`` in
> ``org.fenfire.view.lava.TextHandler`` (`the `TextNodeView``
> inherits). Does it have any role?
> 
>       RESOLVED: AFAIK, currently it's not used anywhere. ``Cursor``
>         is used instead of it.

In that case, you should probably say in the PEG that it should be
removed.

And anyway, it's a lava class.

> Who knows how text's lines are broken?

Knows -- I suggested above "is responsible for managing/knowing" -
I think that would be better here too.

>       RESOLVED: Only the used ``TextNodeView`` knows. 

Fennism. 
Only the ``TextNodeView`` that was used to render the text knows.

>       It uses
>         LibVob's linebreaking code (``org.nongnu.libvob.linebreaking``).

Currently, it uses...

>       The linebreaking information is formed only when needed (when
>         creating a placeable object) and is not stored.

s/formed/generated/

s/placeable/``Placeable``/ ?

> How the information of linebreaking can be reached?

Again, the order of the words in the sentence is a fennism.

"How can X be reached." is the correct order.

"information of linebreaking" is a strange expression.



>         RESOLVED: The information is not stored within
>         ``TextNodeView``, but it could be reconstructed. 

s/could/can/

I'd use the active form:

        The ``TextNodeView`` objects do not store the linebreaking
        information but can reconstruct it.

> Where the information of linebreaking could be reconstructed?

Again, word order: "Where could ..."


>       RESOLVED: The reconstruction is complex and is most practical
>         to do also within ``TextNodeView``, 

"is most practical to do also" -> "it is also most practical to do"

>       since it has already the
>         supportive  methods needed for easy use of linebreaking lib.

supporting methods.  

needed... -> to help using the linebreaking library

>       In ``TextNodeView`` only the text content is needed for
>         linebreaking. When creating a placeable TextNodeView object,
>         the text is fetched from the current node (needed parameters
>         are current ``ConstGraph`` and current node)

needed parameters -> the required parameters

> When the linebreaking information is needed?

When is...

>       RESOLVED: With mudyc we ended up to two main use cases.
> 
>         1) I know the cursor offset, but in which coordinates I should
>            draw the cursor into?
> 
>         2) I click the text with mouse and know the coordinates I
>            clicked, but how I set the cursor offset according to those
>            coordinates? (this should cover also the selection of text
>            using mouse)
>            
> How the needs could be filled?

How could ...

filled -> addressed

>       RESOLVED: According to the previous use cases,

According -> Based on

>               I suggest two
>         new methods into ``TextNodeView``. They will reconstruct the
>         linebreaking information using supportive methods already in

using the supporting method

>         ``TextNodeView`` and use available public methods of

use the public methods -- available duplicates the info in "public"

>         ``linebreaking.HBroken`` and ``linebreaking.HChain`` to
>         collect the information needed.
>            
>         The first method returns the cursor position according to

cursor position *for* given coordinates

>         given coordinates within TextNodeView and another returns the

within *a* 

and *the* other

>         coordinates of the cursor according to it's given position

... of the cursor given its position

>         (often referred as offset) within the text.
> 
>       The following should be always true, 

The following (pseudocode) expression should always be true

>       when a has a proper
>         (existing) text cursor offset value::
> 
>               a == TextNodeView.getPos(TextNodeView.getXY(a))
> 
> Changes
> =======
> 
> Into ``org.fenfire.view.TextNodeView``::
> 
>     /** Get position of the first character placed
>      * after given coordinates.
>      */
>     public int getPos(ConstGraph g, Object node, float x, float y);
> 
>     /** Get coordinates before the given character position.
>      * The Y coordinate is located below the line.
>      */
>     public void getXY(ConstGraph g, Object node, int pos, float[] xy);

Sounds very good.

I'm ready to accept this - just fix the grammar quickly.

> Implementation notes
> ====================
> 
> ``TextNodeView.getXY()`` returns y coordinate located below the line,

*the* y coordinate

> because the ``linebreaking.Hbroken.getLineOffset()`` also does that.

no "the" here - it's a proper noun.

        Tuomas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]