X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCutAndPaste.C;h=36c863428ff1f183dce6c9092f39c18c789aea12;hb=09e01879979643949f1f2c7216023f1f35d5ada2;hp=9eeebfd8875e39046f3d844b7739248025fa56e9;hpb=5dd63a2768cb994f76018747f370d6dcaadc0942;p=lyx.git diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 9eeebfd887..36c863428f 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -2,8 +2,9 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Jurgen Vigna + * \author Juergen Vigna * \author Lars Gullik Bjønnes + * \author Alfredo Braunstein * * Full author contact details are available in file CREDITS */ @@ -37,6 +38,7 @@ using std::make_pair; using std::for_each; using std::vector; +using namespace lyx::support; using lyx::pos_type; using lyx::textclass_type; @@ -49,7 +51,8 @@ CutStack cuts(10); } // namespace anon -vector + +std::vector CutAndPaste::availableSelections(Buffer const & buffer) { vector selList; @@ -57,9 +60,21 @@ CutAndPaste::availableSelections(Buffer const & buffer) CutStack::const_iterator cit = cuts.begin(); CutStack::const_iterator end = cuts.end(); for (; cit != end; ++cit) { - ParagraphList const & pars = cit->first; - string asciiPar(pars.front().asString(&buffer, false), 0, 25); - selList.push_back(asciiPar); + // we do not use cit-> here because gcc 2.9x does not + // like it (JMarc) + ParagraphList const & pars = (*cit).first; + string asciiSel; + ParagraphList::const_iterator pit = pars.begin(); + ParagraphList::const_iterator pend = pars.end(); + for (; pit != pend; ++pit) { + asciiSel += pit->asString(&buffer, false); + if (asciiSel.size() > 25) { + asciiSel.replace(22, string::npos, "..."); + break; + } + } + + selList.push_back(asciiSel); } return selList; @@ -166,11 +181,9 @@ bool CutAndPaste::copySelection(ParagraphList::iterator startpit, ParagraphList::iterator endpit, int start, int end, textclass_type tc) { - lyx::Assert(&*startpit); - lyx::Assert(&*endpit); - lyx::Assert(0 <= start && start <= startpit->size()); - lyx::Assert(0 <= end && end <= endpit->size()); - lyx::Assert(startpit != endpit || start <= end); + Assert(0 <= start && start <= startpit->size()); + Assert(0 <= end && end <= endpit->size()); + Assert(startpit != endpit || start <= end); ParagraphList paragraphs; @@ -215,7 +228,7 @@ CutAndPaste::pasteSelection(Buffer const & buffer, if (!checkPastePossible()) return make_pair(PitPosPair(pit, pos), pit); - lyx::Assert (pos <= pit->size()); + Assert (pos <= pit->size()); // Make a copy of the CaP paragraphs. ParagraphList simple_cut_clone = cuts[cut_index].first; @@ -287,7 +300,7 @@ CutAndPaste::pasteSelection(Buffer const & buffer, for (; lit != eit; ++lit) { switch (lit->inset->lyxCode()) { - case Inset::INCLUDE_CODE: { + case InsetOld::INCLUDE_CODE: { InsetInclude * ii = static_cast(lit->inset); InsetInclude::Params ip = ii->params(); ip.masterFilename_ = buffer.fileName(); @@ -295,7 +308,7 @@ CutAndPaste::pasteSelection(Buffer const & buffer, break; } - case Inset::TABULAR_CODE: { + case InsetOld::TABULAR_CODE: { InsetTabular * it = static_cast(lit->inset); it->buffer(const_cast(&buffer)); break; @@ -370,7 +383,7 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1, ParagraphList & pars, ErrorList & errorlist) { - lyx::Assert(!pars.empty()); + Assert(!pars.empty()); int ret = 0; if (c1 == c2)