]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrc.C
"Inter-word Space"
[lyx.git] / src / lyxrc.C
index 4db42ebe7e7ae55b8f7b1de09e675e9d6686d09a..f9ec51b0dd155ede370425e5a8f6b6ea4d3a06ee 100644 (file)
@@ -1,36 +1,36 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file lyxrc.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
- *
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation "lyxrc.h"
-#endif
-
 #include <fstream>
 #include <iomanip>
 #include <iostream>
 #include <boost/scoped_ptr.hpp>
 
-#include "debug.h"
-
 #include "lyxrc.h"
+
+#include "debug.h"
 #include "kbmap.h"
 #include "LyXAction.h"
 #include "intl.h"
-#include "support/path.h"
-#include "support/filetools.h"
 #include "converter.h"
+#include "format.h"
 #include "gettext.h"
 #include "lyxlex.h"
 
+#include "support/path.h"
+#include "support/tostr.h"
+#include "support/filetools.h"
+#include "support/LAssert.h"
+#include "support/lstrings.h"
+#include "support/userinfo.h"
+
 using std::ostream;
 using std::ofstream;
 using std::cout;
@@ -144,10 +144,12 @@ 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
+       // compatibility with versions older than 1.4.0 only
+       { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
+       { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
        { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
+       { "\\user_email", LyXRC::RC_USER_EMAIL },
+       { "\\user_name", LyXRC::RC_USER_NAME },
        { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
        { "\\viewer" ,LyXRC::RC_VIEWER},
        { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
@@ -210,9 +212,9 @@ void LyXRC::setDefaults() {
        font_sizes[LyXFont::SIZE_HUGE] = 20.74;
        font_sizes[LyXFont::SIZE_HUGER] = 24.88;
        use_scalable_fonts = true;
-       roman_font_name = "times";
-       sans_font_name = "helvetica";
-       typewriter_font_name = "courier";
+       roman_font_name = "";
+       sans_font_name = "";
+       typewriter_font_name = "";
        popup_bold_font = "-*-helvetica-bold-r";
        popup_normal_font = "-*-helvetica-medium-r";
        font_norm = "iso8859-1";
@@ -228,9 +230,7 @@ void LyXRC::setDefaults() {
        backupdir_path.erase();
        display_graphics = grfx::ColorDisplay;
        // Spellchecker settings:
-#ifdef USE_PSPELL
-       use_pspell = true;
-#endif
+       use_spell_lib = true;
        isp_command = "ispell";
        isp_accept_compound = false;
        isp_use_input_encoding = false;
@@ -260,10 +260,12 @@ void LyXRC::setDefaults() {
        preview_hashed_labels  = false;
        preview_scale_factor = 0.9;
 
-       /// These variables are not stored on disk (perhaps they
-       // should be moved from the LyXRC class).
-       use_gui = true;
-       pdf_mode = false;
+       user_name = lyx::user_name();
+
+       user_email = lyx::user_email();
+
+       if (user_email.empty())
+               user_email = _("email address unknown");
 }
 
 
@@ -873,13 +875,11 @@ int LyXRC::read(string const & filename)
                        }
                        break;
                        // Spellchecker settings:
-#ifdef USE_PSPELL
-               case RC_USE_PSPELL:
+               case RC_USE_SPELL_LIB:
                        if (lexrc.next()) {
-                               use_pspell = lexrc.getBool();
+                               use_spell_lib = lexrc.getBool();
                        }
                        break;
-#endif
                case RC_SPELL_COMMAND:
                        if (lexrc.next()) {
                                isp_command = lexrc.getString();
@@ -1094,6 +1094,16 @@ int LyXRC::read(string const & filename)
                        }
                        break;
 
+               case RC_USER_NAME:
+                       if (lexrc.next())
+                               user_name = lexrc.getString();
+                       break;
+
+               case RC_USER_EMAIL:
+                       if (lexrc.next())
+                               user_email = lexrc.getString();
+                       break;
+
                case RC_LAST: break; // this is just a dummy
                }
        }
@@ -1261,6 +1271,12 @@ void LyXRC::output(ostream & os) const
                           << '\n';
                }
 
+       case RC_USER_NAME:
+               os << "\\user_name \"" << user_name << "\"\n";
+
+       case RC_USER_EMAIL:
+               os << "\\user_email \"" << user_email << "\"\n";
+
        case RC_SHOW_BANNER:
                if (show_banner != system_lyxrc.show_banner) {
                        os << "\\show_banner " << tostr(show_banner) << '\n';
@@ -1606,12 +1622,10 @@ 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 " << tostr(use_pspell) << '\n';
+       case RC_USE_SPELL_LIB:
+               if (use_spell_lib != system_lyxrc.use_spell_lib) {
+                       os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
                }
-#endif
        case RC_SPELL_COMMAND:
                if (isp_command != system_lyxrc.isp_command) {
                        os << "\\spell_command \"" << isp_command << "\"\n";
@@ -1798,6 +1812,7 @@ void LyXRC::output(ostream & os) const
                        if (!converters.getConverter(cit->from, cit->to))
                                os << "\\converter \"" << cit->from
                                   << "\" \"" << cit->to << "\" \"\" \"\"\n";
+
        }
        os.flush();
 }