-/* 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
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ * \author Angus Leeming
+ * \author John Levon
+ * \author André Pönitz
+ * \author Allan Rae
+ * \author Dekel Tsur
*
- * 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 "kbmap.h"
-#include "LyXAction.h"
-#include "intl.h"
-#include "support/path.h"
-#include "support/filetools.h"
+
+#include "debug.h"
#include "converter.h"
+#include "format.h"
#include "gettext.h"
+#include "LColor.h"
#include "lyxlex.h"
+#include "lyxfont.h"
+
+#include "graphics/GraphicsTypes.h"
+
+#include "support/filetools.h"
+#include "support/lstrings.h"
+#include "support/translator.h"
+#include "support/tostr.h"
+#include "support/userinfo.h"
+
+using lyx::support::ascii_lowercase;
+using lyx::support::ExpandPath;
+using lyx::support::GetEnv;
+using lyx::support::LibFileSearch;
+using lyx::support::token;
-using std::ostream;
-using std::ofstream;
using std::cout;
-using std::ios;
using std::endl;
-using std::vector;
-class kb_keymap;
+using std::ios;
+using std::ofstream;
+using std::ostream;
+using std::string;
-extern LyXAction lyxaction;
-extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
namespace {
{ "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
{ "\\autosave", LyXRC::RC_AUTOSAVE },
{ "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
- { "\\bind", LyXRC::RC_BIND },
{ "\\bind_file", LyXRC::RC_BINDFILE },
{ "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
{ "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
{ "\\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 }
void LyXRC::setDefaults() {
bind_file = "cua";
- hasBindFile = false;
ui_file = "default";
// Get printer from the environment. If fail, use default "",
// assuming that everything is set up correctly.
use_tempdir = true;
ps_command = "gs";
view_dvi_paper_option.erase();
- default_papersize = BufferParams::PAPER_USLETTER;
+ default_papersize = PAPER_USLETTER;
custom_export_format = "ps";
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
fontenc = "default";
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;
check_lastfiles = true;
make_backup = true;
backupdir_path.erase();
- display_graphics = "color";
+ display_graphics = lyx::graphics::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::support::user_name();
+ user_email = lyx::support::user_email();
-int LyXRC::ReadBindFile(string const & name)
-{
- hasBindFile = true;
- string const tmp = i18nLibFileSearch("bind", name, "bind");
- lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
- int const result = read(tmp);
- if (result) {
- lyxerr << "Error reading bind file: " << tmp << endl;
- }
- return result;
+ if (user_email.empty())
+ user_email = _("email address unknown");
}
-void LyXRC::readBindFileIfNeeded()
+
+namespace {
+
+void oldFontFormat(string & family, string & foundry)
{
- if (!hasBindFile)
- ReadBindFile(bind_file);
+ 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)
{
break;
case RC_BINDFILE: // RVDK_PATCH_5
if (lexrc.next()) {
- string const tmp(lexrc.getString());
- if (hasBindFile)
- // We are already in the
- // "actually read bind file"
- // mode.
- ReadBindFile(tmp);
- else
- // We are still in the "just
- // remember the name of the
- // bind file" mode.
- bind_file = tmp;
+ bind_file = lexrc.getString();
}
break;
break;
case RC_AUTORESET_OPTIONS:
- if (lexrc.next())
+ if (lexrc.next()) {
auto_reset_options = lexrc.getBool();
+ }
break;
case RC_DISPLAY_GRAPHICS:
- if (lexrc.next())
- display_graphics = lexrc.getString();
+ if (lexrc.next()) {
+ display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
+ }
break;
case RC_KBMAP:
- if (lexrc.next())
+ if (lexrc.next()) {
use_kbmap = lexrc.getBool();
+ }
break;
case RC_KBMAP_PRIMARY:
if (kmap.empty()) {
// nothing
} else if (!LibFileSearch("kbd", kmap,
- "kmap").empty())
+ "kmap").empty()) {
primary_kbmap = kmap;
- else
+ } else {
lexrc.printError("LyX: Keymap `$$Token' not found");
+ }
}
break;
if (kmap.empty()) {
// nothing
} else if (!LibFileSearch("kbd", kmap,
- "kmap").empty())
+ "kmap").empty()) {
secondary_kbmap = kmap;
- else
+ } else {
lexrc.printError("LyX: Keymap `$$Token' not found");
+ }
}
break;
case RC_FONT_ENCODING:
- if (lexrc.next())
+ if (lexrc.next()) {
fontenc = lexrc.getString();
+ }
break;
case RC_PRINTER:
- if (lexrc.next())
+ if (lexrc.next()) {
printer = lexrc.getString();
+ }
break;
case RC_PRINT_COMMAND:
- if (lexrc.next())
+ if (lexrc.next()) {
print_command = lexrc.getString();
+ }
break;
case RC_PRINTEVENPAGEFLAG:
- if (lexrc.next())
+ if (lexrc.next()) {
print_evenpage_flag = lexrc.getString();
+ }
break;
case RC_PRINTODDPAGEFLAG:
- if (lexrc.next())
+ if (lexrc.next()) {
print_oddpage_flag = lexrc.getString();
+ }
break;
case RC_PRINTPAGERANGEFLAG:
- if (lexrc.next())
+ if (lexrc.next()) {
print_pagerange_flag = lexrc.getString();
+ }
break;
case RC_PRINTCOPIESFLAG:
- if (lexrc.next())
+ if (lexrc.next()) {
print_copies_flag = lexrc.getString();
+ }
break;
case RC_PRINTCOLLCOPIESFLAG:
- if (lexrc.next())
+ if (lexrc.next()) {
print_collcopies_flag = lexrc.getString();
+ }
break;
case RC_PRINTREVERSEFLAG:
- if (lexrc.next())
+ if (lexrc.next()) {
print_reverse_flag = lexrc.getString();
+ }
break;
case RC_PRINTLANDSCAPEFLAG:
- if (lexrc.next())
+ if (lexrc.next()) {
print_landscape_flag = lexrc.getString();
+ }
break;
case RC_PRINTTOPRINTER:
- if (lexrc.next())
+ if (lexrc.next()) {
print_to_printer = lexrc.getString();
+ }
break;
case RC_PRINT_ADAPTOUTPUT:
- if (lexrc.next())
+ if (lexrc.next()) {
print_adapt_output = lexrc.getBool();
+ }
break;
case RC_PRINTTOFILE:
- if (lexrc.next())
+ if (lexrc.next()) {
print_to_file = lexrc.getString();
+ }
break;
case RC_PRINTFILEEXTENSION:
- if (lexrc.next())
+ if (lexrc.next()) {
print_file_extension = lexrc.getString();
+ }
break;
case RC_PRINTEXSTRAOPTIONS:
- if (lexrc.next())
+ if (lexrc.next()) {
print_extra_options = lexrc.getString();
+ }
break;
case RC_PRINTSPOOL_COMMAND:
- if (lexrc.next())
+ if (lexrc.next()) {
print_spool_command = lexrc.getString();
+ }
break;
case RC_PRINTSPOOL_PRINTERPREFIX:
- if (lexrc.next())
+ if (lexrc.next()) {
print_spool_printerprefix = lexrc.getString();
+ }
break;
case RC_PRINTPAPERDIMENSIONFLAG:
- if (lexrc.next())
+ if (lexrc.next()) {
print_paper_dimension_flag = lexrc.getString();
+ }
break;
case RC_PRINTPAPERFLAG:
- if (lexrc.next())
+ if (lexrc.next()) {
print_paper_flag = lexrc.getString();
+ }
break;
case RC_CUSTOM_EXPORT_COMMAND:
- if (lexrc.next())
+ if (lexrc.next()) {
custom_export_command = lexrc.getString();
+ }
break;
case RC_CUSTOM_EXPORT_FORMAT:
- if (lexrc.next())
+ if (lexrc.next()) {
custom_export_format = lexrc.getString();
+ }
break;
case RC_DEFAULT_PAPERSIZE:
ascii_lowercase(lexrc.getString());
if (size == "usletter")
default_papersize =
- BufferParams::PAPER_USLETTER;
+ PAPER_USLETTER;
else if (size == "legal")
default_papersize =
- BufferParams::PAPER_LEGALPAPER;
+ PAPER_LEGALPAPER;
else if (size == "executive")
default_papersize =
- BufferParams::PAPER_EXECUTIVEPAPER;
+ PAPER_EXECUTIVEPAPER;
else if (size == "a3")
default_papersize =
- BufferParams::PAPER_A3PAPER;
+ PAPER_A3PAPER;
else if (size == "a4")
default_papersize =
- BufferParams::PAPER_A4PAPER;
+ PAPER_A4PAPER;
else if (size == "a5")
default_papersize =
- BufferParams::PAPER_A5PAPER;
+ PAPER_A5PAPER;
else if (size == "b5")
default_papersize =
- BufferParams::PAPER_B5PAPER;
+ PAPER_B5PAPER;
}
break;
case RC_VIEWDVI_PAPEROPTION:
- if (lexrc.next())
+ if (lexrc.next()) {
view_dvi_paper_option = lexrc.getString();
- else
+ } else {
view_dvi_paper_option.erase();
+ }
break;
case RC_PS_COMMAND:
- if (lexrc.next())
+ if (lexrc.next()) {
ps_command = lexrc.getString();
+ }
break;
case RC_CHKTEX_COMMAND:
- if (lexrc.next())
+ if (lexrc.next()) {
chktex_command = lexrc.getString();
+ }
break;
case RC_SCREEN_DPI:
- if (lexrc.next())
+ if (lexrc.next()) {
dpi = lexrc.getInteger();
+ }
break;
case RC_SCREEN_ZOOM:
- if (lexrc.next())
+ if (lexrc.next()) {
zoom = lexrc.getInteger();
+ }
break;
case RC_WHEEL_JUMP:
- if (lexrc.next())
+ if (lexrc.next()) {
wheel_jump = lexrc.getInteger();
+ }
break;
case RC_SCREEN_FONT_SIZES:
- if (lexrc.next())
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_TINY] =
lexrc.getFloat();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_SCRIPT] =
lexrc.getFloat();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_FOOTNOTE] =
lexrc.getFloat();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_SMALL] =
lexrc.getFloat();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_NORMAL] =
lexrc.getFloat();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_LARGE] =
lexrc.getFloat();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_LARGER] =
lexrc.getFloat();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_LARGEST] =
lexrc.getFloat();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_HUGE] =
lexrc.getFloat();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
font_sizes[LyXFont::SIZE_HUGER] =
lexrc.getFloat();
+ }
break;
case RC_SCREEN_FONT_SCALABLE:
- if (lexrc.next())
+ if (lexrc.next()) {
use_scalable_fonts = lexrc.getBool();
+ }
break;
case RC_AUTOSAVE:
- if (lexrc.next())
+ if (lexrc.next()) {
autosave = lexrc.getInteger();
+ }
break;
case RC_DOCUMENTPATH:
break;
case RC_TEMPLATEPATH:
- if (lexrc.next())
+ if (lexrc.next()) {
template_path = ExpandPath(lexrc.getString());
+ }
break;
case RC_TEMPDIRPATH:
- if (lexrc.next())
+ if (lexrc.next()) {
tempdir_path = ExpandPath(lexrc.getString());
+ }
break;
case RC_USETEMPDIR:
- if (lexrc.next())
+ if (lexrc.next()) {
use_tempdir = lexrc.getBool();
+ }
break;
case RC_LASTFILES:
- if (lexrc.next())
+ if (lexrc.next()) {
lastfiles = ExpandPath(lexrc.getString());
+ }
break;
case RC_NUMLASTFILES:
- if (lexrc.next())
+ if (lexrc.next()) {
num_lastfiles = lexrc.getInteger();
+ }
break;
case RC_CHECKLASTFILES:
- if (lexrc.next())
+ if (lexrc.next()) {
check_lastfiles = lexrc.getBool();
+ }
break;
case RC_SCREEN_FONT_ROMAN:
- if (lexrc.next())
+ if (lexrc.next()) {
roman_font_name = lexrc.getString();
+ oldFontFormat(roman_font_name,
+ roman_font_foundry);
+ }
break;
case RC_SCREEN_FONT_SANS:
- if (lexrc.next())
+ if (lexrc.next()) {
sans_font_name = lexrc.getString();
+ oldFontFormat(sans_font_name, sans_font_foundry);
+ }
break;
case RC_SCREEN_FONT_TYPEWRITER:
- if (lexrc.next())
+ 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;
case RC_SCREEN_FONT_ENCODING:
break;
case RC_POPUP_BOLD_FONT:
- if (lexrc.next())
+ if (lexrc.next()) {
popup_bold_font = lexrc.getString();
+ }
break;
case RC_POPUP_NORMAL_FONT:
- if (lexrc.next())
+ if (lexrc.next()) {
popup_normal_font = lexrc.getString();
+ }
break;
case RC_POPUP_FONT_ENCODING:
- if (lexrc.next())
+ if (lexrc.next()) {
popup_font_encoding = lexrc.getString();
+ }
break;
case RC_SET_COLOR:
{
string lyx_name, x11_name;
- if (lexrc.next()) {
+ if (lexrc.next()) {
lyx_name = lexrc.getString();
} else {
lexrc.printError("Missing color tag.");
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;
}
- if (!lcolor.setColor(lyx_name, x11_name))
+ if (!lcolor.setColor(lyx_name, x11_name)) {
lyxerr << "Bad lyxrc set_color for "
<< lyx_name << endl;
+ }
break;
}
case RC_AUTOREGIONDELETE:
// Auto region delete defaults to true
- if (lexrc.next())
- auto_region_delete = lexrc.getBool();
- break;
-
- case RC_BIND:
- {
- // we should not do an explicit binding before
- // loading a bind file. So, in this case, load
- // the default bind file.
- readBindFileIfNeeded();
-
- // !!!chb, dynamic key binding...
- int action = 0;
- string::size_type res = 0;
- string seq, cmd;
-
if (lexrc.next()) {
- seq = lexrc.getString();
- } else {
- lexrc.printError("RC_BIND: Missing key sequence");
- break;
- }
-
- if (lexrc.next(true)) {
- cmd = lexrc.getString();
- } else {
- lexrc.printError("RC_BIND: missing command");
- break;
- }
-
- if ((action = lyxaction.LookupFunc(cmd))>= 0) {
- if (lyxerr.debugging(Debug::LYXRC)) {
- lyxerr << "RC_BIND: Sequence `"
- << seq << "' Command `"
- << cmd << "' Action `"
- << action << '\'' << endl;
- }
- res = toplevel_keymap->bind(seq, kb_action(action));
- if (res != string::npos
- && lyxerr.debugging(Debug::LYXRC)) {
- lexrc.printError(
- "RC_BIND: "
- "Invalid key sequence `"
- + seq + '\'');
- }
- } else {// cmd is the last token read.
- lexrc.printError(
- "Unknown LyX function `$$Token'");
+ auto_region_delete = lexrc.getBool();
}
break;
- }
- case RC_OVERRIDE_X_DEADKEYS:
- if (lexrc.next())
- override_x_deadkeys = lexrc.getBool();
- break;
case RC_SERVERPIPE:
- if (lexrc.next())
+ if (lexrc.next()) {
lyxpipes = ExpandPath(lexrc.getString());
+ }
break;
case RC_CURSOR_FOLLOWS_SCROLLBAR:
- if (lexrc.next())
+ if (lexrc.next()) {
cursor_follows_scrollbar = lexrc.getBool();
+ }
break;
case RC_DIALOGS_ICONIFY_WITH_MAIN:
- if (lexrc.next())
+ if (lexrc.next()) {
dialogs_iconify_with_main = lexrc.getBool();
+ }
break;
case RC_ASCIIROFF_COMMAND:
- if (lexrc.next())
+ if (lexrc.next()) {
ascii_roff_command = lexrc.getString();
+ }
break;
case RC_ASCII_LINELEN:
- if (lexrc.next())
+ if (lexrc.next()) {
ascii_linelen = lexrc.getInteger();
+ }
break;
// Spellchecker settings:
-#ifdef USE_PSPELL
- case RC_USE_PSPELL:
- if (lexrc.next())
- use_pspell = lexrc.getBool();
+ case RC_USE_SPELL_LIB:
+ if (lexrc.next()) {
+ use_spell_lib = lexrc.getBool();
+ }
break;
-#endif
case RC_SPELL_COMMAND:
- if (lexrc.next())
+ if (lexrc.next()) {
isp_command = lexrc.getString();
+ }
break;
case RC_ACCEPT_COMPOUND:
- if (lexrc.next())
+ if (lexrc.next()) {
isp_accept_compound = lexrc.getBool();
+ }
break;
case RC_USE_INP_ENC:
- if (lexrc.next())
+ if (lexrc.next()) {
isp_use_input_encoding = lexrc.getBool();
+ }
break;
case RC_USE_ALT_LANG:
- if (lexrc.next())
+ if (lexrc.next()) {
isp_use_alt_lang = lexrc.getBool();
+ }
break;
case RC_USE_PERS_DICT:
- if (lexrc.next())
+ if (lexrc.next()) {
isp_use_pers_dict = lexrc.getBool();
+ }
break;
case RC_USE_ESC_CHARS:
- if (lexrc.next())
+ if (lexrc.next()) {
isp_use_esc_chars = lexrc.getBool();
+ }
break;
case RC_ALT_LANG:
- if (lexrc.next())
+ if (lexrc.next()) {
isp_alt_lang = lexrc.getString();
+ }
break;
case RC_PERS_DICT:
- if (lexrc.next())
+ if (lexrc.next()) {
isp_pers_dict = lexrc.getString();
+ }
break;
case RC_ESC_CHARS:
- if (lexrc.next())
+ if (lexrc.next()) {
isp_esc_chars = lexrc.getString();
+ }
break;
case RC_MAKE_BACKUP:
- if (lexrc.next())
+ if (lexrc.next()) {
make_backup = lexrc.getBool();
+ }
break;
case RC_BACKUPDIR_PATH:
- if (lexrc.next())
+ if (lexrc.next()) {
backupdir_path = ExpandPath(lexrc.getString());
+ }
break;
case RC_DATE_INSERT_FORMAT:
- if (lexrc.next())
+ if (lexrc.next()) {
date_insert_format = lexrc.getString();
+ }
break;
case RC_LANGUAGE_PACKAGE:
- if (lexrc.next())
+ if (lexrc.next()) {
language_package = lexrc.getString();
+ }
break;
case RC_LANGUAGE_AUTO_BEGIN:
- if (lexrc.next())
+ if (lexrc.next()) {
language_auto_begin = lexrc.getBool();
+ }
break;
case RC_LANGUAGE_AUTO_END:
- if (lexrc.next())
+ if (lexrc.next()) {
language_auto_end = lexrc.getBool();
+ }
break;
case RC_LANGUAGE_GLOBAL_OPTIONS:
- if (lexrc.next())
+ if (lexrc.next()) {
language_global_options = lexrc.getBool();
+ }
break;
case RC_LANGUAGE_USE_BABEL:
- if (lexrc.next())
+ if (lexrc.next()) {
language_use_babel = lexrc.getBool();
+ }
break;
case RC_LANGUAGE_COMMAND_BEGIN:
- if (lexrc.next())
+ if (lexrc.next()) {
language_command_begin = lexrc.getString();
+ }
break;
case RC_LANGUAGE_COMMAND_END:
- if (lexrc.next())
+ if (lexrc.next()) {
language_command_end = lexrc.getString();
+ }
break;
case RC_LANGUAGE_COMMAND_LOCAL:
- if (lexrc.next())
+ if (lexrc.next()) {
language_command_local = lexrc.getString();
+ }
break;
case RC_RTL_SUPPORT:
- if (lexrc.next())
+ if (lexrc.next()) {
rtl_support = lexrc.getBool();
+ }
break;
case RC_AUTO_NUMBER:
- if (lexrc.next())
+ if (lexrc.next()) {
auto_number = lexrc.getBool();
+ }
break;
case RC_MARK_FOREIGN_LANGUAGE:
- if (lexrc.next())
+ if (lexrc.next()) {
mark_foreign_language = lexrc.getBool();
+ }
break;
case RC_CONVERTER: {
string from, to, command, flags;
- if (lexrc.next())
+ if (lexrc.next()) {
from = lexrc.getString();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
to = lexrc.getString();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
command = lexrc.getString();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
flags = lexrc.getString();
- if (command.empty() || command == "none")
+ }
+ if (command.empty()
+ || token(command, ' ', 0) == "none") {
converters.erase(from, to);
- else
+ } else {
converters.add(from, to, command, flags);
+ }
break;
}
case RC_VIEWER: {
string format, command;
- if (lexrc.next())
+ if (lexrc.next()) {
format = lexrc.getString();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
command = lexrc.getString();
+ if (token(command, ' ', 0) == "none")
+ command.erase();
+ }
formats.setViewer(format, command);
break;
}
case RC_FORMAT: {
string format, extension, prettyname, shortcut;
- if (lexrc.next())
+ if (lexrc.next()) {
format = lexrc.getString();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
extension = lexrc.getString();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
prettyname = lexrc.getString();
- if (lexrc.next())
+ }
+ if (lexrc.next()) {
shortcut = lexrc.getString();
+ }
if (prettyname.empty()) {
- if (converters.formatIsUsed(format))
+ if (converters.formatIsUsed(format)) {
lyxerr << "Can't delete format "
<< format << endl;
- else
+ } else {
formats.erase(format);
-
- } else
+ }
+ } else {
formats.add(format, extension, prettyname,
shortcut);
+ }
break;
}
case RC_DEFAULT_LANGUAGE:
- if (lexrc.next())
+ if (lexrc.next()) {
default_language = lexrc.getString();
+ }
break;
case RC_LABEL_INIT_LENGTH:
- if (lexrc.next())
+ if (lexrc.next()) {
label_init_length = lexrc.getInteger();
+ }
break;
case RC_SHOW_BANNER:
- if (lexrc.next())
+ if (lexrc.next()) {
show_banner = lexrc.getBool();
+ }
break;
case RC_PREVIEW:
- if (lexrc.next())
+ if (lexrc.next()) {
preview = lexrc.getBool();
+ }
break;
case RC_PREVIEW_HASHED_LABELS:
- if (lexrc.next())
+ if (lexrc.next()) {
preview_hashed_labels = lexrc.getBool();
+ }
break;
case RC_PREVIEW_SCALE_FACTOR:
- if (lexrc.next())
+ if (lexrc.next()) {
preview_scale_factor = lexrc.getFloat();
+ }
+ 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
case RC_LAST:
case RC_INPUT:
// input/include files are not done here
- case RC_BIND:
- // bindings is not written to the preferences file.
case RC_BINDFILE:
if (bind_file != system_lyxrc.bind_file) {
os << "\\bind_file " << bind_file << "\n";
os << "# Set to false to inhibit automatic replacement of\n"
<< "# the current selection.\n"
<< "\\auto_region_delete " << tostr(auto_region_delete)
- << "\n";
+ << '\n';
}
case RC_AUTORESET_OPTIONS:
if (auto_reset_options != system_lyxrc.auto_reset_options) {
os << "# Set to false to inhibit automatic reset of\n"
<< "# the class options to defaults on class change.\n"
<< "\\auto_reset_options " << tostr(auto_reset_options)
- << "\n";
+ << '\n';
}
case RC_AUTOSAVE:
if (autosave != system_lyxrc.autosave) {
os << "# The time interval between auto-saves in seconds.\n"
- << "\\autosave " << autosave << "\n";
+ << "\\autosave " << autosave << '\n';
}
case RC_DISPLAY_GRAPHICS:
if (display_graphics != system_lyxrc.display_graphics) {
os << "# Display graphics within LyX\n"
- << "# no|mono|gray|color\n"
- << "\\display_graphics " << display_graphics
- << "\n";
+ << "# monochrome|grayscale|color|none\n"
+ << "\\display_graphics "
+ << lyx::graphics::displayTranslator().find(display_graphics)
+ << '\n';
}
case RC_VIEWDVI_PAPEROPTION:
os << "# The default papersize to use.\n"
<< "\\default_papersize \"";
switch (default_papersize) {
- case BufferParams::PAPER_USLETTER:
+ case PAPER_USLETTER:
os << "usletter"; break;
- case BufferParams::PAPER_LEGALPAPER:
+ case PAPER_LEGALPAPER:
os << "legal"; break;
- case BufferParams::PAPER_EXECUTIVEPAPER:
+ case PAPER_EXECUTIVEPAPER:
os << "executive"; break;
- case BufferParams::PAPER_A3PAPER:
+ case PAPER_A3PAPER:
os << "a3"; break;
- case BufferParams::PAPER_A4PAPER:
+ case PAPER_A4PAPER:
os << "a4"; break;
- case BufferParams::PAPER_A5PAPER:
+ case PAPER_A5PAPER:
os << "a5"; break;
- case BufferParams::PAPER_B5PAPER:
+ case PAPER_B5PAPER:
os << "b5"; break;
- case BufferParams::PAPER_DEFAULT: break;
+ case PAPER_DEFAULT: break;
}
os << "\"\n";
}
}
case RC_KBMAP:
if (use_kbmap != system_lyxrc.use_kbmap) {
- os << "\\kbmap " << tostr(use_kbmap) << "\n";
+ os << "\\kbmap " << tostr(use_kbmap) << '\n';
}
case RC_KBMAP_PRIMARY:
if (primary_kbmap != system_lyxrc.primary_kbmap) {
case RC_LABEL_INIT_LENGTH:
if (label_init_length != system_lyxrc.label_init_length) {
os << "\\label_init_length " << label_init_length
- << "\n";
+ << '\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 << "\\show_banner " << tostr(show_banner) << '\n';
}
case RC_PREVIEW:
if (preview != system_lyxrc.preview) {
- os << "\\preview " << tostr(preview) << "\n";
+ os << "\\preview " << tostr(preview) << '\n';
}
case RC_PREVIEW_HASHED_LABELS:
if (preview_hashed_labels !=
system_lyxrc.preview_hashed_labels) {
os << "\\preview_hashed_labels "
- << tostr(preview_hashed_labels) << "\n";
+ << tostr(preview_hashed_labels) << '\n';
}
case RC_PREVIEW_SCALE_FACTOR:
if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
os << "\\preview_scale_factor "
- << preview_scale_factor << "\n";
+ << preview_scale_factor << '\n';
}
os << "\n#\n"
}
case RC_SCREEN_DPI:
if (dpi != system_lyxrc.dpi) {
- os << "\\screen_dpi " << dpi << "\n";
+ os << "\\screen_dpi " << dpi << '\n';
}
case RC_SCREEN_ZOOM:
if (zoom != system_lyxrc.zoom) {
- os << "\\screen_zoom " << zoom << "\n";
+ os << "\\screen_zoom " << zoom << '\n';
}
case RC_WHEEL_JUMP:
if (wheel_jump != system_lyxrc.wheel_jump) {
- os << "\\wheel_jump " << wheel_jump << "\n";
+ os << "\\wheel_jump " << wheel_jump << '\n';
}
case RC_CURSOR_FOLLOWS_SCROLLBAR:
if (cursor_follows_scrollbar
!= system_lyxrc.cursor_follows_scrollbar) {
os << "\\cursor_follows_scrollbar "
- << tostr(cursor_follows_scrollbar) << "\n";
+ << tostr(cursor_follows_scrollbar) << '\n';
}
case RC_DIALOGS_ICONIFY_WITH_MAIN:
if (dialogs_iconify_with_main
!= system_lyxrc.dialogs_iconify_with_main) {
os << "\\dialogs_iconify_with_main "
- << tostr(dialogs_iconify_with_main) << "\n";
+ << tostr(dialogs_iconify_with_main) << '\n';
}
case RC_SCREEN_FONT_ROMAN:
if (roman_font_name != system_lyxrc.roman_font_name) {
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 "
<< tostr(use_scalable_fonts)
- << "\n";
+ << '\n';
}
case RC_SCREEN_FONT_ENCODING:
if (font_norm != system_lyxrc.font_norm) {
os.setf(ios::fixed);
os.precision(2);
os << "\\screen_font_sizes"
- << " " << font_sizes[LyXFont::SIZE_TINY]
- << " " << font_sizes[LyXFont::SIZE_SCRIPT]
- << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
- << " " << font_sizes[LyXFont::SIZE_SMALL]
- << " " << font_sizes[LyXFont::SIZE_NORMAL]
- << " " << font_sizes[LyXFont::SIZE_LARGE]
- << " " << font_sizes[LyXFont::SIZE_LARGER]
- << " " << font_sizes[LyXFont::SIZE_LARGEST]
- << " " << font_sizes[LyXFont::SIZE_HUGE]
- << " " << font_sizes[LyXFont::SIZE_HUGER]
- << "\n";
+ << ' ' << font_sizes[LyXFont::SIZE_TINY]
+ << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
+ << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
+ << ' ' << font_sizes[LyXFont::SIZE_SMALL]
+ << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
+ << ' ' << font_sizes[LyXFont::SIZE_LARGE]
+ << ' ' << font_sizes[LyXFont::SIZE_LARGER]
+ << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
+ << ' ' << font_sizes[LyXFont::SIZE_HUGE]
+ << ' ' << font_sizes[LyXFont::SIZE_HUGER]
+ << '\n';
}
os << "\n#\n"
if (print_adapt_output != system_lyxrc.print_adapt_output) {
os << "\\print_adapt_output "
<< tostr(print_adapt_output)
- << "\n";
+ << '\n';
}
case RC_PRINT_COMMAND:
if (print_command != system_lyxrc.print_command) {
}
case RC_NUMLASTFILES:
if (num_lastfiles != system_lyxrc.num_lastfiles) {
- os << "\\num_lastfiles " << num_lastfiles << "\n";
+ os << "\\num_lastfiles " << num_lastfiles << '\n';
}
case RC_CHECKLASTFILES:
if (check_lastfiles != system_lyxrc.check_lastfiles) {
os << "\\check_lastfiles " << tostr(check_lastfiles)
- << "\n";
+ << '\n';
}
case RC_TEMPLATEPATH:
if (template_path != system_lyxrc.template_path) {
}
case RC_USETEMPDIR:
if (use_tempdir != system_lyxrc.use_tempdir) {
- os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
+ os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
}
case RC_ASCII_LINELEN:
if (ascii_linelen != system_lyxrc.ascii_linelen) {
- os << "\\ascii_linelen " << ascii_linelen << "\n";
+ os << "\\ascii_linelen " << ascii_linelen << '\n';
}
case RC_MAKE_BACKUP:
if (make_backup != system_lyxrc.make_backup) {
- os << "\\make_backup " << tostr(make_backup) << "\n";
+ os << "\\make_backup " << tostr(make_backup) << '\n';
}
case RC_BACKUPDIR_PATH:
if (backupdir_path != system_lyxrc.backupdir_path) {
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";
case RC_ACCEPT_COMPOUND:
if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
os << "\\accept_compound " << tostr(isp_accept_compound)
- << "\n";
+ << '\n';
}
case RC_USE_ALT_LANG:
if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
os << "\\use_alt_language " << tostr(isp_use_alt_lang)
- << "\n";
+ << '\n';
}
case RC_ALT_LANG:
if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
case RC_USE_ESC_CHARS:
if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
- << "\n";
+ << '\n';
}
case RC_ESC_CHARS:
if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
os << "\\use_personal_dictionary "
<< tostr(isp_use_pers_dict)
- << "\n";
+ << '\n';
}
case RC_PERS_DICT:
if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
!= system_lyxrc.isp_use_input_encoding) {
os << "\\use_input_encoding "
<< tostr(isp_use_input_encoding)
- << "\n";
+ << '\n';
}
os << "\n#\n"
case RC_RTL_SUPPORT:
if (rtl_support != system_lyxrc.rtl_support) {
- os << "\\rtl " << tostr(rtl_support) << "\n";
+ os << "\\rtl " << tostr(rtl_support) << '\n';
}
case RC_LANGUAGE_PACKAGE:
if (language_package != system_lyxrc.language_package) {
case RC_LANGUAGE_AUTO_BEGIN:
if (language_auto_begin != system_lyxrc.language_auto_begin) {
os << "\\language_auto_begin "
- << tostr(language_auto_begin) << "\n";
+ << tostr(language_auto_begin) << '\n';
}
case RC_LANGUAGE_AUTO_END:
if (language_auto_end != system_lyxrc.language_auto_end) {
os << "\\language_auto_end "
- << tostr(language_auto_end) << "\n";
+ << tostr(language_auto_end) << '\n';
}
case RC_MARK_FOREIGN_LANGUAGE:
if (mark_foreign_language
!= system_lyxrc.mark_foreign_language) {
os << "\\mark_foreign_language " <<
- tostr(mark_foreign_language) << "\n";
+ tostr(mark_foreign_language) << '\n';
}
os << "\n#\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";
+ os << "\\auto_number " << tostr(auto_number) << '\n';
}
case RC_DEFAULT_LANGUAGE:
if (default_language != system_lyxrc.default_language) {
- os << "\\default_language " << default_language << "\n";
+ os << "\\default_language " << default_language << '\n';
}
os << "\n#\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: