X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathHull.cpp;h=6b9d8d3cce01e5e8a1c9b0ff52208e315307cbb8;hb=e0d54dd3b497b78094ea16ab0f38ccdc8c1642e2;hp=e16f85bb2b8e8152a94a6d1c42b3a5550367eb1a;hpb=39e79d8602920eefe36e898c9f415afb979521b2;p=lyx.git diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index e16f85bb2b..6b9d8d3cce 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -13,7 +13,7 @@ #include "InsetMathArray.h" #include "InsetMathChar.h" #include "InsetMathColor.h" -#include "MathArray.h" +#include "MathData.h" #include "InsetMathDelim.h" #include "MathExtern.h" #include "MathFactory.h" @@ -26,16 +26,16 @@ #include "InsetMathRef.h" #include "bufferview_funcs.h" -#include "LyXText.h" +#include "Text.h" #include "Buffer.h" #include "BufferParams.h" #include "BufferView.h" #include "CutAndPaste.h" #include "FuncStatus.h" -#include "LColor.h" +#include "Color.h" #include "LaTeXFeatures.h" -#include "LCursor.h" +#include "Cursor.h" #include "debug.h" #include "DispatchResult.h" #include "FuncRequest.h" @@ -98,9 +98,9 @@ namespace { // returns position of first relation operator in the array // used for "intelligent splitting" - size_t firstRelOp(MathArray const & ar) + size_t firstRelOp(MathData const & ar) { - for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it) + for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it) if ((*it)->isRelOp()) return it - ar.begin(); return ar.size(); @@ -162,7 +162,7 @@ InsetMathHull::InsetMathHull() //lyxerr << "sizeof InsetMath: " << sizeof(InsetMath) << endl; //lyxerr << "sizeof MetricsInfo: " << sizeof(MetricsInfo) << endl; //lyxerr << "sizeof InsetMathChar: " << sizeof(InsetMathChar) << endl; - //lyxerr << "sizeof LyXFont: " << sizeof(LyXFont) << endl; + //lyxerr << "sizeof Font: " << sizeof(Font) << endl; initMath(); setDefaults(); } @@ -188,9 +188,9 @@ InsetMathHull::~InsetMathHull() {} -auto_ptr InsetMathHull::doClone() const +auto_ptr InsetMathHull::doClone() const { - return auto_ptr(new InsetMathHull(*this)); + return auto_ptr(new InsetMathHull(*this)); } @@ -208,7 +208,7 @@ InsetMathHull & InsetMathHull::operator=(InsetMathHull const & other) } -InsetBase * InsetMathHull::editXY(LCursor & cur, int x, int y) +Inset * InsetMathHull::editXY(Cursor & cur, int x, int y) { if (use_preview_) { edit(cur, true); @@ -227,7 +227,7 @@ InsetMath::mode_type InsetMathHull::currentMode() const } -bool InsetMathHull::idxFirst(LCursor & cur) const +bool InsetMathHull::idxFirst(Cursor & cur) const { cur.idx() = 0; cur.pos() = 0; @@ -235,7 +235,7 @@ bool InsetMathHull::idxFirst(LCursor & cur) const } -bool InsetMathHull::idxLast(LCursor & cur) const +bool InsetMathHull::idxLast(Cursor & cur) const { cur.idx() = nargs() - 1; cur.pos() = cur.lastpos(); @@ -409,7 +409,7 @@ void InsetMathHull::addPreview(graphics::PreviewLoader & ploader) const } -bool InsetMathHull::notifyCursorLeaves(LCursor & cur) +bool InsetMathHull::notifyCursorLeaves(Cursor & cur) { if (RenderPreview::status() == LyXRC::PREVIEW_ON) { Buffer const & buffer = cur.buffer(); @@ -680,7 +680,7 @@ docstring InsetMathHull::nicelabel(row_type row) const void InsetMathHull::glueall() { - MathArray ar; + MathData ar; for (idx_type i = 0; i < nargs(); ++i) ar.append(cell(i)); *this = InsetMathHull(hullSimple); @@ -696,7 +696,7 @@ void InsetMathHull::splitTo2Cols() for (row_type row = 0; row < nrows(); ++row) { idx_type const i = 2 * row; pos_type pos = firstRelOp(cell(i)); - cell(i + 1) = MathArray(cell(i).begin() + pos, cell(i).end()); + cell(i + 1) = MathData(cell(i).begin() + pos, cell(i).end()); cell(i).erase(pos, cell(i).size()); } } @@ -711,7 +711,7 @@ void InsetMathHull::splitTo3Cols() for (row_type row = 0; row < nrows(); ++row) { idx_type const i = 3 * row + 1; if (cell(i).size()) { - cell(i + 1) = MathArray(cell(i).begin() + 1, cell(i).end()); + cell(i + 1) = MathData(cell(i).begin() + 1, cell(i).end()); cell(i).erase(1, cell(i).size()); } } @@ -954,7 +954,7 @@ void InsetMathHull::check() const } -void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func) +void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func) { docstring dlang; docstring extra; @@ -967,7 +967,7 @@ void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func) #ifdef WITH_WARNINGS #warning temporarily disabled //if (cur.selection()) { - // MathArray ar; + // MathData ar; // selGet(cur.ar); // lyxerr << "use selection: " << ar << endl; // insert(pipeThroughExtern(lang, extra, ar)); @@ -975,7 +975,7 @@ void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func) //} #endif - MathArray eq; + MathData eq; eq.push_back(MathAtom(new InsetMathChar('='))); // go to first item in line @@ -984,14 +984,14 @@ void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func) if (getType() == hullSimple) { size_type pos = cur.cell().find_last(eq); - MathArray ar; + MathData ar; if (cur.inMathed() && cur.selection()) { asArray(grabAndEraseSelection(cur), ar); } else if (pos == cur.cell().size()) { ar = cur.cell(); lyxerr << "use whole cell: " << ar << endl; } else { - ar = MathArray(cur.cell().begin() + pos + 1, cur.cell().end()); + ar = MathData(cur.cell().begin() + pos + 1, cur.cell().end()); lyxerr << "use partial cell form pos: " << pos << endl; } cur.cell().append(eq); @@ -1003,7 +1003,7 @@ void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func) if (getType() == hullEquation) { lyxerr << "use equation inset" << endl; mutate(hullEqnArray); - MathArray & ar = cur.cell(); + MathData & ar = cur.cell(); lyxerr << "use cell: " << ar << endl; ++cur.idx(); cur.cell() = eq; @@ -1018,7 +1018,7 @@ void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func) lyxerr << "use eqnarray" << endl; cur.idx() += 2 - cur.idx() % ncols(); cur.pos() = 0; - MathArray ar = cur.cell(); + MathData ar = cur.cell(); lyxerr << "use cell: " << ar << endl; #ifdef WITH_WARNINGS #warning temporarily disabled @@ -1034,7 +1034,7 @@ void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func) } -void InsetMathHull::doDispatch(LCursor & cur, FuncRequest & cmd) +void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) { //lyxerr << "action: " << cmd.action << endl; switch (cmd.action) { @@ -1128,7 +1128,7 @@ void InsetMathHull::doDispatch(LCursor & cur, FuncRequest & cmd) docstring old = label(r); if (str != old) { cur.bv().buffer()->changeRefsIfUnique(old, str, - InsetBase::REF_CODE); + Inset::REF_CODE); label(r, str); } break; @@ -1174,7 +1174,7 @@ void InsetMathHull::doDispatch(LCursor & cur, FuncRequest & cmd) } -bool InsetMathHull::getStatus(LCursor & cur, FuncRequest const & cmd, +bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const { switch (cmd.action) { @@ -1274,7 +1274,7 @@ void InsetMathHull::mutateToText() string str = os.str(); // insert this text - LyXText * lt = view_->cursor().innerText(); + Text * lt = view_->cursor().innerText(); string::const_iterator cit = str.begin(); string::const_iterator end = str.end(); for (; cit != end; ++cit) @@ -1286,7 +1286,7 @@ void InsetMathHull::mutateToText() } -void InsetMathHull::handleFont(LCursor & cur, docstring const & arg, +void InsetMathHull::handleFont(Cursor & cur, docstring const & arg, docstring const & font) { // this whole function is a hack and won't work for incremental font @@ -1301,20 +1301,20 @@ void InsetMathHull::handleFont(LCursor & cur, docstring const & arg, } -void InsetMathHull::handleFont2(LCursor & cur, docstring const & arg) +void InsetMathHull::handleFont2(Cursor & cur, docstring const & arg) { recordUndo(cur); - LyXFont font; + Font font; bool b; bv_funcs::string2font(to_utf8(arg), font, b); - if (font.color() != LColor::inherit) { + if (font.color() != Color::inherit) { MathAtom at = MathAtom(new InsetMathColor(true, font.color())); cur.handleNest(at, 0); } } -void InsetMathHull::edit(LCursor & cur, bool left) +void InsetMathHull::edit(Cursor & cur, bool left) { cur.push(*this); left ? idxFirst(cur) : idxLast(cur); @@ -1331,7 +1331,7 @@ docstring const InsetMathHull::editMessage() const } -void InsetMathHull::revealCodes(LCursor & cur) const +void InsetMathHull::revealCodes(Cursor & cur) const { if (!cur.inMathed()) return; @@ -1367,7 +1367,7 @@ void InsetMathHull::revealCodes(LCursor & cur) const } -InsetBase::Code InsetMathHull::lyxCode() const +Inset::Code InsetMathHull::lyxCode() const { return MATH_CODE; } @@ -1385,7 +1385,7 @@ bool InsetMathHull::searchForward(BufferView * bv, string const & str, #endif static InsetMathHull * lastformula = 0; static CursorBase current = DocIterator(ibegin(nucleus())); - static MathArray ar; + static MathData ar; static string laststr; if (lastformula != this || laststr != str) { @@ -1402,7 +1402,7 @@ bool InsetMathHull::searchForward(BufferView * bv, string const & str, for (DocIterator it = current; it != iend(nucleus()); increment(it)) { CursorSlice & top = it.back(); - MathArray const & a = top.asInsetMath()->cell(top.idx_); + MathData const & a = top.asInsetMath()->cell(top.idx_); if (a.matchpart(ar, top.pos_)) { bv->cursor().setSelection(it, ar.size()); current = it;