diff --git a/ChangeLog b/ChangeLog index 35507e1ccd..045970fad5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 1999-11-25 Jean-Marc Lasgouttes + * src/bufferparams.C: make sure that the default textclass is + "article". It used to be the first one by description order, but + now the first one is "docbook". + + * src/lyx_main.C (setDebuggingLevel): change type of argument to + string; call Debug::value. + (easyParse): pass complete argument to setDebuggingLevel(). + + * src/debug.h (value): fix the code that parses debug levels. + + * src/debug.h: add new debug type ACTION, reserved for LyXAction + class. + + * src/LyXAction.C: use Debug::ACTION as debug channel. + + * src/lyxlookup.C: make the debug statements go to Debug::KEY. + * NEWS: updated for the future 1.1.3 release. * src/mathed/symbol_def.h: swap the definitions of \varepsilon and diff --git a/src/LyXAction.C b/src/LyXAction.C index 67c710ea26..c817c01c9a 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -514,7 +514,7 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const if (pit == lyx_arg_map.end()) { // the action does not have any pseudoactions - lyxerr[Debug::INFO] << "Action " << action + lyxerr[Debug::ACTION] << "Action " << action << " does not have any pseudo actions.\n"; return LFUN_UNKNOWN_ACTION; } @@ -523,7 +523,7 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const if (aci == (*pit).second.end()) { // the action does not have any pseudoactions with this arg - lyxerr[Debug::INFO] + lyxerr[Debug::ACTION] << "Action " << action << "does not have any pseudoactions with arg " << arg << '\n'; @@ -531,7 +531,7 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const } // pseudo action exist - lyxerr[Debug::INFO] << "Pseudoaction exist[" + lyxerr[Debug::ACTION] << "Pseudoaction exist[" << action << '|' << arg << "] = " << (*aci).second << '\n'; @@ -561,7 +561,7 @@ int LyXAction::getPseudoAction(kb_action action, string const & arg) const // put the new pseudo function in it (*ami).second[arg] = pseudo_counter; - lyxerr[Debug::INFO] << "Creating new pseudoaction " + lyxerr[Debug::ACTION] << "Creating new pseudoaction " << pseudo_counter << " for [" << action << '|' << arg << "]\n"; @@ -576,7 +576,7 @@ kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const pseudo_map::const_iterator pit = lyx_pseudo_map.find(pseudo); if (pit != lyx_pseudo_map.end()) { - lyxerr[Debug::INFO] << "Found the pseudoaction: [" + lyxerr[Debug::ACTION] << "Found the pseudoaction: [" << (*pit).second.action << '|' << (*pit).second.arg << '\n'; arg = (*pit).second.arg; @@ -597,8 +597,8 @@ int LyXAction::LookupFunc(string const & func) const // split action and arg string actstr; string argstr = split(func, actstr, ' '); - lyxerr[Debug::INIT] << "Action: " << actstr << '\n'; - lyxerr[Debug::INIT] << "Arg : " << argstr << '\n'; + lyxerr[Debug::ACTION] << "Action: " << actstr << '\n'; + lyxerr[Debug::ACTION] << "Arg : " << argstr << '\n'; func_map::const_iterator fit = lyx_func_map.find(actstr); @@ -674,7 +674,7 @@ string LyXAction::helpText(int pseudoaction) const info_map::const_iterator ici = lyx_info_map.find(action); if (ici != lyx_info_map.end()) { - if (lyxerr.debugging(Debug::INFO)) { + if (lyxerr.debugging(Debug::ACTION)) { lyxerr << "Action: " << action << '\n'; lyxerr << " name: " << (*ici).second.name << '\n'; diff --git a/src/bufferparams.C b/src/bufferparams.C index 00ff5c3e68..f475b97410 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -30,7 +30,12 @@ BufferParams::BufferParams() quotes_language = InsetQuotes::EnglishQ; quotes_times = InsetQuotes::DoubleQ; fontsize = "default"; - textclass = 0; + // Initialize textclass to point to article. if `first' is + // true in the returned pair, then `second' is the textclass + // number; if it is false, second is 0. In both cases, second + // is what we want. + textclass = textclasslist.NumberOfClass("article").second; + /* PaperLayout */ papersize = PAPER_DEFAULT; papersize2 = VM_PAPER_DEFAULT; /* DEFAULT */ diff --git a/src/debug.h b/src/debug.h index 975738ce61..36dd2a0e6c 100644 --- a/src/debug.h +++ b/src/debug.h @@ -4,6 +4,7 @@ #define LYXDEBUG_H #include "LString.h" +#include "support/lstrings.h" /** Ideally this should have been a namespace, but since we try to be compilable on older C++ compilators too, we use a struct instead. @@ -41,13 +42,15 @@ struct Debug { /// LYXSERVER = (1 << 12), // 4096 /// - ROFF = (1 << 13) + ROFF = (1 << 13), // 8192 + /// + ACTION = (1 << 14) // 16384 }; /// static const type ANY = type(INFO | INIT | KEY | TOOLBAR | PARSER | LYXRC | KBMAP | LATEX | MATHED | FONT | TCLASS | LYXVC | - LYXSERVER | ROFF); + LYXSERVER | ROFF | ACTION); /// friend inline void operator|=(Debug::type & d1, Debug::type d2); @@ -61,21 +64,42 @@ struct Debug { string::size_type st = v.find(','); string tmp(v.substr(0, st)); if (tmp.empty()) break; - if (val == "NONE") l |= Debug::NONE; - else if (val == "INFO") l |= Debug::INFO; - else if (val == "INIT") l |= Debug::INIT; - else if (val == "KEY") l |= Debug::KEY; - else if (val == "TOOLBAR") l |= Debug::TOOLBAR; - else if (val == "PARSER") l |= Debug::PARSER; - else if (val == "LYXRC") l |= Debug::LYXRC; - else if (val == "KBMAP") l |= Debug::KBMAP; - else if (val == "LATEX") l |= Debug::LATEX; - else if (val == "MATHED") l |= Debug::MATHED; - else if (val == "FONT") l |= Debug::FONT; - else if (val == "TCLASS") l |= Debug::TCLASS; - else if (val == "LYXVC") l |= Debug::LYXVC; - else if (val == "LYXSERVER") l |= Debug::LYXSERVER; - else if (val == "ROFF") l |= Debug::ROFF; + if (isStrInt(tmp)) { + l |= static_cast(strToInt(tmp)); + break; + } + if (!compare_no_case(tmp,"NONE")) + l |= Debug::NONE; + else if (!compare_no_case(tmp,"INFO")) + l |= Debug::INFO; + else if (!compare_no_case(tmp,"INIT")) + l |= Debug::INIT; + else if (!compare_no_case(tmp,"KEY")) + l |= Debug::KEY; + else if (!compare_no_case(tmp,"TOOLBAR")) + l |= Debug::TOOLBAR; + else if (!compare_no_case(tmp,"PARSER")) + l |= Debug::PARSER; + else if (!compare_no_case(tmp,"LYXRC")) + l |= Debug::LYXRC; + else if (!compare_no_case(tmp,"KBMAP")) + l |= Debug::KBMAP; + else if (!compare_no_case(tmp,"LATEX")) + l |= Debug::LATEX; + else if (!compare_no_case(tmp,"MATHED")) + l |= Debug::MATHED; + else if (!compare_no_case(tmp,"FONT")) + l |= Debug::FONT; + else if (!compare_no_case(tmp,"TCLASS")) + l |= Debug::TCLASS; + else if (!compare_no_case(tmp,"LYXVC")) + l |= Debug::LYXVC; + else if (!compare_no_case(tmp,"LYXSERVER")) + l |= Debug::LYXSERVER; + else if (!compare_no_case(tmp,"ROFF")) + l |= Debug::ROFF; + else if (!compare_no_case(tmp,"ACTION")) + l |= Debug::ACTION; else break; // unknown string if (st == string::npos) break; v.erase(0, st + 1); diff --git a/src/lyx_main.C b/src/lyx_main.C index 53e963954d..4d4fe085a9 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -425,10 +425,10 @@ void LyX::ReadRcFile(string const & name) // Set debugging level and report result to user -void setDebuggingLevel(int dbgLevel) +void setDebuggingLevel(string const &dbgLevel) { lyxerr << _("Setting debug level to ") << dbgLevel << endl; - lyxerr.level(Debug::type(dbgLevel)); + lyxerr.level(Debug::value(dbgLevel)); lyxerr[Debug::INFO] << "Debugging INFO #" << Debug::INFO << endl; lyxerr[Debug::INIT] << "Debugging INIT #" << Debug::INIT << endl; lyxerr[Debug::KEY] << "Debugging KEY #" << Debug::KEY << endl; @@ -474,10 +474,7 @@ bool LyX::easyParse(int * argc, char * argv[]) // Check for -dbg int if (arg == "-dbg") { if (i+1 < *argc) { - int erri = 0; - sscanf(argv[i+1], "%d", &erri); - - setDebuggingLevel(erri); + setDebuggingLevel(argv[i+1]); // Now, remove these two arguments by shifting // the following two places down. diff --git a/src/lyxlookup.C b/src/lyxlookup.C index a53810fb75..2d263c5ca8 100644 --- a/src/lyxlookup.C +++ b/src/lyxlookup.C @@ -35,13 +35,13 @@ void InitLyXLookup(Display * display, Window window) // This part could be done before opening display setlocale(LC_CTYPE, ""); if (!XSupportsLocale()) { - lyxerr.debug() + lyxerr[Debug::KEY] << "InitLyXLookup: X does not support this locale." << endl; return; } if (!XSetLocaleModifiers("")) { - lyxerr.debug() << "InitLyXLookup: Could not set modifiers " + lyxerr[Debug::KEY] << "InitLyXLookup: Could not set modifiers " "for this locale." << endl; return; } @@ -56,14 +56,14 @@ void InitLyXLookup(Display * display, Window window) 0); if (!xic) { - lyxerr.debug() << "InitLyXLookup: could not create " + lyxerr[Debug::KEY] << "InitLyXLookup: could not create " "an input context" << endl; XCloseIM (xim); xim = 0; } } else - lyxerr.debug() << "InitLyXLookup: could not open " + lyxerr[Debug::KEY] << "InitLyXLookup: could not open " "an input method." << endl; } @@ -190,7 +190,7 @@ int LyXLookupString(XEvent * event, void CloseLyXLookup() { if (xic) { - lyxerr.debug() << "CloseLyXLookup: destroying input context" + lyxerr[Debug::KEY] << "CloseLyXLookup: destroying input context" << endl; XDestroyIC(xic); XCloseIM(xim);