#include "InsetLine.h"
-#include "debug.h"
-#include "LColor.h"
-#include "LyXText.h"
+#include "support/debug.h"
+#include "Dimension.h"
+#include "Font.h"
#include "MetricsInfo.h"
#include "LaTeXFeatures.h"
#include "OutputParams.h"
+#include "Text.h"
+
+#include "support/docstream.h"
#include "frontends/Painter.h"
+using namespace std;
+
namespace lyx {
using frontend::Painter;
-using std::endl;
-using std::ostream;
-
void InsetLine::read(Buffer const &, Lexer &)
{
}
-bool InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
{
dim.asc = 3;
dim.des = 3;
dim.wid = mi.base.textwidth;
- bool const changed = dim_ != dim;
- dim_ = dim;
- return changed;
+ // Cache the inset dimension.
+ setDimCache(mi, dim);
}
void InsetLine::draw(PainterInfo & pi, int x, int y) const
{
- pi.pain.line(x, y, x + dim_.wid, y, LColor::topline, Painter::line_solid,
- Painter::line_thick);
+ Dimension const dim = dimension(*pi.base.bv);
+ pi.pain.line(x, y, x + dim.wid, y, Color_topline,
+ Painter::line_solid, Painter::line_thick);
}
int InsetLine::latex(Buffer const &, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "\\lyxline{\\"
<< from_ascii(runparams.local_font->latexSize()) << '}';
int InsetLine::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << "\n-------------------------------------------\n";
return PLAINTEXT_NEWLINE;