From 2a5ab60ce880dea3719832844ee857275b837019 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Mon, 16 Jun 2003 11:49:38 +0000 Subject: [PATCH] IU of clone() and getLabelList() Some mathed internal renamings to prepare further IU git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7173 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 6 +- src/ChangeLog | 8 ++ src/buffer.C | 13 ++- src/buffer.h | 2 +- src/frontends/controllers/ControlRef.C | 4 +- src/insets/ChangeLog | 7 ++ src/insets/inset.h | 8 -- src/insets/insetbase.h | 12 ++- src/insets/insetbibitem.C | 2 +- src/insets/insetbibitem.h | 2 +- src/insets/insetbibtex.h | 2 +- src/insets/insetcite.h | 2 +- src/insets/insetcollapsable.C | 4 +- src/insets/insetcollapsable.h | 2 +- src/insets/insetenv.C | 2 +- src/insets/insetenv.h | 2 +- src/insets/inseterror.h | 2 +- src/insets/insetert.C | 2 +- src/insets/insetert.h | 2 +- src/insets/insetexternal.C | 2 +- src/insets/insetexternal.h | 2 +- src/insets/insetfloat.C | 2 +- src/insets/insetfloat.h | 2 +- src/insets/insetfloatlist.h | 2 +- src/insets/insetfoot.C | 2 +- src/insets/insetfoot.h | 2 +- src/insets/insetgraphics.C | 2 +- src/insets/insetgraphics.h | 2 +- src/insets/insethfill.h | 2 +- src/insets/insetinclude.C | 10 +- src/insets/insetinclude.h | 4 +- src/insets/insetindex.h | 4 +- src/insets/insetlabel.C | 7 +- src/insets/insetlabel.h | 4 +- src/insets/insetlatexaccent.C | 2 +- src/insets/insetlatexaccent.h | 2 +- src/insets/insetmarginal.C | 2 +- src/insets/insetmarginal.h | 2 +- src/insets/insetminipage.C | 2 +- src/insets/insetminipage.h | 2 +- src/insets/insetnewline.h | 2 +- src/insets/insetnote.C | 2 +- src/insets/insetnote.h | 2 +- src/insets/insetoptarg.C | 2 +- src/insets/insetoptarg.h | 2 +- src/insets/insetquotes.C | 2 +- src/insets/insetquotes.h | 2 +- src/insets/insetref.h | 2 +- src/insets/insetspace.C | 2 +- src/insets/insetspace.h | 2 +- src/insets/insetspecialchar.C | 2 +- src/insets/insetspecialchar.h | 2 +- src/insets/insettabular.C | 6 +- src/insets/insettabular.h | 4 +- src/insets/insettext.C | 19 +--- src/insets/insettext.h | 9 +- src/insets/insettheorem.C | 2 +- src/insets/insettheorem.h | 2 +- src/insets/insettoc.h | 2 +- src/insets/inseturl.h | 2 +- src/insets/insetwrap.C | 2 +- src/insets/insetwrap.h | 2 +- src/mathed/ChangeLog | 22 +---- src/mathed/command_inset.C | 2 +- src/mathed/command_inset.h | 2 +- src/mathed/formulabase.C | 2 +- src/mathed/math_amsarrayinset.C | 2 +- src/mathed/math_amsarrayinset.h | 2 +- src/mathed/math_arrayinset.C | 2 +- src/mathed/math_arrayinset.h | 2 +- src/mathed/math_atom.C | 8 +- src/mathed/math_atom.h | 3 +- src/mathed/math_biginset.C | 2 +- src/mathed/math_biginset.h | 2 +- src/mathed/math_binaryopinset.C | 2 +- src/mathed/math_binaryopinset.h | 2 +- src/mathed/math_binominset.C | 2 +- src/mathed/math_binominset.h | 2 +- src/mathed/math_boxinset.C | 2 +- src/mathed/math_boxinset.h | 2 +- src/mathed/math_braceinset.C | 2 +- src/mathed/math_braceinset.h | 2 +- src/mathed/math_casesinset.C | 2 +- src/mathed/math_casesinset.h | 2 +- src/mathed/math_charinset.C | 2 +- src/mathed/math_charinset.h | 2 +- src/mathed/math_commentinset.C | 2 +- src/mathed/math_commentinset.h | 2 +- src/mathed/math_cursor.C | 128 ++++++++++++------------- src/mathed/math_cursor.h | 12 +-- src/mathed/math_decorationinset.C | 2 +- src/mathed/math_decorationinset.h | 2 +- src/mathed/math_deliminset.C | 2 +- src/mathed/math_deliminset.h | 2 +- src/mathed/math_diffinset.C | 2 +- src/mathed/math_diffinset.h | 2 +- src/mathed/math_dotsinset.C | 2 +- src/mathed/math_dotsinset.h | 2 +- src/mathed/math_envinset.C | 2 +- src/mathed/math_envinset.h | 2 +- src/mathed/math_ertinset.C | 2 +- src/mathed/math_ertinset.h | 2 +- src/mathed/math_exfuncinset.C | 2 +- src/mathed/math_exfuncinset.h | 2 +- src/mathed/math_exintinset.C | 2 +- src/mathed/math_exintinset.h | 2 +- src/mathed/math_fboxinset.C | 2 +- src/mathed/math_fboxinset.h | 2 +- src/mathed/math_fontinset.C | 2 +- src/mathed/math_fontinset.h | 2 +- src/mathed/math_fontoldinset.C | 2 +- src/mathed/math_fontoldinset.h | 2 +- src/mathed/math_fracinset.C | 2 +- src/mathed/math_fracinset.h | 2 +- src/mathed/math_frameboxinset.C | 2 +- src/mathed/math_frameboxinset.h | 2 +- src/mathed/math_gridinset.C | 2 +- src/mathed/math_gridinset.h | 2 +- src/mathed/math_hullinset.C | 2 +- src/mathed/math_hullinset.h | 2 +- src/mathed/math_inferinset.C | 2 +- src/mathed/math_inferinset.h | 2 +- src/mathed/math_inset.h | 5 - src/mathed/math_iterator.C | 30 +++--- src/mathed/math_iterator.h | 15 +-- src/mathed/math_kerninset.C | 2 +- src/mathed/math_kerninset.h | 2 +- src/mathed/math_lefteqninset.C | 2 +- src/mathed/math_lefteqninset.h | 2 +- src/mathed/math_liminset.C | 2 +- src/mathed/math_liminset.h | 2 +- src/mathed/math_macro.C | 2 +- src/mathed/math_macro.h | 2 +- src/mathed/math_macroarg.C | 2 +- src/mathed/math_macroarg.h | 2 +- src/mathed/math_macrotemplate.C | 2 +- src/mathed/math_macrotemplate.h | 2 +- src/mathed/math_makeboxinset.C | 2 +- src/mathed/math_makeboxinset.h | 2 +- src/mathed/math_matrixinset.C | 2 +- src/mathed/math_matrixinset.h | 2 +- src/mathed/math_numberinset.C | 2 +- src/mathed/math_numberinset.h | 2 +- src/mathed/math_parboxinset.C | 2 +- src/mathed/math_parboxinset.h | 2 +- src/mathed/math_pos.C | 44 ++++----- src/mathed/math_pos.h | 16 ++-- src/mathed/math_rootinset.C | 2 +- src/mathed/math_rootinset.h | 2 +- src/mathed/math_scriptinset.C | 2 +- src/mathed/math_scriptinset.h | 2 +- src/mathed/math_sizeinset.C | 2 +- src/mathed/math_sizeinset.h | 2 +- src/mathed/math_spaceinset.C | 2 +- src/mathed/math_spaceinset.h | 2 +- src/mathed/math_splitinset.C | 2 +- src/mathed/math_splitinset.h | 2 +- src/mathed/math_sqrtinset.C | 2 +- src/mathed/math_sqrtinset.h | 2 +- src/mathed/math_stackrelinset.C | 2 +- src/mathed/math_stackrelinset.h | 2 +- src/mathed/math_stringinset.C | 2 +- src/mathed/math_stringinset.h | 2 +- src/mathed/math_substackinset.C | 2 +- src/mathed/math_substackinset.h | 2 +- src/mathed/math_symbolinset.C | 2 +- src/mathed/math_symbolinset.h | 2 +- src/mathed/math_tabularinset.C | 2 +- src/mathed/math_tabularinset.h | 2 +- src/mathed/math_textinset.C | 2 +- src/mathed/math_textinset.h | 2 +- src/mathed/math_undersetinset.C | 2 +- src/mathed/math_undersetinset.h | 2 +- src/mathed/math_unknowninset.C | 2 +- src/mathed/math_unknowninset.h | 2 +- src/mathed/math_xarrowinset.C | 2 +- src/mathed/math_xarrowinset.h | 2 +- src/mathed/math_xyarrowinset.C | 2 +- src/mathed/math_xyarrowinset.h | 2 +- src/mathed/ref_inset.C | 2 +- src/mathed/ref_inset.h | 2 +- src/paragraph.C | 7 +- src/tabular.C | 12 +-- src/tabular.h | 2 +- 184 files changed, 358 insertions(+), 383 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 016f495ae5..7b8a4cfa33 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -395,7 +395,8 @@ void BufferView::gotoLabel(string const & label) { for (Buffer::inset_iterator it = buffer()->inset_iterator_begin(); it != buffer()->inset_iterator_end(); ++it) { - vector labels = it->getLabelList(); + vector labels; + it->getLabelList(labels); if (find(labels.begin(),labels.end(),label) != labels.end()) { beforeChange(text); @@ -660,7 +661,8 @@ bool BufferView::ChangeInsets(Inset::Code code, bool BufferView::ChangeRefsIfUnique(string const & from, string const & to) { // Check if the label 'from' appears more than once - vector labels = buffer()->getLabelList(); + vector labels; + buffer()->getLabelList(labels); if (lyx::count(labels.begin(), labels.end(), from) > 1) return false; diff --git a/src/ChangeLog b/src/ChangeLog index cff5d20163..fb04b213ca 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2003-06-16 André Pönitz + + * BufferView.C: + * buffer.C: + * buffer.h: + * paragraph.C: + * tabular.[Ch]: IU of clone() and getLabelList(); + 2003-06-13 André Pönitz * tabular.h: compactification diff --git a/src/buffer.C b/src/buffer.C index 24b8d16677..04e7e1ef14 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -2012,24 +2012,23 @@ void Buffer::validate(LaTeXFeatures & features) const } -vector const Buffer::getLabelList() const +void Buffer::getLabelList(std::vector & list) const { /// if this is a child document and the parent is already loaded /// Use the parent's list instead [ale990407] if (!params.parentname.empty() && bufferlist.exists(params.parentname)) { Buffer const * tmp = bufferlist.getBuffer(params.parentname); - if (tmp) - return tmp->getLabelList(); + if (tmp) { + tmp->getLabelList(list); + return; + } } - vector label_list; for (inset_iterator it = inset_const_iterator_begin(); it != inset_const_iterator_end(); ++it) { - vector const l = it->getLabelList(); - label_list.insert(label_list.end(), l.begin(), l.end()); + it->getLabelList(list); } - return label_list; } diff --git a/src/buffer.h b/src/buffer.h index d5e1f08b36..06e26a6919 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -256,7 +256,7 @@ public: /// return all bibkeys from buffer and its childs void fillWithBibKeys(std::vector > & keys) const; /// - std::vector const getLabelList() const; + void getLabelList(std::vector &) const; /** This will clearly have to change later. Later we can have more than one user per buffer. */ diff --git a/src/frontends/controllers/ControlRef.C b/src/frontends/controllers/ControlRef.C index b311e90624..c47722477a 100644 --- a/src/frontends/controllers/ControlRef.C +++ b/src/frontends/controllers/ControlRef.C @@ -34,7 +34,9 @@ vector const ControlRef::getLabelList(string const & name) const Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name)); if (!buf) buf = kernel().buffer(); - return buf->getLabelList(); + vector list; + buf->getLabelList(list); + return list; } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index f1da486e32..9cc27c1b7b 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,4 +1,11 @@ +2003-06-16 André Pönitz + + * insetbase.h: new virtual base function clone() + + * *inset*.[Ch]: IU of clone() and getLabelList (i.e. essentially + Inset * clone() -> InsetBase * clone() + 2003-06-13 André Pönitz * insettabular.[Ch]: make tabular a proper member diff --git a/src/insets/inset.h b/src/insets/inset.h index 29b18c534b..ff45c5eced 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -15,7 +15,6 @@ #ifndef INSET_H #define INSET_H -#include "LString.h" #include "LColor.h" #include "insetbase.h" #include "support/types.h" @@ -194,13 +193,6 @@ public: /// returns LyX code associated with the inset. Used for TOC, ...) virtual Inset::Code lyxCode() const { return NO_CODE; } - virtual std::vector const getLabelList() const { - return std::vector(); - } - - /// - virtual Inset * clone() const = 0; - /// returns true to override begin and end inset in file virtual bool directWrite() const; diff --git a/src/insets/insetbase.h b/src/insets/insetbase.h index 51ba1a981a..d52f770e15 100644 --- a/src/insets/insetbase.h +++ b/src/insets/insetbase.h @@ -12,6 +12,8 @@ #ifndef INSETBASE_H #define INSETBASE_H +#include "LString.h" + #include class BufferView; @@ -64,6 +66,11 @@ public: /// type for column numbers typedef size_t col_type; + /// virtual base class destructor + virtual ~InsetBase() {} + /// replicate ourselves + virtual InsetBase * clone() const = 0; + // the real dispatcher virtual dispatch_result dispatch (FuncRequest const & cmd, idx_type & idx, pos_type & pos); @@ -75,15 +82,14 @@ public: /// draw inset and update (xo, yo)-cache virtual void draw(PainterInfo & pi, int x, int y) const = 0; - /// - virtual ~InsetBase() {} - /// Methods to cache and retrieve a cached BufferView. virtual void cache(BufferView *) const {} /// virtual BufferView * view() const { return 0; } /// request "external features" virtual void validate(LaTeXFeatures &) const {} + /// fill in all labels in the inset + virtual void getLabelList(std::vector &) const {} }; #endif diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index 24da31f2d5..17fcbc7edd 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -43,7 +43,7 @@ InsetBibitem::~InsetBibitem() } -Inset * InsetBibitem::clone() const +InsetBase * InsetBibitem::clone() const { InsetBibitem * b = new InsetBibitem(params()); b->setCounter(counter); diff --git a/src/insets/insetbibitem.h b/src/insets/insetbibitem.h index 03a6406883..7dd1a172df 100644 --- a/src/insets/insetbibitem.h +++ b/src/insets/insetbibitem.h @@ -29,7 +29,7 @@ public: /// ~InsetBibitem(); /// - Inset * clone() const; + InsetBase * clone() const; /// virtual dispatch_result localDispatch(FuncRequest const & cmd); /** Currently \bibitem is used as a LyX2.x command, diff --git a/src/insets/insetbibtex.h b/src/insets/insetbibtex.h index e618f43b4a..f7827f6688 100644 --- a/src/insets/insetbibtex.h +++ b/src/insets/insetbibtex.h @@ -27,7 +27,7 @@ public: /// ~InsetBibtex(); /// - Inset * clone() const { + InsetBase * clone() const { return new InsetBibtex(params()); } /// small wrapper for the time being diff --git a/src/insets/insetcite.h b/src/insets/insetcite.h index 5618e282b9..0e58a66267 100644 --- a/src/insets/insetcite.h +++ b/src/insets/insetcite.h @@ -25,7 +25,7 @@ public: /// ~InsetCitation(); /// - Inset * clone() const { + InsetBase * clone() const { return new InsetCitation(params()); } /// diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index facf2f5f36..9b1d4235d5 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -481,9 +481,9 @@ void InsetCollapsable::resizeLyXText(BufferView * bv, bool force) const } -vector const InsetCollapsable::getLabelList() const +void InsetCollapsable::getLabelList(std::vector & list) const { - return inset.getLabelList(); + inset.getLabelList(list); } diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index f6b8c70cd3..02c261e13a 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -117,7 +117,7 @@ public: /// void resizeLyXText(BufferView *, bool force = false) const; /// - std::vector const getLabelList() const; + void getLabelList(std::vector &) const; /// bool nodraw() const; /// diff --git a/src/insets/insetenv.C b/src/insets/insetenv.C index 1158b1a1d0..9b9dc1f625 100644 --- a/src/insets/insetenv.C +++ b/src/insets/insetenv.C @@ -40,7 +40,7 @@ InsetEnvironment::InsetEnvironment(InsetEnvironment const & in) {} -Inset * InsetEnvironment::clone() const +InsetBase * InsetEnvironment::clone() const { return new InsetEnvironment(*this); } diff --git a/src/insets/insetenv.h b/src/insets/insetenv.h index 248f92107e..83fd5faf54 100644 --- a/src/insets/insetenv.h +++ b/src/insets/insetenv.h @@ -26,7 +26,7 @@ public: /// void read(Buffer const * buf, LyXLex & lex); /// - Inset * clone() const; + InsetBase * clone() const; /// Inset::Code lyxCode() const { return Inset::ENVIRONMENT_CODE; } /// diff --git a/src/insets/inseterror.h b/src/insets/inseterror.h index bbc787631d..8799c8b208 100644 --- a/src/insets/inseterror.h +++ b/src/insets/inseterror.h @@ -54,7 +54,7 @@ public: /// EDITABLE editable() const { return IS_EDITABLE; } /// - Inset * clone() const { + InsetBase * clone() const { return new InsetError(contents); } /// diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 4a6888091f..842ba5df07 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -70,7 +70,7 @@ InsetERT::InsetERT(InsetERT const & in) } -Inset * InsetERT::clone() const +InsetBase * InsetERT::clone() const { return new InsetERT(*this); } diff --git a/src/insets/insetert.h b/src/insets/insetert.h index 7d793bd95e..86811b6ac3 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -40,7 +40,7 @@ public: /// InsetERT(InsetERT const &); /// - Inset * clone() const; + InsetBase * clone() const; /// InsetERT(BufferParams const &, Language const *, string const & contents, bool collapsed); diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 749860818f..7bd7049575 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -99,7 +99,7 @@ InsetExternal::InsetExternal(InsetExternal const & other) } -Inset * InsetExternal::clone() const +InsetBase * InsetExternal::clone() const { InsetExternal * inset = new InsetExternal(*this); return inset; diff --git a/src/insets/insetexternal.h b/src/insets/insetexternal.h index a3f3f38ce8..c23267fa58 100644 --- a/src/insets/insetexternal.h +++ b/src/insets/insetexternal.h @@ -83,7 +83,7 @@ public: virtual Inset::Code lyxCode() const { return EXTERNAL_CODE; } /// - virtual Inset * clone() const; + virtual InsetBase * clone() const; /// Set the inset parameters. virtual void setParams(Params const &, string const & filepath); diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index e4b7c9944f..cb84cd7386 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -259,7 +259,7 @@ void InsetFloat::validate(LaTeXFeatures & features) const } -Inset * InsetFloat::clone() const +InsetBase * InsetFloat::clone() const { return new InsetFloat(*this); } diff --git a/src/insets/insetfloat.h b/src/insets/insetfloat.h index 2b83382bc3..552dca6d7d 100644 --- a/src/insets/insetfloat.h +++ b/src/insets/insetfloat.h @@ -53,7 +53,7 @@ public: /// void validate(LaTeXFeatures & features) const; /// - Inset * clone() const; + InsetBase * clone() const; /// Inset::Code lyxCode() const { return Inset::FLOAT_CODE; } /// diff --git a/src/insets/insetfloatlist.h b/src/insets/insetfloatlist.h index ab0177cc43..61d2ac0d1c 100644 --- a/src/insets/insetfloatlist.h +++ b/src/insets/insetfloatlist.h @@ -26,7 +26,7 @@ public: /// ~InsetFloatList(); /// - Inset * clone() const { + InsetBase * clone() const { return new InsetFloatList(getCmdName()); } /// diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index e53a1db876..4d0094d49e 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -46,7 +46,7 @@ InsetFoot::InsetFoot(InsetFoot const & in) } -Inset * InsetFoot::clone() const +InsetBase * InsetFoot::clone() const { return new InsetFoot(*this); } diff --git a/src/insets/insetfoot.h b/src/insets/insetfoot.h index b154412b4e..3e47b9682d 100644 --- a/src/insets/insetfoot.h +++ b/src/insets/insetfoot.h @@ -27,7 +27,7 @@ public: /// InsetFoot(InsetFoot const &); /// - Inset * clone() const; + InsetBase * clone() const; /// Inset::Code lyxCode() const { return Inset::FOOT_CODE; } /// diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 782b954033..23bc48e92e 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -151,7 +151,7 @@ InsetGraphics::InsetGraphics(InsetGraphics const & ig) } -Inset * InsetGraphics::clone() const +InsetBase * InsetGraphics::clone() const { return new InsetGraphics(*this); } diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index 4e1e59b88e..c90733520e 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -68,7 +68,7 @@ public: Inset::Code lyxCode() const { return Inset::GRAPHICS_CODE; } /// - virtual Inset * clone() const; + virtual InsetBase * clone() const; /** Set the inset parameters, used by the GUIndependent dialog. Return true of new params are different from what was so far. diff --git a/src/insets/insethfill.h b/src/insets/insethfill.h index 93974e6b50..023d7cc0c7 100644 --- a/src/insets/insethfill.h +++ b/src/insets/insethfill.h @@ -20,7 +20,7 @@ public: /// InsetHFill(); /// - virtual Inset * clone() const { + virtual InsetBase * clone() const { return new InsetHFill; } /// diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 57c7db6204..4a1a773ade 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -203,7 +203,7 @@ void InsetInclude::set(Params const & p) } -Inset * InsetInclude::clone() const +InsetBase * InsetInclude::clone() const { //Params p(params_); //p.masterFilename_ = buffer.fileName(); @@ -489,18 +489,14 @@ void InsetInclude::validate(LaTeXFeatures & features) const } -vector const InsetInclude::getLabelList() const +void InsetInclude::getLabelList(std::vector & list) const { - vector l; - if (loadIfNeeded()) { Buffer * tmp = bufferlist.getBuffer(getFileName()); tmp->setParentName(""); - l = tmp->getLabelList(); + tmp->getLabelList(list); tmp->setParentName(getMasterFilename()); } - - return l; } diff --git a/src/insets/insetinclude.h b/src/insets/insetinclude.h index 47d767e5f3..a4b4c83e89 100644 --- a/src/insets/insetinclude.h +++ b/src/insets/insetinclude.h @@ -74,11 +74,11 @@ public: void set(Params const & params); /// - virtual Inset * clone() const; + virtual InsetBase * clone() const; /// Inset::Code lyxCode() const { return Inset::INCLUDE_CODE; } /// This returns the list of labels on the child buffer - std::vector const getLabelList() const; + void getLabelList(std::vector &) const; /// This returns the list of bibkeys on the child buffer void fillWithBibKeys(std::vector > & keys) const; /// diff --git a/src/insets/insetindex.h b/src/insets/insetindex.h index e3b4caa7fb..5ead498423 100644 --- a/src/insets/insetindex.h +++ b/src/insets/insetindex.h @@ -26,7 +26,7 @@ public: /// ~InsetIndex(); /// - virtual Inset * clone() const { + virtual InsetBase * clone() const { return new InsetIndex(params()); } /// @@ -49,7 +49,7 @@ public: /// ~InsetPrintIndex(); /// - Inset * clone() const { + InsetBase * clone() const { return new InsetPrintIndex(params()); } /// diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index fcab20f025..5f11669a59 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -39,14 +39,13 @@ InsetLabel::InsetLabel(InsetCommandParams const & p) InsetLabel::~InsetLabel() { - InsetCommandMailer mailer("label", *this); - mailer.hideDialog(); + InsetCommandMailer("label", *this).hideDialog(); } -vector const InsetLabel::getLabelList() const +void InsetLabel::getLabelList(std::vector & list) const { - return vector(1, getContents()); + list.push_back(getContents()); } diff --git a/src/insets/insetlabel.h b/src/insets/insetlabel.h index 10013a0da6..bfea5b611f 100644 --- a/src/insets/insetlabel.h +++ b/src/insets/insetlabel.h @@ -22,7 +22,7 @@ public: /// ~InsetLabel(); /// - virtual Inset * clone() const { + virtual InsetBase * clone() const { return new InsetLabel(params()); } /// @@ -34,7 +34,7 @@ public: /// Inset::Code lyxCode() const { return Inset::LABEL_CODE; } /// - std::vector const getLabelList() const; + void getLabelList(std::vector &) const; /// int latex(Buffer const *, std::ostream &, LatexRunParams const &) const; diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index 62af3e8be6..ef1f473f52 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -647,7 +647,7 @@ bool InsetLatexAccent::directWrite() const } -Inset * InsetLatexAccent::clone() const +InsetBase * InsetLatexAccent::clone() const { return new InsetLatexAccent(contents); } diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index 707b0853f5..2aaab8dbb9 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -57,7 +57,7 @@ public: /// bool directWrite() const; /// - virtual Inset * clone() const; + virtual InsetBase * clone() const; /// Inset::Code lyxCode()const; /// diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index b5d140741a..f5c62a92dc 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -41,7 +41,7 @@ InsetMarginal::InsetMarginal(InsetMarginal const & in) } -Inset * InsetMarginal::clone() const +InsetBase * InsetMarginal::clone() const { return new InsetMarginal(*this); } diff --git a/src/insets/insetmarginal.h b/src/insets/insetmarginal.h index 8414bdc2a4..8a934f820a 100644 --- a/src/insets/insetmarginal.h +++ b/src/insets/insetmarginal.h @@ -26,7 +26,7 @@ public: /// InsetMarginal(InsetMarginal const &); /// - Inset * clone() const; + InsetBase * clone() const; /// Inset::Code lyxCode() const { return Inset::MARGIN_CODE; } /// diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index f7cd3b4e7b..a346f5f60d 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -93,7 +93,7 @@ InsetMinipage::InsetMinipage(InsetMinipage const & in) {} -Inset * InsetMinipage::clone() const +InsetBase * InsetMinipage::clone() const { return new InsetMinipage(*this); } diff --git a/src/insets/insetminipage.h b/src/insets/insetminipage.h index 9ba55571e5..b4665cc3dc 100644 --- a/src/insets/insetminipage.h +++ b/src/insets/insetminipage.h @@ -66,7 +66,7 @@ public: /// void read(Buffer const * buf, LyXLex & lex); /// - Inset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo &, Dimension &) const; /// diff --git a/src/insets/insetnewline.h b/src/insets/insetnewline.h index 01597abf6d..b1cb532a87 100644 --- a/src/insets/insetnewline.h +++ b/src/insets/insetnewline.h @@ -20,7 +20,7 @@ public: InsetNewline() {} - virtual Inset * clone() const { + virtual InsetBase * clone() const { return new InsetNewline; } diff --git a/src/insets/insetnote.C b/src/insets/insetnote.C index 0fb0fb6470..07c78db449 100644 --- a/src/insets/insetnote.C +++ b/src/insets/insetnote.C @@ -53,7 +53,7 @@ InsetNote::InsetNote(InsetNote const & in) } -Inset * InsetNote::clone() const +InsetBase * InsetNote::clone() const { return new InsetNote(*this); } diff --git a/src/insets/insetnote.h b/src/insets/insetnote.h index e6bf5f4dff..13b5fca6f2 100644 --- a/src/insets/insetnote.h +++ b/src/insets/insetnote.h @@ -25,7 +25,7 @@ public: /// InsetNote(InsetNote const &); /// - Inset * clone() const; + InsetBase * clone() const; /// string const editMessage() const; /// diff --git a/src/insets/insetoptarg.C b/src/insets/insetoptarg.C index eb3268b89f..dac9f4fb59 100644 --- a/src/insets/insetoptarg.C +++ b/src/insets/insetoptarg.C @@ -47,7 +47,7 @@ InsetOptArg::InsetOptArg(InsetOptArg const & in) } -Inset * InsetOptArg::clone() const +InsetBase * InsetOptArg::clone() const { return new InsetOptArg(*this); } diff --git a/src/insets/insetoptarg.h b/src/insets/insetoptarg.h index 4c3fec1306..ef43a8e2d9 100644 --- a/src/insets/insetoptarg.h +++ b/src/insets/insetoptarg.h @@ -27,7 +27,7 @@ public: InsetOptArg(InsetOptArg const &); /// make a duplicate of this inset - Inset * clone() const; + InsetBase * clone() const; /// this inset is editable EDITABLE editable() const { return IS_EDITABLE; } /// code of the inset diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 3d7d57b42c..22eafe7cb0 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -351,7 +351,7 @@ void InsetQuotes::validate(LaTeXFeatures & features) const } -Inset * InsetQuotes::clone() const +InsetBase * InsetQuotes::clone() const { return new InsetQuotes(language_, side_, times_); } diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index b0cb73ca94..d9c7379879 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -68,7 +68,7 @@ public: /// Create the right quote inset after character c InsetQuotes(char c, BufferParams const & params); /// - Inset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo &, Dimension &) const; /// diff --git a/src/insets/insetref.h b/src/insets/insetref.h index 41ac981dad..c17df7b846 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -42,7 +42,7 @@ public: ~InsetRef(); /// - virtual Inset * clone() const { + virtual InsetBase * clone() const { return new InsetRef(*this); } /// diff --git a/src/insets/insetspace.C b/src/insets/insetspace.C index ced4160a90..5cee67dcd4 100644 --- a/src/insets/insetspace.C +++ b/src/insets/insetspace.C @@ -250,7 +250,7 @@ int InsetSpace::docbook(Buffer const *, ostream & os, bool) const } -Inset * InsetSpace::clone() const +InsetBase * InsetSpace::clone() const { return new InsetSpace(kind_); } diff --git a/src/insets/insetspace.h b/src/insets/insetspace.h index 8ff805ea3d..3b7f8c159d 100644 --- a/src/insets/insetspace.h +++ b/src/insets/insetspace.h @@ -71,7 +71,7 @@ public: /// int docbook(Buffer const *, std::ostream &, bool mixcont) const; /// - virtual Inset * clone() const; + virtual InsetBase * clone() const; /// Inset::Code lyxCode() const { return Inset::SPACE_CODE; } /// We don't need \begin_inset and \end_inset diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index e1da4d2e37..194d2d5e9d 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -238,7 +238,7 @@ int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const } -Inset * InsetSpecialChar::clone() const +InsetBase * InsetSpecialChar::clone() const { return new InsetSpecialChar(kind_); } diff --git a/src/insets/insetspecialchar.h b/src/insets/insetspecialchar.h index 6fe2ecc4ec..a70c4a2815 100644 --- a/src/insets/insetspecialchar.h +++ b/src/insets/insetspecialchar.h @@ -63,7 +63,7 @@ public: /// int docbook(Buffer const *, std::ostream &, bool mixcont) const; /// - virtual Inset * clone() const; + virtual InsetBase * clone() const; /// Inset::Code lyxCode() const { return Inset::SPECIALCHAR_CODE; } /// We don't need \begin_inset and \end_inset diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index e79d8a906b..f840db1a97 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -196,7 +196,7 @@ InsetTabular::~InsetTabular() } -Inset * InsetTabular::clone() const +InsetBase * InsetTabular::clone() const { return new InsetTabular(*this); } @@ -2351,9 +2351,9 @@ FuncStatus InsetTabular::getStatus(string const & what) const } -vector const InsetTabular::getLabelList() const +void InsetTabular::getLabelList(std::vector & list) const { - return tabular.getLabelList(); + tabular.getLabelList(list); } diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 810239eca9..2ab5d2eb9c 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -77,7 +77,7 @@ public: /// ~InsetTabular(); /// - Inset * clone() const; + InsetBase * clone() const; /// void read(Buffer const *, LyXLex &); /// @@ -164,7 +164,7 @@ public: /// FuncStatus getStatus(string const & argument) const; /// - std::vector const getLabelList() const; + void getLabelList(std::vector &) const; /// void nodraw(bool b) const { UpdatableInset::nodraw(b); diff --git a/src/insets/insettext.C b/src/insets/insettext.C index d13ead97c1..897fe7ec61 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -193,12 +193,6 @@ void InsetText::init(InsetText const * ins) } -InsetText::~InsetText() -{ - paragraphs.clear(); -} - - void InsetText::clear(bool just_mark_erased) { if (just_mark_erased) { @@ -224,7 +218,7 @@ void InsetText::clear(bool just_mark_erased) } -Inset * InsetText::clone() const +InsetBase * InsetText::clone() const { return new InsetText(*this); } @@ -1809,21 +1803,16 @@ bool InsetText::showInsetDialog(BufferView * bv) const } -vector const InsetText::getLabelList() const +void InsetText::getLabelList(std::vector & list) const { - vector label_list; - ParagraphList::const_iterator pit = paragraphs.begin(); ParagraphList::const_iterator pend = paragraphs.end(); for (; pit != pend; ++pit) { InsetList::const_iterator beg = pit->insetlist.begin(); InsetList::const_iterator end = pit->insetlist.end(); - for (; beg != end; ++beg) { - vector const l = beg->inset->getLabelList(); - label_list.insert(label_list.end(), l.begin(), l.end()); - } + for (; beg != end; ++beg) + beg->inset->getLabelList(list); } - return label_list; } diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 52f76e7e2c..e295000924 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -72,12 +72,9 @@ public: /// InsetText(BufferParams const &); /// - explicit - InsetText(InsetText const &); + explicit InsetText(InsetText const &); /// - ~InsetText(); - /// - Inset * clone() const; + InsetBase * clone() const; /// InsetText & operator=(InsetText const & it); /// empty inset to empty par, or just mark as erased @@ -172,7 +169,7 @@ public: /// bool showInsetDialog(BufferView *) const; /// - std::vector const getLabelList() const; + void getLabelList(std::vector &) const; /// bool nodraw() const; /// diff --git a/src/insets/insettheorem.C b/src/insets/insettheorem.C index a121bb19a0..ad02764ea8 100644 --- a/src/insets/insettheorem.C +++ b/src/insets/insettheorem.C @@ -53,7 +53,7 @@ void InsetTheorem::write(Buffer const * buf, ostream & os) const } -Inset * InsetTheorem::clone() const +InsetBase * InsetTheorem::clone() const { #ifdef WITH_WARNINGS #warning Is this inset used? If YES this is WRONG!!! (Jug) diff --git a/src/insets/insettheorem.h b/src/insets/insettheorem.h index 53ba5267c6..e03ea05256 100644 --- a/src/insets/insettheorem.h +++ b/src/insets/insettheorem.h @@ -25,7 +25,7 @@ public: /// void write(Buffer const * buf, std::ostream & os) const; /// - virtual Inset * clone() const; + virtual InsetBase * clone() const; /// Inset::Code lyxCode() const { return Inset::THEOREM_CODE; } /// diff --git a/src/insets/insettoc.h b/src/insets/insettoc.h index bb3b5ca003..1d2b34e938 100644 --- a/src/insets/insettoc.h +++ b/src/insets/insettoc.h @@ -24,7 +24,7 @@ public: /// ~InsetTOC(); /// - virtual Inset * clone() const { + virtual InsetBase * clone() const { return new InsetTOC(params()); } /// diff --git a/src/insets/inseturl.h b/src/insets/inseturl.h index e2a16a5a58..b6f69c0b58 100644 --- a/src/insets/inseturl.h +++ b/src/insets/inseturl.h @@ -27,7 +27,7 @@ public: /// ~InsetUrl(); /// - virtual Inset * clone() const { + virtual InsetBase * clone() const { return new InsetUrl(params()); } /// diff --git a/src/insets/insetwrap.C b/src/insets/insetwrap.C index 864225d9c1..2e0140ba28 100644 --- a/src/insets/insetwrap.C +++ b/src/insets/insetwrap.C @@ -167,7 +167,7 @@ void InsetWrap::validate(LaTeXFeatures & features) const } -Inset * InsetWrap::clone() const +InsetBase * InsetWrap::clone() const { return new InsetWrap(*this); } diff --git a/src/insets/insetwrap.h b/src/insets/insetwrap.h index 45324e9269..ab6721bde3 100644 --- a/src/insets/insetwrap.h +++ b/src/insets/insetwrap.h @@ -49,7 +49,7 @@ public: /// void validate(LaTeXFeatures & features) const; /// - Inset * clone() const; + InsetBase * clone() const; /// Inset::Code lyxCode() const { return Inset::WRAP_CODE; } /// diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index fdf5f29afb..be5e2bfd17 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,24 +1,10 @@ -2003-06-11 Angus Leeming - * button_inset.[Ch]: removed. - * Makefile.am: remove button_inset.[Ch]. +2003-06-16 André Pönitz - * command_inset.[Ch]: no longer derived from ButtonInset. - Instead has a ButtonRenderer member variable. + * math_*inset.[Ch]: IU of clone() - * ref_inset.[Ch]: associated changes. - -2003-06-03 John Levon - - * formula.[Ch]: - * formulabase.h: - * formulamacro.[Ch]: clone() doesn't take a Buffer anymore - -2003-06-02 André Pönitz - - * math_*.[Ch]: finish unified two-stage drawing - - * math_inset.h: move validate to insetbase.h + * math_cursorpos.[Ch]: + * math_cursor.[Ch]: rename MathCursorPos -> CursorPos, par_ -> inset_ 2003-05-28 André Pönitz diff --git a/src/mathed/command_inset.C b/src/mathed/command_inset.C index 4c397d6c87..77570665d6 100644 --- a/src/mathed/command_inset.C +++ b/src/mathed/command_inset.C @@ -14,7 +14,7 @@ CommandInset::CommandInset(string const & name) } -MathInset * CommandInset::clone() const +InsetBase * CommandInset::clone() const { return new CommandInset(*this); } diff --git a/src/mathed/command_inset.h b/src/mathed/command_inset.h index 6844a61190..a7107202c9 100644 --- a/src/mathed/command_inset.h +++ b/src/mathed/command_inset.h @@ -25,7 +25,7 @@ public: /// explicit CommandInset(string const & name); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 7691765360..3f7f7f0af0 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -122,7 +122,7 @@ void InsetFormulaBase::handleFont // this whole function is a hack and won't work for incremental font // changes... bv->lockedInsetStoreUndo(Undo::EDIT); - if (mathcursor->par()->name() == font) + if (mathcursor->inset()->name() == font) mathcursor->handleFont(font); else { mathcursor->handleNest(createMathInset(font)); diff --git a/src/mathed/math_amsarrayinset.C b/src/mathed/math_amsarrayinset.C index ea64089128..64ae739934 100644 --- a/src/mathed/math_amsarrayinset.C +++ b/src/mathed/math_amsarrayinset.C @@ -18,7 +18,7 @@ MathAMSArrayInset::MathAMSArrayInset(string const & name) {} -MathInset * MathAMSArrayInset::clone() const +InsetBase * MathAMSArrayInset::clone() const { return new MathAMSArrayInset(*this); } diff --git a/src/mathed/math_amsarrayinset.h b/src/mathed/math_amsarrayinset.h index c7896421e4..04288ea5dd 100644 --- a/src/mathed/math_amsarrayinset.h +++ b/src/mathed/math_amsarrayinset.h @@ -20,7 +20,7 @@ public: /// MathAMSArrayInset(string const & name); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_arrayinset.C b/src/mathed/math_arrayinset.C index ec78e036a3..a8e2cabea9 100644 --- a/src/mathed/math_arrayinset.C +++ b/src/mathed/math_arrayinset.C @@ -57,7 +57,7 @@ MathArrayInset::MathArrayInset(string const & name, string const & str) } -MathInset * MathArrayInset::clone() const +InsetBase * MathArrayInset::clone() const { return new MathArrayInset(*this); } diff --git a/src/mathed/math_arrayinset.h b/src/mathed/math_arrayinset.h index ee3f7545fb..58c873d626 100644 --- a/src/mathed/math_arrayinset.h +++ b/src/mathed/math_arrayinset.h @@ -25,7 +25,7 @@ public: /// convienience constructor from whitespace/newline seperated data MathArrayInset(string const &, string const & str); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_atom.C b/src/mathed/math_atom.C index bbc1275179..b727dac0f8 100644 --- a/src/mathed/math_atom.C +++ b/src/mathed/math_atom.C @@ -14,9 +14,9 @@ #include - #include "math_atom.h" #include "math_inset.h" +#include "insets/insetbase.h" #include @@ -26,13 +26,13 @@ MathAtom::MathAtom() {} -MathAtom::MathAtom(MathInset * p) - : nucleus_(p) +MathAtom::MathAtom(InsetBase * p) + : nucleus_(static_cast(p)) {} MathAtom::MathAtom(MathAtom const & at) - : nucleus_(at.nucleus_ ? at.nucleus_->clone() : 0) + : nucleus_(at.nucleus_ ? static_cast(at.nucleus_->clone()) : 0) {} diff --git a/src/mathed/math_atom.h b/src/mathed/math_atom.h index c251cdc1a2..286b41ea76 100644 --- a/src/mathed/math_atom.h +++ b/src/mathed/math_atom.h @@ -35,6 +35,7 @@ Andre' */ +class InsetBase; class MathInset; class MathAtom { @@ -43,7 +44,7 @@ public: // std::containers MathAtom(); /// the "real constructor" - explicit MathAtom(MathInset * p); + explicit MathAtom(InsetBase * p); /// copy constructor, invokes nucleus_->clone() MathAtom(MathAtom const &); /// we really need to clean up diff --git a/src/mathed/math_biginset.C b/src/mathed/math_biginset.C index bc56b011d4..3f0e11ca46 100644 --- a/src/mathed/math_biginset.C +++ b/src/mathed/math_biginset.C @@ -12,7 +12,7 @@ MathBigInset::MathBigInset(string const & name, string const & delim) {} -MathInset * MathBigInset::clone() const +InsetBase * MathBigInset::clone() const { return new MathBigInset(*this); } diff --git a/src/mathed/math_biginset.h b/src/mathed/math_biginset.h index e88b518c06..accc21ee59 100644 --- a/src/mathed/math_biginset.h +++ b/src/mathed/math_biginset.h @@ -24,7 +24,7 @@ public: /// MathBigInset(string const & name, string const & delim); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_binaryopinset.C b/src/mathed/math_binaryopinset.C index dd801913d0..b8d05a6b5f 100644 --- a/src/mathed/math_binaryopinset.C +++ b/src/mathed/math_binaryopinset.C @@ -16,7 +16,7 @@ MathBinaryOpInset::MathBinaryOpInset(char op) {} -MathInset * MathBinaryOpInset::clone() const +InsetBase * MathBinaryOpInset::clone() const { return new MathBinaryOpInset(*this); } diff --git a/src/mathed/math_binaryopinset.h b/src/mathed/math_binaryopinset.h index 1a736a396e..319336f4f4 100644 --- a/src/mathed/math_binaryopinset.h +++ b/src/mathed/math_binaryopinset.h @@ -16,7 +16,7 @@ public: /// explicit MathBinaryOpInset(char op); /// - MathInset * clone() const; + InsetBase * clone() const; /// void draw(PainterInfo &, int x, int y) const; /// diff --git a/src/mathed/math_binominset.C b/src/mathed/math_binominset.C index fd7aa7ad73..a77872fb02 100644 --- a/src/mathed/math_binominset.C +++ b/src/mathed/math_binominset.C @@ -14,7 +14,7 @@ MathBinomInset::MathBinomInset(bool choose) {} -MathInset * MathBinomInset::clone() const +InsetBase * MathBinomInset::clone() const { return new MathBinomInset(*this); } diff --git a/src/mathed/math_binominset.h b/src/mathed/math_binominset.h index 3b72255614..c583c46099 100644 --- a/src/mathed/math_binominset.h +++ b/src/mathed/math_binominset.h @@ -13,7 +13,7 @@ public: /// explicit MathBinomInset(bool choose = false); /// - MathInset * clone() const; + InsetBase * clone() const; /// void write(WriteStream & os) const; /// diff --git a/src/mathed/math_boxinset.C b/src/mathed/math_boxinset.C index 1729cd4ba8..6a292bb5cb 100644 --- a/src/mathed/math_boxinset.C +++ b/src/mathed/math_boxinset.C @@ -12,7 +12,7 @@ MathBoxInset::MathBoxInset(string const & name) {} -MathInset * MathBoxInset::clone() const +InsetBase * MathBoxInset::clone() const { return new MathBoxInset(*this); } diff --git a/src/mathed/math_boxinset.h b/src/mathed/math_boxinset.h index 8358b99b65..47d6ce8997 100644 --- a/src/mathed/math_boxinset.h +++ b/src/mathed/math_boxinset.h @@ -15,7 +15,7 @@ public: /// explicit MathBoxInset(string const & name); /// - MathInset * clone() const; + InsetBase * clone() const; /// mode_type currentMode() const { return TEXT_MODE; } /// diff --git a/src/mathed/math_braceinset.C b/src/mathed/math_braceinset.C index b3fe857610..e6470f9ef2 100644 --- a/src/mathed/math_braceinset.C +++ b/src/mathed/math_braceinset.C @@ -21,7 +21,7 @@ MathBraceInset::MathBraceInset(MathArray const & ar) } -MathInset * MathBraceInset::clone() const +InsetBase * MathBraceInset::clone() const { return new MathBraceInset(*this); } diff --git a/src/mathed/math_braceinset.h b/src/mathed/math_braceinset.h index 2fc685ba75..357f9b9a97 100644 --- a/src/mathed/math_braceinset.h +++ b/src/mathed/math_braceinset.h @@ -18,7 +18,7 @@ public: /// MathBraceInset(MathArray const & ar); /// - MathInset * clone() const; + InsetBase * clone() const; /// we write extra braces in any case... bool extraBraces() const { return true; } /// diff --git a/src/mathed/math_casesinset.C b/src/mathed/math_casesinset.C index 1c093bd738..ef90f1fdec 100644 --- a/src/mathed/math_casesinset.C +++ b/src/mathed/math_casesinset.C @@ -14,7 +14,7 @@ MathCasesInset::MathCasesInset(row_type n) {} -MathInset * MathCasesInset::clone() const +InsetBase * MathCasesInset::clone() const { return new MathCasesInset(*this); } diff --git a/src/mathed/math_casesinset.h b/src/mathed/math_casesinset.h index 6864325c1e..c1846b5b78 100644 --- a/src/mathed/math_casesinset.h +++ b/src/mathed/math_casesinset.h @@ -12,7 +12,7 @@ public: /// explicit MathCasesInset(row_type rows = 1u); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index 9884a2efe2..b1b2a33328 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -49,7 +49,7 @@ MathCharInset::MathCharInset(char c) -MathInset * MathCharInset::clone() const +InsetBase * MathCharInset::clone() const { return new MathCharInset(*this); } diff --git a/src/mathed/math_charinset.h b/src/mathed/math_charinset.h index 4e49f34038..5f43951534 100644 --- a/src/mathed/math_charinset.h +++ b/src/mathed/math_charinset.h @@ -16,7 +16,7 @@ public: /// explicit MathCharInset(char c); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_commentinset.C b/src/mathed/math_commentinset.C index 11e5e6f3af..1113671d0c 100644 --- a/src/mathed/math_commentinset.C +++ b/src/mathed/math_commentinset.C @@ -21,7 +21,7 @@ MathCommentInset::MathCommentInset(string const & str) } -MathInset * MathCommentInset::clone() const +InsetBase * MathCommentInset::clone() const { return new MathCommentInset(*this); } diff --git a/src/mathed/math_commentinset.h b/src/mathed/math_commentinset.h index c324482b6b..4a1286b3df 100644 --- a/src/mathed/math_commentinset.h +++ b/src/mathed/math_commentinset.h @@ -20,7 +20,7 @@ public: /// explicit MathCommentInset(string const &); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 3e146f460a..450d16614f 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -80,7 +80,7 @@ MathCursor::~MathCursor() void MathCursor::push(MathAtom & t) { - Cursor_.push_back(MathCursorPos(t.nucleus())); + Cursor_.push_back(CursorPos(t.nucleus())); } @@ -106,10 +106,10 @@ bool MathCursor::popLeft() //lyxerr << "Leaving atom to the left\n"; if (depth() <= 1) { if (depth() == 1) - par()->notifyCursorLeaves(idx()); + inset()->notifyCursorLeaves(idx()); return false; } - par()->notifyCursorLeaves(idx()); + inset()->notifyCursorLeaves(idx()); Cursor_.pop_back(); return true; } @@ -117,13 +117,13 @@ bool MathCursor::popLeft() bool MathCursor::popRight() { - //lyxerr << "Leaving atom "; par()->write(cerr, false); cerr << " right\n"; + //lyxerr << "Leaving atom "; inset()->write(cerr, false); cerr << " right\n"; if (depth() <= 1) { if (depth() == 1) - par()->notifyCursorLeaves(idx()); + inset()->notifyCursorLeaves(idx()); return false; } - par()->notifyCursorLeaves(idx()); + inset()->notifyCursorLeaves(idx()); Cursor_.pop_back(); posRight(); return true; @@ -151,7 +151,7 @@ bool MathCursor::popRight() bool MathCursor::isInside(MathInset const * p) const { for (unsigned i = 0; i < depth(); ++i) - if (Cursor_[i].par_ == p) + if (Cursor_[i].inset_ == p) return true; return false; } @@ -169,7 +169,7 @@ bool MathCursor::openable(MathAtom const & t, bool sel) const // we can't move into anything new during selection if (depth() == Anchor_.size()) return false; - if (t.operator->() != Anchor_[depth()].par_) + if (t.operator->() != Anchor_[depth()].inset_) return false; } return true; @@ -178,7 +178,7 @@ bool MathCursor::openable(MathAtom const & t, bool sel) const bool MathCursor::inNucleus() const { - return par()->asScriptInset() && idx() == 2; + return inset()->asScriptInset() && idx() == 2; } @@ -244,7 +244,7 @@ void MathCursor::first() { Cursor_.clear(); push(formula_->par()); - par()->idxFirst(idx(), pos()); + inset()->idxFirst(idx(), pos()); } @@ -252,7 +252,7 @@ void MathCursor::last() { Cursor_.clear(); push(formula_->par()); - par()->idxLast(idx(), pos()); + inset()->idxLast(idx(), pos()); } @@ -265,7 +265,7 @@ bool positionable // anchor might be deeper, should have same path then for (MathIterator::size_type i = 0; i < cursor.size(); ++i) - if (cursor[i].par_ != anchor[i].par_) + if (cursor[i].inset_ != anchor[i].inset_) return false; // position should be ok. @@ -296,7 +296,7 @@ bool MathCursor::home(bool sel) autocorrect_ = false; selHandle(sel); macroModeClose(); - if (!par()->idxHome(idx(), pos())) + if (!inset()->idxHome(idx(), pos())) return popLeft(); dump("home 2"); targetx_ = -1; // "no target" @@ -310,7 +310,7 @@ bool MathCursor::end(bool sel) autocorrect_ = false; selHandle(sel); macroModeClose(); - if (!par()->idxEnd(idx(), pos())) + if (!inset()->idxEnd(idx(), pos())) return popRight(); dump("end 2"); targetx_ = -1; // "no target" @@ -430,8 +430,8 @@ bool MathCursor::backspace() } if (pos() == 0) { - if (par()->ncols() == 1 && - par()->nrows() == 1 && + if (inset()->ncols() == 1 && + inset()->nrows() == 1 && depth() == 1 && size() == 0) return false; @@ -466,15 +466,15 @@ bool MathCursor::erase() // delete empty cells if possible if (array().empty()) - if (par()->idxDelete(idx())) + if (inset()->idxDelete(idx())) return true; // old behaviour when in last position of cell if (pos() == size()) { - if (par()->ncols() == 1 && par()->nrows() == 1 && depth() == 1 && size() == 0) + if (inset()->ncols() == 1 && inset()->nrows() == 1 && depth() == 1 && size() == 0) return false; else{ - par()->idxGlue(idx()); + inset()->idxGlue(idx()); return true; } } @@ -623,10 +623,10 @@ void MathCursor::drawSelection(PainterInfo & pi) const { if (!selection_) return; - MathCursorPos i1; - MathCursorPos i2; + CursorPos i1; + CursorPos i2; getSelection(i1, i2); - i1.par_->drawSelection(pi, i1.idx_, i1.pos_, i2.idx_, i2.pos_); + i1.inset_->drawSelection(pi, i1.idx_, i1.pos_, i2.idx_, i2.pos_); } @@ -641,7 +641,7 @@ void MathCursor::handleNest(MathAtom const & a) void MathCursor::getPos(int & x, int & y) const { - par()->getPos(idx(), pos(), x, y); + inset()->getPos(idx(), pos(), x, y); } @@ -655,9 +655,9 @@ int MathCursor::targetX() const } -MathInset * MathCursor::par() const +MathInset * MathCursor::inset() const { - return cursor().par_; + return cursor().inset_; } @@ -739,7 +739,7 @@ bool MathCursor::selection() const MathGridInset * MathCursor::enclosingGrid(MathCursor::idx_type & idx) const { for (MathInset::difference_type i = depth() - 1; i >= 0; --i) { - MathGridInset * p = Cursor_[i].par_->asGridInset(); + MathGridInset * p = Cursor_[i].inset_->asGridInset(); if (p) { idx = Cursor_[i].idx_; return p; @@ -751,21 +751,21 @@ MathGridInset * MathCursor::enclosingGrid(MathCursor::idx_type & idx) const void MathCursor::popToHere(MathInset const * p) { - while (depth() && Cursor_.back().par_ != p) + while (depth() && Cursor_.back().inset_ != p) Cursor_.pop_back(); } void MathCursor::popToEnclosingGrid() { - while (depth() && !Cursor_.back().par_->asGridInset()) + while (depth() && !Cursor_.back().inset_->asGridInset()) Cursor_.pop_back(); } void MathCursor::popToEnclosingHull() { - while (depth() && !Cursor_.back().par_->asHullInset()) + while (depth() && !Cursor_.back().inset_->asHullInset()) Cursor_.pop_back(); } @@ -795,20 +795,20 @@ void MathCursor::touch() void MathCursor::normalize() { - if (idx() >= par()->nargs()) { + if (idx() >= inset()->nargs()) { lyxerr << "this should not really happen - 1: " - << idx() << ' ' << par()->nargs() - << " in: " << par() << endl; + << idx() << ' ' << inset()->nargs() + << " in: " << inset() << endl; dump("error 2"); } - idx() = min(idx(), par()->nargs() - 1); + idx() = min(idx(), inset()->nargs() - 1); if (pos() > size()) { lyxerr << "this should not really happen - 2: " << pos() << ' ' << size() << " in idx: " << idx() << " in atom: '"; WriteStream wi(lyxerr, false, true); - par()->write(wi); + inset()->write(wi); lyxerr << endl; dump("error 4"); } @@ -866,7 +866,7 @@ MathArray & MathCursor::array() const { static MathArray dummy; - if (idx() >= par()->nargs()) { + if (idx() >= inset()->nargs()) { lyxerr << "############ idx_ " << idx() << " not valid\n"; return dummy; } @@ -882,13 +882,13 @@ MathArray & MathCursor::array() const void MathCursor::idxNext() { - par()->idxNext(idx(), pos()); + inset()->idxNext(idx(), pos()); } void MathCursor::idxPrev() { - par()->idxPrev(idx(), pos()); + inset()->idxPrev(idx(), pos()); } @@ -908,9 +908,9 @@ char MathCursor::halign() const } -void MathCursor::getSelection(MathCursorPos & i1, MathCursorPos & i2) const +void MathCursor::getSelection(CursorPos & i1, CursorPos & i2) const { - MathCursorPos anc = normalAnchor(); + CursorPos anc = normalAnchor(); if (anc < cursor()) { i1 = anc; i2 = cursor(); @@ -921,14 +921,14 @@ void MathCursor::getSelection(MathCursorPos & i1, MathCursorPos & i2) const } -MathCursorPos & MathCursor::cursor() +CursorPos & MathCursor::cursor() { lyx::Assert(depth()); return Cursor_.back(); } -MathCursorPos const & MathCursor::cursor() const +CursorPos const & MathCursor::cursor() const { lyx::Assert(depth()); return Cursor_.back(); @@ -977,7 +977,7 @@ bool MathCursor::goUpDown(bool up) } // try current cell for e.g. text insets - if (par()->idxUpDown2(idx(), pos(), up, targetx_)) + if (inset()->idxUpDown2(idx(), pos(), up, targetx_)) return true; //xarray().boundingBox(xlow, xhigh, ylow, yhigh); @@ -992,9 +992,9 @@ bool MathCursor::goUpDown(bool up) // try to find an inset that knows better then we while (1) { - ///lyxerr << "updown: We are in " << *par() << " idx: " << idx() << '\n'; + ///lyxerr << "updown: We are in " << *inset() << " idx: " << idx() << '\n'; // ask inset first - if (par()->idxUpDown(idx(), pos(), up, targetx_)) { + if (inset()->idxUpDown(idx(), pos(), up, targetx_)) { // try to find best position within this inset if (!selection()) bruteFind2(xo, yo); @@ -1085,21 +1085,21 @@ void MathCursor::bruteFind2(int x, int y) bool MathCursor::idxLineLast() { - idx() -= idx() % par()->ncols(); - idx() += par()->ncols() - 1; + idx() -= idx() % inset()->ncols(); + idx() += inset()->ncols() - 1; pos() = size(); return true; } bool MathCursor::idxLeft() { - return par()->idxLeft(idx(), pos()); + return inset()->idxLeft(idx(), pos()); } bool MathCursor::idxRight() { - return par()->idxRight(idx(), pos()); + return inset()->idxRight(idx(), pos()); } @@ -1118,7 +1118,7 @@ bool MathCursor::script(bool up) string safe = grabAndEraseSelection(); if (inNucleus()) { // we are in a nucleus of a script inset, move to _our_ script - par()->asScriptInset()->ensure(up); + inset()->asScriptInset()->ensure(up); idx() = up; pos() = 0; } else if (hasPrevAtom() && prevAtom()->asScriptInset()) { @@ -1298,7 +1298,7 @@ string MathCursor::info() const ostringstream os; os << "Math editor mode. "; for (int i = 0, n = depth(); i < n; ++i) { - Cursor_[i].par_->infoize(os); + Cursor_[i].inset_->infoize(os); os << " "; } if (hasPrevAtom()) @@ -1318,11 +1318,11 @@ unsigned MathCursor::depth() const namespace { -void region(MathCursorPos const & i1, MathCursorPos const & i2, +void region(CursorPos const & i1, CursorPos const & i2, MathInset::row_type & r1, MathInset::row_type & r2, MathInset::col_type & c1, MathInset::col_type & c2) { - MathInset * p = i1.par_; + MathInset * p = i1.inset_; c1 = p->col(i1.idx_); c2 = p->col(i2.idx_); if (c1 > c2) @@ -1341,8 +1341,8 @@ string MathCursor::grabSelection() const if (!selection_) return string(); - MathCursorPos i1; - MathCursorPos i2; + CursorPos i1; + CursorPos i2; getSelection(i1, i2); if (i1.idx_ == i2.idx_) { @@ -1361,7 +1361,7 @@ string MathCursor::grabSelection() const for (col_type col = c1; col <= c2; ++col) { if (col > c1) data += '&'; - data += asString(i1.par_->cell(i1.par_->index(row, col))); + data += asString(i1.inset_->cell(i1.inset_->index(row, col))); } } return data; @@ -1370,13 +1370,13 @@ string MathCursor::grabSelection() const void MathCursor::eraseSelection() { - MathCursorPos i1; - MathCursorPos i2; + CursorPos i1; + CursorPos i2; getSelection(i1, i2); if (i1.idx_ == i2.idx_) i1.cell().erase(i1.pos_, i2.pos_); else { - MathInset * p = i1.par_; + MathInset * p = i1.inset_; row_type r1, r2; col_type c1, c2; region(i1, i2, r1, r2, c1, c2); @@ -1399,7 +1399,7 @@ string MathCursor::grabAndEraseSelection() } -MathCursorPos MathCursor::normalAnchor() const +CursorPos MathCursor::normalAnchor() const { if (Anchor_.size() < depth()) { Anchor_ = Cursor_; @@ -1407,7 +1407,7 @@ MathCursorPos MathCursor::normalAnchor() const } //lyx::Assert(Anchor_.size() >= cursor.depth()); // use Anchor on the same level as Cursor - MathCursorPos normal = Anchor_[depth() - 1]; + CursorPos normal = Anchor_[depth() - 1]; if (depth() < Anchor_.size() && !(normal < cursor())) { // anchor is behind cursor -> move anchor behind the inset ++normal.pos_; @@ -1425,7 +1425,7 @@ dispatch_result MathCursor::dispatch(FuncRequest const & cmd) case LFUN_MOUSE_MOTION: case LFUN_MOUSE_RELEASE: case LFUN_MOUSE_DOUBLE: { - MathCursorPos & pos = Cursor_.back(); + CursorPos & pos = Cursor_.back(); dispatch_result res = UNDISPATCHED; int x = 0, y = 0; getPos(x, y); @@ -1445,8 +1445,8 @@ dispatch_result MathCursor::dispatch(FuncRequest const & cmd) } for (int i = Cursor_.size() - 1; i >= 0; --i) { - MathCursorPos & pos = Cursor_[i]; - dispatch_result res = pos.par_->dispatch(cmd, pos.idx_, pos.pos_); + CursorPos & pos = Cursor_[i]; + dispatch_result res = pos.inset_->dispatch(cmd, pos.idx_, pos.pos_); if (res != UNDISPATCHED) { if (res == DISPATCHED_POP) { Cursor_.shrink(i + 1); @@ -1462,7 +1462,7 @@ dispatch_result MathCursor::dispatch(FuncRequest const & cmd) MathInset::mode_type MathCursor::currentMode() const { for (int i = Cursor_.size() - 1; i >= 0; --i) { - MathInset::mode_type res = Cursor_[i].par_->currentMode(); + MathInset::mode_type res = Cursor_[i].inset_->currentMode(); if (res != MathInset::UNDECIDED_MODE) return res; } diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 7d30ae57e1..08a019d0ae 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -32,7 +32,7 @@ class MathUnknownInset; [Have a look at math_inset.h first] The MathCursor is different from the kind of cursor used in the Outer -World. It contains a stack of MathCursorPos, each of which is made +World. It contains a stack of CursorPos, each of which is made up of a inset pointer, an index and a position offset, marking a path from this formula's MathHullInset to the current position. @@ -106,7 +106,7 @@ public: /// in pixels from left of screen int targetX() const; /// current inset - MathInset * par() const; + MathInset * inset() const; /// return the next enclosing grid inset and the cursor's index in it MathGridInset * enclosingGrid(idx_type & idx) const; /// go up to enclosing grid @@ -208,14 +208,14 @@ public: MathAtom & nextAtom(); /// returns the selection - void getSelection(MathCursorPos &, MathCursorPos &) const; + void getSelection(CursorPos &, CursorPos &) const; /// returns the normalized anchor of the selection - MathCursorPos normalAnchor() const; + CursorPos normalAnchor() const; /// reference to the last item of the path, i.e. "The Cursor" - MathCursorPos & cursor(); + CursorPos & cursor(); /// reference to the last item of the path, i.e. "The Cursor" - MathCursorPos const & cursor() const; + CursorPos const & cursor() const; /// how deep are we nested? unsigned depth() const; diff --git a/src/mathed/math_decorationinset.C b/src/mathed/math_decorationinset.C index 5f37628eb5..ade9703135 100644 --- a/src/mathed/math_decorationinset.C +++ b/src/mathed/math_decorationinset.C @@ -14,7 +14,7 @@ MathDecorationInset::MathDecorationInset(latexkeys const * key) {} -MathInset * MathDecorationInset::clone() const +InsetBase * MathDecorationInset::clone() const { return new MathDecorationInset(*this); } diff --git a/src/mathed/math_decorationinset.h b/src/mathed/math_decorationinset.h index e84488b1bc..8fc07ad1eb 100644 --- a/src/mathed/math_decorationinset.h +++ b/src/mathed/math_decorationinset.h @@ -19,7 +19,7 @@ public: /// explicit MathDecorationInset(latexkeys const * key); /// - MathInset * clone() const; + InsetBase * clone() const; /// void draw(PainterInfo &, int x, int y) const; /// diff --git a/src/mathed/math_deliminset.C b/src/mathed/math_deliminset.C index 6fd65e3da4..8c522d7317 100644 --- a/src/mathed/math_deliminset.C +++ b/src/mathed/math_deliminset.C @@ -52,7 +52,7 @@ MathDelimInset::MathDelimInset } -MathInset * MathDelimInset::clone() const +InsetBase * MathDelimInset::clone() const { return new MathDelimInset(*this); } diff --git a/src/mathed/math_deliminset.h b/src/mathed/math_deliminset.h index bedd04f55b..84a3ac1451 100644 --- a/src/mathed/math_deliminset.h +++ b/src/mathed/math_deliminset.h @@ -19,7 +19,7 @@ public: /// MathDelimInset(string const & left, string const & right, MathArray const &); /// - MathInset * clone() const; + InsetBase * clone() const; /// MathDelimInset * asDelimInset() { return this; } /// diff --git a/src/mathed/math_diffinset.C b/src/mathed/math_diffinset.C index 5f0f202db4..a5d2ef4bce 100644 --- a/src/mathed/math_diffinset.C +++ b/src/mathed/math_diffinset.C @@ -11,7 +11,7 @@ MathDiffInset::MathDiffInset() {} -MathInset * MathDiffInset::clone() const +InsetBase * MathDiffInset::clone() const { return new MathDiffInset(*this); } diff --git a/src/mathed/math_diffinset.h b/src/mathed/math_diffinset.h index 17436c8da5..84a867aec6 100644 --- a/src/mathed/math_diffinset.h +++ b/src/mathed/math_diffinset.h @@ -13,7 +13,7 @@ public: /// explicit MathDiffInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void addDer(MathArray const & der); /// diff --git a/src/mathed/math_dotsinset.C b/src/mathed/math_dotsinset.C index 51bd28a74d..c437d42873 100644 --- a/src/mathed/math_dotsinset.C +++ b/src/mathed/math_dotsinset.C @@ -12,7 +12,7 @@ MathDotsInset::MathDotsInset(latexkeys const * key) {} -MathInset * MathDotsInset::clone() const +InsetBase * MathDotsInset::clone() const { return new MathDotsInset(*this); } diff --git a/src/mathed/math_dotsinset.h b/src/mathed/math_dotsinset.h index 22d87e076a..542a1082eb 100644 --- a/src/mathed/math_dotsinset.h +++ b/src/mathed/math_dotsinset.h @@ -13,7 +13,7 @@ public: /// explicit MathDotsInset(latexkeys const * l); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_envinset.C b/src/mathed/math_envinset.C index a7da4500ff..42b9dac39e 100644 --- a/src/mathed/math_envinset.C +++ b/src/mathed/math_envinset.C @@ -11,7 +11,7 @@ MathEnvInset::MathEnvInset(string const & name) {} -MathInset * MathEnvInset::clone() const +InsetBase * MathEnvInset::clone() const { return new MathEnvInset(*this); } diff --git a/src/mathed/math_envinset.h b/src/mathed/math_envinset.h index c13a17c099..083273880f 100644 --- a/src/mathed/math_envinset.h +++ b/src/mathed/math_envinset.h @@ -17,7 +17,7 @@ public: /// MathEnvInset(string const & name_); /// - MathInset * clone() const; + InsetBase * clone() const; /// void draw(PainterInfo &, int x, int y) const; /// diff --git a/src/mathed/math_ertinset.C b/src/mathed/math_ertinset.C index 64dfbeca74..b82344947d 100644 --- a/src/mathed/math_ertinset.C +++ b/src/mathed/math_ertinset.C @@ -6,7 +6,7 @@ #include "support/LOstream.h" -MathInset * MathErtInset::clone() const +InsetBase * MathErtInset::clone() const { return new MathErtInset(*this); } diff --git a/src/mathed/math_ertinset.h b/src/mathed/math_ertinset.h index d72b58d907..afc2bdf961 100644 --- a/src/mathed/math_ertinset.h +++ b/src/mathed/math_ertinset.h @@ -11,7 +11,7 @@ public: /// MathErtInset() {} /// - MathInset * clone() const; + InsetBase * clone() const; /// mode_type currentMode() const { return TEXT_MODE; } /// diff --git a/src/mathed/math_exfuncinset.C b/src/mathed/math_exfuncinset.C index 7912da47a1..6033db4a6c 100644 --- a/src/mathed/math_exfuncinset.C +++ b/src/mathed/math_exfuncinset.C @@ -19,7 +19,7 @@ MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar) } -MathInset * MathExFuncInset::clone() const +InsetBase * MathExFuncInset::clone() const { return new MathExFuncInset(*this); } diff --git a/src/mathed/math_exfuncinset.h b/src/mathed/math_exfuncinset.h index 98b08b192e..a68ab76361 100644 --- a/src/mathed/math_exfuncinset.h +++ b/src/mathed/math_exfuncinset.h @@ -15,7 +15,7 @@ public: /// MathExFuncInset(string const & name, MathArray const & ar); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_exintinset.C b/src/mathed/math_exintinset.C index b4b1204365..8ff4679ec4 100644 --- a/src/mathed/math_exintinset.C +++ b/src/mathed/math_exintinset.C @@ -21,7 +21,7 @@ MathExIntInset::MathExIntInset(string const & name) // 3 - upper -MathInset * MathExIntInset::clone() const +InsetBase * MathExIntInset::clone() const { return new MathExIntInset(*this); } diff --git a/src/mathed/math_exintinset.h b/src/mathed/math_exintinset.h index 05e209c36a..c0c68034ac 100644 --- a/src/mathed/math_exintinset.h +++ b/src/mathed/math_exintinset.h @@ -14,7 +14,7 @@ public: /// explicit MathExIntInset(string const & name_); /// - MathInset * clone() const; + InsetBase * clone() const; /// void symbol(string const &); /// diff --git a/src/mathed/math_fboxinset.C b/src/mathed/math_fboxinset.C index 3383a3f97c..f8e5889348 100644 --- a/src/mathed/math_fboxinset.C +++ b/src/mathed/math_fboxinset.C @@ -14,7 +14,7 @@ MathFboxInset::MathFboxInset(latexkeys const * key) {} -MathInset * MathFboxInset::clone() const +InsetBase * MathFboxInset::clone() const { return new MathFboxInset(*this); } diff --git a/src/mathed/math_fboxinset.h b/src/mathed/math_fboxinset.h index c0e9fc85c7..c65eaae8e5 100644 --- a/src/mathed/math_fboxinset.h +++ b/src/mathed/math_fboxinset.h @@ -19,7 +19,7 @@ public: /// MathFboxInset(latexkeys const * key); /// - MathInset * clone() const; + InsetBase * clone() const; /// mode_type currentMode() const; /// diff --git a/src/mathed/math_fontinset.C b/src/mathed/math_fontinset.C index 1873c831a6..c8669f4f50 100644 --- a/src/mathed/math_fontinset.C +++ b/src/mathed/math_fontinset.C @@ -16,7 +16,7 @@ MathFontInset::MathFontInset(latexkeys const * key) {} -MathInset * MathFontInset::clone() const +InsetBase * MathFontInset::clone() const { return new MathFontInset(*this); } diff --git a/src/mathed/math_fontinset.h b/src/mathed/math_fontinset.h index 69ae8bbc21..96c47573f3 100644 --- a/src/mathed/math_fontinset.h +++ b/src/mathed/math_fontinset.h @@ -18,7 +18,7 @@ public: /// explicit MathFontInset(latexkeys const * key); /// - MathInset * clone() const; + InsetBase * clone() const; /// MathFontInset * asFontInset() { return this; } /// diff --git a/src/mathed/math_fontoldinset.C b/src/mathed/math_fontoldinset.C index c6b3c2b299..da27886ffa 100644 --- a/src/mathed/math_fontoldinset.C +++ b/src/mathed/math_fontoldinset.C @@ -19,7 +19,7 @@ MathFontOldInset::MathFontOldInset(latexkeys const * key) } -MathInset * MathFontOldInset::clone() const +InsetBase * MathFontOldInset::clone() const { return new MathFontOldInset(*this); } diff --git a/src/mathed/math_fontoldinset.h b/src/mathed/math_fontoldinset.h index dc168e50a9..dc820348b5 100644 --- a/src/mathed/math_fontoldinset.h +++ b/src/mathed/math_fontoldinset.h @@ -18,7 +18,7 @@ public: /// explicit MathFontOldInset(latexkeys const * key); /// - MathInset * clone() const; + InsetBase * clone() const; /// we are in text mode. mode_type currentMode() const { return TEXT_MODE; } /// we write extra braces in any case... diff --git a/src/mathed/math_fracinset.C b/src/mathed/math_fracinset.C index be4b75d496..86342f3c66 100644 --- a/src/mathed/math_fracinset.C +++ b/src/mathed/math_fracinset.C @@ -14,7 +14,7 @@ MathFracInset::MathFracInset(bool atop) {} -MathInset * MathFracInset::clone() const +InsetBase * MathFracInset::clone() const { return new MathFracInset(*this); } diff --git a/src/mathed/math_fracinset.h b/src/mathed/math_fracinset.h index 61d4dcbeb2..7ae5ddeb4d 100644 --- a/src/mathed/math_fracinset.h +++ b/src/mathed/math_fracinset.h @@ -15,7 +15,7 @@ public: /// explicit MathFracInset(bool atop = false); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_frameboxinset.C b/src/mathed/math_frameboxinset.C index 26b42aff95..30b386fd2d 100644 --- a/src/mathed/math_frameboxinset.C +++ b/src/mathed/math_frameboxinset.C @@ -12,7 +12,7 @@ MathFrameboxInset::MathFrameboxInset() {} -MathInset * MathFrameboxInset::clone() const +InsetBase * MathFrameboxInset::clone() const { return new MathFrameboxInset(*this); } diff --git a/src/mathed/math_frameboxinset.h b/src/mathed/math_frameboxinset.h index 11b3b8ea8a..e05462c3c6 100644 --- a/src/mathed/math_frameboxinset.h +++ b/src/mathed/math_frameboxinset.h @@ -16,7 +16,7 @@ public: /// MathFrameboxInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 4201aef6e5..eaa2e26a44 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -160,7 +160,7 @@ MathGridInset::~MathGridInset() } -MathInset * MathGridInset::clone() const +InsetBase * MathGridInset::clone() const { return new MathGridInset(*this); } diff --git a/src/mathed/math_gridinset.h b/src/mathed/math_gridinset.h index 6177c9be82..00e324f676 100644 --- a/src/mathed/math_gridinset.h +++ b/src/mathed/math_gridinset.h @@ -90,7 +90,7 @@ public: /// Ensures that the dialog is closed. ~MathGridInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi) const; /// diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index a0309b100f..7792793337 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -104,7 +104,7 @@ MathHullInset::MathHullInset(string const & type) } -MathInset * MathHullInset::clone() const +InsetBase * MathHullInset::clone() const { return new MathHullInset(*this); } diff --git a/src/mathed/math_hullinset.h b/src/mathed/math_hullinset.h index c0a1c6ca54..2153384737 100644 --- a/src/mathed/math_hullinset.h +++ b/src/mathed/math_hullinset.h @@ -20,7 +20,7 @@ public: /// explicit MathHullInset(string const & type); /// - MathInset * clone() const; + InsetBase * clone() const; /// mode_type currentMode() const; /// diff --git a/src/mathed/math_inferinset.C b/src/mathed/math_inferinset.C index 7a6da9a3c9..08ea890e28 100644 --- a/src/mathed/math_inferinset.C +++ b/src/mathed/math_inferinset.C @@ -11,7 +11,7 @@ MathInferInset::MathInferInset() {} -MathInset * MathInferInset::clone() const +InsetBase * MathInferInset::clone() const { return new MathInferInset(*this); } diff --git a/src/mathed/math_inferinset.h b/src/mathed/math_inferinset.h index 582a85a17d..350d02ae14 100644 --- a/src/mathed/math_inferinset.h +++ b/src/mathed/math_inferinset.h @@ -15,7 +15,7 @@ public: /// explicit MathInferInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index eac36dd7da..b5e5d20f6a 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -87,8 +87,6 @@ public: /// our members behave nicely... MathInset() {} - /// reproduce itself - virtual MathInset * clone() const = 0; /// substitutes macro arguments if necessary virtual void substitute(MathMacro const & macro); /// draw selection between two positions @@ -255,9 +253,6 @@ public: /// dump content to stderr for debugging virtual void dump() const; - /// LyXInset stuff - /// write labels into a list - virtual void getLabelList(std::vector &) const {} /// LyXInset stuff virtual bool numberedType() const { return false; } /// hull type diff --git a/src/mathed/math_iterator.C b/src/mathed/math_iterator.C index eb73b1a3a3..bf20717181 100644 --- a/src/mathed/math_iterator.C +++ b/src/mathed/math_iterator.C @@ -17,22 +17,22 @@ MathIterator::MathIterator(MathInset * p) } -MathInset const * MathIterator::par() const +MathInset const * MathIterator::inset() const { - return back().par_; + return back().inset_; } -MathInset * MathIterator::par() +MathInset * MathIterator::inset() { - return back().par_; + return back().inset_; } MathArray const & MathIterator::cell() const { - MathCursorPos const & top = back(); - return top.par_->cell(top.idx_); + CursorPos const & top = back(); + return top.inset_->cell(top.idx_); } @@ -40,7 +40,7 @@ MathArray const & MathIterator::cell() const void MathIterator::push(MathInset * p) { //lyxerr << "push: " << p << endl; - push_back(MathCursorPos(p)); + push_back(CursorPos(p)); } @@ -52,13 +52,13 @@ void MathIterator::pop() } -MathCursorPos const & MathIterator::operator*() const +CursorPos const & MathIterator::operator*() const { return back(); } -MathCursorPos const & MathIterator::operator->() const +CursorPos const & MathIterator::operator->() const { return back(); } @@ -66,16 +66,16 @@ MathCursorPos const & MathIterator::operator->() const void MathIterator::goEnd() { - MathCursorPos & top = back(); - top.idx_ = top.par_->nargs() - 1; + CursorPos & top = back(); + top.idx_ = top.inset_->nargs() - 1; top.pos_ = cell().size(); } void MathIterator::operator++() { - MathCursorPos & top = back(); - MathArray & ar = top.par_->cell(top.idx_); + CursorPos & top = back(); + MathArray & ar = top.inset_->cell(top.idx_); // move into the current inset if possible // it is impossible for pos() == size()! @@ -95,10 +95,10 @@ void MathIterator::operator++() } // otherwise try to move on one cell if possible - while (top.idx_ + 1 < top.par_->nargs()) { + while (top.idx_ + 1 < top.inset_->nargs()) { // idx() == nargs() is _not_ valid! ++top.idx_; - if (top.par_->validCell(top.idx_)) { + if (top.inset_->validCell(top.idx_)) { top.pos_ = 0; return; } diff --git a/src/mathed/math_iterator.h b/src/mathed/math_iterator.h index 5c76edc6db..91c39d4db1 100644 --- a/src/mathed/math_iterator.h +++ b/src/mathed/math_iterator.h @@ -2,16 +2,17 @@ #ifndef MATH_ITERATOR_H #define MATH_ITERATOR_H - #include "math_pos.h" + #include + // this is used for traversing math insets -class MathIterator : private std::vector { +class MathIterator : private std::vector { public: // re-use inherited stuff - typedef std::vector base_type; + typedef std::vector base_type; using base_type::clear; using base_type::size; using base_type::push_back; @@ -32,17 +33,17 @@ public: /// start with given inset explicit MathIterator(MathInset * p); /// - MathCursorPos const & operator*() const; + CursorPos const & operator*() const; /// - MathCursorPos const & operator->() const; + CursorPos const & operator->() const; /// move on one step void operator++(); /// move on several steps void jump(difference_type); /// read access to top most inset - MathInset const * par() const; + MathInset const * inset() const; /// read access to top most inset - MathInset * par(); + MathInset * inset(); /// helper for iend void goEnd(); /// read access to top most item diff --git a/src/mathed/math_kerninset.C b/src/mathed/math_kerninset.C index 735df272c3..88e5fff4e9 100644 --- a/src/mathed/math_kerninset.C +++ b/src/mathed/math_kerninset.C @@ -22,7 +22,7 @@ MathKernInset::MathKernInset(string const & s) {} -MathInset * MathKernInset::clone() const +InsetBase * MathKernInset::clone() const { return new MathKernInset(*this); } diff --git a/src/mathed/math_kerninset.h b/src/mathed/math_kerninset.h index 956a5415e4..3503607c82 100644 --- a/src/mathed/math_kerninset.h +++ b/src/mathed/math_kerninset.h @@ -20,7 +20,7 @@ public: /// explicit MathKernInset(string const & wid); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_lefteqninset.C b/src/mathed/math_lefteqninset.C index af20371875..d80f437671 100644 --- a/src/mathed/math_lefteqninset.C +++ b/src/mathed/math_lefteqninset.C @@ -9,7 +9,7 @@ MathLefteqnInset::MathLefteqnInset() {} -MathInset * MathLefteqnInset::clone() const +InsetBase * MathLefteqnInset::clone() const { return new MathLefteqnInset(*this); } diff --git a/src/mathed/math_lefteqninset.h b/src/mathed/math_lefteqninset.h index fea4ee5381..a59cd9de16 100644 --- a/src/mathed/math_lefteqninset.h +++ b/src/mathed/math_lefteqninset.h @@ -12,7 +12,7 @@ public: /// MathLefteqnInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// string name() const; /// diff --git a/src/mathed/math_liminset.C b/src/mathed/math_liminset.C index 0b854fa9a8..84468e5234 100644 --- a/src/mathed/math_liminset.C +++ b/src/mathed/math_liminset.C @@ -16,7 +16,7 @@ MathLimInset::MathLimInset } -MathInset * MathLimInset::clone() const +InsetBase * MathLimInset::clone() const { return new MathLimInset(*this); } diff --git a/src/mathed/math_liminset.h b/src/mathed/math_liminset.h index 18817748f0..87469aff51 100644 --- a/src/mathed/math_liminset.h +++ b/src/mathed/math_liminset.h @@ -13,7 +13,7 @@ public: /// MathLimInset(MathArray const & f, MathArray const & x, MathArray const & x0); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 8d07cf8e79..7ec87a11fc 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -44,7 +44,7 @@ MathMacro::MathMacro(MathMacro const & m) -MathInset * MathMacro::clone() const +InsetBase * MathMacro::clone() const { return new MathMacro(*this); } diff --git a/src/mathed/math_macro.h b/src/mathed/math_macro.h index ec22720880..94395953a9 100644 --- a/src/mathed/math_macro.h +++ b/src/mathed/math_macro.h @@ -43,7 +43,7 @@ public: /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// - MathInset * clone() const; + InsetBase * clone() const; /// void dump() const; diff --git a/src/mathed/math_macroarg.C b/src/mathed/math_macroarg.C index 0e3ea48aad..58b0c76e48 100644 --- a/src/mathed/math_macroarg.C +++ b/src/mathed/math_macroarg.C @@ -21,7 +21,7 @@ MathMacroArgument::MathMacroArgument(int n) } -MathInset * MathMacroArgument::clone() const +InsetBase * MathMacroArgument::clone() const { return new MathMacroArgument(*this); } diff --git a/src/mathed/math_macroarg.h b/src/mathed/math_macroarg.h index c8f4469592..f04f657239 100644 --- a/src/mathed/math_macroarg.h +++ b/src/mathed/math_macroarg.h @@ -15,7 +15,7 @@ public: /// explicit MathMacroArgument(int); /// - MathInset * clone() const; + InsetBase * clone() const; /// bool isActive() const { return false; } /// diff --git a/src/mathed/math_macrotemplate.C b/src/mathed/math_macrotemplate.C index f5ff5995ad..3f03eeeb8a 100644 --- a/src/mathed/math_macrotemplate.C +++ b/src/mathed/math_macrotemplate.C @@ -37,7 +37,7 @@ MathMacroTemplate::MathMacroTemplate(std::istream & is) } -MathInset * MathMacroTemplate::clone() const +InsetBase * MathMacroTemplate::clone() const { //lyxerr << "cloning MacroTemplate!\n"; return new MathMacroTemplate(*this); diff --git a/src/mathed/math_macrotemplate.h b/src/mathed/math_macrotemplate.h index 4e0677a478..405eeb3311 100644 --- a/src/mathed/math_macrotemplate.h +++ b/src/mathed/math_macrotemplate.h @@ -25,7 +25,7 @@ public: /// explicit MathMacroTemplate(std::istream & is); /// - MathInset * clone() const; + InsetBase * clone() const; /// void write(WriteStream & os) const; /// Number of arguments diff --git a/src/mathed/math_makeboxinset.C b/src/mathed/math_makeboxinset.C index 9e57932be7..40bf9557bd 100644 --- a/src/mathed/math_makeboxinset.C +++ b/src/mathed/math_makeboxinset.C @@ -17,7 +17,7 @@ MathMakeboxInset::MathMakeboxInset() {} -MathInset * MathMakeboxInset::clone() const +InsetBase * MathMakeboxInset::clone() const { return new MathMakeboxInset(*this); } diff --git a/src/mathed/math_makeboxinset.h b/src/mathed/math_makeboxinset.h index 805bdd4960..6b308bb606 100644 --- a/src/mathed/math_makeboxinset.h +++ b/src/mathed/math_makeboxinset.h @@ -21,7 +21,7 @@ public: /// MathMakeboxInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_matrixinset.C b/src/mathed/math_matrixinset.C index 37db699ed6..d515da77d2 100644 --- a/src/mathed/math_matrixinset.C +++ b/src/mathed/math_matrixinset.C @@ -10,7 +10,7 @@ MathMatrixInset::MathMatrixInset(MathGridInset const & p) {} -MathInset * MathMatrixInset::clone() const +InsetBase * MathMatrixInset::clone() const { return new MathMatrixInset(*this); } diff --git a/src/mathed/math_matrixinset.h b/src/mathed/math_matrixinset.h index 30ba7b5f9d..08c27545c2 100644 --- a/src/mathed/math_matrixinset.h +++ b/src/mathed/math_matrixinset.h @@ -14,7 +14,7 @@ public: /// MathMatrixInset(string const & str); /// - MathInset * clone() const; + InsetBase * clone() const; /// identifies MatrixInsets MathMatrixInset const * asMatrixInset() const { return this; } diff --git a/src/mathed/math_numberinset.C b/src/mathed/math_numberinset.C index 669a84bf4e..423912308f 100644 --- a/src/mathed/math_numberinset.C +++ b/src/mathed/math_numberinset.C @@ -13,7 +13,7 @@ MathNumberInset::MathNumberInset(string const & s) {} -MathInset * MathNumberInset::clone() const +InsetBase * MathNumberInset::clone() const { return new MathNumberInset(*this); } diff --git a/src/mathed/math_numberinset.h b/src/mathed/math_numberinset.h index 68a4cd5b4b..93a6e49fb2 100644 --- a/src/mathed/math_numberinset.h +++ b/src/mathed/math_numberinset.h @@ -17,7 +17,7 @@ public: /// explicit MathNumberInset(string const & s); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_parboxinset.C b/src/mathed/math_parboxinset.C index 5f41f1fa8b..65b6a17b83 100644 --- a/src/mathed/math_parboxinset.C +++ b/src/mathed/math_parboxinset.C @@ -13,7 +13,7 @@ MathParboxInset::MathParboxInset() } -MathInset * MathParboxInset::clone() const +InsetBase * MathParboxInset::clone() const { return new MathParboxInset(*this); } diff --git a/src/mathed/math_parboxinset.h b/src/mathed/math_parboxinset.h index dc8e0d4d8a..4fcacc9e79 100644 --- a/src/mathed/math_parboxinset.h +++ b/src/mathed/math_parboxinset.h @@ -13,7 +13,7 @@ public: /// MathParboxInset * asParboxInset() { return this; } /// - MathInset * clone() const; + InsetBase * clone() const; /// mode_type currentMode() const { return TEXT_MODE; } /// diff --git a/src/mathed/math_pos.C b/src/mathed/math_pos.C index 3ed162d8b8..a49bfa1a24 100644 --- a/src/mathed/math_pos.C +++ b/src/mathed/math_pos.C @@ -7,67 +7,67 @@ #include "support/LOstream.h" -MathCursorPos::MathCursorPos() - : par_(0), idx_(0), pos_(0) +CursorPos::CursorPos() + : inset_(0), idx_(0), pos_(0) {} -MathCursorPos::MathCursorPos(MathInset * p) - : par_(p), idx_(0), pos_(0) +CursorPos::CursorPos(MathInset * p) + : inset_(p), idx_(0), pos_(0) { - lyx::Assert(par_); + lyx::Assert(inset_); } -MathArray & MathCursorPos::cell(MathArray::idx_type idx) const +MathArray & CursorPos::cell(MathArray::idx_type idx) const { - lyx::Assert(par_); - return par_->cell(idx); + lyx::Assert(inset_); + return inset_->cell(idx); } -MathArray & MathCursorPos::cell() const +MathArray & CursorPos::cell() const { - lyx::Assert(par_); - return par_->cell(idx_); + lyx::Assert(inset_); + return inset_->cell(idx_); } -void MathCursorPos::getPos(int & x, int & y) const +void CursorPos::getPos(int & x, int & y) const { - par_->getPos(idx_, pos_, x, y); + inset_->getPos(idx_, pos_, x, y); } -void MathCursorPos::setPos(MathArray::pos_type pos) +void CursorPos::setPos(MathArray::pos_type pos) { pos_ = pos; } -std::ostream & operator<<(std::ostream & os, MathCursorPos const & p) +std::ostream & operator<<(std::ostream & os, CursorPos const & p) { - os << "(par: " << p.par_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ')'; + os << "(par: " << p.inset_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ')'; return os; } -bool operator==(MathCursorPos const & p, MathCursorPos const & q) +bool operator==(CursorPos const & p, CursorPos const & q) { - return p.par_ == q.par_ && p.idx_ == q.idx_ && p.pos_ == q.pos_; + return p.inset_ == q.inset_ && p.idx_ == q.idx_ && p.pos_ == q.pos_; } -bool operator!=(MathCursorPos const & p, MathCursorPos const & q) +bool operator!=(CursorPos const & p, CursorPos const & q) { - return p.par_ != q.par_ || p.idx_ != q.idx_ || p.pos_ != q.pos_; + return p.inset_ != q.inset_ || p.idx_ != q.idx_ || p.pos_ != q.pos_; } -bool operator<(MathCursorPos const & p, MathCursorPos const & q) +bool operator<(CursorPos const & p, CursorPos const & q) { - if (p.par_ != q.par_) { + if (p.inset_ != q.inset_) { lyxerr << "can't compare cursor and anchor in different insets\n"; return true; } diff --git a/src/mathed/math_pos.h b/src/mathed/math_pos.h index 85198c782f..4c79faa3cc 100644 --- a/src/mathed/math_pos.h +++ b/src/mathed/math_pos.h @@ -7,12 +7,12 @@ /// Description of a position -class MathCursorPos { +class CursorPos { public: /// - MathCursorPos(); + CursorPos(); /// - explicit MathCursorPos(MathInset *); + explicit CursorPos(MathInset *); /// returns cell corresponding to this position MathArray & cell() const; @@ -25,7 +25,7 @@ public: public: /// pointer to an inset - MathInset * par_; + MathInset * inset_; /// cell index of a position in this inset MathArray::idx_type idx_; /// position in this cell @@ -33,12 +33,12 @@ public: }; /// test for equality -bool operator==(MathCursorPos const &, MathCursorPos const &); +bool operator==(CursorPos const &, CursorPos const &); /// test for inequality -bool operator!=(MathCursorPos const &, MathCursorPos const &); +bool operator!=(CursorPos const &, CursorPos const &); /// test for order -bool operator<(MathCursorPos const &, MathCursorPos const &); +bool operator<(CursorPos const &, CursorPos const &); /// output -std::ostream & operator<<(std::ostream &, MathCursorPos const &); +std::ostream & operator<<(std::ostream &, CursorPos const &); #endif diff --git a/src/mathed/math_rootinset.C b/src/mathed/math_rootinset.C index 18aafd84f0..c0530c6ba3 100644 --- a/src/mathed/math_rootinset.C +++ b/src/mathed/math_rootinset.C @@ -25,7 +25,7 @@ MathRootInset::MathRootInset() {} -MathInset * MathRootInset::clone() const +InsetBase * MathRootInset::clone() const { return new MathRootInset(*this); } diff --git a/src/mathed/math_rootinset.h b/src/mathed/math_rootinset.h index d72db051c3..08402f54aa 100644 --- a/src/mathed/math_rootinset.h +++ b/src/mathed/math_rootinset.h @@ -29,7 +29,7 @@ public: /// MathRootInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const; /// diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 67de499710..83d7c79896 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -37,7 +37,7 @@ MathScriptInset::MathScriptInset(MathAtom const & at, bool up) -MathInset * MathScriptInset::clone() const +InsetBase * MathScriptInset::clone() const { return new MathScriptInset(*this); } diff --git a/src/mathed/math_scriptinset.h b/src/mathed/math_scriptinset.h index 5a411e71e1..c7d4ddb28e 100644 --- a/src/mathed/math_scriptinset.h +++ b/src/mathed/math_scriptinset.h @@ -20,7 +20,7 @@ public: /// create inset with single script and given nucleus MathScriptInset(MathAtom const & at, bool up); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_sizeinset.C b/src/mathed/math_sizeinset.C index 4d77161c46..f6e472a108 100644 --- a/src/mathed/math_sizeinset.C +++ b/src/mathed/math_sizeinset.C @@ -15,7 +15,7 @@ MathSizeInset::MathSizeInset(latexkeys const * l) {} -MathInset * MathSizeInset::clone() const +InsetBase * MathSizeInset::clone() const { return new MathSizeInset(*this); } diff --git a/src/mathed/math_sizeinset.h b/src/mathed/math_sizeinset.h index 05bc74d236..6954884829 100644 --- a/src/mathed/math_sizeinset.h +++ b/src/mathed/math_sizeinset.h @@ -19,7 +19,7 @@ public: /// explicit MathSizeInset(latexkeys const * l); /// - MathInset * clone() const; + InsetBase * clone() const; /// we write extra braces in any case... bool extraBraces() const { return true; } /// diff --git a/src/mathed/math_spaceinset.C b/src/mathed/math_spaceinset.C index 0d2ee4e7cc..677394fef7 100644 --- a/src/mathed/math_spaceinset.C +++ b/src/mathed/math_spaceinset.C @@ -32,7 +32,7 @@ MathSpaceInset::MathSpaceInset(string const & name) } -MathInset * MathSpaceInset::clone() const +InsetBase * MathSpaceInset::clone() const { return new MathSpaceInset(*this); } diff --git a/src/mathed/math_spaceinset.h b/src/mathed/math_spaceinset.h index 75c8fbe8bd..4098ebfe05 100644 --- a/src/mathed/math_spaceinset.h +++ b/src/mathed/math_spaceinset.h @@ -13,7 +13,7 @@ public: /// explicit MathSpaceInset(string const & name); /// - MathInset * clone() const; + InsetBase * clone() const; /// MathSpaceInset const * asSpaceInset() const { return this; } /// diff --git a/src/mathed/math_splitinset.C b/src/mathed/math_splitinset.C index 36be6878a1..34e3688947 100644 --- a/src/mathed/math_splitinset.C +++ b/src/mathed/math_splitinset.C @@ -11,7 +11,7 @@ MathSplitInset::MathSplitInset(string const & name) } -MathInset * MathSplitInset::clone() const +InsetBase * MathSplitInset::clone() const { return new MathSplitInset(*this); } diff --git a/src/mathed/math_splitinset.h b/src/mathed/math_splitinset.h index 6ae28c861a..2d89f264a0 100644 --- a/src/mathed/math_splitinset.h +++ b/src/mathed/math_splitinset.h @@ -12,7 +12,7 @@ public: /// explicit MathSplitInset(string const & name); /// - MathInset * clone() const; + InsetBase * clone() const; /// void write(WriteStream & os) const; /// diff --git a/src/mathed/math_sqrtinset.C b/src/mathed/math_sqrtinset.C index b1bcb84d8f..bc642c06a8 100644 --- a/src/mathed/math_sqrtinset.C +++ b/src/mathed/math_sqrtinset.C @@ -11,7 +11,7 @@ MathSqrtInset::MathSqrtInset() {} -MathInset * MathSqrtInset::clone() const +InsetBase * MathSqrtInset::clone() const { return new MathSqrtInset(*this); } diff --git a/src/mathed/math_sqrtinset.h b/src/mathed/math_sqrtinset.h index 40aa6e8b35..74c9901d7b 100644 --- a/src/mathed/math_sqrtinset.h +++ b/src/mathed/math_sqrtinset.h @@ -15,7 +15,7 @@ public: /// MathSqrtInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void draw(PainterInfo &, int x, int y) const; /// diff --git a/src/mathed/math_stackrelinset.C b/src/mathed/math_stackrelinset.C index 4e03e7258b..39b8ee61e2 100644 --- a/src/mathed/math_stackrelinset.C +++ b/src/mathed/math_stackrelinset.C @@ -11,7 +11,7 @@ MathStackrelInset::MathStackrelInset() {} -MathInset * MathStackrelInset::clone() const +InsetBase * MathStackrelInset::clone() const { return new MathStackrelInset(*this); } diff --git a/src/mathed/math_stackrelinset.h b/src/mathed/math_stackrelinset.h index 2474c4929c..b7dbb9eab9 100644 --- a/src/mathed/math_stackrelinset.h +++ b/src/mathed/math_stackrelinset.h @@ -15,7 +15,7 @@ public: /// MathStackrelInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_stringinset.C b/src/mathed/math_stringinset.C index 915c7d3b1a..6899b31089 100644 --- a/src/mathed/math_stringinset.C +++ b/src/mathed/math_stringinset.C @@ -13,7 +13,7 @@ MathStringInset::MathStringInset(string const & s) {} -MathInset * MathStringInset::clone() const +InsetBase * MathStringInset::clone() const { return new MathStringInset(*this); } diff --git a/src/mathed/math_stringinset.h b/src/mathed/math_stringinset.h index a449a99fde..1b36519b13 100644 --- a/src/mathed/math_stringinset.h +++ b/src/mathed/math_stringinset.h @@ -17,7 +17,7 @@ public: /// explicit MathStringInset(string const & s); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_substackinset.C b/src/mathed/math_substackinset.C index 5da53cb4bf..3f31105a58 100644 --- a/src/mathed/math_substackinset.C +++ b/src/mathed/math_substackinset.C @@ -11,7 +11,7 @@ MathSubstackInset::MathSubstackInset() {} -MathInset * MathSubstackInset::clone() const +InsetBase * MathSubstackInset::clone() const { return new MathSubstackInset(*this); } diff --git a/src/mathed/math_substackinset.h b/src/mathed/math_substackinset.h index 4d7b8fabf6..93e2f552ea 100644 --- a/src/mathed/math_substackinset.h +++ b/src/mathed/math_substackinset.h @@ -12,7 +12,7 @@ public: /// MathSubstackInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_symbolinset.C b/src/mathed/math_symbolinset.C index de090d83ab..85df4b3723 100644 --- a/src/mathed/math_symbolinset.C +++ b/src/mathed/math_symbolinset.C @@ -28,7 +28,7 @@ MathSymbolInset::MathSymbolInset(string const & name) -MathInset * MathSymbolInset::clone() const +InsetBase * MathSymbolInset::clone() const { return new MathSymbolInset(*this); } diff --git a/src/mathed/math_symbolinset.h b/src/mathed/math_symbolinset.h index f33def2b1c..cb5a9d5915 100644 --- a/src/mathed/math_symbolinset.h +++ b/src/mathed/math_symbolinset.h @@ -19,7 +19,7 @@ public: /// explicit MathSymbolInset(string const &); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_tabularinset.C b/src/mathed/math_tabularinset.C index 7f506bc040..31d24f176f 100644 --- a/src/mathed/math_tabularinset.C +++ b/src/mathed/math_tabularinset.C @@ -33,7 +33,7 @@ MathTabularInset::MathTabularInset(string const & name, char valign, {} -MathInset * MathTabularInset::clone() const +InsetBase * MathTabularInset::clone() const { return new MathTabularInset(*this); } diff --git a/src/mathed/math_tabularinset.h b/src/mathed/math_tabularinset.h index 62fa37fbaf..acf619078f 100644 --- a/src/mathed/math_tabularinset.h +++ b/src/mathed/math_tabularinset.h @@ -23,7 +23,7 @@ public: /// MathTabularInset(string const &, char valign, string const & halign); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_textinset.C b/src/mathed/math_textinset.C index bc7c9a74f5..e376f93b9c 100644 --- a/src/mathed/math_textinset.C +++ b/src/mathed/math_textinset.C @@ -9,7 +9,7 @@ MathTextInset::MathTextInset() {} -MathInset * MathTextInset::clone() const +InsetBase * MathTextInset::clone() const { return new MathTextInset(*this); } diff --git a/src/mathed/math_textinset.h b/src/mathed/math_textinset.h index d276d16f70..dca293bbda 100644 --- a/src/mathed/math_textinset.h +++ b/src/mathed/math_textinset.h @@ -11,7 +11,7 @@ public: /// MathTextInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// get cursor position void getPos(idx_type idx, pos_type pos, int & x, int & y) const; /// this stores metrics information in cache_ diff --git a/src/mathed/math_undersetinset.C b/src/mathed/math_undersetinset.C index 93335d3e16..03441d8f97 100644 --- a/src/mathed/math_undersetinset.C +++ b/src/mathed/math_undersetinset.C @@ -11,7 +11,7 @@ MathUndersetInset::MathUndersetInset() {} -MathInset * MathUndersetInset::clone() const +InsetBase * MathUndersetInset::clone() const { return new MathUndersetInset(*this); } diff --git a/src/mathed/math_undersetinset.h b/src/mathed/math_undersetinset.h index c4004af554..3f248fd5b5 100644 --- a/src/mathed/math_undersetinset.h +++ b/src/mathed/math_undersetinset.h @@ -18,7 +18,7 @@ public: /// MathUndersetInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_unknowninset.C b/src/mathed/math_unknowninset.C index bda6e8d7bf..26fdbafa6b 100644 --- a/src/mathed/math_unknowninset.C +++ b/src/mathed/math_unknowninset.C @@ -12,7 +12,7 @@ MathUnknownInset::MathUnknownInset(string const & nm, bool final, bool black) {} -MathInset * MathUnknownInset::clone() const +InsetBase * MathUnknownInset::clone() const { return new MathUnknownInset(*this); } diff --git a/src/mathed/math_unknowninset.h b/src/mathed/math_unknowninset.h index 6270cdcaeb..49742422dd 100644 --- a/src/mathed/math_unknowninset.h +++ b/src/mathed/math_unknowninset.h @@ -13,7 +13,7 @@ public: explicit MathUnknownInset(string const & name, bool final = true, bool black = false); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/math_xarrowinset.C b/src/mathed/math_xarrowinset.C index 7add8d2715..4db1538125 100644 --- a/src/mathed/math_xarrowinset.C +++ b/src/mathed/math_xarrowinset.C @@ -12,7 +12,7 @@ MathXArrowInset::MathXArrowInset(string const & name) {} -MathInset * MathXArrowInset::clone() const +InsetBase * MathXArrowInset::clone() const { return new MathXArrowInset(*this); } diff --git a/src/mathed/math_xarrowinset.h b/src/mathed/math_xarrowinset.h index 21d1fcece1..6039b9d18c 100644 --- a/src/mathed/math_xarrowinset.h +++ b/src/mathed/math_xarrowinset.h @@ -17,7 +17,7 @@ public: /// explicit MathXArrowInset(string const & name); /// - MathInset * clone() const; + InsetBase * clone() const; /// void draw(PainterInfo & pi, int x, int y) const; /// diff --git a/src/mathed/math_xyarrowinset.C b/src/mathed/math_xyarrowinset.C index 3f812214da..2935ff3d62 100644 --- a/src/mathed/math_xyarrowinset.C +++ b/src/mathed/math_xyarrowinset.C @@ -18,7 +18,7 @@ MathXYArrowInset::MathXYArrowInset() {} -MathInset * MathXYArrowInset::clone() const +InsetBase * MathXYArrowInset::clone() const { return new MathXYArrowInset(*this); } diff --git a/src/mathed/math_xyarrowinset.h b/src/mathed/math_xyarrowinset.h index 950db5540b..5bff4211f0 100644 --- a/src/mathed/math_xyarrowinset.h +++ b/src/mathed/math_xyarrowinset.h @@ -15,7 +15,7 @@ public: /// MathXYArrowInset(); /// - MathInset * clone() const; + InsetBase * clone() const; /// void metrics(MetricsInfo & mi) const; /// diff --git a/src/mathed/ref_inset.C b/src/mathed/ref_inset.C index 77009c80ba..aacc6c34eb 100644 --- a/src/mathed/ref_inset.C +++ b/src/mathed/ref_inset.C @@ -27,7 +27,7 @@ RefInset::RefInset(string const & data) {} -MathInset * RefInset::clone() const +InsetBase * RefInset::clone() const { return new RefInset(*this); } diff --git a/src/mathed/ref_inset.h b/src/mathed/ref_inset.h index 7bd24ac4dc..c9deda5eb2 100644 --- a/src/mathed/ref_inset.h +++ b/src/mathed/ref_inset.h @@ -12,7 +12,7 @@ public: /// explicit RefInset(string const & data); /// - MathInset * clone() const; + InsetBase * clone() const; /// //void write(WriteStream & os) const; /// diff --git a/src/paragraph.C b/src/paragraph.C index 5d711ee3c0..ceb72f6847 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -90,7 +90,8 @@ Paragraph::Paragraph(Paragraph const & lp) InsetList::iterator it = insetlist.begin(); InsetList::iterator end = insetlist.end(); for (; it != end; ++it) { - it->inset = it->inset->clone(); + // currently we hold Inset*, not InsetBase* + it->inset = static_cast(it->inset->clone()); // tell the new inset who is the boss now it->inset->parOwner(this); } @@ -117,7 +118,7 @@ void Paragraph::operator=(Paragraph const & lp) InsetList::iterator it = insetlist.begin(); InsetList::iterator end = insetlist.end(); for (; it != end; ++it) { - it->inset = it->inset->clone(); + it->inset = static_cast(it->inset->clone()); // tell the new inset who is the boss now it->inset->parOwner(this); } @@ -256,7 +257,7 @@ void Paragraph::copyIntoMinibuffer(Buffer const & buffer, pos_type pos) const minibuffer_inset = 0; if (minibuffer_char == Paragraph::META_INSET) { if (getInset(pos)) { - minibuffer_inset = getInset(pos)->clone(); + minibuffer_inset = static_cast(getInset(pos)->clone()); } else { minibuffer_inset = 0; minibuffer_char = ' '; diff --git a/src/tabular.C b/src/tabular.C index 0bba523a1d..b2a60adc34 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -2514,17 +2514,11 @@ void LyXTabular::validate(LaTeXFeatures & features) const } -vector const LyXTabular::getLabelList() const +void LyXTabular::getLabelList(std::vector & list) const { - vector label_list; for (int i = 0; i < rows_; ++i) - for (int j = 0; j < columns_; ++j) { - vector const l = - getCellInset(i, j)->getLabelList(); - label_list.insert(label_list.end(), - l.begin(), l.end()); - } - return label_list; + for (int j = 0; j < columns_; ++j) + getCellInset(i, j)->getLabelList(list); } diff --git a/src/tabular.h b/src/tabular.h index aee7edc487..47008152d7 100644 --- a/src/tabular.h +++ b/src/tabular.h @@ -382,7 +382,7 @@ public: /// void validate(LaTeXFeatures &) const; /// - std::vector const getLabelList() const; + void getLabelList(std::vector &) const; /// /// recalculate the widths/heights only! void reinit(); -- 2.39.2