]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_funcinset.C
whichFont down to 5.3%
[lyx.git] / src / mathed / math_funcinset.C
index 933b0f344695dfed8de428688a410abb7329b86b..b7dedc3cc3c41521e5b7944daf9053f8e978b499 100644 (file)
@@ -1,3 +1,5 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -5,20 +7,17 @@
 #include "math_funcinset.h"
 #include "font.h"
 #include "Painter.h"
-#include "mathed/support.h"
-#include "support/LOstream.h"
-
+#include "math_support.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
 
-using std::ostream;
 
 extern LyXFont WhichFont(short type, int size);
 
 
-MathFuncInset::MathFuncInset(string const & nm, MathInsetTypes ot)
-       : MathInset(0, nm, ot)
-{
-       lims_ = (GetType() == LM_OT_FUNCLIM);
-}
+MathFuncInset::MathFuncInset(string const & nm)
+       : name_(nm)
+{}
 
 
 MathInset * MathFuncInset::clone() const
@@ -27,34 +26,63 @@ MathInset * MathFuncInset::clone() const
 }
 
 
-void MathFuncInset::Write(std::ostream & os, bool /* fragile */) const
+string const & MathFuncInset::name() const
 {
-       os << "\\" << name_ << ' ';
+       return name_;
 }
 
 
-void MathFuncInset::WriteNormal(std::ostream & os) const
+void MathFuncInset::setName(string const & n)
 {
-       os << "[" << name_ << "] ";
+       name_ = n;
 }
 
 
-void MathFuncInset::Metrics(MathStyles st) 
+void MathFuncInset::metrics(MathMetricsInfo const & mi) const 
 {
-       size_ = st;
-       if (name_.empty()) 
-               mathed_char_dim(LM_TC_TEXTRM, size_, 'I', ascent_, descent_, width_);
-       else 
-               mathed_string_dim(LM_TC_TEXTRM, size_, name_, ascent_, descent_, width_);
+       mi_ = mi;
+       mathed_string_dim(LM_TC_TEXTRM, mi_, name_, ascent_, descent_, width_);
 }
 
 
-void MathFuncInset::draw(Painter & pain, int x, int y)
+void MathFuncInset::draw(Painter & pain, int x, int y) const
 { 
-       xo(x);
-       yo(y);
-       if (name_.empty()) 
-               drawChar(pain, LM_TC_TEXTRM, size_, x, y, ' ');
-       else
-               drawStr(pain, LM_TC_TEXTRM, size_, x, y, name_);
+       drawStr(pain, LM_TC_TEXTRM, mi_, x, y, name_);
+}
+
+
+bool MathFuncInset::match(MathInset * p) const
+{
+       MathFuncInset const * q = p->asFuncInset();
+       return q && name_ == q->name_;
+}
+
+
+void MathFuncInset::maplize(MapleStream & os) const
+{
+       os << ' ' << name_;
+}
+
+
+void MathFuncInset::mathmlize(MathMLStream & os) const
+{
+       os << MTag("mi") << name_ << ETag("mi");
+}
+
+
+void MathFuncInset::octavize(OctaveStream & os) const
+{
+       os << ' ' << name_;
+}
+
+
+void MathFuncInset::normalize(NormalStream & os) const
+{
+       os << "[func " << name_ << ']';
+}
+
+
+void MathFuncInset::write(WriteStream & os) const
+{
+       os << "\\" << name_ << ' ';
 }