Le 20/09/13 18:41, Hashini Senaratne a écrit :

Following is my suggested log, when committing to the master, after deleting
merges that I have done so far. It would be very helpful, even if you can
quickly go through it.

Hello Hashini,

Your commit log is pretty good. See a few comments below.

JMarc

[Feature] Key board based horizontal scrolling for math insets

This feature also applicable for other insets; graphics and labels.

So why not just write that the feature is about horizontal scrolling of wide insets?

Although the initial implementation was started with scrolling the whole
content of the document at once when traverse through a too wide row, the
current implementation is capable of scrolling a single row when reaching
its content which is beyond the screen limits, using left and right arrow
keys.

If the commit is what we plan to send to master, there is no need to describe the history here. This may be relevant in some report to google, however.

The attribute 'left_edge_' introduced in the Cursor plays a main role in

"in the Cursor class"

horizontal scrolling of the wide rows that grow beyond the screen limits.
This attribute represents by how much pixels the current row that the text
cursor lies in should be get scrolled.

The main logic that is responsible for drawing the scrolled rows was
started within TextMetrics::drawParagraph and later moved to BufferView.

Again history is not relevant here

  * The main logic is called via BufferView::draw.

  * What this does is set the left_edge_ attribute in Cursor in order to
  show the position that the text cursor lies in.

"in order to mke sure that the cursor is visible on screen"?


  * To make sure that BufferView::draw gets involved when Update flag is
  FitCursor necessary changes are made in BufferView::processUpdateFlags.

Basically what the logic that used to set the left_edge_ does is,

  * The row which the text cursor lies in is identified by a CursorSlice
  that points to the beginning of the row. This is the 'rowSlice' variable
  used in checkCursorLeftEdge in BufferView. The Cursor members are
  modified correspondingly to obtain this variable. Here row objects were
  not used to identify the current row, because it appears that row objects
  can disappear when doing a decoration update for example. This means that
  comparing row pointers is not a good idea, be cause they can change
  without notice.

  * Using Cursor::setCurrentRowSlice reset left_edge_ when changing cursor
  row. This is done in order to prevent unwanted scrolling that happens
  when changing the selected row using up and down arrow keys.

  * Recompute inset positions before checking left edge of the row, by
  painting the row insets with drawing disabled. This is done because, some
  of the position calculations of math insets are taken place within the
  drawing procedure.

"because the position of insets is computed within the drawing procedure"

You should not need any explicit reference to math insets in your description (and code, actually)


  * Current x position of the text cursor is compared with the left_edge_
  value and the other variables like row.width(), bv.workWidth(). Compute
  the needed left_edge_ value in order to show where the text cursor lies
  in. The basics conditions that we check before recomputing left_edge_
  are,
  if the text cursor lies rightward to the current right screen boundary,
  if the text cursor lies leftward to the current left screen boundary,
  if the text cursor lies within screen boundaries but the length of the
  row is lesser than the left boundary of the screen (this happens when we
  delete some content of the row using delete key or backspace key).

  * Change update strategy when left edge has changed. This allows to
  redraw the row when no drawing was scheduled. By doing so, it was
  possible to redraw a wide row when moving to the leftmost position of the
  wide row, from the leftmost position of the row below, using the left
  arrow key.

In TextMetrics::drawParagraph it is checked whether the current row is
what is drawing now. If it is so, the value used to the x value of the row
for drawing is adapted according to the computed value of left_edge_ of
Cursor.

The method used to pass boundary() was fixed to get row when cursor was in
a nested inset. This matter is considered Cursor::textRow is modified and
Cursor::bottomRow is created which returns the the top-level row that
holds the cursor.

GuiWorkArea::Private::showCursor() is modified to show the cursor position
in a scrolled row.



Reply via email to