* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
- * Copyright 1995-2000 The LyX Team.
+ * Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
#include "support/filetools.h"
#include "lyxtext.h"
#include "converter.h"
+#include "gettext.h"
using std::ostream;
using std::ofstream;
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 },
{ "\\document_path", LyXRC::RC_DOCUMENTPATH },
{ "\\escape_chars", LyXRC::RC_ESC_CHARS },
{ "\\exit_confirmation", LyXRC::RC_EXIT_CONFIRMATION },
-#if 0
- { "\\fax_command", LyXRC::RC_FAX_COMMAND },
- { "\\fax_program", LyXRC::RC_FAXPROGRAM },
-#endif
{ "\\font_encoding", LyXRC::RC_FONT_ENCODING },
{ "\\format", LyXRC::RC_FORMAT },
{ "\\input", LyXRC::RC_INPUT },
{ "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
{ "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
{ "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
+ { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
+ { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
{ "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
+ { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
{ "\\lastfiles", LyXRC::RC_LASTFILES },
{ "\\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 },
-#if 0
- { "\\phone_book", LyXRC::RC_PHONEBOOK },
-#endif
{ "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
{ "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
{ "\\print_command", LyXRC::RC_PRINT_COMMAND },
{ "\\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},
};
/* 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()
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.
menu_font_name = "-*-helvetica-bold-r";
popup_font_name = "-*-helvetica-medium-r";
font_norm = "iso8859-1";
- font_norm_type = OTHER_ENCODING;
+ font_norm_type = ISO_8859_1;
font_norm_menu = "";
override_x_deadkeys = true;
autosave = 300;
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;
isp_use_pers_dict = false;
isp_use_esc_chars = false;
use_kbmap = false;
- hasBindFile = false;
rtl_support = false;
auto_number = true;
mark_foreign_language = true;
- language_package = "\\usepackage{babel}";
language_auto_begin = true;
language_auto_end = true;
+ language_global_options = true;
+ language_use_babel = true;
+ language_package = "\\usepackage{babel}";
language_command_begin = "\\selectlanguage{$$lang}";
language_command_end = "\\selectlanguage{$$lang}";
+ language_command_local = "\\foreignlanguage{$$lang}{";
default_language = "english";
//
new_ask_filename = false;
return result;
}
+void LyXRC::readBindFileIfNeeded()
+{
+ if (!hasBindFile)
+ ReadBindFile(bind_file);
+}
int LyXRC::read(string const & filename)
-{
- // Default bindfile.
- static string const bindFile("cua");
-
+{
LyXLex lexrc(lyxrcTags, lyxrcCount);
if (lyxerr.debugging(Debug::PARSER))
lexrc.printTable(lyxerr);
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
case RC_BINDFILE: // RVDK_PATCH_5
if (lexrc.next()) {
string tmp(lexrc.GetString());
- if (bind_file.empty()) {
- // we only need the name of the first
- // bind file since that (usually)
- // includes several others.
+ 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;
- }
- ReadBindFile(tmp);
}
break;
// we should not do an explicit binding before
// loading a bind file. So, in this case, load
// the default bind file.
- if (!hasBindFile) {
- bind_file = bindFile;
- ReadBindFile();
- }
+ readBindFileIfNeeded();
+
// !!!chb, dynamic key binding...
int action, res = 0;
string seq, cmd;
}
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 + '\'');
}
cursor_follows_scrollbar = lexrc.GetBool();
break;
-#if 0
- case RC_FAX_COMMAND:
- if (lexrc.next())
- fax_command = lexrc.GetString();
- break;
- case RC_FAXPROGRAM:
- if (lexrc.next())
- fax_program = lexrc.GetString();
- break;
- case RC_PHONEBOOK:
- if (lexrc.next()) {
- string s = lexrc.GetString();
- if (AbsolutePath(s))
- phone_book = s;
- else
- phone_book = user_lyxdir + s;
- }
- break;
-#endif
case RC_ASCIIROFF_COMMAND:
if (lexrc.next())
ascii_roff_command = lexrc.GetString();
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();
if (lexrc.next())
language_auto_end = lexrc.GetBool();
break;
+ case RC_LANGUAGE_GLOBAL_OPTIONS:
+ if (lexrc.next())
+ language_global_options = lexrc.GetBool();
+ break;
+ case RC_LANGUAGE_USE_BABEL:
+ if (lexrc.next())
+ language_use_babel = lexrc.GetBool();
+ break;
case RC_LANGUAGE_COMMAND_BEGIN:
if (lexrc.next())
language_command_begin = lexrc.GetString();
if (lexrc.next())
language_command_end = lexrc.GetString();
break;
+ case RC_LANGUAGE_COMMAND_LOCAL:
+ if (lexrc.next())
+ language_command_local = lexrc.GetString();
+ break;
case RC_RTL_SUPPORT:
if (lexrc.next())
rtl_support = lexrc.GetBool();
}
}
+ /// Update converters data-structures
+ converters.Update(formats);
+ converters.BuildGraph();
+
return 0;
}
<< "### 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"
os << "\\backupdir_path \"" << backupdir_path << "\"\n";
}
-#if 0
- os << "\n#\n"
- << "# FAX SECTION #######################################\n"
- << "#\n\n";
-
- case RC_FAX_COMMAND:
- if (fax_command != system_lyxrc.fax_command) {
- os << "\\fax_command \"" << fax_command << "\"\n";
- }
- case RC_PHONEBOOK:
- if (phone_book != system_lyxrc.phone_book) {
- os << "\\phone_book \"" << phone_book << "\"\n";
- }
- case RC_FAXPROGRAM:
- if (fax_program != system_lyxrc.fax_program) {
- os << "\\fax_program \"" << fax_program << "\"\n";
- }
-#endif
os << "\n#\n"
<< "# ASCII EXPORT SECTION ##############################\n"
<< "#\n\n";
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";
os << "\\language_package \"" << language_package
<< "\"\n";
}
+ case RC_LANGUAGE_GLOBAL_OPTIONS:
+ if (language_global_options
+ != system_lyxrc.language_global_options) {
+ os << "\\language_global_options \""
+ << tostr(language_global_options)
+ << "\"\n";
+ }
+ case RC_LANGUAGE_USE_BABEL:
+ if (language_use_babel != system_lyxrc.language_use_babel) {
+ os << "\\language_use_babel \""
+ << tostr(language_use_babel)
+ << "\"\n";
+ }
case RC_LANGUAGE_COMMAND_BEGIN:
if (language_command_begin
!= system_lyxrc.language_command_begin) {
os << "\\language_command_end \"" << language_command_end
<< "\"\n";
}
+ case RC_LANGUAGE_COMMAND_LOCAL:
+ if (language_command_local
+ != system_lyxrc.language_command_local) {
+ os << "\\language_command_local \""
+ << language_command_local
+ << "\"\n";
+ }
case RC_LANGUAGE_AUTO_BEGIN:
if (language_auto_begin != system_lyxrc.language_auto_begin) {
os << "\\language_auto_begin "
str = N_("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard.");
break;
-#if 0
- case RC_FAX_COMMAND:
- break;
-
- case RC_PHONEBOOK:
- break;
-
- case RC_FAXPROGRAM:
- break;
-#endif
case RC_ASCIIROFF_COMMAND:
str = N_("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_LANGUAGE_PACKAGE:
str = N_("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
break;
+
+ case RC_LANGUAGE_GLOBAL_OPTIONS:
+ str = N_("De-select if you don't want the language(s) used as an argument to \\documentclass.");
+ break;
+
+ case RC_LANGUAGE_USE_BABEL:
+ str = N_("De-select if you don't want babel to be used when the language of the document is the default language.");
+ break;
case RC_LANGUAGE_AUTO_BEGIN:
str = N_("Select if a language switching command is needed at the beginning of the document.");
case RC_LANGUAGE_COMMAND_END:
str = N_("The latex command for changing back to the language of the document.");
break;
-
+
+ case RC_LANGUAGE_COMMAND_LOCAL:
+ str = N_("The latex command for local changing of the language.");
+ break;
+
case RC_DATE_INSERT_FORMAT:
//xgettext:no-c-format
str = N_("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");