-/*
- * File: math_inset.C
- * Purpose: Implementation of insets for mathed
- * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
- * Created: January 1996
- * Description:
+/**
+ * \file math_inset.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * Dependencies: Xlib, XForms
+ * \author Alejandro Aguilar Sierra
+ * \author André Pönitz
*
- * Copyright: 1996, 1997 Alejandro Aguilar Sierra
- *
- * Version: 0.8beta.
- *
- * You are free to use and modify this code under the terms of
- * the GNU General Public Licence version 2 or later.
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "math_iter.h"
#include "math_inset.h"
-#include "symbol_def.h"
-#include "lyxfont.h"
-#include "mathed/support.h"
-#include "Painter.h"
+#include "math_data.h"
+#include "math_mathmlstream.h"
+#include "debug.h"
-int MathedInset::df_asc;
-int MathedInset::df_des;
-int MathedInset::df_width;
-int MathedInset::workWidth;
+using std::string;
+using std::ostream;
+using std::endl;
-MathedInset::MathedInset(MathedInset * inset)
-{
- if (inset) {
- name = inset->GetName();
- objtype = inset->GetType();
- size_ = inset->GetStyle();
- width = inset->Width();
- ascent = inset->Ascent();
- descent = inset->Descent();
- } else {
- objtype = LM_OT_UNDEF;
- size_ = LM_ST_TEXT;
- width = ascent = descent = 0;
- //name = 0;
- }
-}
-
+MathArray dummyCell;
-MathedInset::MathedInset(string const & nm, short ot, short st)
- : name(nm), objtype(ot), size_(st)
+MathArray & MathInset::cell(idx_type)
{
- width = ascent = descent = 0;
+ lyxerr << "I don't have a cell 1" << endl;
+ return dummyCell;
}
-// In a near future maybe we use a better fonts renderer
-void MathedInset::drawStr(Painter & pain, short type, int siz,
- int x, int y, string const & s)
+MathArray const & MathInset::cell(idx_type) const
{
- string st;
- if (MathIsBinary(type))
- for (string::const_iterator it = s.begin();
- it != s.end(); ++it) {
- st += ' ';
- st += *it;
- st += ' ';
- }
- else
- st = s;
-
- LyXFont const mf = mathed_get_font(type, siz);
- pain.text(x, y, st, mf);
+ lyxerr << "I don't have a cell 2" << endl;
+ return dummyCell;
}
-int MathedInset::Ascent() const
-{
- return ascent;
-}
+void MathInset::substitute(MathMacro const &)
+{}
-int MathedInset::Descent() const
+
+void MathInset::dump() const
{
- return descent;
+ lyxerr << "---------------------------------------------" << endl;
+ WriteStream wi(lyxerr, false, true);
+ write(wi);
+ lyxerr << "\n---------------------------------------------" << endl;
}
-int MathedInset::Width() const
+void MathInset::metricsT(TextMetricsInfo const &, Dimension &) const
{
- return width;
+#ifdef WITH_WARNINGS
+ lyxerr << "MathInset::metricsT(Text) called directly!" << endl;
+#endif
}
-int MathedInset::Height() const
+void MathInset::drawT(TextPainter &, int, int) const
{
- return ascent + descent;
+#ifdef WITH_WARNINGS
+ lyxerr << "MathInset::drawT(Text) called directly!" << endl;
+#endif
}
-bool MathedInset::GetLimits() const
+
+void MathInset::write(WriteStream & os) const
{
- return false;
+ os << '\\' << name().c_str();
+ os.pendingSpace(true);
}
-void MathedInset::SetLimits(bool) {}
-
-
-string const & MathedInset::GetName() const
+void MathInset::normalize(NormalStream & os) const
{
- return name;
+ os << '[' << name().c_str() << "] ";
}
-short MathedInset::GetType() const
+void MathInset::octave(OctaveStream & os) const
{
- return objtype;
+ NormalStream ns(os.os());
+ normalize(ns);
}
-short MathedInset::GetStyle() const
+void MathInset::maple(MapleStream & os) const
{
- return size_;
+ NormalStream ns(os.os());
+ normalize(ns);
}
-void MathedInset::SetType(short t)
+void MathInset::maxima(MaximaStream & os) const
{
- objtype = t;
+ MapleStream ns(os.os());
+ maple(ns);
}
-void MathedInset::SetStyle(short st)
+void MathInset::mathematica(MathematicaStream & os) const
{
- size_ = st;
+ NormalStream ns(os.os());
+ normalize(ns);
}
-void MathedInset::SetName(string const & n)
+void MathInset::mathmlize(MathMLStream & os) const
{
- name = n;
+ NormalStream ns(os.os());
+ normalize(ns);
}
-void MathedInset::defaultAscent(int da)
+string const & MathInset::getType() const
{
- df_asc = da;
+ static string const t("none");
+ return t;
}
-
-void MathedInset::defaultDescent(int dd)
+string MathInset::name() const
{
- df_des = dd;
+ return "unknown";
}
-void MathedInset::defaultWidth(int dw)
+ostream & operator<<(ostream & os, MathAtom const & at)
{
- df_width = dw;
+ WriteStream wi(os, false, false);
+ at->write(wi);
+ return os;
}
-