diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index a595b2e032..0f514bd1c3 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -152,12 +152,17 @@ void InsetFloat::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_INSET_MODIFY: { InsetFloatParams params; string2params(to_utf8(cmd.argument()), params); - params_.placement = params.placement; - params_.wide = params.wide; - params_.sideways = params.sideways; - params_.subfloat = params.subfloat; - setWide(params_.wide, cur.buffer().params()); - setSideways(params_.sideways, cur.buffer().params()); + + // placement, wide and sideways are not used for subfloats + if (!params_.subfloat) { + params_.placement = params.placement; + params_.wide = params.wide; + params_.sideways = params.sideways; + setWide(params_.wide, cur.buffer().params(), false); + setSideways(params_.sideways, cur.buffer().params(), false); + } + + setNewLabel(cur.buffer().params()); break; } @@ -387,32 +392,45 @@ bool InsetFloat::showInsetDialog(BufferView * bv) const } -void InsetFloat::setWide(bool w, BufferParams const & bp) +void InsetFloat::setWide(bool w, BufferParams const & bp, bool update_label) { params_.wide = w; - docstring lab = _("float: ") + floatName(params_.type, bp); - if (params_.wide) - lab += '*'; - setLabel(lab); + if (update_label) + setNewLabel(bp); } -void InsetFloat::setSideways(bool s, BufferParams const & bp) +void InsetFloat::setSideways(bool s, BufferParams const & bp, bool update_label) { params_.sideways = s; - docstring lab = _("float: ") + floatName(params_.type, bp); - if (params_.sideways) - lab += _(" (sideways)"); - setLabel(lab); + if (update_label) + setNewLabel(bp); } -void InsetFloat::setSubfloat(bool s, BufferParams const & bp) +void InsetFloat::setSubfloat(bool s, BufferParams const & bp, bool update_label) { params_.subfloat = s; - docstring lab = _("float: ") + floatName(params_.type, bp); - if (s) - lab = _("subfloat: ") + floatName(params_.type, bp); + if (update_label) + setNewLabel(bp); +} + + +void InsetFloat::setNewLabel(BufferParams const & bp) +{ + docstring lab = _("float: "); + + if( params_.subfloat ) + lab = _("subfloat: "); + + lab += floatName(params_.type, bp); + + if (params_.wide) + lab += '*'; + + if (params_.sideways) + lab += _(" (sideways)"); + setLabel(lab); } diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index d768a769a0..b1500f9a0e 100644 --- a/src/insets/InsetFloat.h +++ b/src/insets/InsetFloat.h @@ -60,11 +60,13 @@ public: /// static std::string params2string(InsetFloatParams const &); /// - void setWide(bool w, BufferParams const &); + void setWide(bool w, BufferParams const &, bool update_label = true); /// - void setSideways(bool s, BufferParams const &); + void setSideways(bool s, BufferParams const &, bool update_label = true); /// - void setSubfloat(bool s, BufferParams const &); + void setSubfloat(bool s, BufferParams const &, bool update_label = true); + /// + void setNewLabel(BufferParams const &); /// InsetFloatParams const & params() const { return params_; } private: