void InsetCaption::metrics(MetricsInfo & mi, Dimension & dim) const
{
- FontInfo tmpfont = mi.base.font;
- mi.base.font = mi.base.bv->buffer().params().getFont().fontInfo();
labelwidth_ = theFontMetrics(mi.base.font).width(full_label_);
// add some space to separate the label from the inset text
labelwidth_ += leftOffset(mi.base.bv) + rightOffset(mi.base.bv);
// Correct for button and label width
mi.base.textwidth -= dim.wid;
InsetText::metrics(mi, textdim);
- mi.base.font = tmpfont;
mi.base.textwidth += dim.wid;
dim.des = max(dim.des - textdim.asc + dim.asc, textdim.des);
dim.asc = textdim.asc;
rtl_ = !pi.ltr_pos;
FontInfo tmpfont = pi.base.font;
- pi.base.font = pi.base.bv->buffer().params().getFont().fontInfo();
- pi.base.font.setColor(pi.textColor(pi.base.font.color()).baseColor);
- if (is_deleted_)
- pi.base.font.setStrikeout(FONT_ON);
- else if (isChanged() && lyxrc.ct_additions_underlined)
- pi.base.font.setUnderbar(FONT_ON);
+ if (non_float_)
+ pi.base.font.setColor(Color_error);
+ else
+ pi.base.font.setPaintColor(pi.textColor(pi.base.font.color()));
int const lo = leftOffset(pi.base.bv);
if (rtl_) {
InsetText::draw(pi, x, y);
pi.pain.text(x + lo, y, full_label_, pi.base.font);
InsetText::draw(pi, x + labelwidth_, y);
}
+ // Draw the change tracking cue on the label, unless RowPainter already
+ // takes care of it.
+ if (canPaintChange(*pi.base.bv))
+ pi.change.paintCue(pi, x, y, x + labelwidth_, pi.base.font);
pi.base.font = tmpfont;
}
}
+docstring InsetCaption::toolTip(BufferView const & bv, int x, int y) const
+{
+ if (non_float_)
+ return _("Standard captions are not allowed outside floats. You will get a LaTeX error.\n"
+ "For captions outside floats, you can use the 'nonfloat' LaTeX package.");
+ return InsetText::toolTip(bv, x, y);
+}
+
+
void InsetCaption::getArgument(otexstream & os,
OutputParams const & runparams) const
{
void InsetCaption::getCaptionAsDocBook(XMLStream & xs,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
if (runparams.docbook_in_float)
return;
is_deleted_ = deleted;
// Memorize type for addToToc().
floattype_ = type;
- if (type.empty() || type == "senseless")
- full_label_ = master.B_("Senseless!!! ");
- else {
+ if (type.empty() || type == "senseless") {
+ full_label_ = master.B_("Orphaned caption:");
+ non_float_ = true;
+ } else {
// FIXME: life would be _much_ simpler if listings was
// listed in Floating.
docstring name;
if (sec.empty())
sec = from_ascii("#");
full_label_ = bformat(master.B_("%1$s %2$s: [[Caption label (ex. Figure 1: )]]"), name, sec);
+ non_float_ = false;
}
// Do the real work now.