params_.placement = params.placement;
params_.width = params.width;
- cmd.view()->updateInset(this, true);
+ cmd.view()->updateInset(this);
result = DISPATCHED;
}
break;
+
+ case LFUN_INSET_DIALOG_UPDATE: {
+ InsetWrapMailer mailer(*this);
+ mailer.updateDialog(cmd.view());
+ }
+ break;
+
default:
result = InsetCollapsable::localDispatch(cmd);
}
if (!inset.showInsetDialog(bv)) {
InsetWrap * tmp = const_cast<InsetWrap *>(this);
InsetWrapMailer mailer(*tmp);
- mailer.showDialog();
+ mailer.showDialog(bv);
}
return true;
}
}
+string const InsetWrapMailer::name_("wrap");
+
InsetWrapMailer::InsetWrapMailer(InsetWrap & inset)
- : name_("wrap"), inset_(inset)
+ : inset_(inset)
{}
string const InsetWrapMailer::inset2string() const
{
- return params2string(name(), inset_.params());
+ return params2string(inset_.params());
}
{
params = InsetWrapParams();
- string name;
- string body = split(in, name, ' ');
+ istringstream data(in);
+ LyXLex lex(0,0);
+ lex.setStream(data);
- if (name != "wrap" || 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, "Wrap "))
- return;
-
- istringstream data(body);
- LyXLex lex(0,0);
- lex.setStream(data);
+ if (lex.isOK()) {
+ lex.next();
+ string const token = lex.getString();
+ if (token != "Wrap" || !lex.eatLine())
+ return;
+ }
- params.read(lex);
+ if (lex.isOK()) {
+ params.read(lex);
+ }
}
string const
-InsetWrapMailer::params2string(string const & name,
- InsetWrapParams const & params)
+InsetWrapMailer::params2string(InsetWrapParams const & params)
{
ostringstream data;
- data << name << ' ';
+ data << name_ << ' ';
params.write(data);
return data.str();