]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_fboxinset.C
architectural changes to tex2lyx
[lyx.git] / src / mathed / math_fboxinset.C
index 0b7f49d6690da6243093bd12455880dade76b121..53316e0ba8b597471dcc254b3c957326850b3504 100644 (file)
@@ -1,6 +1,5 @@
 #include <config.h>
 
-
 #include "math_fboxinset.h"
 #include "math_support.h"
 #include "math_mathmlstream.h"
@@ -8,6 +7,7 @@
 #include "math_parser.h"
 #include "frontends/Painter.h"
 
+using std::auto_ptr;
 
 
 MathFboxInset::MathFboxInset(latexkeys const * key)
@@ -15,9 +15,9 @@ MathFboxInset::MathFboxInset(latexkeys const * key)
 {}
 
 
-MathInset * MathFboxInset::clone() const
+auto_ptr<InsetBase> MathFboxInset::clone() const
 {
-       return new MathFboxInset(*this);
+       return auto_ptr<InsetBase>(new MathFboxInset(*this));
 }
 
 
@@ -29,25 +29,25 @@ MathInset::mode_type MathFboxInset::currentMode() const
 }
 
 
-void MathFboxInset::metrics(MathMetricsInfo & mi) const
+void MathFboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        if (key_->name == "fbox") {
-               MathFontSetChanger dummy(mi.base, "textnormal");
-               dim_ = cell(0).metrics(mi);
-               metricsMarkers2(5); // 5 pixels margin
+               FontSetChanger dummy(mi.base, "textnormal");
+               cell(0).metrics(mi, dim_);
        } else {
-               dim_ = cell(0).metrics(mi);
-               metricsMarkers2(5); // 5 pixels margin
+               cell(0).metrics(mi, dim_);
        }
+       metricsMarkers(5); // 5 pixels margin
+       dim = dim_;
 }
 
 
-void MathFboxInset::draw(MathPainterInfo & pi, int x, int y) const
+void MathFboxInset::draw(PainterInfo & pi, int x, int y) const
 {
-       pi.pain.rectangle(x + 1, y - ascent() + 1, width() - 2, height() - 2,
-                       LColor::black);
+       pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
+               dim_.width() - 2, dim_.height() - 2, LColor::foreground);
        if (key_->name == "fbox") {
-               MathFontSetChanger dummy(pi.base, "textnormal");
+               FontSetChanger dummy(pi.base, "textnormal");
                cell(0).draw(pi, x + 5, y);
        } else {
                cell(0).draw(pi, x + 5, y);