Make sure the default class for a new file is "article"; make the selection of debug level actually work (more to be done) and change the debug level of some statements.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@336 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 1999-11-25 17:29:19 +00:00
parent 07febc9941
commit ad6f072fe6
6 changed files with 80 additions and 37 deletions

View File

@ -1,5 +1,22 @@
1999-11-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 1999-11-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* 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. * NEWS: updated for the future 1.1.3 release.
* src/mathed/symbol_def.h: swap the definitions of \varepsilon and * src/mathed/symbol_def.h: swap the definitions of \varepsilon and

View File

@ -514,7 +514,7 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
if (pit == lyx_arg_map.end()) { if (pit == lyx_arg_map.end()) {
// the action does not have any pseudoactions // the action does not have any pseudoactions
lyxerr[Debug::INFO] << "Action " << action lyxerr[Debug::ACTION] << "Action " << action
<< " does not have any pseudo actions.\n"; << " does not have any pseudo actions.\n";
return LFUN_UNKNOWN_ACTION; return LFUN_UNKNOWN_ACTION;
} }
@ -523,7 +523,7 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
if (aci == (*pit).second.end()) { if (aci == (*pit).second.end()) {
// the action does not have any pseudoactions with this arg // the action does not have any pseudoactions with this arg
lyxerr[Debug::INFO] lyxerr[Debug::ACTION]
<< "Action " << action << "Action " << action
<< "does not have any pseudoactions with arg " << "does not have any pseudoactions with arg "
<< arg << '\n'; << arg << '\n';
@ -531,7 +531,7 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
} }
// pseudo action exist // pseudo action exist
lyxerr[Debug::INFO] << "Pseudoaction exist[" lyxerr[Debug::ACTION] << "Pseudoaction exist["
<< action << '|' << action << '|'
<< arg << "] = " << (*aci).second << '\n'; << 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 // put the new pseudo function in it
(*ami).second[arg] = pseudo_counter; (*ami).second[arg] = pseudo_counter;
lyxerr[Debug::INFO] << "Creating new pseudoaction " lyxerr[Debug::ACTION] << "Creating new pseudoaction "
<< pseudo_counter << " for [" << action << pseudo_counter << " for [" << action
<< '|' << arg << "]\n"; << '|' << 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); pseudo_map::const_iterator pit = lyx_pseudo_map.find(pseudo);
if (pit != lyx_pseudo_map.end()) { if (pit != lyx_pseudo_map.end()) {
lyxerr[Debug::INFO] << "Found the pseudoaction: [" lyxerr[Debug::ACTION] << "Found the pseudoaction: ["
<< (*pit).second.action << '|' << (*pit).second.action << '|'
<< (*pit).second.arg << '\n'; << (*pit).second.arg << '\n';
arg = (*pit).second.arg; arg = (*pit).second.arg;
@ -597,8 +597,8 @@ int LyXAction::LookupFunc(string const & func) const
// split action and arg // split action and arg
string actstr; string actstr;
string argstr = split(func, actstr, ' '); string argstr = split(func, actstr, ' ');
lyxerr[Debug::INIT] << "Action: " << actstr << '\n'; lyxerr[Debug::ACTION] << "Action: " << actstr << '\n';
lyxerr[Debug::INIT] << "Arg : " << argstr << '\n'; lyxerr[Debug::ACTION] << "Arg : " << argstr << '\n';
func_map::const_iterator fit = lyx_func_map.find(actstr); 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); info_map::const_iterator ici = lyx_info_map.find(action);
if (ici != lyx_info_map.end()) { if (ici != lyx_info_map.end()) {
if (lyxerr.debugging(Debug::INFO)) { if (lyxerr.debugging(Debug::ACTION)) {
lyxerr << "Action: " << action << '\n'; lyxerr << "Action: " << action << '\n';
lyxerr << " name: " lyxerr << " name: "
<< (*ici).second.name << '\n'; << (*ici).second.name << '\n';

View File

@ -30,7 +30,12 @@ BufferParams::BufferParams()
quotes_language = InsetQuotes::EnglishQ; quotes_language = InsetQuotes::EnglishQ;
quotes_times = InsetQuotes::DoubleQ; quotes_times = InsetQuotes::DoubleQ;
fontsize = "default"; 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 */ /* PaperLayout */
papersize = PAPER_DEFAULT; papersize = PAPER_DEFAULT;
papersize2 = VM_PAPER_DEFAULT; /* DEFAULT */ papersize2 = VM_PAPER_DEFAULT; /* DEFAULT */

View File

@ -4,6 +4,7 @@
#define LYXDEBUG_H #define LYXDEBUG_H
#include "LString.h" #include "LString.h"
#include "support/lstrings.h"
/** Ideally this should have been a namespace, but since we try to be /** Ideally this should have been a namespace, but since we try to be
compilable on older C++ compilators too, we use a struct instead. compilable on older C++ compilators too, we use a struct instead.
@ -41,13 +42,15 @@ struct Debug {
/// ///
LYXSERVER = (1 << 12), // 4096 LYXSERVER = (1 << 12), // 4096
/// ///
ROFF = (1 << 13) ROFF = (1 << 13), // 8192
///
ACTION = (1 << 14) // 16384
}; };
/// ///
static const type ANY = type(INFO | INIT | KEY | TOOLBAR | static const type ANY = type(INFO | INIT | KEY | TOOLBAR |
PARSER | LYXRC | KBMAP | LATEX | PARSER | LYXRC | KBMAP | LATEX |
MATHED | FONT | TCLASS | LYXVC | MATHED | FONT | TCLASS | LYXVC |
LYXSERVER | ROFF); LYXSERVER | ROFF | ACTION);
/// ///
friend inline void operator|=(Debug::type & d1, Debug::type d2); friend inline void operator|=(Debug::type & d1, Debug::type d2);
@ -61,21 +64,42 @@ struct Debug {
string::size_type st = v.find(','); string::size_type st = v.find(',');
string tmp(v.substr(0, st)); string tmp(v.substr(0, st));
if (tmp.empty()) break; if (tmp.empty()) break;
if (val == "NONE") l |= Debug::NONE; if (isStrInt(tmp)) {
else if (val == "INFO") l |= Debug::INFO; l |= static_cast<type>(strToInt(tmp));
else if (val == "INIT") l |= Debug::INIT; break;
else if (val == "KEY") l |= Debug::KEY; }
else if (val == "TOOLBAR") l |= Debug::TOOLBAR; if (!compare_no_case(tmp,"NONE"))
else if (val == "PARSER") l |= Debug::PARSER; l |= Debug::NONE;
else if (val == "LYXRC") l |= Debug::LYXRC; else if (!compare_no_case(tmp,"INFO"))
else if (val == "KBMAP") l |= Debug::KBMAP; l |= Debug::INFO;
else if (val == "LATEX") l |= Debug::LATEX; else if (!compare_no_case(tmp,"INIT"))
else if (val == "MATHED") l |= Debug::MATHED; l |= Debug::INIT;
else if (val == "FONT") l |= Debug::FONT; else if (!compare_no_case(tmp,"KEY"))
else if (val == "TCLASS") l |= Debug::TCLASS; l |= Debug::KEY;
else if (val == "LYXVC") l |= Debug::LYXVC; else if (!compare_no_case(tmp,"TOOLBAR"))
else if (val == "LYXSERVER") l |= Debug::LYXSERVER; l |= Debug::TOOLBAR;
else if (val == "ROFF") l |= Debug::ROFF; 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 else break; // unknown string
if (st == string::npos) break; if (st == string::npos) break;
v.erase(0, st + 1); v.erase(0, st + 1);

View File

@ -425,10 +425,10 @@ void LyX::ReadRcFile(string const & name)
// Set debugging level and report result to user // 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 << _("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::INFO] << "Debugging INFO #" << Debug::INFO << endl;
lyxerr[Debug::INIT] << "Debugging INIT #" << Debug::INIT << endl; lyxerr[Debug::INIT] << "Debugging INIT #" << Debug::INIT << endl;
lyxerr[Debug::KEY] << "Debugging KEY #" << Debug::KEY << endl; lyxerr[Debug::KEY] << "Debugging KEY #" << Debug::KEY << endl;
@ -474,10 +474,7 @@ bool LyX::easyParse(int * argc, char * argv[])
// Check for -dbg int // Check for -dbg int
if (arg == "-dbg") { if (arg == "-dbg") {
if (i+1 < *argc) { if (i+1 < *argc) {
int erri = 0; setDebuggingLevel(argv[i+1]);
sscanf(argv[i+1], "%d", &erri);
setDebuggingLevel(erri);
// Now, remove these two arguments by shifting // Now, remove these two arguments by shifting
// the following two places down. // the following two places down.

View File

@ -35,13 +35,13 @@ void InitLyXLookup(Display * display, Window window)
// This part could be done before opening display // This part could be done before opening display
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
if (!XSupportsLocale()) { if (!XSupportsLocale()) {
lyxerr.debug() lyxerr[Debug::KEY]
<< "InitLyXLookup: X does not support this locale." << "InitLyXLookup: X does not support this locale."
<< endl; << endl;
return; return;
} }
if (!XSetLocaleModifiers("")) { if (!XSetLocaleModifiers("")) {
lyxerr.debug() << "InitLyXLookup: Could not set modifiers " lyxerr[Debug::KEY] << "InitLyXLookup: Could not set modifiers "
"for this locale." << endl; "for this locale." << endl;
return; return;
} }
@ -56,14 +56,14 @@ void InitLyXLookup(Display * display, Window window)
0); 0);
if (!xic) { if (!xic) {
lyxerr.debug() << "InitLyXLookup: could not create " lyxerr[Debug::KEY] << "InitLyXLookup: could not create "
"an input context" << endl; "an input context" << endl;
XCloseIM (xim); XCloseIM (xim);
xim = 0; xim = 0;
} }
} }
else else
lyxerr.debug() << "InitLyXLookup: could not open " lyxerr[Debug::KEY] << "InitLyXLookup: could not open "
"an input method." << endl; "an input method." << endl;
} }
@ -190,7 +190,7 @@ int LyXLookupString(XEvent * event,
void CloseLyXLookup() void CloseLyXLookup()
{ {
if (xic) { if (xic) {
lyxerr.debug() << "CloseLyXLookup: destroying input context" lyxerr[Debug::KEY] << "CloseLyXLookup: destroying input context"
<< endl; << endl;
XDestroyIC(xic); XDestroyIC(xic);
XCloseIM(xim); XCloseIM(xim);