22/07/2013 11:53, Hashini Senaratne:
When I test further, figured out that the cur_x only gives the correct
position in pixels just after entering a Math inset; from the next row. That
is the next row consider in the for loop in drawParagraph() method. The line
responsible for updating this bv.getPos(cur).x_ for the current text row is
"rp.paintText()". I do not know how this happens. But when I check
bv.getPos(cur).x_ before this line, it gives the old value for the current
row, and when I check bv.getPos(cur).x_ value after this line, it gives the
new value. Could you help to understand what I am missing?
I am not sure you are missing something... To be frank, this part of the
code with inset coordinates is mysterious to me, and I am not sure who
are the current developers who are acquainted to it. I have made last
week a rewrite of part of the metrics calculations code in branch
features/str-metrics, but I fortunately did not have to try to
understand that :) Already I had to warp my head around many things that
I do not understand.
What I do know is that there are two inset metrics caches:
* ParagraphMetrics::(set)InsetDimension sotres/retrives the size of the
inset, not its dimension.
* CoordCache (accessible from BufferView) stores the position and the
size of insets. There is some discussion in CoordCache.h that may be
useful.
However I do not know what is the relation between these two caches and
even why both exist independently.
JMarc