2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetCaption.cpp
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2000-07-17 18:27:53 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCaption.h"
|
|
|
|
#include "InsetFloat.h"
|
|
|
|
#include "InsetWrap.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Buffer.h"
|
|
|
|
#include "BufferParams.h"
|
2007-11-03 18:50:54 +00:00
|
|
|
#include "BufferView.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Counters.h"
|
2007-04-26 14:56:30 +00:00
|
|
|
#include "Cursor.h"
|
2007-11-03 18:50:54 +00:00
|
|
|
#include "Dimension.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
#include "Floating.h"
|
2001-03-11 03:20:44 +00:00
|
|
|
#include "FloatList.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "FuncRequest.h"
|
2007-01-30 13:23:21 +00:00
|
|
|
#include "FuncStatus.h"
|
2007-10-24 15:32:43 +00:00
|
|
|
#include "InsetList.h"
|
2009-07-12 20:09:53 +00:00
|
|
|
#include "Language.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "MetricsInfo.h"
|
2007-01-30 13:23:21 +00:00
|
|
|
#include "output_latex.h"
|
2009-11-30 17:27:10 +00:00
|
|
|
#include "output_xhtml.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "OutputParams.h"
|
|
|
|
#include "Paragraph.h"
|
2007-11-07 23:34:45 +00:00
|
|
|
#include "TextClass.h"
|
2010-12-01 00:32:30 +00:00
|
|
|
#include "TextMetrics.h"
|
2007-02-01 12:45:14 +00:00
|
|
|
#include "TocBackend.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
|
2006-10-07 16:15:06 +00:00
|
|
|
#include "frontends/FontMetrics.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
#include "frontends/Painter.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
|
2008-06-18 18:54:31 +00:00
|
|
|
#include "support/gettext.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
2004-07-24 10:55:30 +00:00
|
|
|
#include <sstream>
|
2002-11-21 18:33:09 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 19:57:42 +00:00
|
|
|
using namespace lyx::support;
|
2003-06-02 10:03:27 +00:00
|
|
|
|
2007-02-01 12:45:14 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetCaption::InsetCaption(Buffer * buf)
|
2009-04-04 19:34:14 +00:00
|
|
|
: InsetText(buf, InsetText::PlainLayout)
|
2001-03-11 03:20:44 +00:00
|
|
|
{
|
2001-06-28 10:25:20 +00:00
|
|
|
setAutoBreakRows(true);
|
2004-08-14 15:55:22 +00:00
|
|
|
setDrawFrame(true);
|
2010-08-24 01:29:22 +00:00
|
|
|
setFrameColor(Color_collapsableframe);
|
2001-03-11 03:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
void InsetCaption::write(ostream & os) const
|
2000-07-18 17:45:27 +00:00
|
|
|
{
|
|
|
|
os << "Caption\n";
|
2009-08-09 15:29:34 +00:00
|
|
|
text().write(os);
|
2000-07-18 17:45:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-14 17:15:32 +00:00
|
|
|
docstring InsetCaption::name() const
|
|
|
|
{
|
|
|
|
if (type_.empty())
|
|
|
|
return from_ascii("Caption");
|
|
|
|
return from_utf8("Caption:" + type_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
void InsetCaption::read(Lexer & lex)
|
2000-07-18 17:45:27 +00:00
|
|
|
{
|
2001-03-11 03:20:44 +00:00
|
|
|
#if 0
|
|
|
|
// We will enably this check again when the compability
|
|
|
|
// code is removed from Buffer::Read (Lgb)
|
2008-04-05 10:34:29 +00:00
|
|
|
lex.setContext("InsetCaption::Read: consistency check");
|
|
|
|
lex >> "Caption";
|
2001-03-11 03:20:44 +00:00
|
|
|
#endif
|
2008-02-27 20:43:16 +00:00
|
|
|
InsetText::read(lex);
|
2000-07-18 17:45:27 +00:00
|
|
|
}
|
2001-03-11 03:20:44 +00:00
|
|
|
|
|
|
|
|
2006-10-17 16:23:27 +00:00
|
|
|
void InsetCaption::cursorPos(BufferView const & bv,
|
|
|
|
CursorSlice const & sl, bool boundary, int & x, int & y) const
|
2006-05-05 05:51:51 +00:00
|
|
|
{
|
2006-10-17 16:23:27 +00:00
|
|
|
InsetText::cursorPos(bv, sl, boundary, x, y);
|
2006-05-05 05:51:51 +00:00
|
|
|
x += labelwidth_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-01 12:45:14 +00:00
|
|
|
void InsetCaption::setCustomLabel(docstring const & label)
|
2006-05-28 17:02:57 +00:00
|
|
|
{
|
2007-12-12 19:57:42 +00:00
|
|
|
if (!isAscii(label) || label.empty())
|
2007-02-01 12:45:14 +00:00
|
|
|
// This must be a user defined layout. We cannot translate
|
|
|
|
// this, since gettext accepts only ascii keys.
|
|
|
|
custom_label_ = label;
|
|
|
|
else
|
|
|
|
custom_label_ = _(to_ascii(label));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-12 22:23:27 +00:00
|
|
|
void InsetCaption::addToToc(DocIterator const & cpit) const
|
2007-02-01 12:45:14 +00:00
|
|
|
{
|
|
|
|
if (type_.empty())
|
|
|
|
return;
|
|
|
|
|
2008-05-13 08:23:44 +00:00
|
|
|
DocIterator pit = cpit;
|
2011-01-12 22:23:27 +00:00
|
|
|
pit.push_back(CursorSlice(const_cast<InsetCaption &>(*this)));
|
2007-02-01 12:45:14 +00:00
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
Toc & toc = buffer().tocBackend().toc(type_);
|
2010-12-20 21:55:09 +00:00
|
|
|
docstring str = full_label_ + ". ";
|
|
|
|
text().forToc(str, TOC_ENTRY_LENGTH);
|
2007-02-01 12:45:14 +00:00
|
|
|
toc.push_back(TocItem(pit, 0, str));
|
2008-06-03 11:33:13 +00:00
|
|
|
|
|
|
|
// Proceed with the rest of the inset.
|
|
|
|
InsetText::addToToc(cpit);
|
2006-05-28 17:02:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
void InsetCaption::metrics(MetricsInfo & mi, Dimension & dim) const
|
2006-05-05 05:51:51 +00:00
|
|
|
{
|
2007-10-28 18:51:54 +00:00
|
|
|
FontInfo tmpfont = mi.base.font;
|
|
|
|
mi.base.font = mi.base.bv->buffer().params().getFont().fontInfo();
|
2007-01-30 13:23:21 +00:00
|
|
|
labelwidth_ = theFontMetrics(mi.base.font).width(full_label_);
|
2007-02-11 23:35:12 +00:00
|
|
|
// add some space to separate the label from the inset text
|
|
|
|
labelwidth_ += 2 * TEXT_TO_INSET_OFFSET;
|
2006-05-05 05:51:51 +00:00
|
|
|
dim.wid = labelwidth_;
|
|
|
|
Dimension textdim;
|
2007-08-31 17:32:27 +00:00
|
|
|
// Correct for button and label width
|
2007-01-30 13:23:21 +00:00
|
|
|
mi.base.textwidth -= dim.wid;
|
|
|
|
InsetText::metrics(mi, textdim);
|
2007-09-24 17:51:15 +00:00
|
|
|
mi.base.font = tmpfont;
|
2007-08-31 17:32:27 +00:00
|
|
|
mi.base.textwidth += dim.wid;
|
2007-12-12 19:28:07 +00:00
|
|
|
dim.des = max(dim.des - textdim.asc + dim.asc, textdim.des);
|
2006-05-05 05:51:51 +00:00
|
|
|
dim.asc = textdim.asc;
|
|
|
|
dim.wid += textdim.wid;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-01 00:32:30 +00:00
|
|
|
void InsetCaption::drawBackground(PainterInfo & pi, int x, int y) const
|
|
|
|
{
|
|
|
|
TextMetrics & tm = pi.base.bv->textMetrics(&text());
|
|
|
|
int const h = tm.height() + 2 * TEXT_TO_INSET_OFFSET;
|
|
|
|
int const yy = y - TEXT_TO_INSET_OFFSET - tm.ascent();
|
2010-12-01 00:35:35 +00:00
|
|
|
pi.pain.fillRectangle(x, yy, labelwidth_, h, pi.backgroundColor(this));
|
2010-12-01 00:32:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-05-30 06:48:24 +00:00
|
|
|
void InsetCaption::draw(PainterInfo & pi, int x, int y) const
|
2001-03-11 03:20:44 +00:00
|
|
|
{
|
|
|
|
// We must draw the label, we should get the label string
|
|
|
|
// from the enclosing float inset.
|
|
|
|
// The question is: Who should draw the label, the caption inset,
|
|
|
|
// the text inset or the paragraph?
|
|
|
|
// We should also draw the float number (Lgb)
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
// Answer: the text inset (in buffer_funcs.cpp: setCaption).
|
2007-01-30 13:23:21 +00:00
|
|
|
|
2007-10-28 18:51:54 +00:00
|
|
|
FontInfo tmpfont = pi.base.font;
|
|
|
|
pi.base.font = pi.base.bv->buffer().params().getFont().fontInfo();
|
2010-09-09 13:15:25 +00:00
|
|
|
pi.base.font.setColor(pi.textColor(pi.base.font.color()).baseColor);
|
2010-12-01 00:32:30 +00:00
|
|
|
int const xx = x + TEXT_TO_INSET_OFFSET;
|
|
|
|
pi.pain.text(xx, y, full_label_, pi.base.font);
|
2007-09-09 20:21:43 +00:00
|
|
|
InsetText::draw(pi, x + labelwidth_, y);
|
2007-09-24 17:51:15 +00:00
|
|
|
pi.base.font = tmpfont;
|
2006-05-05 05:51:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-11 08:20:13 +00:00
|
|
|
void InsetCaption::edit(Cursor & cur, bool front, EntryDirection entry_from)
|
2006-05-05 05:51:51 +00:00
|
|
|
{
|
|
|
|
cur.push(*this);
|
2008-02-10 19:52:45 +00:00
|
|
|
InsetText::edit(cur, front, entry_from);
|
2006-05-05 05:51:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
Inset * InsetCaption::editXY(Cursor & cur, int x, int y)
|
2006-05-05 05:51:51 +00:00
|
|
|
{
|
|
|
|
cur.push(*this);
|
|
|
|
return InsetText::editXY(cur, x, y);
|
2001-03-11 03:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-13 09:04:52 +00:00
|
|
|
bool InsetCaption::insetAllowed(InsetCode code) const
|
2007-02-02 13:55:14 +00:00
|
|
|
{
|
|
|
|
switch (code) {
|
2009-12-09 23:36:59 +00:00
|
|
|
// code that is not allowed in a caption
|
2007-02-02 13:55:14 +00:00
|
|
|
case CAPTION_CODE:
|
2010-08-07 03:16:38 +00:00
|
|
|
case FLOAT_CODE:
|
|
|
|
case FOOT_CODE:
|
2007-11-23 02:10:00 +00:00
|
|
|
case NEWPAGE_CODE:
|
2010-08-07 03:16:38 +00:00
|
|
|
case MARGIN_CODE:
|
2007-12-21 20:42:46 +00:00
|
|
|
case MATHMACRO_CODE:
|
2010-08-07 03:16:38 +00:00
|
|
|
case TABULAR_CODE:
|
|
|
|
case WRAP_CODE:
|
2007-02-02 13:55:14 +00:00
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
return InsetText::insetAllowed(code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-26 14:56:30 +00:00
|
|
|
bool InsetCaption::getStatus(Cursor & cur, FuncRequest const & cmd,
|
2007-01-30 13:23:21 +00:00
|
|
|
FuncStatus & status) const
|
|
|
|
{
|
2010-04-09 19:00:42 +00:00
|
|
|
switch (cmd.action()) {
|
2007-01-30 13:23:21 +00:00
|
|
|
|
|
|
|
case LFUN_BREAK_PARAGRAPH:
|
2008-05-29 15:14:00 +00:00
|
|
|
status.setEnabled(false);
|
2007-01-30 13:23:21 +00:00
|
|
|
return true;
|
|
|
|
|
2010-06-04 22:53:44 +00:00
|
|
|
case LFUN_ARGUMENT_INSERT:
|
2010-06-04 22:44:58 +00:00
|
|
|
status.setEnabled(cur.paragraph().insetList().find(ARG_CODE) == -1);
|
2007-02-02 21:08:44 +00:00
|
|
|
return true;
|
|
|
|
|
2008-03-25 05:33:39 +00:00
|
|
|
case LFUN_INSET_TOGGLE:
|
|
|
|
// pass back to owner
|
|
|
|
cur.undispatched();
|
|
|
|
return false;
|
|
|
|
|
2007-01-30 13:23:21 +00:00
|
|
|
default:
|
|
|
|
return InsetText::getStatus(cur, cmd, status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-10 20:02:48 +00:00
|
|
|
void InsetCaption::latex(otexstream & os,
|
|
|
|
OutputParams const & runparams_in) const
|
2001-03-11 03:20:44 +00:00
|
|
|
{
|
2009-02-07 12:27:24 +00:00
|
|
|
if (runparams_in.inFloat == OutputParams::SUBFLOAT)
|
2008-03-02 11:30:50 +00:00
|
|
|
// caption is output as an optional argument
|
2011-02-10 20:02:48 +00:00
|
|
|
return;
|
2001-03-11 03:20:44 +00:00
|
|
|
// This is a bit too simplistic to take advantage of
|
|
|
|
// caption options we must add more later. (Lgb)
|
|
|
|
// This code is currently only able to handle the simple
|
|
|
|
// \caption{...}, later we will make it take advantage
|
|
|
|
// of the one of the caption packages. (Lgb)
|
2007-02-02 13:55:14 +00:00
|
|
|
OutputParams runparams = runparams_in;
|
|
|
|
// FIXME: actually, it is moving only when there is no
|
|
|
|
// optional argument.
|
|
|
|
runparams.moving_arg = true;
|
2007-01-30 13:23:21 +00:00
|
|
|
os << "\\caption";
|
2011-02-10 20:02:48 +00:00
|
|
|
latexArgInsets(paragraphs()[0], os, runparams, 0, 1);
|
2007-01-30 13:23:21 +00:00
|
|
|
os << '{';
|
2011-02-10 20:02:48 +00:00
|
|
|
InsetText::latex(os, runparams);
|
2007-01-30 13:23:21 +00:00
|
|
|
os << "}\n";
|
2007-03-18 10:59:16 +00:00
|
|
|
runparams_in.encoding = runparams.encoding;
|
2001-03-11 03:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
int InsetCaption::plaintext(odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const & runparams) const
|
2001-03-11 03:20:44 +00:00
|
|
|
{
|
2007-02-16 09:53:51 +00:00
|
|
|
os << '[' << full_label_ << "\n";
|
2008-02-27 20:43:16 +00:00
|
|
|
InsetText::plaintext(os, runparams);
|
2007-02-16 09:53:51 +00:00
|
|
|
os << "\n]";
|
|
|
|
|
2007-02-20 17:52:41 +00:00
|
|
|
return PLAINTEXT_NEWLINE + 1; // one char on a separate line
|
2001-03-11 03:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
int InsetCaption::docbook(odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const & runparams) const
|
2001-03-11 03:20:44 +00:00
|
|
|
{
|
2001-11-02 16:11:19 +00:00
|
|
|
int ret;
|
|
|
|
os << "<title>";
|
2008-02-27 20:43:16 +00:00
|
|
|
ret = InsetText::docbook(os, runparams);
|
2001-11-02 16:11:19 +00:00
|
|
|
os << "</title>\n";
|
|
|
|
return ret;
|
2001-03-11 03:20:44 +00:00
|
|
|
}
|
2005-02-23 12:01:50 +00:00
|
|
|
|
|
|
|
|
2009-11-30 17:27:10 +00:00
|
|
|
docstring InsetCaption::xhtml(XHTMLStream & xs, OutputParams const & rp) const
|
2009-06-19 12:49:08 +00:00
|
|
|
{
|
2009-10-26 20:47:12 +00:00
|
|
|
if (rp.html_disable_captions)
|
2009-06-19 18:32:50 +00:00
|
|
|
return docstring();
|
2009-12-14 17:15:32 +00:00
|
|
|
string attr = "class='float-caption";
|
|
|
|
if (!type_.empty())
|
|
|
|
attr += " float-caption-" + type_;
|
|
|
|
attr += "'";
|
2010-01-19 22:08:04 +00:00
|
|
|
xs << html::StartTag("div", attr);
|
2009-11-30 17:27:10 +00:00
|
|
|
docstring def = getCaptionAsHTML(xs, rp);
|
2010-01-19 22:08:04 +00:00
|
|
|
xs << html::EndTag("div");
|
2009-06-19 18:32:50 +00:00
|
|
|
return def;
|
2009-06-19 12:49:08 +00:00
|
|
|
}
|
|
|
|
|
2009-11-30 17:27:10 +00:00
|
|
|
|
2011-02-10 20:02:48 +00:00
|
|
|
void InsetCaption::getArgument(otexstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const & runparams) const
|
2007-05-14 20:42:14 +00:00
|
|
|
{
|
2011-02-10 20:02:48 +00:00
|
|
|
InsetText::latex(os, runparams);
|
2007-05-14 20:42:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-10 20:02:48 +00:00
|
|
|
void InsetCaption::getOptArg(otexstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const & runparams) const
|
2007-05-14 20:42:14 +00:00
|
|
|
{
|
2011-02-10 20:02:48 +00:00
|
|
|
latexArgInsets(paragraphs()[0], os, runparams, 0, 1);
|
2007-05-14 20:42:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-19 13:50:19 +00:00
|
|
|
int InsetCaption::getCaptionAsPlaintext(odocstream & os,
|
2008-04-10 09:22:49 +00:00
|
|
|
OutputParams const & runparams) const
|
|
|
|
{
|
|
|
|
os << full_label_ << ' ';
|
|
|
|
return InsetText::plaintext(os, runparams);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-30 17:27:10 +00:00
|
|
|
docstring InsetCaption::getCaptionAsHTML(XHTMLStream & xs,
|
2009-06-19 12:49:08 +00:00
|
|
|
OutputParams const & runparams) const
|
|
|
|
{
|
2009-11-30 17:27:10 +00:00
|
|
|
xs << full_label_ << ' ';
|
|
|
|
InsetText::XHTMLOptions const opts =
|
|
|
|
InsetText::WriteLabel | InsetText::WriteInnerTag;
|
|
|
|
return InsetText::insetAsXHTML(xs, runparams, opts);
|
2009-06-19 12:49:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-03 22:13:45 +00:00
|
|
|
void InsetCaption::updateBuffer(ParIterator const & it, UpdateType utype)
|
2007-02-16 09:53:51 +00:00
|
|
|
{
|
2008-05-20 11:54:23 +00:00
|
|
|
Buffer const & master = *buffer().masterBuffer();
|
|
|
|
DocumentClass const & tclass = master.params().documentClass();
|
2009-07-12 20:09:53 +00:00
|
|
|
string const & lang = it.paragraph().getParLanguage(master.params())->code();
|
2007-08-12 21:43:58 +00:00
|
|
|
Counters & cnts = tclass.counters();
|
|
|
|
string const & type = cnts.current_float();
|
2010-01-20 19:42:12 +00:00
|
|
|
if (utype == OutputUpdate) {
|
2010-01-20 19:03:17 +00:00
|
|
|
// counters are local to the caption
|
|
|
|
cnts.saveLastCounter();
|
|
|
|
}
|
2008-02-11 13:23:42 +00:00
|
|
|
// Memorize type for addToToc().
|
|
|
|
type_ = type;
|
2007-08-12 21:43:58 +00:00
|
|
|
if (type.empty())
|
2008-05-20 11:54:23 +00:00
|
|
|
full_label_ = master.B_("Senseless!!! ");
|
2007-02-16 09:53:51 +00:00
|
|
|
else {
|
2007-08-12 21:43:58 +00:00
|
|
|
// FIXME: life would be _much_ simpler if listings was
|
|
|
|
// listed in Floating.
|
|
|
|
docstring name;
|
|
|
|
if (type == "listing")
|
2008-05-20 11:54:23 +00:00
|
|
|
name = master.B_("Listing");
|
2007-08-12 21:43:58 +00:00
|
|
|
else
|
2008-05-20 11:54:23 +00:00
|
|
|
name = master.B_(tclass.floats().getType(type).name());
|
2008-03-02 11:30:50 +00:00
|
|
|
docstring counter = from_utf8(type);
|
2009-02-07 12:27:24 +00:00
|
|
|
if (cnts.isSubfloat()) {
|
2008-03-02 11:30:50 +00:00
|
|
|
counter = "sub-" + from_utf8(type);
|
|
|
|
name = bformat(_("Sub-%1$s"),
|
2008-05-20 11:54:23 +00:00
|
|
|
master.B_(tclass.floats().getType(type).name()));
|
2008-03-02 11:30:50 +00:00
|
|
|
}
|
|
|
|
if (cnts.hasCounter(counter)) {
|
2010-01-20 19:42:12 +00:00
|
|
|
cnts.step(counter, utype);
|
2007-08-12 21:43:58 +00:00
|
|
|
full_label_ = bformat(from_ascii("%1$s %2$s:"),
|
2008-03-02 11:30:50 +00:00
|
|
|
name,
|
2009-07-12 20:09:53 +00:00
|
|
|
cnts.theCounter(counter, lang));
|
2007-08-12 21:43:58 +00:00
|
|
|
} else
|
|
|
|
full_label_ = bformat(from_ascii("%1$s #:"), name);
|
2007-02-16 09:53:51 +00:00
|
|
|
}
|
2007-08-12 21:43:58 +00:00
|
|
|
|
|
|
|
// Do the real work now.
|
2010-03-03 22:13:45 +00:00
|
|
|
InsetText::updateBuffer(it, utype);
|
2010-01-20 19:42:12 +00:00
|
|
|
if (utype == OutputUpdate)
|
2010-01-20 19:03:17 +00:00
|
|
|
cnts.restoreLastCounter();
|
2007-02-16 09:53:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|