]> 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 abd849d9565486e054fcff9739c088e70658c6cc..14850a8347870b7e208d49f12a9dd5e94f1bc2cb 100644 (file)
@@ -13,7 +13,9 @@
 #include "insetfloatlist.h"
 
 #include "buffer.h"
+#include "bufferparams.h"
 #include "debug.h"
+#include "dispatchresult.h"
 #include "Floating.h"
 #include "FloatList.h"
 #include "funcrequest.h"
 
 #include "support/lstrings.h"
 
-using namespace lyx::support;
+using lyx::support::bformat;
 
 using std::endl;
+using std::string;
 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;
 }
 
 
@@ -86,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;
@@ -98,44 +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);
-}
-
-
-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()];
@@ -153,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() << "}{"
@@ -164,7 +124,7 @@ int InsetFloatList::latex(Buffer const & buf, ostream & os,
 }
 
 
-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";