*
* LyX, The Document Processor
*
- * Copyright (C) 1995 Matthias Ettrich
- * Copyright (C) 1995-1998 The LyX Team.
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-1999 The LyX Team.
*
* ====================================================== */
#pragma implementation "lyxrc.h"
#endif
-#include "error.h"
+#include "debug.h"
#include "lyxrc.h"
#include "LyXAction.h"
#include "lyx_main.h"
#include "intl.h"
#include "tex-strings.h"
-#include "pathstack.h"
-#include "filetools.h"
+#include "support/path.h"
+#include "support/filetools.h"
#include "lyxtext.h"
-// $Id: lyxrc.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $
-
-#if !defined(lint) && !defined(WITH_WARNINGS)
-static char vcid[] = "$Id: lyxrc.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $";
-#endif /* lint */
-
// this is crappy... why are those colors command line arguments and
// not in lyxrc?? (Matthias)
// Because nobody put them there. (Asger)
extern int fast_selection;
-extern LString background_color;
+extern string background_color;
extern char selection_color[];
extern bool cursor_follows_scrollbar;
extern kb_keymap *toplevel_keymap;
extern LyXAction lyxaction;
enum _LyXRCTags {
- RC_BEGINTOOLBAR=1,
+ RC_BEGINTOOLBAR = 1,
RC_FONT_ENCODING,
RC_PRINTER,
RC_PRINT_COMMAND,
RC_EXIT_CONFIRMATION,
RC_DISPLAY_SHORTCUTS,
RC_RELYX_COMMAND,
+ RC_HTML_COMMAND,
RC_LAST
};
{ "\\fax_command", RC_FAX_COMMAND },
{ "\\fax_program", RC_FAXPROGRAM },
{ "\\font_encoding", RC_FONT_ENCODING },
+ { "\\html_command", RC_HTML_COMMAND },
{ "\\input", RC_INPUT },
{ "\\kbmap", RC_KBMAP },
{ "\\kbmap_primary", RC_KBMAP_PRIMARY },
{
// Get printer from the environment. If fail, use default "",
// assuming that everything is set up correctly.
- printer = getenv("PRINTER");
+ printer = GetEnv("PRINTER");
print_command = "dvips";
print_evenpage_flag = "-B";
print_oddpage_flag = "-A";
print_file_extension = ".ps";
print_paper_flag = "-t";
print_paper_dimension_flag = "-T";
- document_path = getEnvPath("HOME");
+ document_path = GetEnvPath("HOME");
tempdir_path = "/tmp";
use_tempdir = true;
latex_command = "latex";
view_ps_command = "ghostview -swap";
view_pspic_command = "ghostview";
view_dvi_command = "xdvi";
- default_papersize = PAPER_USLETTER;
+ default_papersize = BufferParams::PAPER_USLETTER;
custom_export_format = "ps";
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
+ html_command = "tth -t";
fontenc = "default";
dpi = 75;
// Because a screen typically is wider than a piece of paper:
}
-LyXRC::~LyXRC()
-{
-}
-
-int LyXRC::ReadBindFile(LString name)
+int LyXRC::ReadBindFile(string const & name)
{
hasBindFile = true;
- LString tmp = i18nLibFileSearch("bind",name,"bind");
- lyxerr.debug("Reading bindfile:" + tmp, Error::LYXRC);
+ string tmp = i18nLibFileSearch("bind", name, "bind");
+ lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
int result = Read(tmp);
if (result) {
- lyxerr.print("Error reading bind file: " + tmp);
+ lyxerr << "Error reading bind file: " << tmp << endl;
}
return result;
}
-int LyXRC::Read(LString const &filename)
+int LyXRC::Read(string const &filename)
{
// Default bindfile.
- LString bindFile = "cua";
+ string bindFile = "cua";
LyXLex lexrc(lyxrcTags, lyxrcCount);
- if (lyxerr.debugging(Error::LEX_PARSER))
+ if (lyxerr.debugging(Debug::PARSER))
lexrc.printTable();
lexrc.setFile(filename);
if (!lexrc.IsOK()) return -2;
- lyxerr.debug("Reading '" + filename + "'...", Error::INIT);
+ lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
while (lexrc.IsOK()) {
break;
case RC_INPUT: // Include file
if (lexrc.next()) {
- LString tmp = LibFileSearch(LString(),
+ string tmp = LibFileSearch(string(),
lexrc.GetString());
if (Read(tmp)) {
lexrc.printError("Error reading "
break;
case RC_PRINTEXSTRAOPTIONS:
- if (lexrc.EatLine())
+ if (lexrc.next())
print_extra_options = lexrc.GetString();
break;
case RC_DEFAULT_PAPERSIZE:
if (lexrc.next()) {
- LString size = lexrc.GetString();
- size.lowercase();
+ string size = lowercase(lexrc.GetString());
if (size == "usletter")
- default_papersize = PAPER_USLETTER;
+ default_papersize = BufferParams::PAPER_USLETTER;
else if (size == "legal")
- default_papersize = PAPER_LEGALPAPER;
+ default_papersize = BufferParams::PAPER_LEGALPAPER;
else if (size == "executive")
- default_papersize = PAPER_EXECUTIVEPAPER;
+ default_papersize = BufferParams::PAPER_EXECUTIVEPAPER;
else if (size == "a3")
- default_papersize = PAPER_A3PAPER;
+ default_papersize = BufferParams::PAPER_A3PAPER;
else if (size == "a4")
- default_papersize = PAPER_A4PAPER;
+ default_papersize = BufferParams::PAPER_A4PAPER;
else if (size == "a5")
- default_papersize = PAPER_A5PAPER;
+ default_papersize = BufferParams::PAPER_A5PAPER;
else if (size == "b5")
- default_papersize = PAPER_B5PAPER;
+ default_papersize = BufferParams::PAPER_B5PAPER;
}
break;
case RC_VIEWDVI_COMMAND:
chktex_command = lexrc.GetString();
break;
+ case RC_HTML_COMMAND:
+ if (lexrc.next())
+ html_command = lexrc.GetString();
+ break;
+
case RC_SCREEN_DPI:
if (lexrc.next())
dpi = lexrc.GetInteger();
ReadBindFile();
// !!!chb, dynamic key binding...
- int action, res=0;
- LString seq, cmd;
+ int action, res = 0;
+ string seq, cmd;
- if (lexrc.lex()==LyXLex::LEX_DATA) {
+ if (lexrc.lex() == LyXLex::LEX_DATA) {
seq = lexrc.GetString();
} else {
lexrc.printError("Bad key sequence: `$$Token'");
break;
}
- if (lexrc.lex()==LyXLex::LEX_DATA) {
+ if (lexrc.lex() == LyXLex::LEX_DATA) {
cmd = lexrc.GetString();
} else {
lexrc.printError("Bad command: `$$Token'");
break;
}
- if ((action = lyxaction.LookupFunc(cmd.c_str()))>=0) {
- if (lyxerr.debugging(Error::KEY)) {
- lyxerr.print("RC_BIND: Sequence `"
- + seq + "' Command `"
- + cmd + "' Action `"
- + (int) action + '\'');
+ if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
+ if (lyxerr.debugging(Debug::KEY)) {
+ lyxerr << "RC_BIND: Sequence `"
+ << seq << "' Command `"
+ << cmd << "' Action `"
+ << action << '\'' << endl;
}
res = bindKey(seq.c_str(), action);
if (res != 0) {
case RC_SELECTION_COLOR:
if (lexrc.next())
strncpy(selection_color,
- lexrc.GetString().c_str(),31);
+ lexrc.GetString().c_str(), 31);
break;
case RC_FAX_COMMAND:
if (lexrc.next())
break;
case RC_PHONEBOOK:
if (lexrc.next()) {
- LString s = lexrc.GetString();
+ string s = lexrc.GetString();
if (AbsolutePath(s))
phone_book = s;
else
void LyXRC::Print()
{
- lyxerr.print("The current internal LyXRC:");
+ lyxerr << "The current internal LyXRC:" << endl;
}