]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_dotsinset.C
fix pullArg when pressing <Delete> at the end of an cell
[lyx.git] / src / mathed / math_dotsinset.C
index d3deb556c31df75274d70e3f310f1e6a9f1150b6..7054cde4bf2bf0e2a41a090294673a52cbbfd9cf 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,48 @@
 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, int id)
+       : MathInset(0, name), code_(id)
+{}
 
 
-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)
 {
-       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_, 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_);
 }
 
 
-void
-MathDotsInset::Metrics()
+void MathDotsInset::Metrics(MathStyles st, int, int)
 {
-       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 (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;
        }
 } 
 
 
-void
-MathDotsInset::Write(ostream & os, bool /* fragile */)
+void MathDotsInset::Write(ostream & os, bool /* fragile */) const
 {
-       os << '\\' << name << ' ';
+       os << '\\' << name() << ' ';
+}
+
+
+void MathDotsInset::WriteNormal(ostream & os) const
+{
+       os << "[" << name() << "] ";
 }