]> git.lyx.org Git - features.git/commitdiff
Add In nsetOld * argument to updateInset to rebreak the correct par.
authorAlfredo Braunstein <abraunst@lyx.org>
Wed, 27 Aug 2003 13:51:18 +0000 (13:51 +0000)
committerAlfredo Braunstein <abraunst@lyx.org>
Wed, 27 Aug 2003 13:51:18 +0000 (13:51 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7615 a592a061-630c-0410-9148-cb99ea01b6c8

26 files changed:
src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/ChangeLog
src/bufferview_funcs.C
src/graphics/PreviewedInset.C
src/insets/insetbibitem.C
src/insets/insetbranch.C
src/insets/insetcollapsable.C
src/insets/insetcommand.C
src/insets/insetert.C
src/insets/insetexternal.C
src/insets/insetfloat.C
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/insets/insetlabel.C
src/insets/insetminipage.C
src/insets/insetnote.C
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insetwrap.C
src/insets/updatableinset.C
src/mathed/formulabase.C
src/text2.C
src/text3.C

index d925d62bf07c9264d9fcdba2a770e1e68d33f671..41b8c53efb3dfef02168429967245e7595ca21d9 100644 (file)
@@ -543,9 +543,9 @@ int BufferView::unlockInset(UpdatableInset * inset)
 }
 
 
-void BufferView::updateInset()
+void BufferView::updateInset(InsetOld const * inset)
 {
-       pimpl_->updateInset();
+       pimpl_->updateInset(inset);
 }
 
 
index 482492943b1fe29147dcc7ef2ca8ce77e6cae539..076361c14ea53f47b62b0a5758f014e581a101f3 100644 (file)
@@ -79,8 +79,11 @@ public:
        bool fitCursor();
        /// perform pending painting updates
        void update();
-       /// update for a particular inset
-       void updateInset();
+       /** update for a particular inset. Gets a pointer and not a
+        *  reference because we really need the pointer information
+        *  to find it in the buffer.
+        */
+       void updateInset(InsetOld const *);
        /// reset the scrollbar to reflect current view position
        void updateScrollbar();
        /// FIXME
index da2e8b0361283fd83e6ef05f9a9eb8f3eedb5010..a62e5004f99fa74d357fd246b769bedfe5f2012d 100644 (file)
@@ -40,6 +40,7 @@
 #include "lyxrc.h"
 #include "lastfiles.h"
 #include "paragraph.h"
+#include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "TextCache.h"
 #include "undo_funcs.h"
@@ -1182,7 +1183,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
        case LFUN_INSET_INSERT: {
                InsetOld * inset = createInset(ev);
                if (inset && insertInset(inset)) {
-                       updateInset();
+                       updateInset(inset);
 
                        string const name = ev.getArg(0);
                        if (name == "bibitem") {
@@ -1371,14 +1372,16 @@ bool BufferView::Pimpl::insertInset(InsetOld * inset, string const & lout)
 }
 
 
-void BufferView::Pimpl::updateInset()
+void BufferView::Pimpl::updateInset(InsetOld const * inset)
 {
        if (!available())
                return;
 
+       bv_->text->redoParagraph(outerPar(*bv_->buffer(), inset));
+
        // this should not be needed, but it is...
-       bv_->text->redoParagraph(bv_->text->cursor.par());
-       //bv_->text->fullRebreak();
+       // bv_->text->redoParagraph(bv_->text->cursor.par());
+       // bv_->text->fullRebreak();
 
        update();
        updateScrollbar();
index c4ce343a7211fd6720040e09722a242a7ba7faf9..df03767e9ce231e33c8680efe922342e50e3446e 100644 (file)
@@ -101,7 +101,7 @@ struct BufferView::Pimpl : public boost::signals::trackable {
        ///
        bool insertInset(InsetOld * inset, string const & lout = string());
        ///
-       void updateInset();
+       void updateInset(InsetOld const * inset);
        /// a function should be executed from the workarea
        bool workAreaDispatch(FuncRequest const & ev);
        /// a function should be executed
index 4dff19effb4627122f9426ee9a0b6ce047a77237..1b3f994fa8499c160546ba45166599570fae2dc9 100644 (file)
@@ -1,4 +1,8 @@
+2003-08-27  Alfredo Braunstein  <abraunst@libero.it>
 
+       * BufferView.[Ch]:
+       * BufferView_pimpl.[Ch] (updateInset): add an InsetOld * argument
+       
 2003-08-26  André Pönitz  <poenitz@gmx.net>
 
        * paragraph_func.[Ch] (outerPar): new function
index 5496707e2d4925b47ea67d9279b5008d7c6a0646..4d0b6e8760309c042c79df96b3284c10666f44e7 100644 (file)
@@ -35,6 +35,7 @@
 #include "Lsstream.h"
 
 #include "insets/updatableinset.h"
+#include "insets/insettext.h"
 #include <boost/bind.hpp>
 #include <algorithm>
 
@@ -232,8 +233,7 @@ bool changeDepth(BufferView * bv, LyXText * text, DEPTH_CHANGE type, bool test_o
 
        bool const changed = text->changeDepth(type, false);
        if (text->inset_owner)
-               bv->updateInset();
-       bv->update();
+               bv->updateInset(text->inset_owner);
        return changed;
 }
 
index afdf0b4fef36371172f555758c7a79a64b47f53c..47ac36ae6fb522fab923e9ff2e9ce549b3e9ea12 100644 (file)
@@ -124,7 +124,7 @@ void PreviewedInset::imageReady(PreviewImage const & pimage) const
        pimage_ = &pimage;
 
        if (view())
-               view()->updateInset();
+               view()->updateInset(inset());
 }
 
 } // namespace graphics
index d9b56d7e2a367b494f088af9ce8252f6b8a6c421..ff10c841a7a3efae5a6eceb7424f367b456d6327 100644 (file)
@@ -66,7 +66,7 @@ dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
                if (p.getCmdName().empty())
                        return DISPATCHED;
                setParams(p);
-               cmd.view()->updateInset();
+               cmd.view()->updateInset(this);
                cmd.view()->fitCursor();
                return DISPATCHED;
        }
index b4aa05f59c91507de1fddbd05bbf4219487e9b73..c059cea72eb756050775a9b310b6c3b6cd5489bf 100644 (file)
@@ -125,7 +125,7 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
                InsetBranchMailer::string2params(cmd.argument, params);
                params_.branch = params.branch;
                setButtonLabel();
-               bv->updateInset();
+               bv->updateInset(this);
                return DISPATCHED;
                }
        case LFUN_INSET_EDIT:
index bc88b3b279a299d431940c45d7c41ea1df656e63..f8a4d2fcd50d2a6edb157823168c7422615d9b0d 100644 (file)
@@ -210,7 +210,7 @@ void InsetCollapsable::insetUnlock(BufferView * bv)
        inset.insetUnlock(bv);
        if (scroll())
                scroll(bv, 0.0F);
-       bv->updateInset();
+       bv->updateInset(this);
 }
 
 
@@ -229,7 +229,7 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
 
        if (collapsed_ && cmd.button() != mouse_button::button3) {
                collapsed_ = false;
-               bv->updateInset();
+               bv->updateInset(this);
                bv->buffer()->markDirty();
                return;
        }
@@ -241,7 +241,7 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
                        collapsed_ = true;
                        bv->unlockInset(this);
                }
-               bv->updateInset();
+               bv->updateInset(this);
                bv->buffer()->markDirty();
                lyxerr << "InsetCollapsable::lfunMouseRelease\n";
        } else if (!collapsed_ && cmd.y > button_dim.y2) {
@@ -296,7 +296,7 @@ InsetOld::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
                                        lyxerr << "branch collapsed_" << endl;
                                        collapsed_ = false;
                                        if (bv->lockInset(this)) {
-                                               bv->updateInset();
+                                               bv->updateInset(this);
                                                bv->buffer()->markDirty();
                                                inset.localDispatch(cmd);
                                                first_after_edit = true;
@@ -324,7 +324,7 @@ InsetOld::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
                                first_after_edit = true;
                                if (!bv->lockInset(this))
                                        return DISPATCHED;
-                               bv->updateInset();
+                               bv->updateInset(this);
                                bv->buffer()->markDirty();
                                inset.localDispatch(cmd);
                        } else {
@@ -488,7 +488,7 @@ void InsetCollapsable::open(BufferView * bv)
                return;
 
        collapsed_ = false;
-       bv->updateInset();
+       bv->updateInset(this);
 }
 
 
@@ -498,7 +498,7 @@ void InsetCollapsable::close(BufferView * bv) const
                return;
 
        collapsed_ = true;
-       bv->updateInset();
+       bv->updateInset(this);
 }
 
 
index 11ae9ae51ef63199714cbb5eb4becac4b7efc564..009119d21dc121290fd5a0e984579aa105b92474 100644 (file)
@@ -102,7 +102,7 @@ dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
                        return UNDISPATCHED;
 
                setParams(p);
-               cmd.view()->updateInset();
+               cmd.view()->updateInset(this);
                return DISPATCHED;
        }
 
index 0628ad540aab3527a859a2908c07a56f45179665..a0a7071fdd4b15d7435bed97b4c87e3b55d15f77 100644 (file)
@@ -455,7 +455,7 @@ InsetOld::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
                 * taken by the text).
                 */
                inset.getLyXText(cmd.view())->fullRebreak();
-               bv->updateInset();
+               bv->updateInset(this);
                result = DISPATCHED;
        }
        break;
@@ -603,7 +603,7 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
                        break;
                }
                if (bv) {
-                       bv->updateInset();
+                       bv->updateInset(this);
                        bv->buffer()->markDirty();
                }
        }
index c8823466b12f4cf6263271cf19f9b21e7edee477..84167ff165a35fd42d49bbe5e9c2a04238f5b60a 100644 (file)
@@ -127,7 +127,7 @@ void InsetExternal::statusChanged()
 {
        BufferView * bv = renderer_->view();
        if (bv)
-               bv->updateInset();
+               bv->updateInset(this);
 }
 
 
@@ -152,7 +152,7 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd)
                InsetExternal::Params p;
                InsetExternalMailer::string2params(cmd.argument, *buffer, p);
                setParams(p, buffer);
-               cmd.view()->updateInset();
+               cmd.view()->updateInset(this);
                return DISPATCHED;
        }
 
index a910e9e960eb1d5134f1ef7c3806bbb8e3775062..b46e114f5e48e2a0a393a9d5104e224405ea4f16 100644 (file)
@@ -172,7 +172,7 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
                params_.wide      = params.wide;
 
                wide(params_.wide, cmd.view()->buffer()->params);
-               cmd.view()->updateInset();
+               cmd.view()->updateInset(this);
                return DISPATCHED;
        }
 
index 21162b67bd032135d4fcf36db2a9052fac726bcb..0c67703e80329a67b3d3bcd30a2d893a0989bb64 100644 (file)
@@ -170,10 +170,8 @@ InsetGraphics::~InsetGraphics()
 void InsetGraphics::statusChanged()
 {
        BufferView * bv = graphic_->view();
-       if (bv) {
-               bv->text->redoParagraph(outerPar(*bv->buffer(), this));
-               bv->updateInset();
-       }
+       if (bv)
+               bv->updateInset(this);
 }
 
 
@@ -186,7 +184,7 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
                InsetGraphicsMailer::string2params(cmd.argument, buffer, p);
                if (!p.filename.empty()) {
                        setParams(p);
-                       cmd.view()->updateInset();
+                       cmd.view()->updateInset(this);
                }
                return DISPATCHED;
        }
index 7ffd3d3504f4840014e3951a2664742a680684d3..1dceaaedd603e548056066acf94aa23255d56498 100644 (file)
@@ -138,7 +138,7 @@ dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd)
                if (!p.cparams.getCmdName().empty()) {
                        set(p);
                        params_.masterFilename_ = cmd.view()->buffer()->fileName();
-                       cmd.view()->updateInset();
+                       cmd.view()->updateInset(this);
                }
                return DISPATCHED;
        }
@@ -600,7 +600,7 @@ void InsetInclude::PreviewImpl::restartLoading()
        lyxerr << "restartLoading()" << std::endl;
        removePreview();
        if (view())
-               view()->updateInset();
+               view()->updateInset(&parent());
        generatePreview();
 }
 
index ebe0545cb3ee5fbdd8074bd68fbe95709e37a44b..1d164b0c20d2ed0be83e68a941f139d3e5044a9e 100644 (file)
@@ -68,7 +68,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
                }
 
                setParams(p);
-               cmd.view()->updateInset();
+               cmd.view()->updateInset(this);
                return DISPATCHED;
        }
 
index e7ebb7b32f21585974d03e2d0d8ba1f8f0254a77..5111184a345a22f39f885c21fad20e4166fa35a2 100644 (file)
@@ -111,7 +111,7 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
                /* FIXME: I refuse to believe we have to live
                 * with ugliness like this ... */
                inset.getLyXText(cmd.view())->fullRebreak();
-               cmd.view()->updateInset();
+               cmd.view()->updateInset(this);
                return DISPATCHED;
        }
 
index 68b329d0dc03f6858812bf0a93c30e8946d53a2c..efa2de5d91761358f3819030c4beb4cff4e6c19a 100644 (file)
@@ -141,7 +141,7 @@ dispatch_result InsetNote::localDispatch(FuncRequest const & cmd)
                InsetNoteMailer::string2params(cmd.argument, params);
                params_.type = params.type;
                setButtonLabel();
-               bv->updateInset();
+               bv->updateInset(this);
                return DISPATCHED;
        }
 
index 69a1f91c08bbda95090a476b7ea61d3b0c081b3b..72068ed5503fda40315d1b2b7c7abf6edb8aa4cf 100644 (file)
@@ -422,7 +422,7 @@ void InsetTabular::insetUnlock(BufferView * bv)
 
 void InsetTabular::updateLocal(BufferView * bv) const
 {
-       bv->updateInset();
+       bv->updateInset(this);
        if (locked)
                resetPos(bv);
 }
index e184d8b893baf332a99ae7ba398f2586a3f92ee5..e2d4f469816b61f1a0979a4339bdddf68ca4f1e5 100644 (file)
@@ -317,7 +317,7 @@ void InsetText::updateLocal(BufferView * bv, bool /*mark_dirty*/)
                text_.selection.cursor = text_.cursor;
 
        bv->fitCursor();
-       bv->updateInset();
+       bv->updateInset(this);
        bv->owner()->view_state_changed();
        bv->owner()->updateMenubar();
        bv->owner()->updateToolbar();
index f87a44adab7d4ebf8a06641b5446e32c68f856d8..77b59e2a8c8bc3954640f9a9c05c8b457761756f 100644 (file)
@@ -91,7 +91,7 @@ dispatch_result InsetWrap::localDispatch(FuncRequest const & cmd)
                params_.placement = params.placement;
                params_.width     = params.width;
 
-               cmd.view()->updateInset();
+               cmd.view()->updateInset(this);
                return DISPATCHED;
        }
 
index 10e5a640d0343cf74aa055033fe2ade687650162..e65b4f92909b88416ce8a034579de4624c1a24f0 100644 (file)
@@ -125,7 +125,7 @@ InsetOld::RESULT UpdatableInset::localDispatch(FuncRequest const & ev)
                        int const xx = strToInt(ev.argument);
                        scroll(ev.view(), xx);
                }
-               ev.view()->updateInset();
+               ev.view()->updateInset(this);
 
                return DISPATCHED;
        }
index bd5fdcc8a7de8d656c9b1808eb69e423449058b4..004e04502505d1239daedaf2990e7d6a4c249c6a 100644 (file)
@@ -153,12 +153,12 @@ void InsetFormulaBase::insetUnlock(BufferView * bv)
        if (mathcursor) {
                if (mathcursor->inMacroMode()) {
                        mathcursor->macroModeClose();
-                       bv->updateInset();
+                       bv->updateInset(this);
                }
                releaseMathCursor(bv);
        }
        generatePreview();
-       bv->updateInset();
+       bv->updateInset(this);
 }
 
 
@@ -204,7 +204,7 @@ void InsetFormulaBase::fitInsetCursor(BufferView * bv) const
 void InsetFormulaBase::toggleInsetSelection(BufferView * bv)
 {
        if (mathcursor)
-               bv->updateInset();
+               bv->updateInset(this);
 }
 
 
@@ -214,7 +214,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
                return UNDISPATCHED;
 
        BufferView * bv = cmd.view();
-       bv->updateInset();
+       bv->updateInset(this);
        //lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl;
 
        if (cmd.button() == mouse_button::button3) {
@@ -233,7 +233,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
                mathcursor->selClear();
                mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
                mathcursor->insert(ar);
-               bv->updateInset();
+               bv->updateInset(this);
                return DISPATCHED;
        }
 
@@ -280,7 +280,7 @@ dispatch_result InsetFormulaBase::lfunMousePress(FuncRequest const & cmd)
                return DISPATCHED;
        }
 
-       bv->updateInset();
+       bv->updateInset(this);
        return DISPATCHED;
 }
 
@@ -308,7 +308,7 @@ dispatch_result InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
 
        BufferView * bv = cmd.view();
        mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
-       bv->updateInset();
+       bv->updateInset(this);
        return DISPATCHED;
 }
 
@@ -342,7 +342,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
                        }
                        // if that is removed, we won't get the magenta box when entering an
                        // inset for the first time
-                       bv->updateInset();
+                       bv->updateInset(this);
                        return DISPATCHED;
 
                case LFUN_MOUSE_PRESS:
@@ -720,7 +720,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
        }
 
        if (result == DISPATCHED)
-               bv->updateInset();
+               bv->updateInset(this);
 
        mathcursor->normalize();
        mathcursor->touch();
@@ -850,7 +850,7 @@ bool InsetFormulaBase::searchForward(BufferView * bv, string const & str,
                        mathcursor->setSelection(it, ar.size());
                        current = it;
                        it.jump(ar.size());
-                       bv->updateInset();
+                       bv->updateInset(this);
                        return true;
                }
        }
index c4848d91beb81daddb490bec74c9a7f11645148c..45d3be00ceae4936c7c741c029d831e190c0910a 100644 (file)
@@ -282,7 +282,7 @@ void LyXText::toggleInset()
        else
                inset->open(bv());
 
-       bv()->updateInset();
+       bv()->updateInset(inset);
 }
 
 
@@ -848,7 +848,7 @@ void LyXText::setParagraph(bool line_top, bool line_bottom,
        setSelection();
        setCursor(tmpcursor.par(), tmpcursor.pos());
        if (inset_owner)
-               bv()->updateInset();
+               bv()->updateInset(inset_owner);
 }
 
 
index a13e51928361a3cc134da52a4375a7c346a686d2..e2795e8239abd518c6df3485818dd5d13c0aee21 100644 (file)
@@ -355,7 +355,7 @@ void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind)
        if (!bv->insertInset(new_inset))
                delete new_inset;
        else
-               bv->updateInset();
+               bv->updateInset(new_inset);
 }