]> git.lyx.org Git - features.git/commitdiff
apply combo.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 5 Dec 2001 23:16:13 +0000 (23:16 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 5 Dec 2001 23:16:13 +0000 (23:16 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3163 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView2.C
src/ChangeLog
src/LyXView.C

index 0d5d4c10a418bd6a90f4c40242f5a36808a80994..822bfde0b7bb0f719268f0868217de1db640e2ec 100644 (file)
@@ -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<InsetCommand *>(*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;
 }
 
 
index 3173a563eb6d8a6dfbda3673fbc483b7dc11cb16..cd3d3a40e58e92a8b5a73509897b0f46834f58cf 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-05  John Levon  <moz@compsoc.man.ac.uk>
+
+       * LyXView.C:
+       * BufferView2.C: fix layout combo update on inset unlock
+
 2001-12-05  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am: don't compile unused files
index 36804ac4c6bbafe4c419202ff69ec2345d9b05c2..df55886c3e03d4981b026224b28c45edbd75afe1 100644 (file)
@@ -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;
        }