mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Fix bug #7224. This allows two different floats to declare the same
ListCommand without our writing it to the menu twice. There's a minor annoyance, which is that we always take the list name from the first declaration of the Float, but it's not clear whether this is a real issue. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37424 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5dcac0b5c5
commit
32ab2ff2b7
@ -221,6 +221,7 @@ Float
|
|||||||
NumberWithin none
|
NumberWithin none
|
||||||
Style plain
|
Style plain
|
||||||
ListName "List of Tables"
|
ListName "List of Tables"
|
||||||
|
ListCommand listoftables
|
||||||
NeedsFloatPkg false
|
NeedsFloatPkg false
|
||||||
End
|
End
|
||||||
|
|
||||||
@ -232,6 +233,7 @@ Float
|
|||||||
NumberWithin none
|
NumberWithin none
|
||||||
Style plain
|
Style plain
|
||||||
ListName "List of Figures"
|
ListName "List of Figures"
|
||||||
|
ListCommand listoffigures
|
||||||
NeedsFloatPkg false
|
NeedsFloatPkg false
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -1094,11 +1094,21 @@ void MenuDefinition::expandFloatListInsert(Buffer const * buf)
|
|||||||
FloatList const & floats = buf->params().documentClass().floats();
|
FloatList const & floats = buf->params().documentClass().floats();
|
||||||
FloatList::const_iterator cit = floats.begin();
|
FloatList::const_iterator cit = floats.begin();
|
||||||
FloatList::const_iterator end = floats.end();
|
FloatList::const_iterator end = floats.end();
|
||||||
|
set<string> seen;
|
||||||
for (; cit != end; ++cit) {
|
for (; cit != end; ++cit) {
|
||||||
addWithStatusCheck(MenuItem(MenuItem::Command,
|
// Different floats could declare the same ListCommand. We only
|
||||||
qt_(cit->second.listName()),
|
// want it on the list once, though.
|
||||||
FuncRequest(LFUN_FLOAT_LIST_INSERT,
|
string const & list_cmd = cit->second.listCommand();
|
||||||
cit->second.floattype())));
|
// This form of insert returns an iterator pointing to the newly
|
||||||
|
// inserted element OR the existing element with that value, and
|
||||||
|
// a bool indicating whether we inserted a new element. So we can
|
||||||
|
// see if one is there and insert it if not all at once.
|
||||||
|
pair<set<string>::iterator, bool> ret = seen.insert(list_cmd);
|
||||||
|
if (!ret.second)
|
||||||
|
continue;
|
||||||
|
string const & list_name = cit->second.listName();
|
||||||
|
addWithStatusCheck(MenuItem(MenuItem::Command, qt_(list_name),
|
||||||
|
FuncRequest(LFUN_FLOAT_LIST_INSERT, cit->second.floattype())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user