]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_dotsinset.C
halfway through fixing size of math in non-standard sizesd paragraohs like
[lyx.git] / src / mathed / math_dotsinset.C
index 92fdccec98772e5f02e7cb45a0c8656f51a4a690..40249eeff18bae8df1f36266da0da3811ff3640c 100644 (file)
@@ -1,4 +1,6 @@
-#include <config.h>
+#ifdef __GNUG__
+#pragma implementation
+#endif
 
 #include "math_dotsinset.h"
 #include "mathed/support.h"
@@ -7,42 +9,49 @@
 using std::ostream;
 
 
-MathDotsInset::MathDotsInset(string const & nam, int id, short st)
-       : MathedInset(nam, LM_OT_DOTS, st), code(id) {}
+MathDotsInset::MathDotsInset(string const & name)
+       : name_(name)
+{}
 
 
-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::draw(Painter & pain, int x, int y) 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_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
+       char const c = name_[0];
+       if (c == 'v' || c == 'd')
+               ++x;
+       if (c != 'v')
+               --y;
+       mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
 }
 
 
-void
-MathDotsInset::Metrics()
+void MathDotsInset::metrics(MathMetricsInfo const & st) 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;
+       size_ = st;
+       mathed_char_dim(LM_TC_VAR, size_, 'M', ascent_, descent_, width_);
+       switch (name_[0]) {
+               case 'l': dh_ = 0; break;
+               case 'c': dh_ = ascent_ / 2; break;
+               case 'v': width_ /= 2;
+               case 'd': dh_ = ascent_; break;
        }
 } 
 
 
-void
-MathDotsInset::Write(ostream & os, bool /* fragile */)
+void MathDotsInset::write(MathWriteInfo & os) const
 {
-       os << '\\' << name << ' ';
+       os << '\\' << name_ << ' ';
+}
+
+
+void MathDotsInset::writeNormal(ostream & os) const
+{
+       os << "[" << name_ << "] ";
 }