Fix updating inset inside insets (typically graphics after loading).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3701 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2002-03-08 11:42:30 +00:00
parent 7a3f5f9f6f
commit 2b24ca217f
5 changed files with 48 additions and 18 deletions

View File

@ -1192,7 +1192,8 @@ void BufferView::Pimpl::cursorNext(LyXText * text)
bool BufferView::Pimpl::available() const
{
if (buffer_ && bv_->text) return true;
if (buffer_ && bv_->text)
return true;
return false;
}
@ -3405,7 +3406,7 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
{
if (!inset)
if (!inset || !available())
return;
// first check for locking insets
@ -3431,9 +3432,14 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
}
}
// then check the current buffer
if (available()) {
hideCursor();
// then check if the inset is a top_level inset (has no owner)
// if yes do the update as always otherwise we have to update the
// toplevel inset where this inset is inside
Inset * tl_inset = inset;
while(tl_inset->owner())
tl_inset = tl_inset->owner();
hideCursor();
if (tl_inset == inset) {
update(bv_->text, BufferView::UPDATE);
if (bv_->text->updateInset(bv_, inset)) {
if (mark_dirty) {
@ -3446,6 +3452,13 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
}
return;
}
} else if (static_cast<UpdatableInset *>(tl_inset)
->updateInsetInInset(bv_, inset))
{
if (bv_->text->updateInset(bv_, tl_inset)) {
update();
updateScrollbar();
}
}
}

View File

@ -1,3 +1,8 @@
2002-03-08 Juergen Vigna <jug@sad.it>
* BufferView_pimpl.C (updateInset): update inset inside inset also
if it isn't inside theLockingInset().
2002-03-07 Lars Gullik Bjønnes <larsbj@birdstep.com>
* buffer.C (asciiParagraph): redo some of the word and line length

View File

@ -1,3 +1,13 @@
2002-03-08 Juergen Vigna <jug@sad.it>
* insettabular.C (updateLocal): do a FULL update if we're not locked
and only a CELL update is asked.
* insettext.C (updateInsetInInset): update insets inside inset also
if it isn't inside the_locking_inset.
* insettabular.C (updateInsetInInset): ditto.
2002-03-06 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* insetexternal.C (doSubstitution): check whether we are using a

View File

@ -618,6 +618,8 @@ void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what,
LyXFont font;
calculate_dimensions_of_cells(bv, font, true);
}
if (!locked && what == CELL)
what = FULL;
if (need_update < what) // only set this if it has greater update
need_update = what;
#if 0 // maybe this should not be done!
@ -709,10 +711,16 @@ bool InsetTabular::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
bool InsetTabular::updateInsetInInset(BufferView * bv, Inset * inset)
{
if (!the_locking_inset)
Inset * tl_inset = inset;
// look if this inset is really inside myself!
while(tl_inset->owner() && tl_inset->owner() != this)
tl_inset = tl_inset->owner();
// if we enter here it's not ower inset
if (!tl_inset->owner())
return false;
if (the_locking_inset != inset) {
if (!the_locking_inset->updateInsetInInset(bv, inset))
// we only have to do this if this is a subinset of our cells
if (tl_inset != inset) {
if (!static_cast<InsetText *>(tl_inset)->updateInsetInInset(bv, inset))
return false;
}
updateLocal(bv, CELL, false);

View File

@ -869,15 +869,7 @@ bool InsetText::updateInsetInInset(BufferView * bv, Inset * inset)
lt = getLyXText(bv);
clear = true;
}
if (!the_locking_inset) {
bool found = lt->updateInset(bv, inset);
if (clear)
lt = 0;
if (found)
setUpdateStatus(bv, NONE);
return found;
}
if (the_locking_inset != inset) {
if (inset->owner() != this) {
bool found = the_locking_inset->updateInsetInInset(bv, inset);
if (clear)
lt = 0;
@ -890,7 +882,9 @@ bool InsetText::updateInsetInInset(BufferView * bv, Inset * inset)
lt = 0;
if (found) {
setUpdateStatus(bv, CURSOR_PAR);
if (cpar(bv) == inset_par && cpos(bv) == inset_pos) {
if (the_locking_inset &&
cpar(bv) == inset_par && cpos(bv) == inset_pos)
{
inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset;
}