git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4082 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2002-04-28 14:00:48 +00:00
parent f6dd42baa1
commit 86d8e730d7
4 changed files with 29 additions and 21 deletions

View File

@ -2928,23 +2928,17 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
break;
case LFUN_INSET_WIDE_FLOAT:
{
// check if the float type exist
if (floatList.typeExist(argument)) {
InsetFloat * new_inset =
new InsetFloat(buffer_->params, argument);
new_inset->wide(true);
if (insertInset(new_inset))
new_inset->edit(bv_);
else
delete new_inset;
insertAndEditInset(new_inset);
} else {
lyxerr << "Non-existent float type: "
<< argument << endl;
}
}
break;
break;
#if 0
case LFUN_INSET_LIST:
@ -3247,13 +3241,15 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
break;
case LFUN_FLOAT_LIST:
{
// We should check the argument for validity. (Lgb)
Inset * inset = new InsetFloatList(argument);
if (!insertInset(inset, "Standard"))
delete inset;
}
break;
if (floatList.typeExist(argument)) {
Inset * inset = new InsetFloatList(argument);
if (!insertInset(inset, "Standard"))
delete inset;
} else {
lyxerr << "Non-existent float type: "
<< argument << endl;
}
break;
case LFUN_THESAURUS_ENTRY:
{

View File

@ -1,3 +1,8 @@
2002-04-28 Dekel Tsur <dekelts@tau.ac.il>
* BufferView_pimpl.C (Dispatch): Check that float type exists when
inserting list of floats.
2002-04-24 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* CutAndPaste.C (SwitchLayoutsBetweenClasses): when converting a

View File

@ -1,3 +1,8 @@
2002-04-28 Dekel Tsur <dekelts@tau.ac.il>
* insetfloatlist.C (getScreenLabel): Fix crash in the case where
float type do not exist.
2002-04-26 Angus Leeming <a.leeming@ic.ac.uk>
* insetfloat.C (c-tor, wide): translate the name of the float.

View File

@ -34,11 +34,11 @@ InsetFloatList::InsetFloatList(string const & type)
string const InsetFloatList::getScreenLabel(Buffer const *) const
{
string const guiName = floatList[getCmdName()]->second.listName();
if (!guiName.empty()) {
return _(guiName);
}
return _("ERROR: Nonexistent float type!");
FloatList::const_iterator it = floatList[getCmdName()];
if (it != floatList.end())
return _(it->second.listName());
else
return _("ERROR: Nonexistent float type!");
}
@ -60,7 +60,9 @@ void InsetFloatList::read(Buffer const *, LyXLex & lex)
if (lex.eatLine()) {
setCmdName(lex.getString());
lyxerr << "FloatList::float_type: " << getCmdName() << endl;
lyxerr[Debug::INSETS] << "FloatList::float_type: " << getCmdName() << endl;
if (!floatList.typeExist(getCmdName()))
lex.printError("InsetFloatList: Unknown float type: `$$Token'");
} else
lex.printError("InsetFloatList: Parse error: `$$Token'");
while (lex.isOK()) {