#include "FuncRequest.h"
#include "FuncStatus.h"
#include "gettext.h"
-#include "LColor.h"
+#include "Color.h"
#include "MetricsInfo.h"
#include "output_latex.h"
#include "OutputParams.h"
using support::bformat;
+InsetCaption::InsetCaption(InsetCaption const & ic)
+ : InsetText(ic), textclass_(ic.textclass_)
+{
+ setAutoBreakRows(true);
+ setDrawFrame(true);
+ setFrameColor(Color::captionframe);
+}
+
InsetCaption::InsetCaption(BufferParams const & bp)
- : InsetText(bp), textclass_(bp.getLyXTextClass())
+ : InsetText(bp), textclass_(bp.getTextClass())
{
setAutoBreakRows(true);
setDrawFrame(true);
- setFrameColor(LColor::captionframe);
+ setFrameColor(Color::captionframe);
}
int const width_offset = TEXT_TO_INSET_OFFSET / 2;
mi.base.textwidth -= width_offset;
- computeFullLabel();
+ computeFullLabel(*mi.base.bv->buffer());
labelwidth_ = theFontMetrics(mi.base.font).width(full_label_);
// add some space to separate the label from the inset text
}
-InsetBase * InsetCaption::editXY(Cursor & cur, int x, int y)
+Inset * InsetCaption::editXY(Cursor & cur, int x, int y)
{
cur.push(*this);
return InsetText::editXY(cur, x, y);
}
-bool InsetCaption::insetAllowed(InsetBase::Code code) const
+bool InsetCaption::insetAllowed(Inset::Code code) const
{
switch (code) {
case FLOAT_CODE:
int InsetCaption::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
- computeFullLabel();
+ computeFullLabel(buf);
os << '[' << full_label_ << "\n";
InsetText::plaintext(buf, os, runparams);
}
-void InsetCaption::computeFullLabel() const
+int InsetCaption::getArgument(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams) const
+{
+ return InsetText::latex(buf, os, runparams);
+}
+
+
+int InsetCaption::getOptArg(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams) const
+{
+ return latexOptArgInsets(buf, paragraphs()[0], os, runparams, 1);
+}
+
+
+void InsetCaption::computeFullLabel(Buffer const & buf) const
{
if (type_.empty())
- full_label_ = _("Senseless!!! ");
+ full_label_ = buf.B_("Senseless!!! ");
else {
docstring const number = convert<docstring>(counter_);
- docstring label = custom_label_.empty()? _(type_): custom_label_;
+ docstring label = custom_label_.empty()? buf.B_(type_): custom_label_;
full_label_ = bformat(from_ascii("%1$s %2$s:"), label, number);
}
}
-auto_ptr<InsetBase> InsetCaption::doClone() const
+auto_ptr<Inset> InsetCaption::doClone() const
{
- return auto_ptr<InsetBase>(new InsetCaption(*this));
+ return auto_ptr<Inset>(new InsetCaption(*this));
}