]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_sizeinset.C
further code uglification to make Jean-Marc's compiler happy
[lyx.git] / src / mathed / math_sizeinset.C
index dc2dae86f6bab60407ca072a4b09f6e89b58f210..8587e570479198cd474c7dce735cfe57e29a9308 100644 (file)
@@ -3,30 +3,13 @@
 #endif
 
 #include "math_sizeinset.h"
+#include "math_parser.h"
 #include "support/LOstream.h"
 
 
-MathSizeInset::MathSizeInset(MathStyles st)
-       : MathInset(1), style_(st)
-{
-       name_ = verbose();
-}
-
-
-char const * MathSizeInset::verbose() const
-{
-       switch (style_) {
-               case LM_ST_DISPLAY:
-                       return "displaystyle";
-               case LM_ST_TEXT:
-                       return "textstyle";
-               case LM_ST_SCRIPT:
-                       return "scriptstyle";
-               case LM_ST_SCRIPTSCRIPT:
-                       return "scriptscriptstyle";
-       }
-       return "unknownstyle";
-}
+MathSizeInset::MathSizeInset(latexkeys const * l)
+       : MathNestInset(1), key_(l)
+{}
 
 
 MathInset * MathSizeInset::clone() const
@@ -35,7 +18,7 @@ MathInset * MathSizeInset::clone() const
 }
 
 
-void MathSizeInset::draw(Painter & pain, int x, int y)
+void MathSizeInset::draw(Painter & pain, int x, int y) const
 {
        xo(x);
        yo(y);
@@ -43,9 +26,9 @@ void MathSizeInset::draw(Painter & pain, int x, int y)
 }
 
 
-void MathSizeInset::metrics(MathStyles /* st */)
+void MathSizeInset::metrics(MathStyles /* st */) const
 {
-       xcell(0).metrics(style_);
+       xcell(0).metrics(MathStyles(key_->id));
        ascent_   = xcell(0).ascent_;
        descent_  = xcell(0).descent_;
        width_    = xcell(0).width_;
@@ -54,7 +37,7 @@ void MathSizeInset::metrics(MathStyles /* st */)
 
 void MathSizeInset::write(std::ostream & os, bool fragile) const
 {
-       os << "{\\" << name() << " ";
+       os << "{\\" << key_->name << " ";
        cell(0).write(os, fragile);
        os << "}";
 }
@@ -62,7 +45,7 @@ void MathSizeInset::write(std::ostream & os, bool fragile) const
 
 void MathSizeInset::writeNormal(std::ostream & os) const
 {
-       os << "[" << name() << " ";
+       os << "[" << key_->name << " ";
        cell(0).writeNormal(os);
        os << "]";
 }