#include "buffer.h"
#include "bufferparams.h"
#include "debug.h"
+#include "dispatchresult.h"
#include "Floating.h"
#include "FloatList.h"
#include "funcrequest.h"
InsetFloatList::InsetFloatList()
- : InsetCommand(InsetCommandParams())
+ : InsetCommand(InsetCommandParams(), "toc")
{}
InsetFloatList::InsetFloatList(string const & type)
- : InsetCommand(InsetCommandParams())
+ : InsetCommand(InsetCommandParams(), "toc")
{
setCmdName(type);
}
-InsetFloatList::~InsetFloatList()
-{
- InsetCommandMailer mailer("toc", *this);
- mailer.hideDialog();
-}
-
-
string const InsetFloatList::getScreenLabel(Buffer const & buf) const
{
FloatList const & floats = buf.params().getLyXTextClass().floats();
FloatList::const_iterator it = floats[getCmdName()];
if (it != floats.end())
- return _(it->second.listName());
+ return buf.B_(it->second.listName());
else
return _("ERROR: Nonexistent float type!");
}
} else
lex.printError("InsetFloatList: Parse error: `$$Token'");
while (lex.isOK()) {
- lex.nextToken();
+ lex.next();
token = lex.getString();
if (token == "\\end_inset")
break;
}
-void InsetFloatList::metrics(MetricsInfo & mi, Dimension & dim) const
-{
- InsetCommand::metrics(mi, dim);
- int center_indent = (mi.base.textwidth - dim.wid) / 2;
- Box b(center_indent, center_indent + dim.wid, -dim.asc, dim.des);
- button().setBox(b);
-
- dim.wid = mi.base.textwidth;
- dim_ = dim;
-}
-
-
-void InsetFloatList::draw(PainterInfo & pi, int x, int y) const
-{
- InsetCommand::draw(pi, x + button().box().x1, y);
-}
-
-
-dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd)
-{
- switch (cmd.action) {
- case LFUN_MOUSE_RELEASE:
- if (button().box().contains(cmd.x, cmd.y))
- InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DISPATCHED;
-
- case LFUN_INSET_DIALOG_SHOW:
- InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DISPATCHED;
-
- default:
- return InsetCommand::localDispatch(cmd);
- }
-}
-
-
int InsetFloatList::latex(Buffer const & buf, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
FloatList const & floats = buf.params().getLyXTextClass().floats();
FloatList::const_iterator cit = floats[getCmdName()];
}
} else {
os << "\\listof{" << getCmdName() << "}{"
- << cit->second.listName() << "}\n";
+ << buf.B_(cit->second.listName()) << "}\n";
}
} else {
os << "%%\\listof{" << getCmdName() << "}{"
}
-int InsetFloatList::ascii(Buffer const & buffer, ostream & os, int) const
+int InsetFloatList::plaintext(Buffer const & buffer, ostream & os, OutputParams const &) const
{
os << getScreenLabel(buffer) << "\n\n";