* src/insets/InsetFloat{.cpp,h}:

- subfloat labelling fixes from Vincent.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26214 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-08-19 14:56:12 +00:00
parent 26e3e050a4
commit 0d63bbae14
2 changed files with 43 additions and 23 deletions

View File

@ -152,12 +152,17 @@ void InsetFloat::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_INSET_MODIFY: { case LFUN_INSET_MODIFY: {
InsetFloatParams params; InsetFloatParams params;
string2params(to_utf8(cmd.argument()), params); string2params(to_utf8(cmd.argument()), params);
params_.placement = params.placement;
params_.wide = params.wide; // placement, wide and sideways are not used for subfloats
params_.sideways = params.sideways; if (!params_.subfloat) {
params_.subfloat = params.subfloat; params_.placement = params.placement;
setWide(params_.wide, cur.buffer().params()); params_.wide = params.wide;
setSideways(params_.sideways, cur.buffer().params()); params_.sideways = params.sideways;
setWide(params_.wide, cur.buffer().params(), false);
setSideways(params_.sideways, cur.buffer().params(), false);
}
setNewLabel(cur.buffer().params());
break; 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; params_.wide = w;
docstring lab = _("float: ") + floatName(params_.type, bp); if (update_label)
if (params_.wide) setNewLabel(bp);
lab += '*';
setLabel(lab);
} }
void InsetFloat::setSideways(bool s, BufferParams const & bp) void InsetFloat::setSideways(bool s, BufferParams const & bp, bool update_label)
{ {
params_.sideways = s; params_.sideways = s;
docstring lab = _("float: ") + floatName(params_.type, bp); if (update_label)
if (params_.sideways) setNewLabel(bp);
lab += _(" (sideways)");
setLabel(lab);
} }
void InsetFloat::setSubfloat(bool s, BufferParams const & bp) void InsetFloat::setSubfloat(bool s, BufferParams const & bp, bool update_label)
{ {
params_.subfloat = s; params_.subfloat = s;
docstring lab = _("float: ") + floatName(params_.type, bp); if (update_label)
if (s) setNewLabel(bp);
lab = _("subfloat: ") + floatName(params_.type, 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); setLabel(lab);
} }

View File

@ -60,11 +60,13 @@ public:
/// ///
static std::string params2string(InsetFloatParams const &); 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_; } InsetFloatParams const & params() const { return params_; }
private: private: