]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbox.C
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / insetbox.C
index e1836d5e23d3b3731aea90124f572ff14cb36685..9440fc5283d330a3f09aef35a2dcbdbc45f5416b 100644 (file)
@@ -17,6 +17,7 @@
 #include "cursor.h"
 #include "dispatchresult.h"
 #include "debug.h"
+#include "FuncStatus.h"
 #include "funcrequest.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
@@ -155,14 +156,19 @@ void InsetBox::setButtonLabel()
 void InsetBox::metrics(MetricsInfo & m, Dimension & dim) const
 {
        MetricsInfo mi = m;
-       mi.base.textwidth = params_.width.inPixels(m.base.textwidth);
+       if (params_.inner_box || params_.special != "width")
+               mi.base.textwidth = params_.width.inPixels(m.base.textwidth);
        InsetCollapsable::metrics(mi, dim);
-       //if (params_.inner_box && isOpen())
-       //      dim.wid = mi.base.textwidth;
        dim_ = dim;
 }
 
 
+bool InsetBox::forceDefaultParagraphs(idx_type) const
+{
+       return !params_.inner_box;
+}
+
+
 bool InsetBox::showInsetDialog(BufferView * bv) const
 {
        InsetBoxMailer(const_cast<InsetBox &>(*this)).showDialog(bv);
@@ -170,7 +176,7 @@ bool InsetBox::showInsetDialog(BufferView * bv) const
 }
 
 
-void InsetBox::priv_dispatch(LCursor & cur, FuncRequest & cmd)
+void InsetBox::doDispatch(LCursor & cur, FuncRequest & cmd)
 {
        switch (cmd.action) {
 
@@ -190,16 +196,39 @@ void InsetBox::priv_dispatch(LCursor & cur, FuncRequest & cmd)
                        InsetBoxMailer(*this).showDialog(&cur.bv());
                        break;
                }
-               InsetCollapsable::priv_dispatch(cur, cmd);
+               InsetCollapsable::doDispatch(cur, cmd);
                break;
 
        default:
-               InsetCollapsable::priv_dispatch(cur, cmd);
+               InsetCollapsable::doDispatch(cur, cmd);
                break;
        }
 }
 
 
+bool InsetBox::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;
+       case LFUN_BREAKPARAGRAPH:
+               if (params_.inner_box) {
+                       return InsetCollapsable::getStatus(cur, cmd, flag);
+               } else {
+                       flag.enabled(false);
+                       return true;
+               }
+
+       default:
+               return InsetCollapsable::getStatus(cur, cmd, flag);
+       }
+}
+
+
 int InsetBox::latex(Buffer const & buf, ostream & os,
                                OutputParams const & runparams) const
 {