]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrc.C
Fix crash when running lyx -dbg insets -e ...
[lyx.git] / src / lyxrc.C
index bfdb1ad4ce123c694f666ba390a765823440774c..bc3b7d302ebf40235cff681c85ce36216d338e4b 100644 (file)
@@ -4,7 +4,7 @@
  *           LyX, The Document Processor
  *      
  *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2000 The LyX Team.
+ *          Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
@@ -31,6 +31,7 @@
 #include "support/filetools.h"
 #include "lyxtext.h"
 #include "converter.h"
+#include "gettext.h"
 
 using std::ostream;
 using std::ofstream;
@@ -40,10 +41,10 @@ using std::endl;
 using std::vector;
 
 extern LyXAction lyxaction;
-extern kb_keymap * toplevel_keymap;
+extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
 
+namespace {
 
-static
 keyword_item lyxrcTags[] = {
        { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
        { "\\alternate_language", LyXRC::RC_ALT_LANG },
@@ -132,6 +133,9 @@ keyword_item lyxrcTags[] = {
        { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
        { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
        { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
+#ifdef USE_PSPELL
+       { "\\use_pspell", LyXRC::RC_USE_PSPELL },
+#endif
        { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
        { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
        { "\\viewer" ,LyXRC::RC_VIEWER}, 
@@ -139,7 +143,9 @@ keyword_item lyxrcTags[] = {
 };
 
 /* Let the range depend of the size of lyxrcTags.  Alejandro 240596 */
-static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
+const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
+
+} // namespace anon
 
 
 LyXRC::LyXRC() 
@@ -213,6 +219,9 @@ void LyXRC::setDefaults() {
        exit_confirmation = true;
        display_shortcuts = true;
        // Spellchecker settings:
+#ifdef USE_PSPELL      
+       use_pspell = true;
+#endif
        isp_command = "ispell";
        isp_accept_compound = false;
        isp_use_input_encoding = false;
@@ -275,7 +284,7 @@ int LyXRC::read(string const & filename)
        lexrc.setFile(filename);
        if (!lexrc.IsOK()) return -2;
        
-       lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
+       lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
        
        while (lexrc.IsOK()) {
                // By using two switches we take advantage of the compiler
@@ -704,15 +713,17 @@ int LyXRC::read(string const & filename)
                        }
                        
                        if ((action = lyxaction.LookupFunc(cmd))>= 0) {
-                               if (lyxerr.debugging(Debug::KBMAP)) {
+                               if (lyxerr.debugging(Debug::LYXRC)) {
                                        lyxerr << "RC_BIND: Sequence `"
                                               << seq << "' Command `"
                                               << cmd << "' Action `"
                                               << action << '\'' << endl;
                                }
                                res = toplevel_keymap->bind(seq, action);
-                               if (res != 0) {
+                               if (res != 0
+                                   && lyxerr.debugging(Debug::LYXRC)) {
                                        lexrc.printError(
+                                               "RC_BIND: "
                                                "Invalid key sequence `"
                                                + seq + '\''); 
                                }
@@ -746,6 +757,12 @@ int LyXRC::read(string const & filename)
                                ascii_linelen = lexrc.GetInteger();
                        break;
                        // Spellchecker settings:
+#ifdef USE_PSPELL
+               case RC_USE_PSPELL:
+                       if (lexrc.next())
+                               use_pspell = lexrc.GetBool();
+                       break;
+#endif
                case RC_SPELL_COMMAND:
                        if (lexrc.next())
                                isp_command = lexrc.GetString();
@@ -940,7 +957,7 @@ void LyXRC::output(ostream & os) const
           << "###          LyX, The Document Processor\n"
           << "###\n"
           << "###          Copyright 1995 Matthias Ettrich\n"
-          << "###          Copyright 1995-2000 The LyX Team.\n"
+          << "###          Copyright 1995-2001 The LyX Team.\n"
           << "###\n"
           << "### ========================================================\n"
           << "\n"
@@ -1370,7 +1387,12 @@ void LyXRC::output(ostream & os) const
                os << "\n#\n"
                   << "# SPELLCHECKER SECTION ##############################\n"
                   << "#\n\n";
-
+#ifdef USE_PSPELL
+       case RC_USE_PSPELL:
+               if (use_pspell != system_lyxrc.use_pspell) {
+                       os << "\\use_pspell \"" << use_pspell << "\"\n";
+               }
+#endif
        case RC_SPELL_COMMAND:
                if (isp_command != system_lyxrc.isp_command) {
                        os << "\\spell_command \"" << isp_command << "\"\n";
@@ -1586,6 +1608,8 @@ void LyXRC::set_font_norm_type()
                font_norm_type = ISO_8859_6_8;
        else if (font_norm == "iso8859-9")
                font_norm_type = ISO_8859_9;
+       else if (font_norm == "iso8859-15")
+               font_norm_type = ISO_8859_15;
        else
                font_norm_type = OTHER_ENCODING;
 }