#include "Encoding.h"
#include "ErrorList.h"
#include "Format.h"
+#include "FuncStatus.h"
#include "KeyMap.h"
#include "Language.h"
#include "Lexer.h"
#include "LyXAction.h"
#include "LyXFunc.h"
#include "LyXRC.h"
-#include "MenuBackend.h"
#include "ModuleList.h"
#include "Mover.h"
#include "Server.h"
break;
}
case ui_menuset:
- theApp()->menuBackend().read(lex);
+ theApp()->readMenus(lex);
break;
case ui_toolbarset:
$(ASPELL) $(PSPELL) $(ISPELL) SpellBase.cpp \
Box.cpp \
Box.h \
+ MenuBackend.cpp \
+ MenuBackend.h \
Dimension.cpp \
Dimension.h \
PrinterParams.cpp \
LyXFunc.cpp \
LyXRC.cpp \
LyXVC.cpp \
- MenuBackend.cpp \
MetricsInfo.cpp \
ModuleList.cpp \
Mover.cpp \
LyX.h \
LyXRC.h \
LyXVC.h \
- MenuBackend.h \
MetricsInfo.h \
ModuleList.h \
Mover.h \
}
-bool Menu::searchFunc(FuncRequest & func, stack<docstring> & names) const
+bool Menu::searchMenu(FuncRequest const & func, vector<docstring> & names) const
{
const_iterator m = begin();
const_iterator m_end = end();
for (; m != m_end; ++m) {
if (m->kind() == MenuItem::Command && m->func() == func) {
- names.push(m->label());
+ names.push_back(m->label());
return true;
- } else if (m->kind() == MenuItem::Submenu) {
- names.push(m->label());
+ }
+ if (m->kind() == MenuItem::Submenu) {
+ names.push_back(m->label());
Menu submenu = theApp()->menuBackend().getMenu(m->submenuname());
- if (submenu.searchFunc(func, names))
+ if (submenu.searchMenu(func, names))
return true;
- else
- names.pop();
+ names.pop_back();
}
}
return false;
#include <boost/shared_ptr.hpp>
#include <vector>
-#include <stack>
namespace lyx {
// search for func in this menu iteratively, and put menu
// names in a stack.
- bool searchFunc(FuncRequest & func, std::stack<docstring> & names) const;
+ bool searchMenu(FuncRequest const & func, std::vector<docstring> & names)
+ const;
private:
friend class MenuBackend;
#include "ColorCode.h"
#include "support/strfwd.h"
+#include "support/docstring.h"
#include <boost/function.hpp>
+#include <vector>
+
namespace lyx {
class FuncRequest;
class FuncStatus;
class Inset;
+class Lexer;
class MenuBackend;
struct RGBColor;
*/
virtual void updateColor(ColorCode col) = 0;
+ /**
+ * read and create the menu structure
+ */
+ virtual void readMenus(Lexer & lex) = 0;
+
/**
* add a callback for socket read notification
* @param fd socket descriptor (file/socket/etc)
///
virtual MenuBackend const & menuBackend() const = 0;
virtual MenuBackend & menuBackend() = 0;
+
+ virtual bool searchMenu(FuncRequest const & func,
+ std::vector<docstring> & names) const = 0;
};
} // namespace frontend
#include "Font.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "support/gettext.h"
#include "LyX.h"
#include "LyXFunc.h"
#include "LyXRC.h"
#include "support/ExceptionMessage.h"
#include "support/FileName.h"
#include "support/ForkedCalls.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/os.h"
#include "support/Package.h"
}
+void GuiApplication::readMenus(Lexer & lex)
+{
+ menuBackend().read(lex);
+}
+
+
+bool GuiApplication::searchMenu(FuncRequest const & func,
+ vector<docstring> & names) const
+{
+ return menuBackend().getMenubar().searchMenu(func, names);
+}
+
+
////////////////////////////////////////////////////////////////////////
// X11 specific stuff goes here...
#ifdef Q_WS_X11
virtual bool getRgbColor(ColorCode col, RGBColor & rgbcol);
virtual std::string const hexName(ColorCode col);
virtual void updateColor(ColorCode col);
+ virtual void readMenus(Lexer & lex);
virtual void registerSocketCallback(int fd, SocketCallback func);
void unregisterSocketCallback(int fd);
+ bool searchMenu(FuncRequest const & func, std::vector<docstring> & names) const;
//@}
Menus const & menus() const { return menus_; }
#include "InsetInfo.h"
-#include <sstream>
-#include <stack>
-
#include "BaseClassList.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "LyXAction.h"
#include "LyXRC.h"
#include "Lexer.h"
-#include "MenuBackend.h"
#include "MetricsInfo.h"
#include "ParagraphParameters.h"
#include "support/lstrings.h"
#include "support/ExceptionMessage.h"
+#include <sstream>
+
using namespace std;
using namespace lyx::support;
break;
}
case MENU_INFO: {
- stack<docstring> names;
+ vector<docstring> names;
FuncRequest func = lyxaction.lookupFunc(name_);
if (func.action == LFUN_UNKNOWN_ACTION) {
setText(_("No menu entry for "), bp.getFont(), false);
break;
}
// iterate through the menubackend to find it
- Menu menu = theApp()->menuBackend().getMenubar();
- if (!menu.searchFunc(func, names)) {
+ if (!theApp()->searchMenu(func, names)) {
setText(_("No menu entry for "), bp.getFont(), false);
break;
}
if (i != 0)
info.insertInset(0, new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR),
Change(Change::UNCHANGED));
- for (i = 0; i < names.top().length(); ++i)
- info.insertChar(i, names.top()[i], bp.getFont(), false);
- names.pop();
+ for (i = 0; i != names.back().length(); ++i)
+ info.insertChar(i, names.back()[i], bp.getFont(), false);
+ names.pop_back();
}
break;
}
#include "InsetText.h"
#include "RenderButton.h"
-#include "support/gettext.h"
#include "Cursor.h"
+
+#include "support/gettext.h"
#include "support/Translator.h"
/* InsetInfo displays shortcuts, lyxrc, package and textclass