#include "ToolbarBackend.h"
#include "FuncRequest.h"
#include "Lexer.h"
-#include "support/debug.h"
-#include "support/gettext.h"
#include "LyXAction.h"
#include "support/lstrings.h"
-#include <boost/bind.hpp>
-#include <algorithm>
+#include "support/debug.h"
+#include "support/gettext.h"
-namespace lyx {
+#include <boost/bind.hpp>
-using support::compare_ascii_no_case;
-using support::getVectorFromString;
+#include <algorithm>
-using std::make_pair;
-using std::string;
-using std::vector;
-using std::find_if;
+using namespace std;
+using namespace lyx::support;
+namespace lyx {
namespace {
ToolbarBackend toolbarbackend;
+/////////////////////////////////////////////////////////////////////////
+//
+// ToolbarItem
+//
+/////////////////////////////////////////////////////////////////////////
+
ToolbarItem::ToolbarItem(Type type, FuncRequest const & func, docstring const & label)
: type_(type), func_(func), label_(label)
{
ToolbarInfo & ToolbarInfo::read(Lexer & lex)
{
- enum tooltags {
+ enum {
TO_COMMAND = 1,
TO_ENDTOOLBAR,
TO_SEPARATOR,
TO_TABLEINSERT,
TO_POPUPMENU,
TO_ICONPALETTE,
- TO_LAST
};
- struct keyword_item toolTags[TO_LAST - 1] = {
+ struct LexerKeyword toolTags[] = {
{ "end", TO_ENDTOOLBAR },
{ "iconpalette", TO_ICONPALETTE },
{ "item", TO_COMMAND },
bool quit = false;
- lex.pushTable(toolTags, TO_LAST - 1);
+ lex.pushTable(toolTags);
if (lyxerr.debugging(Debug::PARSER))
lex.printTable(lyxerr);
case TO_MINIBUFFER:
add(ToolbarItem(ToolbarItem::MINIBUFFER,
- FuncRequest(kb_action(ToolbarItem::MINIBUFFER))));
+ FuncRequest(FuncCode(ToolbarItem::MINIBUFFER))));
break;
case TO_SEPARATOR:
add(ToolbarItem(ToolbarItem::SEPARATOR,
- FuncRequest(kb_action(ToolbarItem::SEPARATOR))));
+ FuncRequest(FuncCode(ToolbarItem::SEPARATOR))));
break;
case TO_POPUPMENU:
case TO_LAYOUTS:
add(ToolbarItem(ToolbarItem::LAYOUTS,
- FuncRequest(kb_action(ToolbarItem::LAYOUTS))));
+ FuncRequest(FuncCode(ToolbarItem::LAYOUTS))));
break;
case TO_TABLEINSERT:
if (lex.next(true)) {
docstring const tooltip = lex.getDocString();
add(ToolbarItem(ToolbarItem::TABLEINSERT,
- FuncRequest(kb_action(ToolbarItem::TABLEINSERT)), tooltip));
+ FuncRequest(FuncCode(ToolbarItem::TABLEINSERT)), tooltip));
}
break;
+/////////////////////////////////////////////////////////////////////////
+//
+// ToolbarBackend
+//
+/////////////////////////////////////////////////////////////////////////
+
ToolbarBackend::ToolbarBackend()
{
+ fullScreenWindows = 0;
}
void ToolbarBackend::readToolbars(Lexer & lex)
{
- enum tooltags {
+ enum {
TO_TOOLBAR = 1,
TO_ENDTOOLBARSET,
- TO_LAST
};
- struct keyword_item toolTags[TO_LAST - 1] = {
+ struct LexerKeyword toolTags[] = {
{ "end", TO_ENDTOOLBARSET },
{ "toolbar", TO_TOOLBAR }
};
<< lex.getString() << '\'');
}
- lex.pushTable(toolTags, TO_LAST - 1);
+ lex.pushTable(toolTags);
if (lyxerr.debugging(Debug::PARSER))
lex.printTable(lyxerr);
flag = ToolbarInfo::MATH;
else if (!compare_ascii_no_case(*cit, "table"))
flag = ToolbarInfo::TABLE;
+ else if (!compare_ascii_no_case(*cit, "mathmacrotemplate"))
+ flag = ToolbarInfo::MATHMACROTEMPLATE;
else if (!compare_ascii_no_case(*cit, "review"))
flag = ToolbarInfo::REVIEW;
else if (!compare_ascii_no_case(*cit, "top"))
flag = ToolbarInfo::LEFT;
else if (!compare_ascii_no_case(*cit, "right"))
flag = ToolbarInfo::RIGHT;
+ else if (!compare_ascii_no_case(*cit, "auto"))
+ flag = ToolbarInfo::AUTO;
else {
LYXERR(Debug::ANY,
"ToolbarBackend::readToolbarSettings: unrecognised token:`"