]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetwrap.C
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / insetwrap.C
index b43ba83cf7faf7c6f7be7d7019ca19fe432b6036..7d41b6df86586c56f04a01fe4834c29f5024a004 100644 (file)
@@ -21,6 +21,7 @@
 #include "Floating.h"
 #include "FloatList.h"
 #include "funcrequest.h"
+#include "FuncStatus.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
 #include "LColor.h"
@@ -82,7 +83,6 @@ void InsetWrap::doDispatch(LCursor & cur, FuncRequest & cmd)
                InsetWrapMailer::string2params(cmd.argument, params);
                params_.placement = params.placement;
                params_.width     = params.width;
-               cur.bv().update();
                break;
        }
 
@@ -106,6 +106,21 @@ void InsetWrap::doDispatch(LCursor & cur, FuncRequest & cmd)
 }
 
 
+bool InsetWrap::getStatus(LCursor & cur, FuncRequest const & cmd,
+               FuncStatus & flag) const
+{
+       switch (cmd.action) {
+       case LFUN_INSET_MODIFY:
+       case LFUN_INSET_DIALOG_UPDATE:
+               flag.enabled(true);
+               return true;
+
+       default:
+               return InsetCollapsable::getStatus(cur, cmd, flag);
+       }
+}
+
+
 void InsetWrapParams::write(ostream & os) const
 {
        os << "Wrap " << type << '\n';
@@ -227,12 +242,12 @@ void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
        // Find a caption layout in one of the (child inset's) pars
        for (; pit != end; ++pit) {
                if (pit->layout()->labeltype == LABEL_SENSITIVE) {
-                       string const name = floatname(params_.type, buf.params());
+                       string const type = params_.type;
                        string const str =
-                               convert<string>(toclist[name].size() + 1)
+                               convert<string>(toclist[type].size() + 1)
                                + ". " + pit->asString(buf, false);
                        lyx::toc::TocItem const item(pit->id(), 0 , str);
-                       toclist[name].push_back(item);
+                       toclist[type].push_back(item);
                }
        }
 }