]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.C
fix #1073
[lyx.git] / src / mathed / math_inset.C
index e3a0f3be588aca82aff9068c9198a69858530181..7b4fd1fdb80ec61bb65d08048e06a3178b900042 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"
 #include "BufferView.h"
 #include "formulabase.h"
 
-
 using std::ostream;
-using std::vector;
 
 
-int MathInset::height() const
+BufferView * MathInset::view() const
 {
-       return ascent() + descent();
+       if (!mathcursor)
+               return 0;
+       return mathcursor->formula()->view();
 }
 
 
-ostream & operator<<(ostream & os, MathAtom const & at)
+int MathInset::height() const
 {
-       WriteStream wi(os, false, false);
-       at->write(wi);
-       return os;
+       return ascent() + descent();
 }
 
 
@@ -125,6 +120,12 @@ bool MathInset::idxUpDown(idx_type &, pos_type &, bool, int) const
 }
 
 
+bool MathInset::idxUpDown2(idx_type &, pos_type &, bool, int) const
+{
+       return false;
+}
+
+
 bool MathInset::idxFirst(idx_type &, pos_type &) const
 {
        return false;
@@ -171,19 +172,19 @@ bool MathInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
 }
 
 
-void MathInset::metrics(MathMetricsInfo &) const
+void MathInset::metrics(MetricsInfo &) const
 {
        lyxerr << "MathInset::metrics() called directly!\n";
 }
 
 
-void MathInset::draw(MathPainterInfo &, int, int) const
+void MathInset::draw(PainterInfo &, int, int) const
 {
        lyxerr << "MathInset::draw() called directly!\n";
 }
 
 
-void MathInset::drawSelection(MathPainterInfo &,
+void MathInset::drawSelection(PainterInfo &,
        idx_type, pos_type, idx_type, pos_type) const
 {
        lyxerr << "MathInset::drawSelection() called directly!\n";
@@ -209,7 +210,8 @@ void MathInset::drawT(TextPainter &, int, int) const
 
 void MathInset::write(WriteStream & os) const
 {
-       os << '\\' << name().c_str() << ' ';
+       os << '\\' << name().c_str();
+       os.pendingSpace(true);
 }
 
 
@@ -219,21 +221,28 @@ void MathInset::normalize(NormalStream & os) const
 }
 
 
-void MathInset::octavize(OctaveStream & os) const
+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);
@@ -265,12 +274,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");
@@ -289,7 +292,7 @@ string asString(MathArray const & ar)
        std::ostringstream os;
        WriteStream ws(os);
        ws << ar;
-       return os.str();
+       return STRCONV(os.str());
 }
 
 
@@ -301,13 +304,10 @@ 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()
-{
-       return mathcursor->formula()->view()->owner()->getLyXFunc();
-}