Dekel literate patch + my final word on naming new files.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1071 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-10-02 16:44:47 +00:00
parent 2b300d130c
commit 41d36cfe2b
16 changed files with 134 additions and 652 deletions

View File

@ -123,6 +123,10 @@ public:
/// use this for running LaTeX once
int operator() ();
///
int scanLogFile(TeXErrors &);
protected:
/// The dependency file.
string depfile;
@ -130,9 +134,6 @@ protected:
///
void deplog(DepTable & head);
///
int scanLogFile(TeXErrors &);
///
bool runMakeIndex(string const &);

View File

@ -1,107 +0,0 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team.
*
* ======================================================
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include <fstream>
#include "support/filetools.h"
#include "LaTeX.h"
#include "Literate.h"
#include "support/FileInfo.h"
#include "debug.h"
#include "support/lyxlib.h"
#include "support/syscall.h"
#include "support/syscontr.h"
#include "support/path.h"
#include "bufferlist.h"
#include "minibuffer.h"
#include "gettext.h"
using std::ifstream;
using std::getline;
using std::endl;
extern BufferList bufferlist;
Literate::Literate(string const & latex, string const & f, string const & p,
string const & l,
string const & literate, string const & literate_f,
string const & build, string const & build_f)
: LaTeX(latex, f, p),
litfile(l),
literate_cmd(literate), literate_filter(literate_f),
build_cmd(build), build_filter(build_f)
{}
int Literate::weave(TeXErrors & terr, MiniBuffer * minib)
{
int scanres = Literate::NO_ERRORS;
string tmp1, tmp2;
int ret1, ret2;
Systemcalls one, two;
string logfile = OnlyFilename(ChangeExtension(file, ".log"));
// The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(GetCWD());
lyxerr[Debug::LATEX] << "Weaving document" << endl;
minib->Set(string(_("Weaving document")));
minib->Store();
// Run the literate program to convert \literate_extension file to .tex file
//
tmp1 = literate_cmd + " < " + litfile + " > " + file + " 2> " + litfile + ".out";
tmp2 = literate_filter + " < " + litfile + ".out" + " > " + logfile;
ret1 = one.startscript(Systemcalls::System, tmp1);
ret2 = two.startscript(Systemcalls::System, tmp2);
lyxerr.debug() << "LITERATE {" << tmp1 << "} {" << tmp2 << "}" << endl;
scanres = scanLogFile(terr);
if (scanres & Literate::ERRORS) return scanres; // return on literate error
return run(terr, minib);
}
int Literate::build(TeXErrors & terr, MiniBuffer * minib)
// We know that this function will only be run if the lyx buffer
// has been changed.
{
int scanres = Literate::NO_ERRORS;
num_errors = 0; // just to make sure.
string tmp1, tmp2;
int ret1, ret2;
Systemcalls one, two;
string logfile = OnlyFilename(ChangeExtension(file, ".log"));
// The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(GetCWD());
lyxerr[Debug::LATEX] << "Building program" << endl;
minib->Set(string(_("Building program")));
minib->Store();
// Run the build program
//
tmp1 = build_cmd + ' ' + litfile + " > " + litfile + ".out 2>&1";
tmp2 = build_filter + " < " + litfile + ".out" + " > " + logfile;
ret1 = one.startscript(Systemcalls::System, tmp1);
ret2 = two.startscript(Systemcalls::System, tmp2);
scanres = scanLogFile(terr);
lyxerr[Debug::LATEX] << "Done." << endl;
return scanres;
}

View File

@ -1,55 +0,0 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team.
*
* ======================================================
*/
#ifndef LITERATE_H
#define LITERATE_H
#ifdef __GNUG__
#pragma interface
#endif
class MiniBuffer;
///
class Literate : public LaTeX {
public:
///
Literate(string const & cmd, string const & file, string const & path,
string const & litfile,
string const & literate_cmd, string const & literate_filter,
string const & build_cmd, string const & build_filter);
/// runs literate and latex
int weave(TeXErrors &, MiniBuffer *);
/// runs literate and build
int build(TeXErrors &, MiniBuffer *);
private:
///
string litfile;
///
string literate_cmd;
///
string literate_filter;
///
string build_cmd;
///
string build_filter;
};
#endif

View File

@ -55,8 +55,6 @@ lyx_SOURCES = \
LaTeXFeatures.C \
LaTeXFeatures.h \
LaTeXLog.C \
Literate.C \
Literate.h \
Lsstream.h \
LyXAction.C \
LyXAction.h \

View File

@ -77,7 +77,6 @@
#include "support/filetools.h"
#include "support/path.h"
#include "LaTeX.h"
#include "Literate.h"
#include "Chktex.h"
#include "LyXView.h"
#include "debug.h"
@ -3325,144 +3324,6 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
}
int Buffer::runLiterate()
{
if (!users->text) return 0;
ProhibitInput(users);
// get LaTeX-Filename
string name = getLatexName();
// get Literate-Filename
string lit_name = OnlyFilename(ChangeExtension (getLatexName(),
lyxrc.literate_extension));
string path = OnlyPath(filename);
string org_path = path;
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
path = tmppath;
}
Path p(path); // path to Literate file
users->owner()->getMiniBuffer()->Set(_("Running Literate..."));
// Remove all error insets
bool removedErrorInsets = users->removeAutoInsets();
// generate the Literate file if necessary
makeLaTeXFile(lit_name, org_path, false);
string latex_command = lyxrc.pdf_mode ?
lyxrc.pdflatex_command : lyxrc.latex_command;
Literate literate(latex_command, name, filepath,
lit_name,
lyxrc.literate_command, lyxrc.literate_error_filter,
lyxrc.build_command, lyxrc.build_error_filter);
TeXErrors terr;
int res = literate.weave(terr, users->owner()->getMiniBuffer());
// check return value from literate.weave().
if ((res & Literate::NO_LOGFILE)) {
WriteAlert(_("Literate command did not work!"),
_("Missing log file:"), name);
} else if ((res & Literate::ERRORS)) {
users->owner()->getMiniBuffer()->Set(_("Done"));
// Insert all errors as errors boxes
users->insertErrors(terr);
// Dvi should also be kept dirty if the latex run
// ends up with errors. However it should be possible
// to view a dirty dvi too.
} else {
//no errors or any other things to think about so:
users->owner()->getMiniBuffer()->Set(_("Done"));
}
// if we removed error insets before we ran LaTeX or if we inserted
// error insets after we ran LaTeX this must be run:
if (removedErrorInsets || (res & Literate::ERRORS)){
users->redraw();
users->fitCursor(users->text);
//users->updateScrollbar();
}
AllowInput(users);
return literate.getNumErrors();
}
int Buffer::buildProgram()
{
if (!users->text) return 0;
ProhibitInput(users);
// get LaTeX-Filename
string name = getLatexName();
// get Literate-Filename
string lit_name = OnlyFilename(ChangeExtension(getLatexName(),
lyxrc.literate_extension));
string path = OnlyPath(filename);
string org_path = path;
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
path = tmppath;
}
Path p(path); // path to Literate file
users->owner()->getMiniBuffer()->Set(_("Building Program..."));
// Remove all error insets
bool removedErrorInsets = users->removeAutoInsets();
// generate the LaTeX file if necessary
if (!isNwClean() || removedErrorInsets) {
makeLaTeXFile(lit_name, org_path, false);
markNwDirty();
}
string latex_command = lyxrc.pdf_mode ?
lyxrc.pdflatex_command : lyxrc.latex_command;
Literate literate(latex_command, name, filepath,
lit_name,
lyxrc.literate_command, lyxrc.literate_error_filter,
lyxrc.build_command, lyxrc.build_error_filter);
TeXErrors terr;
int const res = literate.build(terr, users->owner()->getMiniBuffer());
// check return value from literate.build().
if ((res & Literate::NO_LOGFILE)) {
WriteAlert(_("Build did not work!"),
_("Missing log file:"), name);
} else if ((res & Literate::ERRORS)) {
users->owner()->getMiniBuffer()->Set(_("Done"));
// Insert all errors as errors boxes
users->insertErrors(terr);
// Literate files should also be kept dirty if the literate
// command run ends up with errors.
} else {
//no errors or any other things to think about so:
users->owner()->getMiniBuffer()->Set(_("Done"));
markNwClean();
}
// if we removed error insets before we ran Literate/Build or
// if we inserted error insets after we ran Literate/Build this
// must be run:
if (removedErrorInsets || (res & Literate::ERRORS)){
users->redraw();
users->fitCursor(users->text);
//users->updateScrollbar();
}
AllowInput(users);
return literate.getNumErrors();
}
// This should be enabled when the Chktex class is implemented. (Asger)
// chktex should be run with these flags disabled: 3, 22, 25, 30, 38(?)
// Other flags: -wall -v0 -x

View File

@ -165,12 +165,6 @@ public:
void latexParagraphs(std::ostream & os, LyXParagraph * par,
LyXParagraph * endpar, TexRow & texrow) const;
///
int runLiterate();
///
int buildProgram();
///
int runChktex();
@ -189,9 +183,6 @@ public:
///
bool isLyxClean() const { return lyx_clean; }
///
bool isNwClean() const { return nw_clean; }
///
bool isBakClean() const { return bak_clean; }
@ -209,18 +200,12 @@ public:
bak_clean = true;
}
///
void markNwClean() { nw_clean = true; }
///
void markBakClean() { bak_clean = true; }
///
void markDepClean(string const & name);
///
void markNwDirty() { nw_clean = false; }
///
void setUnnamed(bool flag=true) { unnamed = flag; }
@ -233,7 +218,6 @@ public:
lyx_clean = false;
updateTitles();
}
nw_clean = false;
bak_clean = false;
DEPCLEAN * tmp = dep_clean;
while (tmp) {
@ -400,9 +384,6 @@ private:
/// is autosave needed
mutable bool bak_clean;
/// do we need to run weave/tangle
bool nw_clean;
/// is this a unnamed file (New...)
bool unnamed;

View File

@ -66,6 +66,7 @@ Format::Format(string const & n)
{ "txt", "Ascii" },
{ "html", "HTML" },
{ "pdf", "PDF" },
{ "nw", "NoWeb/LaTeX"},
{ 0, 0}
};
@ -88,9 +89,9 @@ void Formats::Add(string const & name)
void Formats::SetViewer(string const & name, string const & command)
{
string command2 = subst(command, "$$FName", "'$$FName'");
if (!contains(command,"$$FName"))
command2 += " '$$FName'";
string command2 = command;
if (!contains(command2,"$$FName"))
command2 += " $$FName";
Add(name);
GetFormat(name)->viewer = command2;
@ -127,7 +128,7 @@ bool Formats::View(Buffer * buffer, string const & filename)
lyxerr << "Executing command: " << command2 << endl;
ShowMessage(buffer, _("Executing command:"), command2);
command = subst(command, "$$FName", filename);
command = subst(command, "$$FName", QuoteName(filename));
Systemcalls one;
int res = one.startscript(Systemcalls::SystemDontWait, command);
@ -171,16 +172,12 @@ void Converter::Add(string const & from, string const & to,
if (command == "none")
return;
string command2 =
subst(command, "$$FName", "'$$FName'");
command2 = subst(command2, "$$BaseName", "'$$BaseName'");
command2 = subst(command2, "$$OutName", "'$$OutName'");
Command Com(from, to, command2);
Command Com(from, to, command);
if (from == "tex" &&
(to == "dvi" ||
(to == "pdf" && latex_command.empty())))
latex_command = command2;
latex_command = command;
// Read the flags
string flag_name,flag_value;
@ -197,6 +194,8 @@ void Converter::Add(string const & from, string const & to,
? "$$BaseName" : flag_value;
else if (flag_name == "resultfile")
Com.result_file = flag_value;
else if (flag_name == "parselog")
Com.parselog = flag_value;
}
if (!Com.result_dir.empty() && Com.result_file.empty())
Com.result_file = "index." + to;
@ -370,9 +369,12 @@ bool Converter::Convert(Buffer * buffer, string const & from_file,
? outfile : MakeRelPath(outfile, path);
string command = (*it).command;
command = subst(command, "$$FName", infile2);
command = subst(command, "$$BaseName", from_base);
command = subst(command, "$$OutName", outfile2);
command = subst(command, "$$FName", QuoteName(infile2));
command = subst(command, "$$BaseName", QuoteName(from_base));
command = subst(command, "$$OutName", QuoteName(outfile2));
if (!(*it).parselog.empty())
command += " 2> " + QuoteName(infile2 + ".out");
if ((*it).from == "dvi" && (*it).to == "ps")
command = add_options(command,
@ -388,10 +390,25 @@ bool Converter::Convert(Buffer * buffer, string const & from_file,
res = one.startscript(Systemcalls::System, command);
} else
res = one.startscript(Systemcalls::System, command);
if (!(*it).parselog.empty()) {
string const logfile = infile2 + ".log";
string const command2 = (*it).parselog +
" < " + QuoteName(infile2 + ".out") +
" > " + QuoteName(logfile);
one.startscript(Systemcalls::System, command2);
if (!scanLog(buffer, command, logfile))
return false;
}
if (res) {
WriteAlert(_("Can not convert file"),
"Error while executing",
command.substr(0, 50));
if ((*it).to == "Program")
WriteAlert(_("There were errors during the Build process."),
_("You should try to fix them."));
else
WriteAlert(_("Can not convert file"),
"Error while executing",
command.substr(0, 50));
return false;
}
}
@ -430,6 +447,52 @@ string const Converter::SplitFormat(string const & str, string & format)
return using_format;
}
bool Converter::scanLog(Buffer * buffer, string const & command,
string const & filename)
{
BufferView * bv = buffer->getUser();
bool need_redraw = false;
if (bv) {
ProhibitInput(bv);
// Remove all error insets
need_redraw = bv->removeAutoInsets();
}
LaTeX latex("", filename, "");
TeXErrors terr;
int result = latex.scanLogFile(terr);
if (bv) {
if ((result & LaTeX::ERRORS)) {
// Insert all errors as errors boxes
bv->insertErrors(terr);
need_redraw = true;
}
if (need_redraw) {
bv->redraw();
bv->fitCursor(bv->text);
}
AllowInput(bv);
}
if ((result & LaTeX::ERRORS)) {
int num_errors = latex.getNumErrors();
string s;
string t;
if (num_errors == 1) {
s = _("One error detected");
t = _("You should try to fix it.");
} else {
s = tostr(num_errors);
s += _(" errors detected.");
t = _("You should try to fix them.");
}
string head;
split(command, head, ' ');
WriteAlert(_("There were errors during running of ") + head,
s, t);
return false;
}
return true;
}
bool Converter::runLaTeX(Buffer * buffer, string const & command)
{

View File

@ -44,9 +44,12 @@ struct Command {
/// If the converter put the result in a directory, then result_file
/// is the name of the main file in that directory
string result_file;
///
/// Command to convert the program output to a LaTeX log file format
string parselog;
/// Used by the BFS algorithm
bool visited;
///
/// Used by the BFS algorithm
std::vector<Command>::iterator previous;
};
@ -120,6 +123,10 @@ public:
private:
///
static
bool scanLog(Buffer * buffer, string const & command,
string const & filename);
///
static
bool runLaTeX(Buffer * buffer, string const & command);
///
static

View File

@ -82,6 +82,17 @@ bool Exporter::Preview(Buffer * buffer, string const & format0)
}
bool Exporter::IsExportable(Buffer const * buffer, string const & format)
{
// This is not efficient
vector<pair<string, string> > const v = GetExportableFormats(buffer);
for (vector<pair<string, string> >::const_iterator it = v.begin();
it != v.end(); ++it)
if ((*it).first == format)
return true;
return false;
}
vector<pair<string, string> > const
Exporter::GetExportableFormats(Buffer const * buffer)
{
@ -96,7 +107,7 @@ vector<pair<string, string> > const
Exporter::GetViewableFormats(Buffer const * buffer)
{
vector<pair<string, string> > result =
Converter::GetReachable(BufferExtension(buffer), false);
Converter::GetReachable(BufferExtension(buffer), true);
Format * format = Formats::GetFormat("txt");
if (format && !format->viewer.empty())
result.push_back(pair<string,string>("txt", "Ascii"));
@ -110,6 +121,8 @@ string const Exporter::BufferExtension(Buffer const * buffer)
return "sgml";
else if (buffer->isDocBook())
return "docbook";
else if (buffer->isLiterate())
return lyxrc.literate_extension;
else
return "tex";
}

View File

@ -33,6 +33,9 @@ public:
bool Preview(Buffer * buffer, string const & format);
///
static
bool IsExportable(Buffer const * buffer, string const & format);
///
static
std::vector<std::pair<string, string> > const
GetExportableFormats(Buffer const * buffer);
///

View File

@ -61,6 +61,7 @@
#include "font.h"
#include "bufferview_funcs.h"
#include "ColorHandler.h"
#include "converter.h"
using std::ostream;
using std::istream;
@ -1904,32 +1905,15 @@ void InsetFig::RestoreForm()
void InsetFig::Preview(string const & p)
{
int pid = fork();
if (pid == -1) {
lyxerr << "Cannot fork process!" << endl;
return; // error
}
if (pid > 0) {
addpidwait(pid);
return; // parent process
}
string tfname = p;
if (GetExtension(tfname).empty())
tfname += ".eps";
string buf1 = OnlyPath(owner->fileName());
string buf2 = MakeAbsPath(tfname, buf1);
lyxerr << "Error during rendering "
<< execlp(lyxrc.view_pspic_command.c_str(),
lyxrc.view_pspic_command.c_str(),
buf2.c_str(), 0)
<< endl;
_exit(0);
if (!Formats::View(owner, buf2))
lyxerr << "Can't view " << buf2 << endl;
}
void InsetFig::BrowseFile()
{
static string current_figure_path;

View File

@ -124,6 +124,9 @@ void LangInit::initL()
items[i].encoding, items[i].code);
++i;
}
#if 0
// This code does not make sense as it is run even before
// main() is invoked. (JMarc)
if (languages.find(lyxrc.default_language) == languages.end()) {
string l1 = _("Default language \"") + lyxrc.default_language +
_("\" not found!");
@ -131,6 +134,9 @@ void LangInit::initL()
default_language = &languages["english"];
} else
default_language = &languages[lyxrc.default_language];
#else
default_language = &languages["english"];
#endif
}

View File

@ -292,36 +292,6 @@ bool MenuWriteAs(Buffer * buffer)
}
int MenuBuildProg(Buffer * buffer)
{
int ret = 0;
if (buffer->isLiterate())
ret = buffer->buildProgram();
else {
string s = _("Wrong type of document");
string t = _("The Build operation is not allowed in this document");
WriteAlert(_("There were errors during the Build process."), s, t);
return 1;
}
if (ret > 0) {
string s;
string t;
if (ret == 1) {
s = _("One error detected");
t = _("You should try to fix it.");
} else {
s += tostr(ret);
s += _(" errors detected.");
t = _("You should try to fix them.");
}
WriteAlert(_("There were errors during the Build process."), s, t);
}
return ret;
}
int MenuRunChktex(Buffer * buffer)
{
int ret;

View File

@ -466,14 +466,15 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
// I would really like to avoid having this switch and rather try to
// encode this in the function itself.
static bool noLaTeX = lyxrc.latex_command == "none";
bool disable = false;
switch (action) {
case LFUN_MENUPRINT:
disable = noLaTeX || lyxrc.print_command == "none";
disable = !Exporter::IsExportable(buf, "dvi")
|| lyxrc.print_command == "none";
break;
case LFUN_FAX:
disable = noLaTeX || lyxrc.fax_command == "none";
disable = !Exporter::IsExportable(buf, "ps")
|| lyxrc.fax_command == "none";
break;
case LFUN_IMPORT:
if (argument == "latex" || argument == "noweb")
@ -494,8 +495,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
disable = lyxrc.chktex_command == "none";
break;
case LFUN_BUILDPROG:
disable = (lyxrc.literate_command == "none"
|| ! buf->isLiterate());
disable = !Exporter::IsExportable(buf, "Program");
break;
case LFUN_LAYOUT_TABULAR:
@ -610,6 +610,7 @@ string const LyXFunc::Dispatch(int ac,
{
string argument;
kb_action action;
LyXText * text = 0;
// we have not done anything wrong yet.
errorstat = false;
@ -685,7 +686,6 @@ string const LyXFunc::Dispatch(int ac,
}
}
LyXText * text = 0;
if (owner->view()->available() && owner->view()->the_locking_inset) {
text = owner->view()->the_locking_inset->getLyXText(owner->view());
UpdatableInset::RESULT result;
@ -929,7 +929,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_BUILDPROG:
MenuBuildProg(owner->buffer());
Exporter::Export(owner->buffer(), "Program", true);
break;
case LFUN_RUNCHKTEX:
@ -3130,14 +3130,14 @@ void LyXFunc::MenuNew(bool fromTemplate)
}
}
} else {
s = lyxrc.document_path +
"newfile" + tostr(++newfile_number) + ".lyx";
s = AddName(lyxrc.document_path,
"newfile" + tostr(++newfile_number) + ".lyx");
FileInfo fi(s);
while (bufferlist.exists(s) || fi.readable()) {
++newfile_number;
s = lyxrc.document_path +
"newfile" + tostr(newfile_number) +
".lyx";
s = AddName(lyxrc.document_path,
"newfile" + tostr(newfile_number) +
".lyx");
fi.newFile(s);
}
}

View File

@ -69,12 +69,7 @@ enum LyXRCTags {
RC_PRINTPAPERDIMENSIONFLAG,
RC_CUSTOM_EXPORT_COMMAND,
RC_CUSTOM_EXPORT_FORMAT,
RC_LATEX_COMMAND,
RC_LITERATE_COMMAND,
RC_LITERATE_EXTENSION,
RC_LITERATE_ERROR_FILTER,
RC_BUILD_COMMAND,
RC_BUILD_ERROR_FILTER,
RC_SCREEN_DPI,
RC_SCREEN_ZOOM,
RC_SCREEN_FONT_SIZES,
@ -109,12 +104,9 @@ enum LyXRCTags {
RC_ASCII_LINELEN,
RC_NUMLASTFILES,
RC_CHECKLASTFILES,
RC_VIEWDVI_COMMAND,
RC_VIEWDVI_PAPEROPTION,
RC_DEFAULT_PAPERSIZE,
RC_PS_COMMAND,
RC_VIEWPS_COMMAND,
RC_VIEWPSPIC_COMMAND,
RC_ACCEPT_COMPOUND,
RC_SPELL_COMMAND,
RC_USE_INP_ENC,
@ -130,7 +122,6 @@ enum LyXRCTags {
RC_EXIT_CONFIRMATION,
RC_DISPLAY_SHORTCUTS,
RC_RELYX_COMMAND,
RC_HTML_COMMAND,
RC_MAKE_BACKUP,
RC_BACKUPDIR_PATH,
RC_RTL_SUPPORT,
@ -141,20 +132,9 @@ enum LyXRCTags {
RC_LANGUAGE_AUTO_END,
RC_LANGUAGE_COMMAND_BEGIN,
RC_LANGUAGE_COMMAND_END,
RC_PDFLATEX_COMMAND,
RC_PDF_MODE,
RC_VIEWPDF_COMMAND,
RC_PDF_TO_PS_COMMAND,
RC_DVI_TO_PS_COMMAND,
RC_DATE_INSERT_FORMAT,
RC_SHOW_BANNER,
RC_USE_GUI,
RC_LINUXDOC_TO_LYX_COMMAND,
RC_LINUXDOC_TO_HTML_COMMAND,
RC_LINUXDOC_TO_LATEX_COMMAND,
RC_DOCBOOK_TO_DVI_COMMAND,
RC_DOCBOOK_TO_HTML_COMMAND,
RC_DOCBOOK_TO_PDF_COMMAND,
RC_WHEEL_JUMP,
RC_CONVERTER,
RC_VIEWER,
@ -176,8 +156,6 @@ keyword_item lyxrcTags[] = {
{ "\\backupdir_path", RC_BACKUPDIR_PATH },
{ "\\bind", RC_BIND },
{ "\\bind_file", RC_BINDFILE },
{ "\\build_command", RC_BUILD_COMMAND },
{ "\\build_error_filter", RC_BUILD_ERROR_FILTER },
{ "\\check_lastfiles", RC_CHECKLASTFILES },
{ "\\chktex_command", RC_CHKTEX_COMMAND },
{ "\\converter", RC_CONVERTER },
@ -188,17 +166,12 @@ keyword_item lyxrcTags[] = {
{ "\\default_language", RC_DEFAULT_LANGUAGE },
{ "\\default_papersize", RC_DEFAULT_PAPERSIZE },
{ "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
{ "\\docbook_to_dvi_command", RC_DOCBOOK_TO_DVI_COMMAND },
{ "\\docbook_to_html_command", RC_DOCBOOK_TO_HTML_COMMAND },
{ "\\docbook_to_pdf_command", RC_DOCBOOK_TO_PDF_COMMAND },
{ "\\document_path", RC_DOCUMENTPATH },
{ "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
{ "\\escape_chars", RC_ESC_CHARS },
{ "\\exit_confirmation", RC_EXIT_CONFIRMATION },
{ "\\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 },
@ -209,21 +182,13 @@ keyword_item lyxrcTags[] = {
{ "\\language_command_end", RC_LANGUAGE_COMMAND_END },
{ "\\language_package", RC_LANGUAGE_PACKAGE },
{ "\\lastfiles", RC_LASTFILES },
{ "\\latex_command", RC_LATEX_COMMAND },
{ "\\linuxdoc_to_html_command", RC_LINUXDOC_TO_HTML_COMMAND },
{ "\\linuxdoc_to_latex_command", RC_LINUXDOC_TO_LATEX_COMMAND },
{ "\\linuxdoc_to_lyx_command", RC_LINUXDOC_TO_LYX_COMMAND },
{ "\\literate_command", RC_LITERATE_COMMAND },
{ "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
{ "\\literate_extension", RC_LITERATE_EXTENSION },
{ "\\make_backup", RC_MAKE_BACKUP },
{ "\\mark_foreign_language", RC_MARK_FOREIGN_LANGUAGE },
{ "\\new_ask_filename", RC_NEW_ASK_FILENAME },
{ "\\num_lastfiles", RC_NUMLASTFILES },
{ "\\override_x_deadkeys", RC_OVERRIDE_X_DEADKEYS },
{ "\\pdf_mode", RC_PDF_MODE },
{ "\\pdf_to_ps_command", RC_PDF_TO_PS_COMMAND },
{ "\\pdflatex_command", RC_PDFLATEX_COMMAND },
{ "\\personal_dictionary", RC_PERS_DICT },
{ "\\phone_book", RC_PHONEBOOK },
{ "\\print_adapt_output", RC_PRINT_ADAPTOUTPUT },
@ -267,15 +232,10 @@ keyword_item lyxrcTags[] = {
{ "\\ui_file", RC_UIFILE },
{ "\\use_alt_language", RC_USE_ALT_LANG },
{ "\\use_escape_chars", RC_USE_ESC_CHARS },
{ "\\use_gui", RC_USE_GUI },
{ "\\use_input_encoding", RC_USE_INP_ENC },
{ "\\use_personal_dictionary", RC_USE_PERS_DICT },
{ "\\use_tempdir", RC_USETEMPDIR },
{ "\\view_dvi_command", RC_VIEWDVI_COMMAND },
{ "\\view_dvi_paper_option", RC_VIEWDVI_PAPEROPTION },
{ "\\view_pdf_command", RC_VIEWPDF_COMMAND },
{ "\\view_ps_command", RC_VIEWPS_COMMAND },
{ "\\view_pspic_command", RC_VIEWPSPIC_COMMAND },
{ "\\viewer" ,RC_VIEWER},
{ "\\wheel_jump", RC_WHEEL_JUMP }
};
@ -312,27 +272,13 @@ void LyXRC::setDefaults() {
document_path = GetEnvPath("HOME");
tempdir_path = "/tmp";
use_tempdir = true;
pdf_mode = false;
latex_command = "latex";
pdflatex_command = "pdflatex";
pdf_to_ps_command = "pdf2ps";
dvi_to_ps_command = "dvips";
literate_command = "none";
literate_extension = "none";
literate_error_filter = "cat";
build_command = "make";
build_error_filter = "cat";
relyx_command = "reLyX";
ps_command = "gs";
view_ps_command = "ghostview -swap";
view_pspic_command = "ghostview";
view_dvi_command = "xdvi";
view_dvi_paper_option = "-paper";
view_pdf_command = "xpdf";
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:
@ -392,16 +338,14 @@ void LyXRC::setDefaults() {
///
date_insert_format = "%A, %e %B %Y";
show_banner = true;
use_gui = true;
///
linuxdoc_to_latex_command="none";
linuxdoc_to_lyx_command="none";
linuxdoc_to_html_command="none";
docbook_to_dvi_command="none";
docbook_to_html_command="none";
docbook_to_pdf_command="none";
/// These variables are not stored on disk (perhaps they
// should be moved from the LyXRC class).
use_gui = true;
pdf_mode = false;
}
@ -625,56 +569,11 @@ int LyXRC::read(string const & filename)
custom_export_format = lexrc.GetString();
break;
case RC_PDF_MODE:
if (lexrc.next())
pdf_mode = lexrc.GetBool();
break;
case RC_LATEX_COMMAND:
if (lexrc.next())
latex_command = lexrc.GetString();
break;
case RC_PDFLATEX_COMMAND:
if (lexrc.next())
pdflatex_command = lexrc.GetString();
break;
case RC_PDF_TO_PS_COMMAND:
if (lexrc.next())
pdf_to_ps_command = lexrc.GetString();
break;
case RC_DVI_TO_PS_COMMAND:
if (lexrc.next())
dvi_to_ps_command = lexrc.GetString();
break;
case RC_LITERATE_COMMAND:
if (lexrc.next())
literate_command = lexrc.GetString();
break;
case RC_LITERATE_EXTENSION:
if (lexrc.next())
literate_extension = lexrc.GetString();
break;
case RC_LITERATE_ERROR_FILTER:
if (lexrc.next())
literate_error_filter = lexrc.GetString();
break;
case RC_BUILD_COMMAND:
if (lexrc.next())
build_command = lexrc.GetString();
break;
case RC_BUILD_ERROR_FILTER:
if (lexrc.next())
build_error_filter = lexrc.GetString();
break;
case RC_RELYX_COMMAND:
if (lexrc.next())
relyx_command = lexrc.GetString();
@ -706,10 +605,6 @@ int LyXRC::read(string const & filename)
BufferParams::PAPER_B5PAPER;
}
break;
case RC_VIEWDVI_COMMAND:
if (lexrc.next())
view_dvi_command = lexrc.GetString();
break;
case RC_VIEWDVI_PAPEROPTION:
if (lexrc.next())
@ -718,36 +613,16 @@ int LyXRC::read(string const & filename)
view_dvi_paper_option = "";
break;
case RC_VIEWPDF_COMMAND:
if (lexrc.next())
view_pdf_command = lexrc.GetString();
break;
case RC_PS_COMMAND:
if (lexrc.next())
ps_command = lexrc.GetString();
break;
case RC_VIEWPS_COMMAND:
if (lexrc.next())
view_ps_command = lexrc.GetString();
break;
case RC_VIEWPSPIC_COMMAND:
if (lexrc.next())
view_pspic_command = lexrc.GetString();
break;
case RC_CHKTEX_COMMAND:
if (lexrc.next())
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();
@ -1080,34 +955,10 @@ int LyXRC::read(string const & filename)
if (lexrc.next())
show_banner = lexrc.GetBool();
break;
case RC_USE_GUI:
if (lexrc.next())
use_gui = lexrc.GetBool();
break;
case RC_LINUXDOC_TO_LYX_COMMAND:
if ( lexrc.next())
linuxdoc_to_lyx_command = lexrc.GetString();
break;
case RC_LINUXDOC_TO_HTML_COMMAND:
if ( lexrc.next())
linuxdoc_to_html_command = lexrc.GetString();
break;
case RC_LINUXDOC_TO_LATEX_COMMAND:
if ( lexrc.next())
linuxdoc_to_latex_command = lexrc.GetString();
break;
case RC_DOCBOOK_TO_DVI_COMMAND:
if ( lexrc.next())
docbook_to_dvi_command = lexrc.GetString();
break;
case RC_DOCBOOK_TO_HTML_COMMAND:
if ( lexrc.next())
docbook_to_html_command = lexrc.GetString();
break;
case RC_DOCBOOK_TO_PDF_COMMAND:
if ( lexrc.next())
docbook_to_pdf_command = lexrc.GetString();
break;
case RC_NEW_ASK_FILENAME:
if ( lexrc.next())
@ -1229,9 +1080,6 @@ void LyXRC::output(ostream & os) const
<< "# list of short-cuts in the minibuffer.\n"
<< "\\display_shortcuts " << tostr(display_shortcuts)
<< "\n";
case RC_VIEWDVI_COMMAND:
os << "# Program used to view dvi files.\n"
<< "\\view_dvi_command \"" << view_dvi_command << "\"\n";
case RC_VIEWDVI_PAPEROPTION:
os << "# Options used to specify paper size to the\n"
<< "# view_dvi_command\n"
@ -1258,24 +1106,11 @@ void LyXRC::output(ostream & os) const
case BufferParams::PAPER_DEFAULT: break;
}
os << "\"\n";
case RC_VIEWPDF_COMMAND:
os << "# Command used to view PDF files.\n"
<< "\\view_pdf_command \"" << view_pdf_command << "\"\n";
case RC_VIEWPS_COMMAND:
os << "# Command used to view PostScript files.\n"
<< "\\view_ps_command \"" << view_ps_command << "\"\n";
case RC_VIEWPSPIC_COMMAND:
os << "# Command used to view full screen included PS\n"
<< "# pictures.\n"
<< "\\view_pspic_command \"" << view_pspic_command
<< "\"\n";
case RC_PS_COMMAND:
os << "# Program used for interpreting postscript.\n"
<< "\\ps_command \"" << ps_command << "\"\n";
case RC_CHKTEX_COMMAND:
os << "\\chktex_command \"" << chktex_command << "\"\n";
case RC_HTML_COMMAND:
os << "\\html_command \"" << html_command << "\"\n";
case RC_KBMAP:
os << "\\kbmap " << tostr(use_kbmap) << "\n";
case RC_KBMAP_PRIMARY:
@ -1407,12 +1242,6 @@ void LyXRC::output(ostream & os) const
<< "# TEX SECTION #######################################\n"
<< "#\n\n";
case RC_LATEX_COMMAND:
os << "\\latex_command \"" << latex_command << "\"\n";
case RC_PDFLATEX_COMMAND:
os << "\\pdflatex_command \"" << pdflatex_command << "\"\n";
case RC_PDF_MODE:
os << "\\pdf_mode " << tostr(pdf_mode) << "\n";
case RC_FONT_ENCODING:
os << "\\font_encoding \"" << fontenc << "\"\n";
@ -1420,30 +1249,10 @@ void LyXRC::output(ostream & os) const
<< "# LINUXDOC SECTION ##################################\n"
<< "#\n\n";
case RC_LINUXDOC_TO_LATEX_COMMAND:
os << "\\linuxdoc_to_latex_command \"" << linuxdoc_to_latex_command
<< "\"\n";
case RC_LINUXDOC_TO_HTML_COMMAND:
os << "\\linuxdoc_to_html_command \"" << linuxdoc_to_html_command
<< "\"\n";
case RC_LINUXDOC_TO_LYX_COMMAND:
os << "\\linuxdoc_to_lyx_command \"" << linuxdoc_to_lyx_command
<< "\"\n";
os << "\n#\n"
<< "# DOCBOOK SECTION ###################################\n"
<< "#\n\n";
case RC_DOCBOOK_TO_DVI_COMMAND:
os << "\\docbook_to_dvi_command \"" << docbook_to_dvi_command
<< "\"\n";
case RC_DOCBOOK_TO_HTML_COMMAND:
os << "\\docbook_to_html_command \"" << docbook_to_html_command
<< "\"\n";
case RC_DOCBOOK_TO_PDF_COMMAND:
os << "\\docbook_to_pdf_command \"" << docbook_to_pdf_command
<< "\"\n";
os << "\n#\n"
<< "# FILE SECTION ######################################\n"
<< "#\n\n";
@ -1543,23 +1352,9 @@ void LyXRC::output(ostream & os) const
<< "# 2nd MISC SUPPORT SECTION ##########################\n"
<< "#\n\n";
case RC_PDF_TO_PS_COMMAND:
os << "\\pdf_to_ps_command \"" << pdf_to_ps_command << "\"\n";
case RC_DVI_TO_PS_COMMAND:
os << "\\dvi_to_ps_command \"" << dvi_to_ps_command << "\"\n";
case RC_LITERATE_COMMAND:
os << "\\literate_command \"" << literate_command << "\"\n";
case RC_LITERATE_EXTENSION:
os << "\\literate_extension \"" << literate_extension
<< "\"\n";
case RC_LITERATE_ERROR_FILTER:
os << "\\literate_error_filter \"" << literate_error_filter
<< "\"\n";
case RC_BUILD_COMMAND:
os << "\\build_command \"" << build_command << "\"\n";
case RC_BUILD_ERROR_FILTER:
os << "\\build_error_filter \"" << build_error_filter
<< "\"\n";
case RC_OVERRIDE_X_DEADKEYS:
os << "\\override_x_deadkeys "
<< tostr(override_x_deadkeys) << "\n";
@ -1568,8 +1363,6 @@ void LyXRC::output(ostream & os) const
<< "\"\n";
case RC_AUTO_NUMBER:
os << "\\auto_number " << tostr(auto_number) << "\n";
case RC_USE_GUI:
os << "\\use_gui " << tostr(use_gui) << "\n";
case RC_NEW_ASK_FILENAME:
os << "\\new_ask_filename " << tostr(new_ask_filename) << "\n";
case RC_DEFAULT_LANGUAGE:

View File

@ -84,44 +84,18 @@ public:
string custom_export_format;
///
bool pdf_mode;
/// program for running latex
string latex_command;
///
string pdflatex_command;
///
string pdf_to_ps_command;
///
string dvi_to_ps_command;
/// program for performing literate programming
string literate_command;
///
string literate_extension;
///
string literate_error_filter;
/// program for compiling
string build_command;
///
string build_error_filter;
/// program for running relyx
string relyx_command;
/// postscript interpreter (in general "gs", if it is installed)
string ps_command;
/// program for viewing postscript output (default "ghostview -swap")
string view_ps_command;
/// program for viewing postscript pictures (default "ghostview")
string view_pspic_command;
/// program for viewing dvi output (default "xdvi")
string view_dvi_command;
/// option for telling the dvi viewer about the paper size
string view_dvi_paper_option;
/// program for viewing pdf output (default "xpdf")
string view_pdf_command;
/// default paper size for local xdvi/dvips/ghostview/whatever
BufferParams::PAPER_SIZE default_papersize;
/// command to run chktex incl. options
string chktex_command;
/// command to run an html converter incl. options
string html_command;
///
string document_path;
///
@ -250,16 +224,6 @@ public:
///
string linuxdoc_to_lyx_command;
///
string linuxdoc_to_html_command;
///
string linuxdoc_to_latex_command;
///
string docbook_to_dvi_command;
///
string docbook_to_html_command;
///
string docbook_to_pdf_command;
///
bool new_ask_filename;
///
string default_language;