]> git.lyx.org Git - features.git/commitdiff
Make sure the default class for a new file is "article"; make the selection of debug...
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 25 Nov 1999 17:29:19 +0000 (17:29 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 25 Nov 1999 17:29:19 +0000 (17:29 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@336 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/LyXAction.C
src/bufferparams.C
src/debug.h
src/lyx_main.C
src/lyxlookup.C

index 35507e1ccd716c131171de7eabb5150df4450fd9..045970fad50c42ea2ae1173be55595902925267c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 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.
 
        * src/mathed/symbol_def.h: swap the definitions of \varepsilon and
index 67c710ea267e90ec8887bc37abcc3c578b3230b8..c817c01c9a55d0b6a616c7b46b62d115c87863ec 100644 (file)
@@ -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';
index 00ff5c3e68053463ee9e412ca16c721d272811c1..f475b97410840359c3be2ff30221aa4ac7d4964e 100644 (file)
@@ -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 */
index 975738ce61896173d45bbd7b32e18ff93293767b..36dd2a0e6cefb217f19b1edfc00087ce6caa6d92 100644 (file)
@@ -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<type>(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);
index 53e963954d071e6158ad53732298828a5b3aada1..4d4fe085a951f553ba9d9e7c81ce926ac8756539 100644 (file)
@@ -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.
index a53810fb754dca074cc5346f939d28a4a441b5fe..2d263c5ca8299593ecee2d1358a08df65cfc168d 100644 (file)
@@ -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);