X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FToolbarDefaults.C;h=8930ae982a3b827be2f02ee4308fc2622483270c;hb=855181bd35f0440b08b65eabacce0720b93a0b53;hp=1a40c510b834b0aa6661b7522a730b1b217c2c6c;hpb=b8072fd6f77ebd592ecd514dadc04839516b8a8b;p=lyx.git diff --git a/src/ToolbarDefaults.C b/src/ToolbarDefaults.C index 1a40c510b8..8930ae982a 100644 --- a/src/ToolbarDefaults.C +++ b/src/ToolbarDefaults.C @@ -1,10 +1,10 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2000 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * * ====================================================== */ @@ -20,16 +20,36 @@ #include "lyxlex.h" #include "debug.h" #include "lyxlex.h" -#if 1 -// only until we don't need access tot he NEW_INSETS or NEW_TABULAR anymore -#include "lyxparagraph.h" -#endif +#include "support/lstrings.h" using std::endl; extern LyXAction lyxaction; ToolbarDefaults toolbardefaults; +namespace { + +enum _tooltags { + TO_ADD = 1, + TO_ENDTOOLBAR, + TO_SEPARATOR, + TO_LAYOUTS, + TO_NEWLINE, + TO_LAST +}; + + +struct keyword_item toolTags[TO_LAST - 1] = { + { "end", TO_ENDTOOLBAR }, + { "icon", TO_ADD }, + { "layouts", TO_LAYOUTS }, + { "newline", TO_NEWLINE }, + { "separator", TO_SEPARATOR } +}; + +} // end of anon namespace + + ToolbarDefaults::ToolbarDefaults() { init(); @@ -41,10 +61,11 @@ void ToolbarDefaults::add(int action) defaults.push_back(action); } -void ToolbarDefaults::init() + +void ToolbarDefaults::init() { add(LAYOUTS); - add(LFUN_MENUOPEN); + add(LFUN_FILE_OPEN); //add(LFUN_CLOSEBUFFER); add(LFUN_MENUWRITE); add(LFUN_MENUPRINT); @@ -54,100 +75,68 @@ void ToolbarDefaults::init() add(LFUN_COPY); add(LFUN_PASTE); add(SEPARATOR); - + add(LFUN_EMPH); add(LFUN_NOUN); add(LFUN_FREE); add(SEPARATOR); - -#ifndef NEW_INSETS - add(LFUN_FOOTMELT); - add(LFUN_MARGINMELT); -#else + add(LFUN_INSET_FOOTNOTE); add(LFUN_INSET_MARGINAL); -#endif - add(LFUN_DEPTH); + + add(LFUN_DEPTH_PLUS); add(SEPARATOR); - add(LFUN_TEX); - add(LFUN_MATH_MODE); + add(LFUN_MATH_MODE); add(SEPARATOR); - add(LFUN_FIGURE); -#ifndef NEW_TABULAR - add(LFUN_TABLE); -#else - add(LFUN_INSET_TABULAR); -#endif - //add(LFUN_MELT); + add(LFUN_INSET_GRAPHICS); + add(LFUN_DIALOG_TABULAR_INSERT); } -enum _tooltags { - TO_ADD = 1, - TO_ENDTOOLBAR, - TO_SEPARATOR, - TO_LAYOUTS, - TO_NEWLINE, - TO_LAST -}; - - -struct keyword_item toolTags[TO_LAST - 1] = { - { "end", TO_ENDTOOLBAR }, - { "icon", TO_ADD }, - { "layouts", TO_LAYOUTS }, - { "newline", TO_NEWLINE }, - { "separator", TO_SEPARATOR } -}; - - -void ToolbarDefaults::read(LyXLex & lex) +void ToolbarDefaults::read(LyXLex & lex) { //consistency check - if (compare_no_case(lex.GetString(), "toolbar")) + if (compare_no_case(lex.getString(), "toolbar")) { lyxerr << "Toolbar::read: ERROR wrong token:`" - << lex.GetString() << '\'' << endl; + << lex.getString() << '\'' << endl; + } defaults.clear(); - - string func; + bool quit = false; - + lex.pushTable(toolTags, TO_LAST - 1); if (lyxerr.debugging(Debug::PARSER)) lex.printTable(lyxerr); - - while (lex.IsOK() && !quit) { - switch(lex.lex()) { + while (lex.isOK() && !quit) { + switch (lex.lex()) { case TO_ADD: - if (lex.next()) { - func = lex.GetString(); - lyxerr[Debug::GUI] + if (lex.next(true)) { + string const func = lex.getString(); + lyxerr[Debug::PARSER] << "Toolbar::read TO_ADD func: `" << func << "'" << endl; add(func); } break; - + case TO_SEPARATOR: add(SEPARATOR); break; - + case TO_LAYOUTS: add(LAYOUTS); break; - + case TO_NEWLINE: add(NEWLINE); break; - + case TO_ENDTOOLBAR: - // should not set automatically - //set(); quit = true; break; default: @@ -157,17 +146,16 @@ void ToolbarDefaults::read(LyXLex & lex) } } lex.popTable(); - lex.next(); } void ToolbarDefaults::add(string const & func) { - int tf = lyxaction.LookupFunc(func); + int const tf = lyxaction.LookupFunc(func); if (tf == -1) { - lyxerr << "Toolbar::add: no LyX command called`" - << func << "'exists!" << endl; + lyxerr << "Toolbar::add: no LyX command called `" + << func << "' exists!" << endl; } else { add(tf); }