]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetPagebreak.cpp
* InsetCollapsable:
[lyx.git] / src / insets / InsetPagebreak.cpp
index e75b08ffa6943f49f6a2e77042813014eddce7b7..3b1ea36e4216bf3beec25488e153a00739fd7b73 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "debug.h"
 #include "gettext.h"
-#include "Color.h"
 #include "Text.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
@@ -41,38 +40,39 @@ void InsetPagebreak::write(Buffer const &, std::ostream & os) const
 }
 
 
-bool InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        dim.asc = defaultRowHeight();
        dim.des = defaultRowHeight();
        dim.wid = mi.base.textwidth;
-       bool const changed = dim_ != dim;
-       dim_ = dim;
-       return changed;
+       // Cache the inset dimension. 
+       setDimCache(mi, dim);
 }
 
 
 void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
 {
-       Font font;
-       font.setColor(Color::pagebreak);
+       FontInfo font;
+       font.setColor(Color_pagebreak);
        font.decSize();
 
+       Dimension const dim = dimension(*pi.base.bv);
+
        int w = 0;
        int a = 0;
        int d = 0;
        theFontMetrics(font).rectText(insetLabel(), w, a, d);
 
-       int const text_start = int(x + (dim_.wid - w) / 2);
+       int const text_start = int(x + (dim.wid - w) / 2);
        int const text_end = text_start + w;
 
        pi.pain.rectText(text_start, y + d, insetLabel(), font,
-               Color::none, Color::none);
+               Color_none, Color_none);
 
        pi.pain.line(x, y, text_start, y,
-                  Color::pagebreak, Painter::line_onoffdash);
-       pi.pain.line(text_end, y, int(x + dim_.wid), y,
-                  Color::pagebreak, Painter::line_onoffdash);
+                  Color_pagebreak, Painter::line_onoffdash);
+       pi.pain.line(text_end, y, int(x + dim.wid), y,
+                  Color_pagebreak, Painter::line_onoffdash);
 }