]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetWrap.cpp
Make members of FuncRequest private, per the FIXME there. Again, this is
[lyx.git] / src / insets / InsetWrap.cpp
index e92fdb76cd8eab8f1d8fa002334282ed9eb65a44..4ee0f7eed733985de182628f1332619bb30a129f 100644 (file)
@@ -77,7 +77,7 @@ docstring InsetWrap::toolTip(BufferView const & bv, int x, int y) const
 
 void InsetWrap::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
-       switch (cmd.action) {
+       switch (cmd.action()) {
        case LFUN_INSET_MODIFY: {
                InsetWrapParams params;
                InsetWrap::string2params(to_utf8(cmd.argument()), params);
@@ -102,7 +102,7 @@ void InsetWrap::doDispatch(Cursor & cur, FuncRequest & cmd)
 bool InsetWrap::getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & flag) const
 {
-       switch (cmd.action) {
+       switch (cmd.action()) {
        case LFUN_INSET_MODIFY:
        case LFUN_INSET_DIALOG_UPDATE:
                flag.setEnabled(true);
@@ -114,20 +114,26 @@ bool InsetWrap::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-void InsetWrap::updateLabels(ParIterator const & it, bool out)
+void InsetWrap::updateBuffer(ParIterator const & it, UpdateType utype)
 {
        setLabel(_("wrap: ") + floatName(params_.type));
        Counters & cnts =
                buffer().masterBuffer()->params().documentClass().counters();
+       if (utype == OutputUpdate) {
+               // counters are local to the wrap
+               cnts.saveLastCounter();
+       }
        string const saveflt = cnts.current_float();
 
        // Tell to captions what the current float is
        cnts.current_float(params().type);
 
-       InsetCollapsable::updateLabels(it, out);
+       InsetCollapsable::updateBuffer(it, utype);
 
        // reset afterwards
        cnts.current_float(saveflt);
+       if (utype == OutputUpdate)
+               cnts.restoreLastCounter();
 }
 
 
@@ -220,11 +226,11 @@ docstring InsetWrap::xhtml(XHTMLStream & xs, OutputParams const & rp) const
        string const len = params_.width.asHTMLString();
        string const width = len.empty() ? "50%" : len;
        string const attr = "class='wrap' style='width: " + len + ";'";
-       xs << StartTag("div", attr);
+       xs << html::StartTag("div", attr);
        docstring const deferred = 
                InsetText::insetAsXHTML(xs, rp, InsetText::WriteInnerTag);
        if (!len.empty())
-               xs << EndTag("div");
+               xs << html::EndTag("div");
        return deferred;
 }