* 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: {
InsetFloatParams params;
string2params(to_utf8(cmd.argument()), 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;
params_.subfloat = params.subfloat;
setWide(params_.wide, cur.buffer().params());
setSideways(params_.sideways, cur.buffer().params());
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);
}

View File

@ -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: