From 75454ca8c5ce911ea6505716f84b461941cb100c Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 5 Mar 2010 23:47:33 +0000 Subject: [PATCH] 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 --- src/Text3.cpp | 15 ++++++++++++++- src/insets/InsetFloatList.cpp | 10 ++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Text3.cpp b/src/Text3.cpp index f810eceac5..9eba7dbecb 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -2275,11 +2275,24 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, // not allowed in description items enable = !inDescriptionItem(cur); break; - case LFUN_FLOAT_LIST_INSERT: + case LFUN_FLOAT_LIST_INSERT: { code = FLOAT_LIST_CODE; // not allowed in description items 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; + } case LFUN_CAPTION_INSERT: code = CAPTION_CODE; // not allowed in description items diff --git a/src/insets/InsetFloatList.cpp b/src/insets/InsetFloatList.cpp index fba5e40dfb..24f9491f90 100644 --- a/src/insets/InsetFloatList.cpp +++ b/src/insets/InsetFloatList.cpp @@ -124,8 +124,14 @@ int InsetFloatList::latex(odocstream & os, OutputParams const &) const if (fl.needsFloatPkg()) os << "\\listof{" << getParam("type") << "}{" << buffer().B_(fl.listName()) << "}\n"; - else - os << "\\" << from_ascii(fl.listCommand()) << "\n"; + else { + if (!fl.listCommand().empty()) + os << "\\" << from_ascii(fl.listCommand()) << "\n"; + else + os << "%% " + << bformat(_("LyX cannot generate a list of %1$s"), getParam("type")) + << "\n"; + } } else { os << "%%\\listof{" << getParam("type") << "}{" << bformat(_("List of %1$s"), getParam("type"))