From 6b6d49b7dfc48c14c8faf48ed087e5daf8d90013 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 5 Dec 2001 23:16:13 +0000 Subject: [PATCH] apply combo.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3163 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView2.C | 19 ++++++++++++------- src/ChangeLog | 5 +++++ src/LyXView.C | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/BufferView2.C b/src/BufferView2.C index 0d5d4c10a4..822bfde0b7 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -456,10 +456,13 @@ int BufferView::unlockInset(UpdatableInset * inset) if (inset && theLockingInset() == inset) { inset->insetUnlock(this); theLockingInset(0); + // make sure we update the combo ! + owner()->setLayout(getLyXText()->cursor.par()->getLayout()); finishUndo(); return 0; } else if (inset && theLockingInset() && theLockingInset()->unlockInsetInInset(this, inset)) { + // owner inset has updated the layout combo finishUndo(); return 0; } @@ -488,7 +491,7 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty) bool BufferView::ChangeInsets(Inset::Code code, string const & from, string const & to) { - bool flag = false; + bool need_update = false; LyXCursor cursor = text->cursor; LyXCursor tmpcursor = cursor; cursor.par(tmpcursor.par()); @@ -498,20 +501,22 @@ bool BufferView::ChangeInsets(Inset::Code code, for (ParIterator it = buffer()->par_iterator_begin(); it != end; ++it) { Paragraph * par = *it; - bool flag2 = false; + bool changed_inset = false; for (Paragraph::inset_iterator it2 = par->inset_iterator_begin(); it2 != par->inset_iterator_end(); ++it2) { if ((*it2)->lyxCode() == code) { InsetCommand * inset = static_cast(*it2); if (inset->getContents() == from) { inset->setContents(to); - flag2 = true; + changed_inset = true; } } } - if (flag2) { - flag = true; -#warning Fix me + if (changed_inset) { + need_update = true; +#ifdef WITH_WARNINGS +#warning FIXME +#endif // The test it.size()==1 was needed to prevent crashes. // How to set the cursor corretly when it.size()>1 ?? if (it.size() == 1) { @@ -523,7 +528,7 @@ bool BufferView::ChangeInsets(Inset::Code code, } } text->setCursorIntern(this, cursor.par(), cursor.pos()); - return flag; + return need_update; } diff --git a/src/ChangeLog b/src/ChangeLog index 3173a563eb..cd3d3a40e5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-12-05 John Levon + + * LyXView.C: + * BufferView2.C: fix layout combo update on inset unlock + 2001-12-05 John Levon * Makefile.am: don't compile unused files diff --git a/src/LyXView.C b/src/LyXView.C index 36804ac4c6..df55886c3e 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -206,9 +206,9 @@ void LyXView::updateLayoutChoice() toolbar->updateLayoutList(false); } - layout_type layout = bufferview->text->cursor.par()->getLayout(); + layout_type layout = bufferview->getLyXText()->cursor.par()->getLayout(); - if (layout != current_layout){ + if (layout != current_layout) { toolbar->setLayout(layout); current_layout = layout; } -- 2.39.5