#include "gettext.h"
#include "Color.h"
#include "Lexer.h"
-#include "LyXText.h"
+#include "Text.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
}
-std::auto_ptr<Inset> InsetVSpace::doClone() const
+Inset * InsetVSpace::clone() const
{
- return std::auto_ptr<Inset>(new InsetVSpace(*this));
+ return new InsetVSpace(*this);
}
}
case LFUN_MOUSE_RELEASE:
- InsetVSpaceMailer(*this).showDialog(&cur.bv());
+ if (!cur.selection())
+ InsetVSpaceMailer(*this).showDialog(&cur.bv());
break;
default:
}
-bool InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
{
int height = 3 * arrow_size;
if (space_.length().len().value() >= 0.0)
height = max(height, space_.inPixels(*mi.base.bv));
- LyXFont font;
+ Font font;
font.decSize();
font.decSize();
dim.asc = height / 2 + (a - d) / 2; // align cursor with the
dim.des = height - dim.asc; // label text
dim.wid = ADD_TO_VSPACE_WIDTH + 2 * arrow_size + 5 + w;
- bool const changed = dim_ != dim;
- dim_ = dim;
- return changed;
+ // Cache the inset dimension.
+ setDimCache(mi, dim);
}
void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
{
- setPosCache(pi, x, y);
-
+ Dimension const dim = dimension(*pi.base.bv);
x += ADD_TO_VSPACE_WIDTH;
-
- int const start = y - dim_.asc;
- int const end = y + dim_.des;
+ int const start = y - dim.asc;
+ int const end = y + dim.des;
// y-values for top arrow
int ty1, ty2;
int a = 0;
int d = 0;
- LyXFont font;
+ Font font;
font.setColor(Color::added_space);
font.decSize();
font.decSize();
int InsetVSpace::latex(Buffer const & buf, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << from_ascii(space_.asLatexCommand(buf.params())) << '\n';
return 1;
int InsetVSpace::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << "\n\n";
return PLAINTEXT_NEWLINE;
int InsetVSpace::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 1;