]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.C
Jean-Marc's fix for wrong descent
[lyx.git] / src / mathed / math_inset.C
index 70010e623466f26d637b7dfe6273798668b28443..065408881be4c724c456001a489c8c67b86bc039 100644 (file)
  *   the GNU General Public Licence version 2 or later.
  */
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include <config.h>
 
-#include "Lsstream.h"
+
 #include "math_inset.h"
+#include "Lsstream.h"
 #include "math_scriptinset.h"
 #include "math_mathmlstream.h"
 #include "math_cursor.h"
@@ -34,9 +31,7 @@
 #include "BufferView.h"
 #include "formulabase.h"
 
-
 using std::ostream;
-using std::vector;
 
 
 int MathInset::height() const
@@ -45,24 +40,6 @@ int MathInset::height() const
 }
 
 
-ostream & operator<<(ostream & os, MathAtom const & at)
-{
-       if (at.nucleus())
-               os << *(at.nucleus());
-       else
-               os << "(nil)";
-       return os;
-}
-
-
-ostream & operator<<(ostream & os, MathInset const & inset)
-{
-       WriteStream wi(os, false, false);
-       inset.write(wi);
-       return os;
-}
-
-
 MathInset::size_type MathInset::nargs() const
 {
        return 0;
@@ -166,15 +143,6 @@ void MathInset::getPos(idx_type, pos_type, int & x, int & y) const
 }
 
 
-void MathInset::normalize(NormalStream & os) const
-{
-       os << "[unknown ";
-       WriteStream wi(os.os(), false, true);
-       write(wi);
-       os << "] ";
-}
-
-
 void MathInset::dump() const
 {
        lyxerr << "---------------------------------------------\n";
@@ -226,27 +194,41 @@ void MathInset::drawT(TextPainter &, int, int) const
 
 
 
-void MathInset::write(WriteStream &) const
+void MathInset::write(WriteStream & os) const
 {
-       lyxerr << "MathInset::write() called directly!\n";
+       os << '\\' << name().c_str();
+       os.pendingSpace(true);
 }
 
 
-void MathInset::octavize(OctaveStream & os) const
+void MathInset::normalize(NormalStream & os) const
+{
+       os << '[' << name().c_str() << "] ";
+}
+
+
+void MathInset::octave(OctaveStream & os) const
 {
        NormalStream ns(os.os());
        normalize(ns);
 }
 
 
-void MathInset::maplize(MapleStream & os) const
+void MathInset::maple(MapleStream & os) const
 {
        NormalStream ns(os.os());
        normalize(ns);
 }
 
 
-void MathInset::mathematicize(MathematicaStream & os) const
+void MathInset::maxima(MaximaStream & os) const
+{
+       MapleStream ns(os.os());
+       maple(ns);
+}
+
+
+void MathInset::mathematica(MathematicaStream & os) const
 {
        NormalStream ns(os.os());
        normalize(ns);
@@ -278,12 +260,6 @@ int MathInset::docbook(std::ostream &, bool) const
 }
 
 
-int MathInset::dispatch(string const &, idx_type, pos_type) 
-{
-       return 0; // undispatched
-}
-
-
 string const & MathInset::getType() const
 {
        static string t("none");
@@ -302,7 +278,7 @@ string asString(MathArray const & ar)
        std::ostringstream os;
        WriteStream ws(os);
        ws << ar;
-       return os.str();
+       return STRCONV(os.str());
 }
 
 
@@ -314,13 +290,15 @@ MathArray asArray(string const & str)
 }
 
 
-Dialogs * getDialogs()
+ostream & operator<<(ostream & os, MathAtom const & at)
 {
-       return mathcursor->formula()->view()->owner()->getDialogs();
+       WriteStream wi(os, false, false);
+       at->write(wi);
+       return os;
 }
 
 
-LyXFunc * getLyXFunc()
+Dialogs & getDialogs()
 {
-       return mathcursor->formula()->view()->owner()->getLyXFunc();
+       return mathcursor->formula()->view()->owner()->getDialogs();
 }