]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.cpp
LyXText -> Text
[lyx.git] / src / mathed / InsetMathNest.cpp
index bf224bb12f67fe3a5233f08b8c337fec12cf5305..a80c791554bee515ef96fe305c400696c7df0768 100644 (file)
 #include "InsetMathBrace.h"
 #include "InsetMathColor.h"
 #include "InsetMathComment.h"
-#include "MathArray.h"
 #include "InsetMathDelim.h"
-#include "MathFactory.h"
 #include "InsetMathHull.h"
-#include "MathStream.h"
-#include "MathMacroArgument.h"
 //#include "InsetMathMBox.h"
-#include "MathParser.h"
+#include "InsetMathRef.h"
 #include "InsetMathScript.h"
 #include "InsetMathSpace.h"
 #include "InsetMathSymbol.h"
-#include "MathSupport.h"
 #include "InsetMathUnknown.h"
-#include "InsetMathRef.h"
+#include "MathData.h"
+#include "MathFactory.h"
+#include "MathMacroArgument.h"
+#include "MathParser.h"
+#include "MathStream.h"
+#include "MathSupport.h"
 
-#include "BufferView.h"
-#include "CutAndPaste.h"
-#include "FuncStatus.h"
-#include "LColor.h"
 #include "bufferview_funcs.h"
+#include "BufferView.h"
+#include "Color.h"
 #include "CoordCache.h"
 #include "Cursor.h"
+#include "CutAndPaste.h"
 #include "debug.h"
 #include "DispatchResult.h"
 #include "FuncRequest.h"
+#include "FuncStatus.h"
 #include "gettext.h"
-#include "LyXText.h"
+#include "Text.h"
 #include "OutputParams.h"
 #include "Undo.h"
 
@@ -56,8 +56,6 @@
 #include "frontends/Selection.h"
 
 #include "FuncRequest.h"
-#include "LyXServer.h"
-#include "LyXServerSocket.h"
 
 #include <sstream>
 
@@ -92,13 +90,13 @@ void InsetMathNest::cursorPos(BufferView const & bv,
 {
 // FIXME: This is a hack. Ideally, the coord cache should not store
 // absolute positions, but relative ones. This would mean to call
-// setXY() not in MathArray::draw(), but in the parent insets' draw()
+// setXY() not in MathData::draw(), but in the parent insets' draw()
 // with the correctly adjusted x,y values. But this means that we'd have
 // to touch all (math)inset's draw() methods. Right now, we'll store
 // absolute value, and make them here relative, only to make them
 // absolute again when actually drawing the cursor. What a mess.
        BOOST_ASSERT(ptr_cmp(&sl.inset(), this));
-       MathArray const & ar = sl.cell();
+       MathData const & ar = sl.cell();
        CoordCache const & coord_cache = bv.coordCache();
        if (!coord_cache.getArrays().has(&ar)) {
                // this can (semi-)legally happen if we just created this cell
@@ -117,7 +115,7 @@ void InsetMathNest::cursorPos(BufferView const & bv,
                return;
        }
        Point const pt2 = coord_cache.getInsets().xy(this);
-       //lyxerr << "retrieving position cache for MathArray "
+       //lyxerr << "retrieving position cache for MathData "
        //      << pt.x_ << ' ' << pt.y_ << std::endl;
        x = pt.x_ - pt2.x_ + ar.pos2x(sl.pos());
        y = pt.y_ - pt2.y_;
@@ -213,7 +211,7 @@ void InsetMathNest::draw(PainterInfo & pi, int x, int y) const
 #if 0
        if (lock_)
                pi.pain.fillRectangle(x, y - ascent(), width(), height(),
-                                       LColor::mathlockbg);
+                                       Color::mathlockbg);
 #endif
        setPosCache(pi, x, y);
 }
@@ -240,24 +238,24 @@ void InsetMathNest::drawSelection(PainterInfo & pi, int x, int y) const
        //lyxerr << "InsetMathNest::drawing selection: "
        //      << " s1: " << s1 << " s2: " << s2 << endl;
        if (s1.idx() == s2.idx()) {
-               MathArray const & c = cell(s1.idx());
+               MathData const & c = cell(s1.idx());
                int x1 = c.xo(bv) + c.pos2x(s1.pos());
                int y1 = c.yo(bv) - c.ascent();
                int x2 = c.xo(bv) + c.pos2x(s2.pos());
                int y2 = c.yo(bv) + c.descent();
-               pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
+               pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color::selection);
        //lyxerr << "InsetMathNest::drawing selection 3: "
        //      << " x1: " << x1 << " x2: " << x2
        //      << " y1: " << y1 << " y2: " << y2 << endl;
        } else {
                for (idx_type i = 0; i < nargs(); ++i) {
                        if (idxBetween(i, s1.idx(), s2.idx())) {
-                               MathArray const & c = cell(i);
+                               MathData const & c = cell(i);
                                int x1 = c.xo(bv);
                                int y1 = c.yo(bv) - c.ascent();
                                int x2 = c.xo(bv) + c.width();
                                int y2 = c.yo(bv) + c.descent();
-                               pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
+                               pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color::selection);
                        }
                }
        }
@@ -278,7 +276,7 @@ void InsetMathNest::replace(ReplaceData & rep)
 }
 
 
-bool InsetMathNest::contains(MathArray const & ar) const
+bool InsetMathNest::contains(MathData const & ar) const
 {
        for (idx_type i = 0; i < nargs(); ++i)
                if (cell(i).contains(ar))
@@ -305,9 +303,9 @@ bool InsetMathNest::isActive() const
 }
 
 
-MathArray InsetMathNest::glue() const
+MathData InsetMathNest::glue() const
 {
-       MathArray ar;
+       MathData ar;
        for (size_t i = 0; i < nargs(); ++i)
                ar.append(cell(i));
        return ar;
@@ -352,12 +350,12 @@ bool InsetMathNest::notifyCursorLeaves(Cursor & /*cur*/)
 #warning look here
 #endif
 #if 0
-       MathArray & ar = cur.cell();
+       MathData & ar = cur.cell();
        // remove base-only "scripts"
        for (pos_type i = 0; i + 1 < ar.size(); ++i) {
                InsetMathScript * p = operator[](i).nucleus()->asScriptInset();
                if (p && p->nargs() == 1) {
-                       MathArray ar = p->nuc();
+                       MathData ar = p->nuc();
                        erase(i);
                        insert(i, ar);
                        cur.adjust(i, ar.size() - 1);
@@ -406,10 +404,10 @@ void InsetMathNest::handleFont
 void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
 {
        recordUndo(cur, Undo::ATOMIC);
-       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);
        }
@@ -831,7 +829,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_MATH_MODE: {
 #if 1
                // ignore math-mode on when already in math mode
-               if (currentMode() == InsetBase::MATH_MODE && cmd.argument() == "on")
+               if (currentMode() == Inset::MATH_MODE && cmd.argument() == "on")
                        break;
                cur.macroModeClose();
                docstring const save_selection = grabAndEraseSelection(cur);
@@ -842,7 +840,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.pushLeft(*cur.nextInset());
                cur.niceInsert(save_selection);
 #else
-               if (currentMode() == InsetBase::TEXT_MODE) {
+               if (currentMode() == Inset::TEXT_MODE) {
                        cur.niceInsert(MathAtom(new InsetMathHull("simple")));
                        cur.message(_("create new math text environment ($...$)"));
                } else {
@@ -917,7 +915,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                                                                rdelim)));
                }
                // Don't call cur.undispatched() if we did nothing, this would
-               // lead to infinite recursion via LyXText::dispatch().
+               // lead to infinite recursion via Text::dispatch().
                break;
        }
 
@@ -967,7 +965,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                docstring const & name = cmd.argument();
                string data;
                if (name == "ref") {
-                       RefInset tmp(name);
+                       InsetMathRef tmp(name);
                        data = tmp.createDialogStr(to_utf8(name));
                }
                cur.bv().showInsetDialog(to_utf8(name), data, 0);
@@ -975,7 +973,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INSET_INSERT: {
-               MathArray ar;
+               MathData ar;
                if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
                        recordUndo(cur);
                        cur.insert(ar);
@@ -1101,7 +1099,7 @@ void InsetMathNest::edit(Cursor & cur, bool left)
 }
 
 
-InsetBase * InsetMathNest::editXY(Cursor & cur, int x, int y)
+Inset * InsetMathNest::editXY(Cursor & cur, int x, int y)
 {
        int idx_min = 0;
        int dist_min = 1000000;
@@ -1112,7 +1110,7 @@ InsetBase * InsetMathNest::editXY(Cursor & cur, int x, int y)
                        idx_min = i;
                }
        }
-       MathArray & ar = cell(idx_min);
+       MathData & ar = cell(idx_min);
        cur.push(*this);
        cur.idx() = idx_min;
        cur.pos() = ar.x2pos(x - ar.xo(cur.bv()));
@@ -1144,9 +1142,9 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd)
                // cur.result().update(): don't overwrite previously set flags.
                cur.updateFlags(Update::Decoration | Update::FitCursor | cur.result().update());
        } else if (cmd.button() == mouse_button::button2) {
-               MathArray ar;
+               MathData ar;
                if (cap::selection()) {
-                       // See comment in LyXText::dispatch why we do this
+                       // See comment in Text::dispatch why we do this
                        cap::copySelectionToStack();
                        cmd = FuncRequest(LFUN_PASTE, "0");
                        doDispatch(cur, cmd);