Andre Poenitz wrote:

> The problem is that selection painting relies on a warm position cache
> yet we have the position only _after_ drawing. We need it before, as we
> want to draw the selection first. Chicken and egg...

Exactly.

> I think this problem has been there since day one but never emerged to
> the surface as we always had a warm cache due to the 'extensive'
> repainting.

Well not extensive repainting: y coordinates were kept updated.

> The only clean solution I can see is to reorganze the current two
> drawing phases (1. metrics, 2. draw, including pos cache setting)
> into four:
> 
>   1. metrics
>   2. pos cache setting
>   3. selection drawing
>   4. text/inset drawing
> 
> This is conceptually no big change but we would need to touch quite a
> few inset's draw() methods.

Actually, I've done exactly this for the outer LyXText (have a look).

This is not possible for inner insets, because you don't have the complete
pos cache after metrics (you need the draw step to have the x positions)
and moreover, you don't even have the y positions after doing its own
metrics (the size of following things could change its position)
*But*
it is ok for outer paragraphs: after their metrics we have everything
y-related. And outer paragraphs is all we need for getting absolute
coodinates for selection*.

Again, it works fine here now so finding something better is 1.5.x business
at best IMO.

* (The rest is then asked recursively to insets [with your
coordOffset/inset.getCursorPos])

I'll commit briefly the last fix I have in the selection area (out-of-screen
endpoints)

Alfredo (fighting with cvs branches but please don't switch to subversion
now that I'm starting to understand them ;-)



Reply via email to