Hi Jean-Marc, 

> The important thing is to know what is the row that you have decided to 
> slide. This is why you have defined (set|get)ToowideRow, isn't it? Why 
> don't you use these methods?

Thank you. I implemented the basic sliding functionality in order to slide a
single row, according to the decided algorithm. Please check:(When checking
it please ignore the cursor positions; I have not implemented that part yet.
As you mentioned; I kept a 10 pixel margin) 
http://git.lyx.org/?p=gsoc.git;a=commitdiff;h=f48dab797054c1dba45d5005db62a8407ca14216
This code works fine for a Math inset, with sliding. What I have to do more;
* Modify the cursor appearing positions
* Modify the code to handle selecting a range of text within a row
* Update the cursor position, when the selected row get changed (moving from
a scrolled row to a non-too wide row)

> Here is (again) how I see the algorithm. The following pseudo code 
> should be placed somewhere inside the for() loop of 
> TextMetrics::drawParagraph:
> 
> if current row is the cursor's textRow
>    if cursor's getToowideRow != cursor's texRow
>      reset left edge to 0
>    endif
>    if cursor is not visible with current LeftEdge
>      increase or decrease leftedge so that the cursor is visible
>    endif
>    add cursor's leftedge to inc_x
> endif
> 

To check whether a row matches with the row where the cursor is in, I used
if (&cur.textRow() == &row)
Is this fine? 

> You can try a simpler solution where you keep, say, 10 pixels of margin. 
> Or, if pixels are not good because of high-resolution screen issues, you 
> could experiment with a percentage of max_width (like 3%).


> targetX is where you ant the cursor to be, not where it is.
> 
> First example. Below, `|' stands for the cursor.
> 
> foo bar foo bar |foo bar
> foo bar
> foo bar foo bar foo bar
> 
> Imagine you press CursorDown. The situation is now
> 
> foo bar foo bar foo bar
> foo bar|
> foo bar foo bar foo bar
> 
> CursorDown again. Situation becomes
> 
> foo bar foo bar foo bar
> foo bar
> foo bar foo bar |foo bar
> 
> This is made possible because, although second paragraph is very short, 
> targetX makes us remember where we want to be.
> 
> Another situation where this is useful is when using cursor down in the 
> following text
> 
> foo bar foo |bar foo bar
> foo bar<labelinset> bar
> foo bar foo bar foo bar
> 
> Again, knowing the targetX will avoid a `drift' of the cursor as you 
> move down the document.
> 
> Does this help?

Thank you for your explanation with these examples.

> PS: I will have many comments concerning style. Do you want them or 
> later when you have a proper patch? I recommend that you read first
> development/coding/CodingRulesAndAdvice.lyx (or at least part of it).

I am really Sorry. I will go through it and refactor my code and then ask
for your comments. Thank you for reminding me.

Thank you
Hashini




Reply via email to