Disable lists of floats we don't know how to generate.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33635 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-05 23:47:33 +00:00
parent 99bbf5b42a
commit 75454ca8c5
2 changed files with 22 additions and 3 deletions

View File

@ -2275,11 +2275,24 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
// not allowed in description items // not allowed in description items
enable = !inDescriptionItem(cur); enable = !inDescriptionItem(cur);
break; break;
case LFUN_FLOAT_LIST_INSERT: case LFUN_FLOAT_LIST_INSERT: {
code = FLOAT_LIST_CODE; code = FLOAT_LIST_CODE;
// not allowed in description items // not allowed in description items
enable = !inDescriptionItem(cur); enable = !inDescriptionItem(cur);
if (enable) {
FloatList const & floats = cur.buffer()->params().documentClass().floats();
FloatList::const_iterator cit = floats[to_ascii(cmd.argument())];
// make sure we know about such floats
if (cit == floats.end() ||
// and that we know how to generate a list of them
(!cit->second.needsFloatPkg() && cit->second.listCommand().empty())) {
flag.unknown(true);
// probably not necessary, but...
enable = false;
}
}
break; break;
}
case LFUN_CAPTION_INSERT: case LFUN_CAPTION_INSERT:
code = CAPTION_CODE; code = CAPTION_CODE;
// not allowed in description items // not allowed in description items

View File

@ -124,8 +124,14 @@ int InsetFloatList::latex(odocstream & os, OutputParams const &) const
if (fl.needsFloatPkg()) if (fl.needsFloatPkg())
os << "\\listof{" << getParam("type") << "}{" os << "\\listof{" << getParam("type") << "}{"
<< buffer().B_(fl.listName()) << "}\n"; << buffer().B_(fl.listName()) << "}\n";
else else {
if (!fl.listCommand().empty())
os << "\\" << from_ascii(fl.listCommand()) << "\n"; os << "\\" << from_ascii(fl.listCommand()) << "\n";
else
os << "%% "
<< bformat(_("LyX cannot generate a list of %1$s"), getParam("type"))
<< "\n";
}
} else { } else {
os << "%%\\listof{" << getParam("type") << "}{" os << "%%\\listof{" << getParam("type") << "}{"
<< bformat(_("List of %1$s"), getParam("type")) << bformat(_("List of %1$s"), getParam("type"))