]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_dotsinset.C
rename commandtags.h to lfuns.h and renumber/cleanup. Rebuild the tree !
[lyx.git] / src / mathed / math_dotsinset.C
index d3deb556c31df75274d70e3f310f1e6a9f1150b6..8251356cf7a589ba0202e0e1ce1437d5ee6ed858 100644 (file)
@@ -1,48 +1,54 @@
 #include <config.h>
 
-#include "math_dotsinset.h"
-#include "mathed/support.h"
-#include "support/LOstream.h"
 
-using std::ostream;
+#include "math_dotsinset.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
+#include "math_support.h"
+#include "math_parser.h"
 
 
-MathDotsInset::MathDotsInset(string const & nam, int id, short st)
-       : MathedInset(nam, LM_OT_DOTS, st), code(id) {}
+MathDotsInset::MathDotsInset(latexkeys const * key)
+       : key_(key)
+{}
 
 
-MathedInset * MathDotsInset::Clone()
+MathInset * MathDotsInset::clone() const
 {
-       return new MathDotsInset(name, code, GetStyle());
-}     
+       return new MathDotsInset(*this);
+}
 
 
-void
-MathDotsInset::draw(Painter & pain, int x, int y)
+void MathDotsInset::metrics(MathMetricsInfo & mi) const
 {
-       mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
-       if (code == LM_vdots || code == LM_ddots) ++x; 
-       if (code != LM_vdots) --y;
-       mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
+       mathed_char_dim(mi.base.font, 'M', dim_);
+       dh_ = 0;
+       if (key_->name == "cdots" || key_->name == "dotsb"
+                       || key_->name == "dotsm" || key_->name == "dotsi")
+               dh_ = ascent() / 2;
+       else if (key_->name == "dotsc")
+               dh_ = ascent() / 4;
+       else if (key_->name == "vdots") {
+               dim_.w = (dim_.w / 2) + 1;
+               dh_ = ascent();
+       }
+       else if (key_->name == "ddots")
+               dh_ = ascent();
 }
 
 
-void
-MathDotsInset::Metrics()
+void MathDotsInset::draw(MathPainterInfo & pain, int x, int y) const
 {
-       mathed_char_height(LM_TC_VAR, size, 'M', ascent, descent);
-       width = mathed_char_width(LM_TC_VAR, size, 'M');   
-       switch (code) {
-       case LM_ldots: dh = 0; break;
-       case LM_cdots: dh = ascent/2; break;
-       case LM_vdots: width /= 2;
-       case LM_ddots: dh = ascent; break;
-       }
-} 
+       mathed_draw_deco(pain, x + 2, y - dh_, width() - 2, ascent(), key_->name);
+       if (key_->name == "vdots" || key_->name == "ddots")
+               ++x;
+       if (key_->name != "vdots")
+               --y;
+       mathed_draw_deco(pain, x + 2, y - dh_, width() - 2, ascent(), key_->name);
+}
 
 
-void
-MathDotsInset::Write(ostream & os, bool /* fragile */)
+string MathDotsInset::name() const
 {
-       os << '\\' << name << ' ';
+       return key_->name;
 }