]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
Revert cs 28908: wrong fix.
[lyx.git] / src / LyXRC.cpp
index be650c3a7447d04bcbe6e819edf3bc7e87beb706..19bbb157a3813b33f86c2c117d6a19e081b9bb56 100644 (file)
 
 #include <config.h>
 
-#include <fstream>
-#include <iostream>
-
 #include "LyXRC.h"
 
-#include "Color.h"
+#include "ColorSet.h"
 #include "Converter.h"
+#include "FontEnums.h"
 #include "Format.h"
-#include "Session.h"
 #include "Lexer.h"
-#include "FontEnums.h"
 #include "Mover.h"
+#include "Session.h"
+#include "version.h"
 
 #include "graphics/GraphicsTypes.h"
 
@@ -40,6 +38,9 @@
 #include "support/os.h"
 #include "support/userinfo.h"
 
+#include <fstream>
+#include <iostream>
+
 using namespace std;
 using namespace lyx::support;
 
@@ -57,6 +58,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
        { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
        { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
+       { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
        { "\\autosave", LyXRC::RC_AUTOSAVE },
        { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
        { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
@@ -164,6 +166,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\template_path", LyXRC::RC_TEMPLATEPATH },
        { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
        { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
+       { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
        { "\\ui_file", LyXRC::RC_UIFILE },
        { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
        { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
@@ -312,6 +315,7 @@ void LyXRC::setDefaults()
        completion_popup_text = false;
        completion_popup_delay = 2.0;
        completion_popup_after_complete = true;
+       autocorrection_math = false;
        completion_inline_math = true;
        completion_inline_text = false;
        completion_inline_dots = -1;
@@ -381,15 +385,13 @@ int LyXRC::read(Lexer & lexrc)
 
                int le = lexrc.lex();
                switch (le) {
-                       case Lexer::LEX_UNDEF:
-                               // dro[ obsolete tag
-                               if (lexrc.getString() != "\\plaintest_roff_command")
-                                       lexrc.printError("Unknown tag `$$Token'");
-                               continue;
-                       case Lexer::LEX_FEOF:
-                               continue;
-                       default:
-                               break;
+               case Lexer::LEX_UNDEF:
+                       lexrc.printError("Unknown tag `$$Token'");
+                       continue;
+               case Lexer::LEX_FEOF:
+                       continue;
+               default:
+                       break;
                }
                switch (static_cast<LyXRCTags>(le)) {
                case RC_INPUT: // Include file
@@ -671,6 +673,13 @@ int LyXRC::read(Lexer & lexrc)
                        }
                        break;
 
+               case RC_THESAURUSDIRPATH:
+                       if (lexrc.next()) {
+                               thesaurusdir_path = os::internal_path(lexrc.getString());
+                               thesaurusdir_path = expandPath(thesaurusdir_path);
+                       }
+                       break;
+
                case RC_USETEMPDIR:
                        if (lexrc.next())
                                LYXERR0("Ignoring obsolete use_tempdir flag.");
@@ -704,6 +713,10 @@ int LyXRC::read(Lexer & lexrc)
                        lexrc >> completion_inline_dots;
                        break;
 
+               case RC_AUTOCORRECTION_MATH:
+                       lexrc >> autocorrection_math;
+                       break;
+
                case RC_COMPLETION_POPUP_DELAY:
                        lexrc >> completion_popup_delay;
                        break;
@@ -827,7 +840,7 @@ int LyXRC::read(Lexer & lexrc)
                        break;
 
                case RC_PLAINTEXT_ROFF_COMMAND: 
-                       (void) lexrc.getString(); // Obsoleted in 1.7
+                       (void) lexrc.getString(); // Obsoleted in 2.0
                        break;
                case RC_PLAINTEXT_LINELEN:
                        lexrc >> plaintext_linelen;
@@ -1076,11 +1089,8 @@ int LyXRC::read(Lexer & lexrc)
                        lexrc >> open_buffers_in_tabs;
                        break;
 
-               // Obsoleted in 1.7
+               // Obsoleted in 2.0
                case RC_SPELL_COMMAND:
-                       (void) lexrc.getString();
-                       break;
-               // Obsoleted in 1.7
                case RC_USE_SPELL_LIB:
                        (void) lexrc.getString();
                        break;
@@ -1155,8 +1165,9 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
        }
 
        if (tag == RC_LAST)
-               os << "# This file is written by LyX, if you want to make your own\n"
-                  << "# modifications you should do them from inside LyX and save\n"
+               os << "# LyX " << lyx_version
+                  << " generated this file. If you want to make your own\n"
+                  << "# modifications you should do them from inside LyX and save.\n"
                   << "\n";
 
        // Why the switch you might ask. It is a trick to ensure that all
@@ -1963,6 +1974,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
+       case RC_AUTOCORRECTION_MATH:
+               if (ignore_system_lyxrc ||
+                   autocorrection_math != system_lyxrc.autocorrection_math) {
+                       os << "\\autocorrection_math "
+                               << convert<string>(autocorrection_math) << '\n';
+               }
+               if (tag != RC_LAST)
+                       break;
        case RC_COMPLETION_POPUP_DELAY:
                if (ignore_system_lyxrc ||
                    completion_popup_delay != system_lyxrc.completion_popup_delay) {
@@ -2042,11 +2061,19 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
+       case RC_THESAURUSDIRPATH:
+               if (ignore_system_lyxrc ||
+                   thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
+                       string const path = os::external_path(thesaurusdir_path);
+                       os << "\\thesaurusdir_path \"" << path << "\"\n";
+               }
+               if (tag != RC_LAST)
+                       break;
        case RC_USETEMPDIR:
                if (tag != RC_LAST)
                        break;
                // Ignore it
-       case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 1.7
+       case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 2.0
                if (tag != RC_LAST)
                        break;
        case RC_PLAINTEXT_LINELEN:
@@ -2080,9 +2107,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                   << "# SPELLCHECKER SECTION ##############################\n"
                   << "#\n\n";
        case RC_SPELL_COMMAND:
-               // Obsoleted in 1.7
        case RC_USE_SPELL_LIB:
-               // Obsoleted in 1.7
+               // Obsoleted in 2.0
+               if (tag != RC_LAST)
+                       break;
        case RC_ACCEPT_COMPOUND:
                if (ignore_system_lyxrc ||
                    spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
@@ -2638,6 +2666,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("Use \"...\" to shorten long completions.");
                break;
 
+       case RC_AUTOCORRECTION_MATH:
+               str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
+               break;
+
        case RC_NUMLASTFILES:
                str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
                        maxlastfiles);
@@ -2651,7 +2683,7 @@ string const LyXRC::getDescription(LyXRCTags tag)
 
        case RC_PERS_DICT:
        case RC_USE_PERS_DICT:
-               str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
+               str = _("Specify an alternate personal dictionary file. E.g. \".aspell_english\".");
                break;
 
        case RC_PREVIEW:
@@ -2793,6 +2825,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
                break;
 
+       case RC_THESAURUSDIRPATH:
+               str = _("This is the place where the files of the thesaurus library reside.");
+               break;
+
        case RC_TEMPLATEPATH:
                str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
                break;
@@ -2817,7 +2853,7 @@ string const LyXRC::getDescription(LyXRCTags tag)
                break;
 
        case RC_USE_INP_ENC:
-               str = _("Specify whether to pass the -T input encoding option to ispell. Enable this if you cannot check the spelling of words containing accented letters. This may not work with all dictionaries.");
+               str = _("Specify whether to pass the -T input encoding option to aspell. Enable this if you cannot check the spelling of words containing accented letters. This may not work with all dictionaries.");
                break;
 
        case RC_USE_TOOLTIP: