]> git.lyx.org Git - lyx.git/blobdiff - src/insets/inset.C
Clean up InsetGraphics::Cache and rename as GraphicsInset.
[lyx.git] / src / insets / inset.C
index 51f655cf47a02b39e07583a65d34699a30c8374a..a69f1f8884baa8d348423ed2d986c68b395a71a0 100644 (file)
 #include "lyxfont.h"
 #include "lyxtext.h"
 #include "dimension.h"
+#include "metricsinfo.h"
 
 #include "frontends/Painter.h"
 #include "frontends/mouse_state.h"
 
 #include "support/lstrings.h"
 
-using std::endl;
-
 
 // Initialization of the counter for the inset id's,
 unsigned int Inset::inset_id = 0;
@@ -40,15 +39,12 @@ Inset::Inset()
 {}
 
 
-Inset::Inset(Inset const & in, bool same_id)
+Inset::Inset(Inset const & in)
        : InsetBase(),
        top_x(0), top_baseline(0), scx(0), owner_(0),
        name_(in.name_), background_color_(in.background_color_)
 {
-       if (same_id)
-               id_ = in.id();
-       else
-               id_ = inset_id++;
+       id_ = inset_id++;
 }
 
 
@@ -64,10 +60,6 @@ Inset::EDITABLE Inset::editable() const
 }
 
 
-void Inset::validate(LaTeXFeatures &) const
-{}
-
-
 bool Inset::autoDelete() const
 {
        return false;
@@ -151,7 +143,10 @@ int Inset::latexTextWidth(BufferView * bv) const
 int Inset::ascent(BufferView * bv, LyXFont const & font) const
 {
        Dimension dim;
-       dimension(bv, font, dim);
+       MetricsInfo mi;
+       mi.base.bv = bv;
+       mi.base.font = font;
+       metrics(mi, dim);
        return dim.ascent();
 }
 
@@ -159,7 +154,10 @@ int Inset::ascent(BufferView * bv, LyXFont const & font) const
 int Inset::descent(BufferView * bv, LyXFont const & font) const
 {
        Dimension dim;
-       dimension(bv, font, dim);
+       MetricsInfo mi;
+       mi.base.bv = bv;
+       mi.base.font = font;
+       metrics(mi, dim);
        return dim.descent();
 }
 
@@ -167,7 +165,9 @@ int Inset::descent(BufferView * bv, LyXFont const & font) const
 int Inset::width(BufferView * bv, LyXFont const & font) const
 {
        Dimension dim;
-       dimension(bv, font, dim);
+       MetricsInfo mi;
+       mi.base.bv = bv;
+       mi.base.font = font;
+       metrics(mi, dim);
        return dim.width();
 }
-