29/06/2013 13:40, Hashini Senaratne:
I think this not-suitability cannot decide only with this offset attribute.
As proceeds I figured out that only using the offset value, it is impossible
to give a correct output in scrolling. That is, without knowing the amount
that we already slid, we cannot take a decision whether to slide the row or
not; when the cursor is moving. This amount can vary from time to time.

Hello Hashini,

I am not sure we undertand each other: in my mind, this "offset" is indeed the amount of horizontal pixel by which the row has been slid. That is, instead of drawing the part of the row that goes from 0 to window_width, LyX will draw the part between offset and offset+window_width. Isn't this what you are proposing below?

What is in your mind the difference between an offset and "an attribute which shows the actual position in pixels of the leftmost edge of the current appearing screen"?

The problem might be that the word "offset" was a poor choice from my part.

The algorithm you describe below is exactly what I have in mond. Concerning this left_value variable, it is exactly what I called an "offset" and I think that it should be kept in the bufferview (along with the row to which it applies).

JMarc

Following are few examples that can take in to account. Consider about an
already slid row.

*We are going to click on a place which is visible in the current screen
(may be from right or left from the current cursor) Note that the
implementation that we have in mind, will not have the cursor always at the
right edge as in my last test.

*We can start selecting a range of content in a Math inset by clicking at a
point and and move the mouse further to left and release the mouse. How are
we going to know whether we passed the screen limits or not?

*Even it can be a situation where the cursor is at a righter part of the
content and we are going to re size the screen (actually reduce) such that
the cursor tends to disappear from the screen. At such a moment, we need to
slide the row such that the cursor appears in the screen.

*In the current version of LyX; if we closed a document and re-open it, the
cursor appears at the same point where we stopped it. Horizontal scrolling
also should support this feature.

The solution that I am going to propose it to have an attribute which shows
the actual position in pixels of the leftmost edge of the current appearing
screen. We actually may not need an offset in this case. We can however
compute the offset by: (cur.targetX()- bv.workWidth()) in the
drawparagraph() method in TextMetrics.cpp whenever we need.

The only problem that I have is how to get this pixel value of the left edge
of the screen???

The algorithm would be as simple as follows if we can find that attribute
from time to time. Here (screen_width= bv.workWidth())

*if(cur.targetX()>left_edge_Value &&
cur.targetX()<left_edge_Value+screen_width) then move only the cursor, do
not slide row [Selecting an appearing position scenario]

*if(cur.targetX()<left_edge_Value) then slide row to right and move the
cursor to the right edge [Selecting a range of content with the use of mouse
scenario/ reduce the size of the screen from left side]

*if(cur.targetX()>left_edge_Value &&
cur.targetX()<left_edge_Value+screen_width) then move only the cursor, do
not slide row [Selecting a range of content with the use of mouse scenario/
reduce the size of the screen from right side]

Do not you think that this is a good approach? However we need to consider
about changing rows, as you proposed earlier.

Is there a technique to find this left_edge_Value (in pixel) in your mind?

Thank you
Hashini





Reply via email to