- if (x >= 0
- && x < button_length
- && y >= button_top_y
- && y < button_bottom_y
- && button == 3) {
- // This obviously need to change.
- lyxerr << "InsetFloat: Let's edit this floats parameters!"
- << endl;
- } else {
- InsetCollapsable::InsetButtonRelease(bv, x, y, button);
+ params_.wide = w;
+
+ string lab(_("float:"));
+ lab += floatname(params_.type, bp);
+
+ if (params_.wide)
+ lab += '*';
+
+ setLabel(lab);
+}
+
+
+void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
+{
+ ParIterator pit(inset.paragraphs.begin(), inset.paragraphs);
+ ParIterator end(inset.paragraphs.end(), inset.paragraphs);
+
+a // Find a caption layout in one of the (child inset's) pars
+ for (; pit != end; ++pit) {
+ if (pit->layout()->name() == caplayout) {
+ string const name = floatname(params_.type, buf->params);
+ string const str =
+ tostr(toclist[name].size() + 1)
+ + ". " + pit->asString(buf, false);
+ toc::TocItem const item(pit->id(), 0 , str);
+ toclist[name].push_back(item);
+ }
+ }
+}
+
+
+string const InsetFloatMailer::name_("float");
+
+InsetFloatMailer::InsetFloatMailer(InsetFloat & inset)
+ : inset_(inset)
+{}
+
+
+string const InsetFloatMailer::inset2string() const
+{
+ return params2string(inset_.params());
+}
+
+
+void InsetFloatMailer::string2params(string const & in,
+ InsetFloatParams & params)
+{
+ params = InsetFloatParams();
+
+ if (in.empty())
+ return;
+
+ istringstream data(STRCONV(in));
+ LyXLex lex(0,0);
+ lex.setStream(data);
+
+ 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
+ if (lex.isOK()) {
+ lex.next();
+ string const token = lex.getString();
+ if (token != "Float" || !lex.eatLine())
+ return;