From 6725b2db59fbc23f08962c187c5aac283fe9efbb Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 18 Oct 2007 15:29:51 +0000 Subject: [PATCH] Reduce header dependencies in Paragraph.h - Move Changes.h out of Paragraph.h - pimpl the inset list. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21033 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 3 +- src/CutAndPaste.cpp | 6 ++- src/DocIterator.cpp | 5 +- src/InsetList.cpp | 8 +++ src/InsetList.h | 6 ++- src/Paragraph.cpp | 100 ++++++++++++++++++++++++----------- src/Paragraph.h | 45 ++++++++-------- src/Text.cpp | 1 + src/Text2.cpp | 1 + src/TextMetrics.cpp | 13 ++--- src/TocBackend.cpp | 9 ++-- src/buffer_funcs.cpp | 5 +- src/insets/Inset.h | 4 +- src/insets/InsetListings.cpp | 12 +++-- src/insets/InsetText.cpp | 5 +- src/lyxfind.cpp | 1 + src/output_latex.cpp | 5 +- src/paragraph_funcs.cpp | 12 ++--- src/rowpainter.cpp | 1 + 19 files changed, 155 insertions(+), 87 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index e24d3e3857..03632c41b7 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -30,6 +30,7 @@ #include "FuncRequest.h" #include "gettext.h" #include "InsetIterator.h" +#include "InsetList.h" #include "Language.h" #include "LaTeX.h" #include "LaTeXFeatures.h" @@ -1801,7 +1802,7 @@ void Buffer::buildMacros() for (size_t i = 0, n = pars.size(); i != n; ++i) { //lyxerr << "searching main par " << i // << " for macro definitions" << std::endl; - InsetList const & insets = pars[i].insetlist; + InsetList const & insets = pars[i].insetList(); InsetList::const_iterator it = insets.begin(); InsetList::const_iterator end = insets.end(); for ( ; it != end; ++it) { diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 63fa7ccdae..f7aca651f0 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -19,12 +19,14 @@ #include "buffer_funcs.h" #include "BufferParams.h" #include "BufferView.h" +#include "Changes.h" #include "Cursor.h" #include "debug.h" #include "ErrorList.h" #include "FuncRequest.h" #include "gettext.h" #include "InsetIterator.h" +#include "InsetList.h" #include "Language.h" #include "lfuns.h" #include "LyXFunc.h" @@ -218,8 +220,8 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, ParIterator fend = par_iterator_end(in); for (; fpit != fend; ++fpit) { - InsetList::const_iterator lit = fpit->insetlist.begin(); - InsetList::const_iterator eit = fpit->insetlist.end(); + InsetList::const_iterator lit = fpit->insetList().begin(); + InsetList::const_iterator eit = fpit->insetList().end(); for (; lit != eit; ++lit) { switch (lit->inset->lyxCode()) { diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index 7bfc2fb1f5..7b7a59d201 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -15,8 +15,9 @@ #include "DocIterator.h" #include "debug.h" -#include "Text.h" +#include "InsetList.h" #include "Paragraph.h" +#include "Text.h" #include "mathed/MathData.h" #include "mathed/InsetMath.h" @@ -303,7 +304,7 @@ void DocIterator::forwardPar() pos_type const lastp = lastpos(); Paragraph const & par = paragraph(); pos_type & pos = top().pos(); - if (par.insetlist.empty()) + if (par.insetList().empty()) pos = lastp; else while (pos < lastp && !par.isInset(pos)) diff --git a/src/InsetList.cpp b/src/InsetList.cpp index c34677be07..50c40f710d 100644 --- a/src/InsetList.cpp +++ b/src/InsetList.cpp @@ -138,4 +138,12 @@ void InsetList::decreasePosAfterPos(pos_type pos) } +void InsetList::clone() +{ + List::iterator it = list_.begin(); + List::iterator end = list_.end(); + for (; it != end; ++it) + it->inset = it->inset->clone(); +} + } // namespace lyx diff --git a/src/InsetList.h b/src/InsetList.h index 13beeb0b9c..aa99aeb4af 100644 --- a/src/InsetList.h +++ b/src/InsetList.h @@ -22,7 +22,6 @@ namespace lyx { class Inset; class Buffer; - /// class InsetList { public: @@ -72,6 +71,11 @@ public: /// void decreasePosAfterPos(pos_type pos); + /// replicate ourselves. + /// Warning: this should be used with care, only + /// Paragraph::Pimpl should use it actually. + void clone(); + private: /// List list_; diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 9bd4e6e0b5..104c31dac9 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -21,10 +21,12 @@ #include "Buffer.h" #include "BufferParams.h" +#include "Changes.h" #include "Counters.h" #include "Encoding.h" #include "debug.h" #include "gettext.h" +#include "InsetList.h" #include "Language.h" #include "LaTeXFeatures.h" #include "Color.h" @@ -229,6 +231,9 @@ public: /// Who owns us? Paragraph * owner_; + + /// + InsetList insetlist_; }; @@ -277,6 +282,8 @@ Paragraph::Pimpl::Pimpl(Pimpl const & p, Paragraph * owner) inset_owner = p.inset_owner; fontlist = p.fontlist; id_ = paragraph_id++; + insetlist_ = p.insetlist_; + insetlist_.clone(); } @@ -461,7 +468,7 @@ void Paragraph::Pimpl::insertChar(pos_type pos, value_type c, Change const & cha } // Update the insets - owner_->insetlist.increasePosAfterPos(pos); + insetlist_.increasePosAfterPos(pos); } @@ -474,8 +481,8 @@ void Paragraph::Pimpl::insertInset(pos_type pos, Inset * inset, insertChar(pos, META_INSET, change); BOOST_ASSERT(owner_->text_[pos] == META_INSET); - // Add a new entry in the insetlist. - owner_->insetlist.insert(inset, pos); + // Add a new entry in the insetlist_. + insetlist_.insert(inset, pos); } @@ -514,7 +521,7 @@ bool Paragraph::Pimpl::eraseChar(pos_type pos, bool trackChanges) // if it is an inset, delete the inset entry if (owner_->text_[pos] == Paragraph::META_INSET) { - owner_->insetlist.erase(pos); + insetlist_.erase(pos); } owner_->text_.erase(owner_->text_.begin() + pos); @@ -549,8 +556,8 @@ bool Paragraph::Pimpl::eraseChar(pos_type pos, bool trackChanges) for (; it != fend; ++it) it->pos(it->pos() - 1); - // Update the insetlist - owner_->insetlist.decreasePosAfterPos(pos); + // Update the insetlist_ + insetlist_.decreasePosAfterPos(pos); return true; } @@ -1104,8 +1111,8 @@ void Paragraph::Pimpl::validate(LaTeXFeatures & features, features.require("ParagraphLeftIndent"); // then the insets - InsetList::const_iterator icit = owner_->insetlist.begin(); - InsetList::const_iterator iend = owner_->insetlist.end(); + InsetList::const_iterator icit = insetlist_.begin(); + InsetList::const_iterator iend = insetlist_.end(); for (; icit != iend; ++icit) { if (icit->inset) { icit->inset->validate(features); @@ -1149,16 +1156,11 @@ Paragraph::Paragraph() Paragraph::Paragraph(Paragraph const & par) - : itemdepth(par.itemdepth), insetlist(par.insetlist), + : itemdepth(par.itemdepth), layout_(par.layout_), text_(par.text_), begin_of_body_(par.begin_of_body_), pimpl_(new Paragraph::Pimpl(*par.pimpl_, this)) { - //lyxerr << "Paragraph::Paragraph(Paragraph const&)" << endl; - InsetList::iterator it = insetlist.begin(); - InsetList::iterator end = insetlist.end(); - for (; it != end; ++it) - it->inset = it->inset->clone(); } @@ -1167,13 +1169,6 @@ Paragraph & Paragraph::operator=(Paragraph const & par) // needed as we will destroy the pimpl_ before copying it if (&par != this) { itemdepth = par.itemdepth; - - insetlist = par.insetlist; - InsetList::iterator it = insetlist.begin(); - InsetList::iterator end = insetlist.end(); - for (; it != end; ++it) - it->inset = it->inset->clone(); - layout_ = par.layout(); text_ = par.text_; begin_of_body_ = par.begin_of_body_; @@ -1804,8 +1799,8 @@ void Paragraph::setBeginOfBody() int Paragraph::getPositionOfInset(Inset const * inset) const { // Find the entry. - InsetList::const_iterator it = insetlist.begin(); - InsetList::const_iterator end = insetlist.end(); + InsetList::const_iterator it = pimpl_->insetlist_.begin(); + InsetList::const_iterator end = pimpl_->insetlist_.end(); for (; it != end; ++it) if (it->inset == inset) return it->pos; @@ -1815,8 +1810,8 @@ int Paragraph::getPositionOfInset(Inset const * inset) const InsetBibitem * Paragraph::bibitem() const { - if (!insetlist.empty()) { - Inset * inset = insetlist.begin()->inset; + if (!pimpl_->insetlist_.empty()) { + Inset * inset = pimpl_->insetlist_.begin()->inset; if (inset->lyxCode() == BIBITEM_CODE) return static_cast(inset); } @@ -2707,10 +2702,10 @@ int Paragraph::checkBiblio(bool track_changes) if (layout()->labeltype != LABEL_BIBLIO) return 0; - bool hasbibitem = !insetlist.empty() + bool hasbibitem = !pimpl_->insetlist_.empty() // Insist on it being in pos 0 && getChar(0) == Paragraph::META_INSET - && insetlist.begin()->inset->lyxCode() == BIBITEM_CODE; + && pimpl_->insetlist_.begin()->inset->lyxCode() == BIBITEM_CODE; docstring oldkey; docstring oldlabel; @@ -2721,8 +2716,8 @@ int Paragraph::checkBiblio(bool track_changes) // we're assuming there's only one of these, which there // should be. int erasedInsetPosition = -1; - InsetList::iterator it = insetlist.begin(); - InsetList::iterator end = insetlist.end(); + InsetList::iterator it = pimpl_->insetlist_.begin(); + InsetList::iterator end = pimpl_->insetlist_.end(); for (; it != end; ++it) if (it->inset->lyxCode() == BIBITEM_CODE && it->pos > 0) { @@ -2743,7 +2738,7 @@ int Paragraph::checkBiblio(bool track_changes) //erase one. So we give its properties to the beginning inset. if (hasbibitem) { InsetBibitem * inset = - static_cast(insetlist.begin()->inset); + static_cast(pimpl_->insetlist_.begin()->inset); if (!oldkey.empty()) inset->setParam("key", oldkey); inset->setParam("label", oldlabel); @@ -2769,4 +2764,49 @@ void Paragraph::checkAuthors(AuthorList const & authorList) pimpl_->changes_.checkAuthors(authorList); } + +bool Paragraph::isUnchanged(pos_type pos) const +{ + return lookupChange(pos).type == Change::UNCHANGED; +} + + +bool Paragraph::isInserted(pos_type pos) const +{ + return lookupChange(pos).type == Change::INSERTED; +} + + +bool Paragraph::isDeleted(pos_type pos) const +{ + return lookupChange(pos).type == Change::DELETED; +} + + +InsetList const & Paragraph::insetList() const +{ + return pimpl_->insetlist_; +} + + +Inset * Paragraph::releaseInset(pos_type pos) +{ + Inset * inset = pimpl_->insetlist_.release(pos); + /// does not honour change tracking! + eraseChar(pos, false); + return inset; +} + + +Inset * Paragraph::getInset(pos_type pos) +{ + return pimpl_->insetlist_.get(pos); +} + + +Inset const * Paragraph::getInset(pos_type pos) const +{ + return pimpl_->insetlist_.get(pos); +} + } // namespace lyx diff --git a/src/Paragraph.h b/src/Paragraph.h index 9059e2963a..4e8a3d9f79 100644 --- a/src/Paragraph.h +++ b/src/Paragraph.h @@ -16,23 +16,29 @@ #ifndef PARAGRAPH_H #define PARAGRAPH_H -#include "Changes.h" -#include "InsetList.h" #include "lyxlayout_ptr_fwd.h" #include "insets/InsetCode.h" +#include "support/docstring.h" +// FIXME: would be nice to forward declare odocstream instead of +// including this: +#include "support/docstream.h" + +#include namespace lyx { - +class AuthorList; class Buffer; class BufferParams; +class Change; class Counters; class Inset; class InsetBibitem; class LaTeXFeatures; class Inset_code; +class InsetList; class Language; class Font; class Font_size; @@ -186,17 +192,11 @@ public: /// is there a change within the given range ? bool isChanged(pos_type start, pos_type end) const; /// is there an unchanged char at the given pos ? - bool isUnchanged(pos_type pos) const { - return lookupChange(pos).type == Change::UNCHANGED; - } + bool isUnchanged(pos_type pos) const; /// is there an insertion at the given pos ? - bool isInserted(pos_type pos) const { - return lookupChange(pos).type == Change::INSERTED; - } + bool isInserted(pos_type pos) const; /// is there a deletion at the given pos ? - bool isDeleted(pos_type pos) const { - return lookupChange(pos).type == Change::DELETED; - } + bool isDeleted(pos_type pos) const; /// will the paragraph be physically merged with the next /// one if the imaginary end-of-par character is logically deleted? @@ -309,13 +309,18 @@ public: /// bool insetAllowed(InsetCode code); /// - Inset * getInset(pos_type pos) { - return insetlist.get(pos); - } + Inset * getInset(pos_type pos); /// - Inset const * getInset(pos_type pos) const { - return insetlist.get(pos); - } + Inset const * getInset(pos_type pos) const; + + /// Release inset at given position. + /// \warning does not honour change tracking! + /// Therefore, it should only be used for breaking and merging + /// paragraphs + Inset * releaseInset(pos_type pos); + + /// + InsetList const & insetList() const; /// bool isHfill(pos_type pos) const; @@ -366,10 +371,6 @@ public: /// by this author in the paragraph. void checkAuthors(AuthorList const & authorList); -public: - /// - InsetList insetlist; - private: /// diff --git a/src/Text.cpp b/src/Text.cpp index 917d797091..456a127d41 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -25,6 +25,7 @@ #include "buffer_funcs.h" #include "BufferParams.h" #include "BufferView.h" +#include "Changes.h" #include "Cursor.h" #include "ParIterator.h" #include "CutAndPaste.h" diff --git a/src/Text2.cpp b/src/Text2.cpp index 2472cda888..86115d5467 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -28,6 +28,7 @@ #include "BufferParams.h" #include "BufferView.h" #include "Bullet.h" +#include "Changes.h" #include "Color.h" #include "Cursor.h" #include "CutAndPaste.h" diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 3dd79c234f..9331a03c73 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -29,6 +29,7 @@ #include "debug.h" #include "FontIterator.h" #include "FuncRequest.h" +#include "InsetList.h" #include "Layout.h" #include "Length.h" #include "LyXRC.h" @@ -381,8 +382,8 @@ bool TextMetrics::redoParagraph(pit_type const pit) // FIXME: We should always use getFont(), see documentation of // noFontChange() in Inset.h. Font const bufferfont = buffer.params().getFont(); - InsetList::const_iterator ii = par.insetlist.begin(); - InsetList::const_iterator iend = par.insetlist.end(); + InsetList::const_iterator ii = par.insetList().begin(); + InsetList::const_iterator iend = par.insetList().end(); for (; ii != iend; ++ii) { Dimension dim; int const w = max_width_ - leftMargin(max_width_, pit, ii->pos) @@ -863,8 +864,8 @@ boost::tuple TextMetrics::rowHeight(pit_type const pit, pos_type const // insets may be taller ParagraphMetrics const & pm = par_metrics_[pit]; - InsetList::const_iterator ii = par.insetlist.begin(); - InsetList::const_iterator iend = par.insetlist.end(); + InsetList::const_iterator ii = par.insetList().begin(); + InsetList::const_iterator iend = par.insetList().end(); for ( ; ii != iend; ++ii) { Dimension const & dim = pm.insetDimension(ii->inset); if (ii->pos >= first && ii->pos < end) { @@ -1411,8 +1412,8 @@ Inset * TextMetrics::checkInsetHit(int x, int y) << " y: " << y << " pit: " << pit << endl; - InsetList::const_iterator iit = par.insetlist.begin(); - InsetList::const_iterator iend = par.insetlist.end(); + InsetList::const_iterator iit = par.insetList().begin(); + InsetList::const_iterator iend = par.insetList().end(); for (; iit != iend; ++iit) { Inset * inset = iit->inset; diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp index a93e9f324c..ba72b747b9 100644 --- a/src/TocBackend.cpp +++ b/src/TocBackend.cpp @@ -19,6 +19,7 @@ #include "debug.h" #include "FloatList.h" #include "FuncRequest.h" +#include "InsetList.h" #include "Layout.h" #include "LyXAction.h" #include "Paragraph.h" @@ -109,8 +110,8 @@ void TocBackend::updateItem(ParConstIterator const & par_it) // For each paragraph, traverse its insets and let them add // their toc items - InsetList::const_iterator it = toc_item->par_it_->insetlist.begin(); - InsetList::const_iterator end = toc_item->par_it_->insetlist.end(); + InsetList::const_iterator it = toc_item->par_it_->insetList().begin(); + InsetList::const_iterator end = toc_item->par_it_->insetList().end(); for (; it != end; ++it) { Inset & inset = *it->inset; if (inset.lyxCode() == OPTARG_CODE) { @@ -152,8 +153,8 @@ void TocBackend::update() // For each paragraph, traverse its insets and let them add // their toc items - InsetList::const_iterator it = pit->insetlist.begin(); - InsetList::const_iterator end = pit->insetlist.end(); + InsetList::const_iterator it = pit->insetList().begin(); + InsetList::const_iterator end = pit->insetList().end(); for (; it != end; ++it) { Inset & inset = *it->inset; inset.addToToc(tocs_, *buffer_, pit); diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp index a8c1c4072d..5ce299e12f 100644 --- a/src/buffer_funcs.cpp +++ b/src/buffer_funcs.cpp @@ -23,6 +23,7 @@ #include "Floating.h" #include "FloatList.h" #include "gettext.h" +#include "InsetList.h" #include "InsetIterator.h" #include "Language.h" #include "LaTeX.h" @@ -575,8 +576,8 @@ void updateLabels(Buffer const & buf, ParIterator & parit) setLabel(buf, parit); // Now the insets - InsetList::const_iterator iit = parit->insetlist.begin(); - InsetList::const_iterator end = parit->insetlist.end(); + InsetList::const_iterator iit = parit->insetList().begin(); + InsetList::const_iterator end = parit->insetList().end(); for (; iit != end; ++iit) { parit.pos() = iit->pos; iit->inset->updateLabels(buf, parit); diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 70a88593c1..7e6995e6fa 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -38,6 +38,7 @@ class FuncRequest; class FuncStatus; class InsetIterator; class InsetLayout; +class InsetList; class InsetMath; class InsetText; class LaTeXFeatures; @@ -46,7 +47,6 @@ class MathAtom; class MetricsInfo; class OutputParams; class PainterInfo; -class Paragraph; class ParConstIterator; class ParIterator; class Text; @@ -391,7 +391,7 @@ protected: Inset(); /// replicate ourselves - friend class Paragraph; + friend class InsetList; friend class MathAtom; virtual Inset * clone() const = 0; diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index 4b5a523e29..e9007fa14d 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -17,13 +17,15 @@ #include "Buffer.h" #include "BufferParams.h" #include "Counters.h" -#include "Language.h" -#include "gettext.h" +#include "Cursor.h" #include "DispatchResult.h" #include "FuncRequest.h" #include "FuncStatus.h" +#include "gettext.h" +#include "InsetList.h" +#include "Language.h" #include "MetricsInfo.h" -#include "Cursor.h" + #include "support/lstrings.h" #include @@ -326,8 +328,8 @@ docstring InsetListings::getCaption(Buffer const & buf, ParagraphList::const_iterator pit = paragraphs().begin(); for (; pit != paragraphs().end(); ++pit) { - InsetList::const_iterator it = pit->insetlist.begin(); - for (; it != pit->insetlist.end(); ++it) { + InsetList::const_iterator it = pit->insetList().begin(); + for (; it != pit->insetList().end(); ++it) { Inset & inset = *it->inset; if (inset.lyxCode() == CAPTION_CODE) { odocstringstream ods; diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 91366ef852..52e9e4970d 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -25,6 +25,7 @@ #include "ErrorList.h" #include "FuncRequest.h" #include "gettext.h" +#include "InsetList.h" #include "Intl.h" #include "Color.h" #include "lyxfind.h" @@ -403,8 +404,8 @@ void InsetText::addPreview(PreviewLoader & loader) const ParagraphList::const_iterator pend = paragraphs().end(); for (; pit != pend; ++pit) { - InsetList::const_iterator it = pit->insetlist.begin(); - InsetList::const_iterator end = pit->insetlist.end(); + InsetList::const_iterator it = pit->insetList().begin(); + InsetList::const_iterator end = pit->insetList().end(); for (; it != end; ++it) it->inset->addPreview(loader); } diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 4da5b14d56..a7fe5a38a9 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -21,6 +21,7 @@ #include "CutAndPaste.h" #include "buffer_funcs.h" #include "BufferView.h" +#include "Changes.h" #include "debug.h" #include "FuncRequest.h" #include "gettext.h" diff --git a/src/output_latex.cpp b/src/output_latex.cpp index a5c0d02df7..4d357131a6 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -16,6 +16,7 @@ #include "BufferParams.h" #include "debug.h" #include "Encoding.h" +#include "InsetList.h" #include "Language.h" #include "Layout.h" #include "LyXRC.h" @@ -223,8 +224,8 @@ int latexOptArgInsets(Buffer const & buf, Paragraph const & par, { int lines = 0; - InsetList::const_iterator it = par.insetlist.begin(); - InsetList::const_iterator end = par.insetlist.end(); + InsetList::const_iterator it = par.insetList().begin(); + InsetList::const_iterator end = par.insetList().end(); for (; it != end && number > 0 ; ++it) { if (it->inset->lyxCode() == OPTARG_CODE) { InsetOptArg * ins = diff --git a/src/paragraph_funcs.cpp b/src/paragraph_funcs.cpp index 0de78ee67b..baf9399573 100644 --- a/src/paragraph_funcs.cpp +++ b/src/paragraph_funcs.cpp @@ -13,11 +13,13 @@ #include "paragraph_funcs.h" #include "BufferParams.h" +#include "Changes.h" #include "debug.h" +#include "InsetList.h" #include "Layout.h" -#include "Text.h" #include "Paragraph.h" #include "ParagraphParameters.h" +#include "Text.h" #include @@ -41,11 +43,9 @@ static bool moveItem(Paragraph & fromPar, pos_type fromPos, Inset * tmpInset = 0; if (fromPar.getInset(fromPos)) { // the inset is not in the paragraph any more - tmpInset = fromPar.insetlist.release(fromPos); + tmpInset = fromPar.releaseInset(fromPos); } - fromPar.eraseChar(fromPos, false); - if (!toPar.insetAllowed(tmpInset->lyxCode())) { delete tmpInset; return false; @@ -313,8 +313,8 @@ int numberOfOptArgs(Paragraph const & par) { int num = 0; - InsetList::const_iterator it = par.insetlist.begin(); - InsetList::const_iterator end = par.insetlist.end(); + InsetList::const_iterator it = par.insetList().begin(); + InsetList::const_iterator end = par.insetList().end(); for (; it != end ; ++it) { if (it->inset->lyxCode() == OPTARG_CODE) ++num; diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index 9ed482c990..ee25609259 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -21,6 +21,7 @@ #include "debug.h" #include "BufferParams.h" #include "BufferView.h" +#include "Changes.h" #include "Encoding.h" #include "gettext.h" #include "Language.h"