1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2001 The LyX Team.
10 * ====================================================== */
13 #pragma implementation
18 #include "ToolbarDefaults.h"
19 #include "LyXAction.h"
23 #include "support/lstrings.h"
27 extern LyXAction lyxaction;
28 ToolbarDefaults toolbardefaults;
42 struct keyword_item toolTags[TO_LAST - 1] = {
43 { "end", TO_ENDTOOLBAR },
45 { "layouts", TO_LAYOUTS },
46 { "newline", TO_NEWLINE },
47 { "separator", TO_SEPARATOR }
50 } // end of anon namespace
53 ToolbarDefaults::ToolbarDefaults()
59 void ToolbarDefaults::add(int action)
61 defaults.push_back(action);
65 void ToolbarDefaults::init()
69 //add(LFUN_CLOSEBUFFER);
84 add(LFUN_INSET_FOOTNOTE);
85 add(LFUN_INSET_MARGINAL);
93 add(LFUN_INSET_GRAPHICS);
94 add(LFUN_DIALOG_TABULAR_INSERT);
98 void ToolbarDefaults::read(LyXLex & lex)
101 if (compare_no_case(lex.getString(), "toolbar")) {
102 lyxerr << "Toolbar::read: ERROR wrong token:`"
103 << lex.getString() << '\'' << endl;
110 lex.pushTable(toolTags, TO_LAST - 1);
112 if (lyxerr.debugging(Debug::PARSER))
113 lex.printTable(lyxerr);
115 while (lex.isOK() && !quit) {
118 if (lex.next(true)) {
119 string const func = lex.getString();
120 lyxerr[Debug::PARSER]
121 << "Toolbar::read TO_ADD func: `"
122 << func << "'" << endl;
143 lex.printError("Toolbar::read: "
144 "Unknown toolbar tag: `$$Token'");
152 void ToolbarDefaults::add(string const & func)
154 int const tf = lyxaction.LookupFunc(func);
157 lyxerr << "Toolbar::add: no LyX command called `"
158 << func << "' exists!" << endl;