]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Menus.cpp
fix completion painting for RTL (inline completion and completion list)
[lyx.git] / src / frontends / qt4 / Menus.cpp
index cebd8975eb35400f5be78ddee30fbd26d6546cbb..7acb9e11b35ee4b35c3d1d44bea6f4ddd0d47d87 100644 (file)
@@ -46,7 +46,7 @@
 #include "Session.h"
 #include "TextClass.h"
 #include "TocBackend.h"
-#include "ToolbarBackend.h"
+#include "Toolbars.h"
 
 #include "insets/Inset.h"
 #include "insets/InsetCitation.h"
@@ -352,7 +352,7 @@ void MenuDefinition::addWithStatusCheck(MenuItem const & i)
                        }
                        if (enabled || !i.optional()) {
                                items_.push_back(i);
-                               items_.back().status().enabled(enabled);
+                               items_.back().status().setEnabled(enabled);
                        }
                }
                else
@@ -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();
+       graphics::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)));
@@ -813,7 +807,7 @@ void MenuDefinition::expandFloatListInsert(Buffer const * buf)
        for (; cit != end; ++cit) {
                addWithStatusCheck(MenuItem(MenuItem::Command,
                                    qt_(cit->second.listName()),
-                                   FuncRequest(LFUN_FLOAT_LIST,
+                                   FuncRequest(LFUN_FLOAT_LIST_INSERT,
                                                cit->second.type())));
        }
 }
@@ -1010,27 +1004,23 @@ void MenuDefinition::expandPasteRecent()
 
 void MenuDefinition::expandToolbars()
 {
-       //
+       MenuDefinition other_lists;
        // extracts the toolbars from the backend
-       ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
-       ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
-
+       Toolbars::Infos::const_iterator cit = guiApp->toolbars().begin();
+       Toolbars::Infos::const_iterator end = guiApp->toolbars().end();
        for (; cit != end; ++cit) {
-               QString label = qt_(cit->gui_name);
-               // frontends are not supposed to turn on/off toolbars,
-               // if they cannot update ToolbarBackend::flags. That
-               // is to say, ToolbarsBackend::flags should reflect
-               // the true state of toolbars.
-               //
-               // menu is displayed as
-               //       on/off review
-               // and
-               //              review (auto)
-               // in the case of auto.
-               if (cit->flags & ToolbarInfo::AUTO)
-                       label += qt_(" (auto)");
-               add(MenuItem(MenuItem::Command, label,
-                                   FuncRequest(LFUN_TOOLBAR_TOGGLE, cit->name + " allowauto")));
+               MenuItem const item(MenuItem::Command, qt_(cit->gui_name),
+                               FuncRequest(LFUN_TOOLBAR_TOGGLE, cit->name));
+               if (guiApp->toolbars().isMainToolbar(cit->name))
+                       add(item);
+               else
+                       other_lists.add(item);
+       }
+
+       if (!other_lists.empty()) {
+               MenuItem item(MenuItem::Submenu, qt_("Other Toolbars"));
+               item.setSubmenu(other_lists);
+               add(item);
        }
 }