Andre Poenitz wrote:
> One question: what should now be the meaning of y in Inset::draw()?
>
> Currently it is 'screen absolute' as far as I can tell. Do we change
> that?
>
> Going to 'doc absolute' would mean adding lots of top_y() all over
> the place when calling the low-level drawing routines.
>
> Another option ('nicer' perhaps...) would be to do the top_y()
> addition in all low-level routines (i.e. Painter::line() ::rect()
> etc)
>
> Should we just do that?
Or perhaps the nicest of all would be to have a helper function that
took the absolute coordinate and returned a coordinate relative to
the top of the screen.
Since the 'top of the screen' is a BufferView property, why not:
class BufferView {
int y(int y_absolute) const { return y_absolute - top_y(); }
};
Then the inset code would be
void InsetCommand::draw(PainterInfo & pi, int x, int y_abs) const
{
BufferView const & bv = *pi.base.bv;
xo_ = x;
yo_ = y;
button_.draw(pi, x, bv.y(y_abs));
}
--
Angus