]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_nestinset.C
fix compile problem
[lyx.git] / src / mathed / math_nestinset.C
index 79c529bbc3f61731e829f28aa0b2c0917ba97da6..6a6ceb3e7017e6e2c8ff69e08c025206748c6dd1 100644 (file)
@@ -25,6 +25,7 @@
 #include "math_parser.h"
 #include "math_scriptinset.h"
 #include "math_spaceinset.h"
+#include "math_symbolinset.h"
 #include "math_support.h"
 #include "math_unknowninset.h"
 
 #include "outputparams.h"
 #include "undo.h"
 
-#include "support/std_sstream.h"
 #include "support/lstrings.h"
 
 #include "frontends/Dialogs.h"
 #include "frontends/LyXView.h"
 #include "frontends/Painter.h"
 
+#include <sstream>
+
 using lyx::cap::copySelection;
 using lyx::cap::grabAndEraseSelection;
 using lyx::cap::cutSelection;
@@ -205,7 +207,7 @@ void MathNestInset::drawSelection(PainterInfo & pi, int, int) const
        CursorSlice s1 = cur.selBegin();
        CursorSlice s2 = cur.selEnd();
        //lyxerr << "MathNestInset::drawing selection: "
-       //      << " s1: " << s1 << " s2: " << s2 << endl; 
+       //      << " s1: " << s1 << " s2: " << s2 << endl;
        if (s1.idx() == s2.idx()) {
                MathArray const & c = cell(s1.idx());
                int x1 = c.xo() + c.pos2x(s1.pos());
@@ -215,7 +217,7 @@ void MathNestInset::drawSelection(PainterInfo & pi, int, int) const
                pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
        //lyxerr << "MathNestInset::drawing selection 3: "
        //      << " x1: " << x1 << " x2: " << x2
-       //      << " y1: " << y1 << " y2: " << y2 << endl; 
+       //      << " y1: " << y1 << " y2: " << y2 << endl;
        } else {
                for (idx_type i = 0; i < nargs(); ++i) {
                        if (idxBetween(i, s1.idx(), s2.idx())) {
@@ -313,9 +315,11 @@ int MathNestInset::latex(Buffer const &, std::ostream & os,
 }
 
 
-void MathNestInset::notifyCursorLeaves(LCursor & cur)
+void MathNestInset::notifyCursorLeaves(LCursor & /*cur*/)
 {
+#ifdef WITH_WARNINGS
 #warning look here
+#endif
 #if 0
        MathArray & ar = cur.cell();
        // remove base-only "scripts"
@@ -381,7 +385,7 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
        switch (cmd.action) {
 
        case LFUN_PASTE: {
-               recordUndo(cur);        
+               recordUndo(cur);
                cur.message(_("Paste"));
                replaceSelection(cur);
                size_t n = 0;
@@ -438,9 +442,8 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                cur.selHandle(cmd.action == LFUN_RIGHTSEL);
                cur.autocorrect() = false;
                cur.clearTargetX();
-               if (cur.inMacroMode())
-                       cur.macroModeClose();
-               else if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
+               cur.macroModeClose();
+               if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
                        cur.pushLeft(*cur.nextAtom().nucleus());
                        cur.inset().idxFirst(cur);
                } else if (cur.posRight() || idxRight(cur)
@@ -455,9 +458,8 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                cur.selHandle(cmd.action == LFUN_LEFTSEL);
                cur.autocorrect() = false;
                cur.clearTargetX();
-               if (cur.inMacroMode())
-                       cur.macroModeClose();
-               else if (cur.pos() != 0 && cur.openable(cur.prevAtom())) {
+               cur.macroModeClose();
+               if (cur.pos() != 0 && cur.openable(cur.prevAtom())) {
                        cur.posLeft();
                        cur.push(*cur.nextAtom().nucleus());
                        cur.inset().idxLast(cur);
@@ -800,7 +802,7 @@ bool MathNestInset::getStatus(LCursor & /*cur*/, FuncRequest const & cmd,
                FuncStatus & flag) const
 {
        // the font related toggles
-       //string tc = "mathnormal"; 
+       //string tc = "mathnormal";
        bool ret = true;
        switch (cmd.action) {
 #if 0
@@ -1003,6 +1005,9 @@ bool MathNestInset::interpret(LCursor & cur, char c)
                        } else if (c == '{') {
                                cur.backspace();
                                cur.niceInsert(MathAtom(new MathBraceInset));
+                       } else if (c == '%') {
+                               cur.backspace();
+                               cur.niceInsert(MathAtom(new MathCommentInset));
                        } else if (c == '#') {
                                lyxerr << "setting name to " << name + c << endl;
                                BOOST_ASSERT(cur.activeMacro());
@@ -1085,13 +1090,13 @@ bool MathNestInset::interpret(LCursor & cur, char c)
                return true;
        }
 
-       if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#') {
+       if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%') {
                cur.niceInsert(createMathInset(string(1, c)));
                return true;
        }
 
-       if (c == '%') {
-               cur.niceInsert(MathAtom(new MathCommentInset));
+       if (c == '~') {
+               cur.niceInsert(createMathInset("sim"));
                return true;
        }
 
@@ -1108,7 +1113,7 @@ bool MathNestInset::interpret(LCursor & cur, char c)
 
 bool MathNestInset::script(LCursor & cur, bool up)
 {
-       // Hack to get \\^ and \\_ working
+       // Hack to get \^ and \_ working
        lyxerr << "handling script: up: " << up << endl;
        if (cur.inMacroMode() && cur.macroName() == "\\") {
                if (up)