First of all, empty your stomachs, this is about the ugliest hack I've ever
porduced, so it obviously won't go into CVS.

Having said that, what do you think about the idea?
[Aplly to your local tree, create some math, watch teh minibuffer]

Andre'

-- 
André Pönitz .............................................. [EMAIL PROTECTED]
Index: formulabase.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formulabase.C,v
retrieving revision 1.127
diff -u -p -r1.127 formulabase.C
--- formulabase.C       2002/02/13 13:15:15     1.127
+++ formulabase.C       2002/02/14 17:59:54
@@ -729,7 +729,42 @@ InsetFormulaBase::localDispatch(BufferVi
        else
                bv->unlockInset(this);
 
+       revealCodes(bv);
+
        return result;  // original version
+}
+
+
+void InsetFormulaBase::revealCodes(BufferView * bv) const
+{
+       if (!mathcursor)
+               return;
+#if 1
+       // 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
 }
 
 
Index: formulabase.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formulabase.h,v
retrieving revision 1.34
diff -u -p -r1.34 formulabase.h
--- formulabase.h       2002/02/13 13:15:15     1.34
+++ formulabase.h       2002/02/14 17:59:54
@@ -112,6 +112,8 @@ public:
        virtual bool isTextInset() const { return true; }
        ///
        virtual void mutateToText();
+       ///
+       virtual void revealCodes(BufferView *) const;
 
 
 private:
Index: math_cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v
retrieving revision 1.233
diff -u -p -r1.233 math_cursor.C
--- math_cursor.C       2002/02/14 14:52:23     1.233
+++ math_cursor.C       2002/02/14 17:59:54
@@ -428,6 +428,20 @@ void MathCursor::plainErase()
 }
 
 
+void MathCursor::markInsert()
+{
+       //lyxerr << "inserting mark\n";
+       array().insert(pos(), MathAtom(new MathCharInset(0, lastcode_)));
+}
+
+
+void MathCursor::markErase()
+{
+       //lyxerr << "deleting mark\n";
+       array().erase(pos());
+}
+
+
 void MathCursor::plainInsert(MathAtom const & t)
 {
        array().insert(pos(), t);
Index: math_cursor.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.h,v
retrieving revision 1.100
diff -u -p -r1.100 math_cursor.h
--- math_cursor.h       2002/02/01 14:56:49     1.100
+++ math_cursor.h       2002/02/14 17:59:54
@@ -244,6 +244,10 @@ public:
        ///
        void insert(char);
 
+       /// hack for reveal codes
+       void markInsert();
+       void markErase();
+       
        ///
        friend class Selection;
 

Reply via email to