On Monday 08 July 2002 4:36 pm, Juergen Vigna wrote:
> Ok. No we don't have a isVisible function right now and I don't think
> this is easy to make as the "visibility" depends on the x,baseline
> values passed as parameters to draw, which could change if I have to
> rebreak the text after the loading. You could have a look at the
> tabular.C or insettext.C draw functions. I just draw the visible
> parts there, but for a graphics file with a fixed hight it could
> be as easy as "if baseline+graphics_height > 0 then draw".

Excuse me if I'm being dumn, but do you do have this info to hand because you 
only call Inset::draw for a small set of Insets at a time. All you need to do 
is cache this info. Something like:

vector<Inset *> visible_insets;

void Your_Main_Draw_Routine () {
        visible_insets.clear();
        for (some group of insets) {
                inset->draw(...);
                visible_insets.push_back(inset);
        }
}

bool isVisible(Inset * inset) {
        vector<Inset *>::const_iterator it = visible_insets.begin();
        vector<Inset *>::const_iterator end = visible_insets.end();
        it = std::find(it, end, inset);
        return it != end;
}

Am I wrong?
Angus

Reply via email to