]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/formulabase.C
whichFont down to 5.3%
[lyx.git] / src / mathed / formulabase.C
index c5ef86ec7020333d2b12c19820e84ba3df528712..f1c6113b5733e7c07c5cc44a24e6b08532489aa6 100644 (file)
@@ -401,6 +401,8 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
 
        case LFUN_RIGHT:
                result = mathcursor->right(sel) ? DISPATCHED : FINISHED_RIGHT;
+               //lyxerr << "calling scroll 20\n";
+               //scroll(bv, 20);
                updateLocal(bv, false);
                // write something to the minibuffer
                //bv->owner()->message(mathcursor->info());
@@ -569,10 +571,14 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
                break;
 
        case LFUN_MATH_MODE:
-               //handleFont(bv, arg, LM_TC_TEXTRM);
+#if 0
+               handleFont(bv, arg, LM_TC_TEXTRM);
+#endif
 
-               //mathcursor->niceInsert(MathAtom(new MathHullInset(LM_OT_SIMPLE)));
-               //updateLocal(bv, true);
+#if 0
+               mathcursor->niceInsert(MathAtom(new MathHullInset(LM_OT_SIMPLE)));
+               updateLocal(bv, true);
+#endif
 
                //bv->owner()->message(_("math text mode toggled"));
                break;
@@ -727,10 +733,45 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        else
                bv->unlockInset(this);
 
+       revealCodes(bv);
+
        return result;  // original version
 }
 
 
+void InsetFormulaBase::revealCodes(BufferView * bv) const
+{
+       if (!mathcursor)
+               return;
+#if 0
+       // write something to the minibuffer
+       // translate to latex
+       mathcursor->markInsert();
+       ostringstream os;
+       write(NULL, os);
+       string str = os.str();
+       mathcursor->markErase();
+       string::size_type pos = 0;
+       string res;
+       for (string::iterator it = str.begin(); it != str.end(); ++it) {
+               if (*it == '\n')
+                       res += ' ';
+               else if (*it == '\0') {
+                       res += "  -X-  ";
+                       pos = it - str.begin();
+               }
+               else
+                       res += *it;
+       }
+       if (pos > 30)
+               res = res.substr(pos - 30);
+       if (res.size() > 60)
+               res = res.substr(0, 60);
+       bv->owner()->message(res);
+#endif
+}
+
+
 Inset::Code InsetFormulaBase::lyxCode() const
 {
        return Inset::MATH_CODE;