]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_fboxinset.C
bug + spped fixes + small stuff
[lyx.git] / src / mathed / math_fboxinset.C
index d6f9e1fbd491e7e5155d5070b222a0752b47a875..7411545fb4351bd63c363f3bbe4b82df7c5d6cf0 100644 (file)
@@ -1,13 +1,24 @@
-#include <config.h>
+/**
+ * \file math_fboxinset.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
 
+#include <config.h>
 
 #include "math_fboxinset.h"
-#include "math_support.h"
+#include "math_data.h"
 #include "math_mathmlstream.h"
-#include "math_streamstr.h"
 #include "math_parser.h"
+#include "math_streamstr.h"
+#include "LColor.h"
 #include "frontends/Painter.h"
 
+using std::auto_ptr;
 
 
 MathFboxInset::MathFboxInset(latexkeys const * key)
@@ -15,9 +26,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,23 +40,23 @@ MathInset::mode_type MathFboxInset::currentMode() const
 }
 
 
-void MathFboxInset::metrics(MetricsInfo & mi) const
+void MathFboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        if (key_->name == "fbox") {
                FontSetChanger dummy(mi.base, "textnormal");
-               dim_ = cell(0).metrics(mi);
-               metricsMarkers2(5); // 5 pixels margin
+               cell(0).metrics(mi, dim);
        } else {
-               dim_ = cell(0).metrics(mi);
-               metricsMarkers2(5); // 5 pixels margin
+               cell(0).metrics(mi, dim);
        }
+       metricsMarkers(dim, 5); // 5 pixels margin
+       dim_ = dim;
 }
 
 
 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") {
                FontSetChanger dummy(pi.base, "textnormal");
                cell(0).draw(pi, x + 5, y);