#include "InsetFloat.h"
#include "InsetWrap.h"
-#include "buffer.h"
-#include "bufferparams.h"
-#include "counters.h"
-#include "cursor.h"
+#include "Buffer.h"
+#include "BufferParams.h"
+#include "Counters.h"
+#include "Cursor.h"
#include "BufferView.h"
#include "Floating.h"
#include "FloatList.h"
-#include "funcrequest.h"
+#include "FuncRequest.h"
#include "FuncStatus.h"
#include "gettext.h"
-#include "LColor.h"
-#include "metricsinfo.h"
+#include "Color.h"
+#include "MetricsInfo.h"
#include "output_latex.h"
-#include "outputparams.h"
-#include "paragraph.h"
+#include "OutputParams.h"
+#include "Paragraph.h"
#include "paragraph_funcs.h"
#include "TocBackend.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);
}
}
-void InsetCaption::read(Buffer const & buf, LyXLex & lex)
+void InsetCaption::read(Buffer const & buf, Lexer & lex)
{
#if 0
// We will enably this check again when the compability
}
-void InsetCaption::addToToc(TocList & toclist, Buffer const & buf) const
+void InsetCaption::addToToc(TocList & toclist, Buffer const & buf, ParConstIterator &) const
{
if (type_.empty())
return;
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
// the text inset or the paragraph?
// We should also draw the float number (Lgb)
- // Answer: the text inset (in buffer_funcs.C: setCaption).
+ // Answer: the text inset (in buffer_funcs.cpp: setCaption).
labelwidth_ = pi.pain.text(x, y, full_label_, pi.base.font);
// add some space to separate the label from the inset text
}
-void InsetCaption::edit(LCursor & cur, bool left)
+void InsetCaption::edit(Cursor & cur, bool left)
{
cur.push(*this);
InsetText::edit(cur, left);
}
-InsetBase * InsetCaption::editXY(LCursor & 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:
}
-bool InsetCaption::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetCaption::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & status) const
{
switch (cmd.action) {
int InsetCaption::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams_in) const
+ OutputParams const & runparams_in) const
{
// This is a bit too simplistic to take advantage of
// caption options we must add more later. (Lgb)
int InsetCaption::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
- computeFullLabel();
+ computeFullLabel(buf);
os << '[' << full_label_ << "\n";
InsetText::plaintext(buf, os, runparams);
int InsetCaption::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret;
os << "<title>";
}
-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));
}