make display of group list only depend on existence of groups; move the addition of a separator to the ui file

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24941 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2008-05-26 09:33:08 +00:00
parent a94c091d9d
commit 703eca7670
2 changed files with 6 additions and 11 deletions

View File

@ -300,6 +300,7 @@ Menuset
Item "Settings...|S" "next-inset-toggle"
Separator
Item "Edit externally...|x" "inset-edit"
Separator
GraphicsGroups
End

View File

@ -639,21 +639,15 @@ void MenuDefinition::expandGraphicsGroups(BufferView const * bv)
{
if (!bv)
return;
Cursor const & cur = bv->cursor();
Buffer const & buf = bv->buffer();
set<string> grp;
InsetGraphics::getGraphicsGroups(buf, grp);
set<string>::const_iterator it = grp.begin();
set<string>::const_iterator end = grp.end();
InsetGraphics::getGraphicsGroups(bv->buffer(), grp);
if (grp.empty())
return;
InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(cur);
if (!ins)
return;
add(MenuItem(MenuItem::Separator));
if (!ins->getParams().groupId.empty())
add(MenuItem(MenuItem::Command, qt_("Clear group"), FuncRequest(LFUN_SET_GRAPHICS_GROUP)));
set<string>::const_iterator it = grp.begin();
set<string>::const_iterator end = grp.end();
add(MenuItem(MenuItem::Command, qt_("No Group"),
FuncRequest(LFUN_SET_GRAPHICS_GROUP)));
for (; it != end; it++) {
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(*it),
FuncRequest(LFUN_SET_GRAPHICS_GROUP, *it)));