]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetfloatlist.C
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / insetfloatlist.C
index e24621809d9fb81286e4e4bead0e3d670d3ab176..14850a8347870b7e208d49f12a9dd5e94f1bc2cb 100644 (file)
@@ -35,38 +35,31 @@ using std::ostream;
 
 
 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!");
 }
 
 
-InsetOld::Code InsetFloatList::lyxCode() const
+InsetBase::Code InsetFloatList::lyxCode() const
 {
-       return InsetOld::FLOAT_LIST_CODE;
+       return InsetBase::FLOAT_LIST_CODE;
 }
 
 
@@ -89,7 +82,7 @@ void InsetFloatList::read(Buffer const & buf, LyXLex & lex)
        } else
                lex.printError("InsetFloatList: Parse error: `$$Token'");
        while (lex.isOK()) {
-               lex.nextToken();
+               lex.next();
                token = lex.getString();
                if (token == "\\end_inset")
                        break;
@@ -101,46 +94,8 @@ void InsetFloatList::read(Buffer const & buf, LyXLex & lex)
 }
 
 
-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);
-}
-
-
-DispatchResult
-InsetFloatList::priv_dispatch(FuncRequest const & cmd,
-                             idx_type & idx, pos_type & pos)
-{
-       switch (cmd.action) {
-               case LFUN_MOUSE_RELEASE:
-                       if (button().box().contains(cmd.x, cmd.y))
-                               InsetCommandMailer("toc", *this).showDialog(cmd.view());
-                       return DispatchResult(true);
-
-               case LFUN_INSET_DIALOG_SHOW:
-                       InsetCommandMailer("toc", *this).showDialog(cmd.view());
-                       return DispatchResult(true);
-
-               default:
-                       return InsetCommand::priv_dispatch(cmd, idx, pos);
-       }
-}
-
-
 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()];
@@ -158,7 +113,7 @@ int InsetFloatList::latex(Buffer const & buf, ostream & os,
                        }
                } else {
                        os << "\\listof{" << getCmdName() << "}{"
-                          << cit->second.listName() << "}\n";
+                          << buf.B_(cit->second.listName()) << "}\n";
                }
        } else {
                os << "%%\\listof{" << getCmdName() << "}{"
@@ -169,7 +124,7 @@ int InsetFloatList::latex(Buffer const & buf, ostream & os,
 }
 
 
-int InsetFloatList::ascii(Buffer const & buffer, ostream & os, LatexRunParams const &) const
+int InsetFloatList::plaintext(Buffer const & buffer, ostream & os, OutputParams const &) const
 {
        os << getScreenLabel(buffer) << "\n\n";