]> git.lyx.org Git - features.git/commitdiff
Remove the layout_ cache in InsetCollapsable.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 14 Jul 2009 12:07:51 +0000 (12:07 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 14 Jul 2009 12:07:51 +0000 (12:07 +0000)
Remove setLayout methods and all the calls to it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30560 a592a061-630c-0410-9148-cb99ea01b6c8

src/CutAndPaste.cpp
src/Text3.cpp
src/insets/InsetBox.cpp
src/insets/InsetBranch.cpp
src/insets/InsetCollapsable.cpp
src/insets/InsetCollapsable.h
src/insets/InsetFlex.cpp
src/insets/InsetIndex.cpp
src/insets/InsetInfo.cpp
src/insets/InsetNote.cpp
src/insets/InsetPhantom.cpp

index b85aa21c34417993062d68d1204f8e3c45707773..f92d74dca222c95c6352030a787097a05780e5f6 100644 (file)
@@ -582,7 +582,6 @@ void switchBetweenClasses(DocumentClass const * const oldone,
                if (inset->lyxCode() != FLEX_CODE)
                        // FIXME: Should we verify all InsetCollapsable?
                        continue;
-               inset->setLayout(newone);
                if (!inset->undefined())
                        continue;
                // The flex inset is undefined in newtc
index 1bd1bcce3b6d838a1a74d7a45c8fd187bf6bb0d8..5f32da6e22de7cf0616fecc225c4b69c71bfbacd 100644 (file)
@@ -233,9 +233,6 @@ static bool doInsertInset(Cursor & cur, Text * text,
        if (!inset)
                return false;
 
-       if (InsetCollapsable * ci = inset->asInsetCollapsable())
-               ci->setLayout();
-
        cur.recordUndo();
        if (cmd.action == LFUN_INDEX_INSERT) {
                docstring ds = subst(text->getStringToIndex(cur), '\n', ' ');
index 1300533feeac126c4655aa4e7b249c4e864b31e7..ecf9f4fb94e4423686d2d76fa5bff81d7b7bafc3 100644 (file)
@@ -213,7 +213,6 @@ void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
                        params_.type = cmd.getArg(1);
                else
                        string2params(to_utf8(cmd.argument()), params_);
-               setLayout();
                break;
        }
 
index 1e09c9c7a30c1685c8833233459ad291b2b70924..17960a2344dbf7382babff9d58d156dacfe1d7f1 100644 (file)
@@ -136,7 +136,6 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd)
                InsetBranchParams params;
                InsetBranch::string2params(to_utf8(cmd.argument()), params);
                params_.branch = params.branch;
-               setLayout();
                break;
        }
 
index e35ad10cba607cfa6b7732c26e00f778432577f1..51c7048a409474d1e2e9cc77eedbd120da704405 100644 (file)
@@ -109,7 +109,6 @@ InsetCollapsable::InsetCollapsable(Buffer const & buf, InsetText::UsePlain ltype
        : InsetText(buf, ltype), status_(Inset::Open),
          openinlined_(false), mouse_hover_(false)
 {
-       setLayout(&buf.params().documentClass());
        setAutoBreakRows(true);
        setDrawFrame(true);
        setFrameColor(Color_collapsableframe);
@@ -119,7 +118,6 @@ InsetCollapsable::InsetCollapsable(Buffer const & buf, InsetText::UsePlain ltype
 InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs)
        : InsetText(rhs),
          status_(rhs.status_),
-         layout_(rhs.layout_),
          labelstring_(rhs.labelstring_),
          button_dim(rhs.button_dim),
          openinlined_(rhs.openinlined_),
@@ -146,26 +144,6 @@ docstring InsetCollapsable::toolTip(BufferView const & bv, int x, int y) const
 }
 
 
-void InsetCollapsable::setLayout()
-{
-       setLayout(buffer().params().documentClassPtr());
-}
-
-
-void InsetCollapsable::setLayout(DocumentClass const * const dc)
-{
-       if (dc) {
-               layout_ = &(dc->insetLayout(name()));
-               labelstring_ = translateIfPossible(getLayout().labelstring());
-       } else {
-               layout_ = &DocumentClass::plainInsetLayout();
-               labelstring_ = _("UNDEFINED");
-       }
-
-       setButtonLabel();
-}
-
-
 void InsetCollapsable::write(ostream & os) const
 {
        os << "status ";
@@ -192,10 +170,7 @@ void InsetCollapsable::read(Lexer & lex)
                status_ = Open;
 
        // this must be set before we enter InsetText::read()
-       setLayout();
        InsetText::read(lex);
-       // set button label again as the inset contents was not read yet at
-       // setLayout() time.
        setButtonLabel();
 
        // Force default font, if so requested
@@ -211,7 +186,6 @@ void InsetCollapsable::read(Lexer & lex)
 
 Dimension InsetCollapsable::dimensionCollapsed(BufferView const & bv) const
 {
-       LASSERT(layout_, /**/);
        Dimension dim;
        theFontMetrics(getLayout().labelfont()).buttonText(
                buttonLabel(bv), dim.wid, dim.asc, dim.des);
index 41c79334fc25bd5293b645bbe9d4c1880443c78c..0ed8bcf63fc55ecd8979af7e6a591443677db25d 100644 (file)
@@ -44,15 +44,6 @@ public:
        docstring toolTip(BufferView const & bv, int x, int y) const;
        ///
        docstring name() const { return from_ascii("Collapsable"); }
-#if 0
-       ///
-       InsetLayout const & getLayout() const { return *layout_; } 
-#endif
-       ///
-       void setLayout();
-       /// (Re-)set the character style parameters from \p tc according
-       /// to name()
-       void setLayout(DocumentClass const * const tc);
        ///
        void read(Lexer &);
        ///
@@ -172,8 +163,6 @@ protected:
        ///
        mutable CollapseStatus status_;
 private:
-       /// cache for the layout_. Make sure it is in sync with the document class!
-       InsetLayout const * layout_;
        ///
        Dimension dimensionCollapsed(BufferView const & bv) const;
        ///
index 80c755bc28b1dee98c05157212b9fe70c20f6dd9..be730417410f3ccdabd49580de057f2bf7e52c29 100644 (file)
@@ -30,8 +30,6 @@ namespace lyx {
 InsetFlex::InsetFlex(Buffer const & buf, string const & layoutName)
        : InsetCollapsable(buf), name_(layoutName)
 {
-       // again, because now the name is initialized
-       setLayout(buf.params().documentClassPtr());
        status_= Collapsed;
 }
 
index e64685335b7af1bab160fd15216e641cc0da0f78..cb3a276741d1d0ee1a043ce5bd7075a316b8c15a 100644 (file)
@@ -192,13 +192,11 @@ void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_INSET_MODIFY: {
                if (cmd.getArg(0) == "changetype") {
                        params_.index = from_utf8(cmd.getArg(1));
-                       setLayout();
                        break;
                }
                InsetIndexParams params;
                InsetIndex::string2params(to_utf8(cmd.argument()), params);
                params_.index = params.index;
-               setLayout();
                break;
        }
 
index 6875afd47b595bd0fb121a3c89ff10dfc289e870..fa769710739808ca576a413b323e7ef7b7dbc636 100644 (file)
@@ -139,7 +139,6 @@ void InsetInfo::read(Lexer & lex)
                        _("Missing \\end_inset at this point."),
                        from_utf8(token));
        }
-       setLayout();
        updateInfo();
 }
 
@@ -244,7 +243,6 @@ void InsetInfo::setInfo(string const & name)
        string type;
        name_ = trim(split(name, type, ' '));
        type_ = nameTranslator().find(type);
-       setLayout();
        updateInfo();
 }
 
index 918e6f30c87969908220891ffef8a3cb892dbe81..4cbe6172bc9238b72591ea9ad469f4c84c61fba1 100644 (file)
@@ -181,7 +181,6 @@ void InsetNote::doDispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_INSET_MODIFY:
                string2params(to_utf8(cmd.argument()), params_);
-               setLayout();
                break;
 
        case LFUN_INSET_DIALOG_UPDATE:
index 797049c1f6b1c3f15a634cec231c22600b1799f1..2f5daf07e33feb7ea9b8c1fbf61165869cbf3c63 100644 (file)
@@ -266,7 +266,6 @@ void InsetPhantom::doDispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_INSET_MODIFY:
                string2params(to_utf8(cmd.argument()), params_);
-               setLayout();
                break;
 
        case LFUN_INSET_DIALOG_UPDATE: