]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_sizeinset.C
use stream-like syntax for LaTeX output
[lyx.git] / src / mathed / math_sizeinset.C
index 37a19b2aec5e03a3f46a94c57c5b77ed91f5d64b..389b233597ce63cd4124e7b270c72fef3b8f48c0 100644 (file)
@@ -3,30 +3,15 @@
 #endif
 
 #include "math_sizeinset.h"
+#include "math_parser.h"
 #include "support/LOstream.h"
 
 
-MathSizeInset::MathSizeInset(MathStyles st)
-       : MathNestInset(1), style_(st)
+MathSizeInset::MathSizeInset(latexkeys const * l)
+       : MathNestInset(1), key_(l)
 {}
 
 
-char const * MathSizeInset::name() 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";
-}
-
-
 MathInset * MathSizeInset::clone() const
 {
        return new MathSizeInset(*this);
@@ -41,26 +26,26 @@ void MathSizeInset::draw(Painter & pain, int x, int y) const
 }
 
 
-void MathSizeInset::metrics(MathStyles /* st */) const
+void MathSizeInset::metrics(MathMetricsInfo const & st) const
 {
-       xcell(0).metrics(style_);
+       size_ = st;
+       size_.size = MathStyles(key_->id);
+       xcell(0).metrics(size_);
        ascent_   = xcell(0).ascent_;
        descent_  = xcell(0).descent_;
        width_    = xcell(0).width_;
 }
 
 
-void MathSizeInset::write(std::ostream & os, bool fragile) const
+void MathSizeInset::write(MathWriteInfo & os) const
 {
-       os << "{\\" << name() << " ";
-       cell(0).write(os, fragile);
-       os << "}";
+       os << "{\\" << key_->name << ' ' << cell(0) << '}';
 }
 
 
 void MathSizeInset::writeNormal(std::ostream & os) const
 {
-       os << "[" << name() << " ";
+       os << "[" << key_->name << " ";
        cell(0).writeNormal(os);
        os << "]";
 }