-/* 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;
{ "\\make_backup", LyXRC::RC_MAKE_BACKUP },
{ "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
{ "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
- { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
{ "\\personal_dictionary", LyXRC::RC_PERS_DICT },
{ "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
{ "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
// compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
{ "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
{ "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
+ { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
{ "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
+ { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
{ "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
{ "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
{ "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
+ { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
{ "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
{ "\\set_color", LyXRC::RC_SET_COLOR },
{ "\\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 }
dpi = 75;
// Because a screen typically is wider than a piece of paper:
zoom = 150;
- wheel_jump = 100;
+ wheel_jump = 5;
// Default LaTeX font size:
font_sizes[LyXFont::SIZE_TINY] = 5.0;
font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
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";
font_norm_type = ISO_8859_1;
popup_font_encoding.erase();
- override_x_deadkeys = true;
autosave = 300;
auto_region_delete = true;
auto_reset_options = false;
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;
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");
}
}
+namespace {
+
+void oldFontFormat(string & family, string & foundry)
+{
+ if (family.empty() || family[0] != '-')
+ return;
+ foundry = token(family, '-', 1);
+ family = token(family, '-', 2);
+ if (foundry == "*")
+ foundry.erase();
+}
+
+} // namespace anon
+
+
int LyXRC::read(string const & filename)
{
LyXLex lexrc(lyxrcTags, lyxrcCount);
case RC_SCREEN_FONT_ROMAN:
if (lexrc.next()) {
roman_font_name = lexrc.getString();
+ oldFontFormat(roman_font_name,
+ roman_font_foundry);
}
break;
case RC_SCREEN_FONT_SANS:
if (lexrc.next()) {
sans_font_name = lexrc.getString();
+ oldFontFormat(sans_font_name, sans_font_foundry);
}
break;
case RC_SCREEN_FONT_TYPEWRITER:
if (lexrc.next()) {
typewriter_font_name = lexrc.getString();
+ oldFontFormat(typewriter_font_name,
+ typewriter_font_foundry);
+ }
+ break;
+
+ case RC_SCREEN_FONT_ROMAN_FOUNDRY:
+ if (lexrc.next()) {
+ roman_font_foundry = lexrc.getString();
+ }
+ break;
+
+ case RC_SCREEN_FONT_SANS_FOUNDRY:
+ if (lexrc.next()) {
+ sans_font_foundry = lexrc.getString();
+ }
+ break;
+
+ case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
+ if (lexrc.next()) {
+ typewriter_font_foundry = lexrc.getString();
}
break;
if (lexrc.next()) {
x11_name = lexrc.getString();
} else {
- lexrc.printError("Missing color name for color : `$$Token'");
+ lexrc.printError("Missing color name for color: `$$Token'");
break;
}
}
break;
}
- case RC_OVERRIDE_X_DEADKEYS:
- if (lexrc.next()) {
- override_x_deadkeys = lexrc.getBool();
- }
- break;
-
case RC_SERVERPIPE:
if (lexrc.next()) {
lyxpipes = ExpandPath(lexrc.getString());
}
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();
}
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
}
}
<< '\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';
os << "\\screen_font_roman \"" << roman_font_name
<< "\"\n";
}
+ case RC_SCREEN_FONT_ROMAN_FOUNDRY:
+ if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
+ os << "\\screen_font_roman_foundry \"" << roman_font_foundry
+ << "\"\n";
+ }
case RC_SCREEN_FONT_SANS:
if (sans_font_name != system_lyxrc.sans_font_name) {
os << "\\screen_font_sans \"" << sans_font_name
<< "\"\n";
}
+ case RC_SCREEN_FONT_SANS_FOUNDRY:
+ if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
+ os << "\\screen_font_sans_foundry \"" << sans_font_foundry
+ << "\"\n";
+ }
case RC_SCREEN_FONT_TYPEWRITER:
if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
os << "\\screen_font_typewriter \""
<< typewriter_font_name << "\"\n";
}
+ case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
+ if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
+ os << "\\screen_font_typewriter_foundry \""
+ << typewriter_font_foundry << "\"\n";
+ }
+
case RC_SCREEN_FONT_SCALABLE:
if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
os << "\\screen_font_scalable "
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";
<< "# 2nd MISC SUPPORT SECTION ##########################\n"
<< "#\n\n";
- case RC_OVERRIDE_X_DEADKEYS:
- if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
- os << "\\override_x_deadkeys "
- << tostr(override_x_deadkeys) << '\n';
- }
case RC_AUTO_NUMBER:
if (auto_number != system_lyxrc.auto_number) {
os << "\\auto_number " << tostr(auto_number) << '\n';
if (!converters.getConverter(cit->from, cit->to))
os << "\\converter \"" << cit->from
<< "\" \"" << cit->to << "\" \"\" \"\"\n";
+
}
os.flush();
}
break;
case RC_DOCUMENTPATH:
- str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
+ str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
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.");
+ str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
break;
case RC_TEMPDIRPATH:
str = _("De-select if you don't want the class options to be reset to defaults after class change.");
break;
- case RC_OVERRIDE_X_DEADKEYS:
- str = _("Select if LyX is to take over the handling of the dead keys (a.k.a. accent keys) that may be defined for your keyboard.");
- break;
-
-
case RC_SERVERPIPE:
str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
break;
break;
case RC_UIFILE:
- str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
+ str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
break;
case RC_KBMAP:
break;
case RC_ASCIIROFF_COMMAND:
- str = _("Use to define an external program to render tables in the ASCII output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"none\" is specified, an internal routine is used.");
+ str = _("Use to define an external program to render tables in the ASCII output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"none\" is specified, an internal routine is used.");
break;
case RC_ASCII_LINELEN:
break;
case RC_LANGUAGE_PACKAGE:
- str = _("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
+ str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
break;
case RC_LANGUAGE_GLOBAL_OPTIONS:
break;
case RC_LANGUAGE_COMMAND_BEGIN:
- str = _("The latex command for changing from the language of the document to another language. E.g. \\selectlanguage{$$lang} where $$lang is substituted by the name of the second language.");
+ str = _("The LaTeX command for changing from the language of the document to another language. E.g. \\selectlanguage{$$lang} where $$lang is substituted by the name of the second language.");
break;
case RC_LANGUAGE_COMMAND_END:
- str = _("The latex command for changing back to the language of the document.");
+ str = _("The LaTeX command for changing back to the language of the document.");
break;
case RC_LANGUAGE_COMMAND_LOCAL:
- str = _("The latex command for local changing of the language.");
+ str = _("The LaTeX command for local changing of the language.");
break;
case RC_DATE_INSERT_FORMAT:
break;
case RC_WHEEL_JUMP:
- str = _("The wheel movement factor (for mice with wheels or five button mice).");
+ str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
break;
case RC_CONVERTER: