]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetfloat.C
The markDirty() and fitCursor() changes
[lyx.git] / src / insets / insetfloat.C
index 0293a8032702abcf3b1ceed7d3ad8817a91deddf..5e3ddf271ab6ae825b312fd0d7dfb438332bd69a 100644 (file)
@@ -165,10 +165,17 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
                params_.placement = params.placement;
                params_.wide      = params.wide;
 
-               cmd.view()->updateInset(this, true);
+               cmd.view()->updateInset(this);
                result = DISPATCHED;
        }
        break;
+
+       case LFUN_INSET_DIALOG_UPDATE: {
+               InsetFloatMailer mailer(*this);
+               mailer.updateDialog(cmd.view());
+       }
+       break;
+
        default:
                result = InsetCollapsable::localDispatch(cmd);
        }
@@ -328,7 +335,7 @@ bool InsetFloat::showInsetDialog(BufferView * bv) const
        if (!inset.showInsetDialog(bv)) {
                InsetFloat * tmp = const_cast<InsetFloat *>(this);
                InsetFloatMailer mailer(*tmp);
-               mailer.showDialog();
+               mailer.showDialog(bv);
        }
        return true;
 }
@@ -395,14 +402,16 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
 }
 
 
+string const InsetFloatMailer::name_("float");
+
 InsetFloatMailer::InsetFloatMailer(InsetFloat & inset)
-       : name_("float"), inset_(inset)
+       : inset_(inset)
 {}
 
 
 string const InsetFloatMailer::inset2string() const
 {
-       return params2string(name(), inset_.params());
+       return params2string(inset_.params());
 }
 
 
@@ -411,32 +420,37 @@ void InsetFloatMailer::string2params(string const & in,
 {
        params = InsetFloatParams();
 
-       string name;
-       string body = split(in, name, ' ');
+       istringstream data(in);
+       LyXLex lex(0,0);
+       lex.setStream(data);
 
-       if (name != "float" || body.empty())
-               return;
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != name_)
+                       return;
+       }
 
        // This is part of the inset proper that is usually swallowed
        // by Buffer::readInset
-       body = split(body, name, '\n');
-       if (!prefixIs(name, "Float "))
-               return;
-
-       istringstream data(body);
-       LyXLex lex(0,0);
-       lex.setStream(data);
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != "Float" || !lex.eatLine())
+                       return;
+       }
 
-       params.read(lex);
+       if (lex.isOK()) {
+               params.read(lex);
+       }
 }
 
 
 string const
-InsetFloatMailer::params2string(string const & name,
-                               InsetFloatParams const & params)
+InsetFloatMailer::params2string(InsetFloatParams const & params)
 {
        ostringstream data;
-       data << name << ' ';
+       data << name_ << ' ';
        params.write(data);
 
        return data.str();