diff --git a/ChangeLog b/ChangeLog index 60c8ade705..2c5b47c8db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2000-09-11 Jean-Marc Lasgouttes + + * src/frontends/xforms/GUIRunTime.C (initApplication): use lyxerr, + not cerr. + +2000-09-09 Dekel Tsur + + * src/converter.C (Add, Convert): Added support for converter flags: + needaux, resultdir, resultfile. + (Convert): Added new parameter view_file. + (dvips_options): Fixed letter paper option. + + * src/exporter.C (Export, BufferExtension): Added support for Docbook. + (Export, GetExportableFormats, GetViewableFormats): Added support + for Ascii. + + * src/lyx_main.C (LyX): Call to QuitLyX() to remove temporary + directory! + (easyParse): Fixed to work with new export code. + + * src/support/filetools.C (DeleteAllFilesInDir) Fixed to delete + directories. + + * lyx-devel-export/lib/configure.m4: Changed flags of tth. + + * lib/bind/*.bind: Replaced + buffer-view,buffer-view-ps,buffer-typeset,buffer-typeset-ps by + buffer-view dvi,buffer-view ps,buffer-update dvi,buffer-update ps + 2000-09-11 Juergen Vigna * src/lyx_gui.C (runTime): uses global guiruntime variable. diff --git a/lib/bind/cua.bind b/lib/bind/cua.bind index c691c7cd98..b7f493eaa3 100644 --- a/lib/bind/cua.bind +++ b/lib/bind/cua.bind @@ -44,10 +44,10 @@ \bind "C-s" "buffer-write" \bind "C-S-S" "buffer-write-as" \bind "C-p" "buffer-print" -\bind "C-d" "buffer-view" # 'd' for dvi -\bind "C-t" "buffer-view-ps" -\bind "C-S-D" "buffer-typeset" # 'd' for dvi -\bind "C-S-T" "buffer-typeset-ps" +\bind "C-d" "buffer-view dvi" # 'd' for dvi +\bind "C-t" "buffer-view ps" +\bind "C-S-D" "buffer-update dvi" # 'd' for dvi +\bind "C-S-T" "buffer-update ps" \bind "C-q" "lyx-quit" \bind "C-b" "font-bold" diff --git a/lib/bind/de_menus.bind b/lib/bind/de_menus.bind index 684b998951..bda956b99b 100644 --- a/lib/bind/de_menus.bind +++ b/lib/bind/de_menus.bind @@ -52,10 +52,10 @@ \bind "M-d s" "buffer-write" \bind "M-d u" "buffer-write-as" \bind "M-d w" "buffer-reload" -\bind "M-d a" "buffer-view" -\bind "M-d p" "buffer-view-ps" -\bind "M-d i" "buffer-typeset" -\bind "M-d k" "buffer-typeset-ps" +\bind "M-d a" "buffer-view dvi" +\bind "M-d p" "buffer-view ps" +\bind "M-d i" "buffer-update dvi" +\bind "M-d k" "buffer-update ps" \bind "M-d r" "build-program" \bind "M-d d" "buffer-print" \bind "M-d f" "buffer-fax" diff --git a/lib/bind/emacs.bind b/lib/bind/emacs.bind index 1cfc1808a6..4359b270c8 100644 --- a/lib/bind/emacs.bind +++ b/lib/bind/emacs.bind @@ -72,13 +72,13 @@ \bind "C-x a" "buffer-auto-save" #\bind "C-x b" "buffer-previous" \bind "C-x d" "buffer-new" -\bind "C-x g" "buffer-view-ps" +\bind "C-x g" "buffer-view ps" \bind "C-x k" "buffer-close" -\bind "C-x p" "buffer-view" -\bind "C-x r" "buffer-typeset" +\bind "C-x p" "buffer-view dvi" +\bind "C-x r" "buffer-update dvi" # Should have been "buffer-write-some" # \bind "C-x s" "buffer-write" -\bind "C-x t" "buffer-typeset" +\bind "C-x t" "buffer-update dvi" \bind "C-x u" "undo" \bind "C-x v h" "vc-history" \bind "C-x v v" "vc-check-in" @@ -92,12 +92,12 @@ \bind "C-x C-c" "lyx-quit" \bind "C-x C-d" "buffer-new" \bind "C-x C-f" "buffer-open" -\bind "C-x C-g" "buffer-view-ps" -\bind "C-x C-p" "buffer-view" +\bind "C-x C-g" "buffer-view ps" +\bind "C-x C-p" "buffer-view dvi" \bind "C-x C-q" "buffer-toggle-read-only" -#\bind "C-x C-r" "buffer-typeset" +#\bind "C-x C-r" "buffer-update dvi" \bind "C-x C-s" "buffer-write" -\bind "C-x C-t" "buffer-typeset" +\bind "C-x C-t" "buffer-update dvi" # this is "upcase-region" in emacs diff --git a/lib/bind/fi_menus.bind b/lib/bind/fi_menus.bind index 912e324f40..03c257047b 100644 --- a/lib/bind/fi_menus.bind +++ b/lib/bind/fi_menus.bind @@ -38,10 +38,10 @@ \bind "M-t t" "buffer-write" \bind "M-t n" "buffer-write-as" \bind "M-t h" "buffer-reload" -\bind "M-t d" "buffer-view" -\bind "M-t c" "buffer-view-ps" -\bind "M-t v" "buffer-typeset" -\bind "M-t i" "buffer-typeset-ps" +\bind "M-t d" "buffer-view dvi" +\bind "M-t c" "buffer-view ps" +\bind "M-t v" "buffer-update dvi" +\bind "M-t i" "buffer-update ps" \bind "M-t l" "buffer-print" \bind "M-t f" "buffer-fax" \bind "M-t o l" "buffer-import latex" diff --git a/lib/bind/fr_menus.bind b/lib/bind/fr_menus.bind index 352f04aeeb..dcd1a0f024 100644 --- a/lib/bind/fr_menus.bind +++ b/lib/bind/fr_menus.bind @@ -34,10 +34,10 @@ \bind "M-f e" "buffer-write" #Enregistrer \bind "M-f s" "buffer-write-as" #Enregistrer Sous \bind "M-f r" "buffer-reload" #Recharger -\bind "M-f S-D" "buffer-view" #Visualiser DVI -\bind "M-f S-P" "buffer-view-ps" #Visualiser Postscript -\bind "M-f d" "buffer-typeset" #Mise à jour dvi -\bind "M-f p" "buffer-typeset-ps" #Mise à jour Postscript +\bind "M-f S-D" "buffer-view dvi" #Visualiser DVI +\bind "M-f S-P" "buffer-view ps" #Visualiser Postscript +\bind "M-f d" "buffer-update dvi" #Mise à jour dvi +\bind "M-f p" "buffer-update ps" #Mise à jour Postscript \bind "M-f c" "build-program" #Compiler programme \bind "M-f i" "buffer-print" #Imprimer \bind "M-f v" "buffer-fax" #Fax diff --git a/lib/bind/hu_menus.bind b/lib/bind/hu_menus.bind index f7e63eb161..bdbbb7e1d8 100644 --- a/lib/bind/hu_menus.bind +++ b/lib/bind/hu_menus.bind @@ -35,10 +35,10 @@ \bind "M-f m" "buffer-write" \bind "M-f t" "buffer-write-as" \bind "M-f i" "buffer-reload" -\bind "M-f d" "buffer-view" -\bind "M-f p" "buffer-view-ps" -\bind "M-f v" "buffer-typeset" -\bind "M-f o" "buffer-typeset-ps" +\bind "M-f d" "buffer-view dvi" +\bind "M-f p" "buffer-view ps" +\bind "M-f v" "buffer-update dvi" +\bind "M-f o" "buffer-update ps" \bind "M-f y" "buffer-print" \bind "M-f f" "buffer-fax" \bind "M-f l" "buffer-export latex" diff --git a/lib/bind/menus.bind b/lib/bind/menus.bind index 69aa6e781f..07d7a1c390 100644 --- a/lib/bind/menus.bind +++ b/lib/bind/menus.bind @@ -34,10 +34,10 @@ \bind "M-f s" "buffer-write" \bind "M-f a" "buffer-write-as" \bind "M-f r" "buffer-reload" -\bind "M-f d" "buffer-view" -\bind "M-f w" "buffer-view-ps" -\bind "M-f v" "buffer-typeset" -\bind "M-f u" "buffer-typeset-ps" +\bind "M-f d" "buffer-view dvi" +\bind "M-f w" "buffer-view ps" +\bind "M-f v" "buffer-update dvi" +\bind "M-f u" "buffer-update ps" \bind "M-f p" "buffer-print" \bind "M-f f" "buffer-fax" \bind "M-f i l" "buffer-import latex" diff --git a/lib/bind/pt_menus.bind b/lib/bind/pt_menus.bind index 6b04f6b657..179091711c 100644 --- a/lib/bind/pt_menus.bind +++ b/lib/bind/pt_menus.bind @@ -38,10 +38,10 @@ \bind "M-a l" "buffer-write" \bind "M-a c" "buffer-write-as" \bind "M-a r" "buffer-reload" -\bind "M-a d" "buffer-view" -\bind "M-a o" "buffer-view-ps" -\bind "M-a v" "buffer-typeset" -\bind "M-a z" "buffer-typeset-ps" +\bind "M-a d" "buffer-view dvi" +\bind "M-a o" "buffer-view ps" +\bind "M-a v" "buffer-update dvi" +\bind "M-a z" "buffer-update ps" \bind "M-a p" "buffer-print" \bind "M-a x" "buffer-fax" \bind "M-a i l" "buffer-import latex" diff --git a/lib/bind/sciword.bind b/lib/bind/sciword.bind index ed1513631e..577d71d769 100644 --- a/lib/bind/sciword.bind +++ b/lib/bind/sciword.bind @@ -252,13 +252,13 @@ \bind "M-f o" "buffer-open" \bind "M-f p" "buffer-print" \bind "M-f q" "lyx-quit" -\bind "M-f r" "buffer-typeset" +\bind "M-f r" "buffer-update dvi" # Obsolete \bind "M-f s" "buffer-write" -\bind "M-f t" "buffer-typeset" +\bind "M-f t" "buffer-update dvi" -\bind "M-f x" "buffer-view" -\bind "M-f g" "buffer-view-ps" +\bind "M-f x" "buffer-view dvi" +\bind "M-f g" "buffer-view ps" \bind "M-f space" "menu-open File" diff --git a/lib/bind/sv_menus.bind b/lib/bind/sv_menus.bind index 91d97db497..165613617f 100644 --- a/lib/bind/sv_menus.bind +++ b/lib/bind/sv_menus.bind @@ -44,10 +44,10 @@ \bind "M-f s" "buffer-write" \bind "M-f o" "buffer-write-as" \bind "M-f t" "buffer-reload" -\bind "M-f v" "buffer-view" -\bind "M-f i" "buffer-view-ps" -\bind "M-f u" "buffer-typeset" -\bind "M-f d" "buffer-typeset-ps" +\bind "M-f v" "buffer-view dvi" +\bind "M-f i" "buffer-view ps" +\bind "M-f u" "buffer-update dvi" +\bind "M-f d" "buffer-update ps" \bind "M-f k" "buffer-print" \bind "M-f f" "buffer-fax" \bind "M-f l" "buffer-export latex" diff --git a/lib/bind/xemacs.bind b/lib/bind/xemacs.bind index a7f9bcc121..13acaf8816 100644 --- a/lib/bind/xemacs.bind +++ b/lib/bind/xemacs.bind @@ -75,13 +75,13 @@ # not currently supported #\bind "C-x b" "buffer-previous" \bind "C-x d" "buffer-new" -\bind "C-x g" "buffer-view-ps" +\bind "C-x g" "buffer-view ps" \bind "C-x k" "buffer-close" -\bind "C-x p" "buffer-view" -\bind "C-x r" "buffer-typeset" +\bind "C-x p" "buffer-view dvi" +\bind "C-x r" "buffer-update dvi" # Should have been "buffer-write-some" # \bind "C-x s" "buffer-write" -\bind "C-x t" "buffer-typeset" +\bind "C-x t" "buffer-update dvi" \bind "C-x u" "undo" \bind "C-x v h" "vc-history" \bind "C-x v v" "vc-check-in" @@ -97,13 +97,13 @@ \bind "C-x C-c" "lyx-quit" \bind "C-x C-d" "buffer-new" \bind "C-x C-f" "buffer-open" -\bind "C-x C-g" "buffer-view-ps" +\bind "C-x C-g" "buffer-view ps" \bind "C-x C-l" "word-lowcase" # downcase-region! -\bind "C-x C-p" "buffer-view" +\bind "C-x C-p" "buffer-view dvi" \bind "C-x C-q" "buffer-toggle-read-only" -#\bind "C-x C-r" "buffer-typeset" +#\bind "C-x C-r" "buffer-update dvi" \bind "C-x C-s" "buffer-write" -\bind "C-x C-t" "buffer-typeset" +\bind "C-x C-t" "buffer-update dvi" \bind "C-x C-u" "word-upcase" # upcase-region! \bind "C-x C-w" "buffer-write-as" @@ -285,9 +285,9 @@ # ## Start TeX mode, some overlap with AucTeX mode # -\bind "C-c C-b" "buffer-typeset" +\bind "C-c C-b" "buffer-update dvi" \bind "C-c C-p" "buffer-print" -\bind "C-c C-r" "buffer-typeset" # tex region +\bind "C-c C-r" "buffer-update dvi" # tex region # ## End TeX mode # diff --git a/lib/configure b/lib/configure index 8c8081660b..a0becb63fd 100755 --- a/lib/configure +++ b/lib/configure @@ -857,7 +857,7 @@ fi latex_to_html_command = $TOHTML case $TOHTML in - tth) latex_to_html_command="tth -t < \$\$FName > \$\$OutName";; + tth) latex_to_html_command="tth -t -e2 -L\$\$BaseName < \$\$FName > \$\$OutName";; latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$FName";; hevea) latex_to_html_command="hevea -s \$\$FName";; esac @@ -945,15 +945,16 @@ cat >lyxrc.defaults <lyxrc.defaults < Formats::formats; vector Converter::commands; +string Converter::latex_command; inline string add_options(string const & command, string const & options) @@ -98,6 +99,9 @@ void Formats::SetViewer(string const & name, string const & command) bool Formats::View(Buffer * buffer, string const & filename) { + if (filename.empty()) + return false; + string extension = GetExtension(filename); Format * format = GetFormat(extension); if (!format || format->viewer.empty()) { @@ -167,19 +171,43 @@ void Converter::Add(string const & from, string const & to, if (command == "none") return; - bool original_dir = flags == "origdir"; string command2 = subst(command, "$$FName", "'$$FName'"); command2 = subst(command2, "$$BaseName", "'$$BaseName'"); command2 = subst(command2, "$$OutName", "'$$OutName'"); + Command Com(from, to, command2); + + if (from == "tex" && + (to == "dvi" || + (to == "pdf" && latex_command.empty()))) + latex_command = command2; + + // Read the flags + string flag_name,flag_value; + string flag_list(flags); + while (!flag_list.empty()) { + flag_list = split(flag_list, flag_value,','); + flag_value = split(flag_value, flag_name, '='); + if (flag_name == "originaldir") + Com.original_dir = true; + else if (flag_name == "needaux") + Com.need_aux = true; + else if (flag_name == "resultdir") + Com.result_dir = (flag_value.empty()) + ? "$$BaseName" : flag_value; + else if (flag_name == "resultfile") + Com.result_file = flag_value; + } + if (!Com.result_dir.empty() && Com.result_file.empty()) + Com.result_file = "index." + to; for (vector::iterator it = commands.begin(); it != commands.end(); ++it) if ((*it).from == from && (*it).to == to) { - *it = Command(from, to, command2, original_dir); + *it = Com; return; } - commands.push_back(Command(from, to, command2, original_dir)); + commands.push_back(Com); Formats::Add(from); Formats::Add(to); ++Formats::GetFormat(to)->in_degree; @@ -237,8 +265,12 @@ Converter::GetReachable(string const & from, bool only_viewable) bool Converter::Convert(Buffer * buffer, string const & from_file, - string const & to_file, string const & using_format) + string const & to_file, string const & using_format, + string * view_file) { + if (view_file) + *view_file = to_file; + string from_format = GetExtension(from_file); string to_format = GetExtension(to_file); if (from_format == to_format) @@ -296,30 +328,51 @@ bool Converter::Convert(Buffer * buffer, string const & from_file, it = (*it).previous; } - Path p(OnlyPath(from_file)); + string path = OnlyPath(from_file); + Path p(path); - string basename = ChangeExtension(from_file, ""); + bool run_latex = false; + string from_base = ChangeExtension(from_file, ""); + string to_base = ChangeExtension(to_file, ""); + string infile; + string outfile = from_file; for (vector< vector::iterator >::reverse_iterator rit = S.rbegin(); rit != S.rend(); ++rit) { it = *rit; lyxerr << "Converting from " << (*it).from << " to " << (*it).to << endl; + infile = outfile; + outfile = (*it).result_dir.empty() + ? ChangeExtension(from_file, (*it).to) + : AddName(subst((*it).result_dir, + "$$BaseName", from_base), + subst((*it).result_file, + "$$BaseName", OnlyFilename(from_base))); if ((*it).from == "tex" && ( (*it).to == "dvi" || (*it).to == "pdf") ) { lyxrc.pdf_mode = (*it).to == "pdf"; + lyxerr << "Running " << (*it).command << endl; + run_latex = true; if (!runLaTeX(buffer, (*it).command)) return false; } else { - string infile = ChangeExtension(from_file, (*it).from); - if (!(*it).original_dir) - infile = OnlyFilename(infile); - string outfile = ChangeExtension(infile, (*it).to); + if ((*it).need_aux && !run_latex + && !latex_command.empty()) { + lyxerr << "Running " << latex_command + << " to update aux file"<< endl; + runLaTeX(buffer, latex_command); + } + + string infile2 = ((*it).original_dir) + ? infile : MakeRelPath(infile, path); + string outfile2 = ((*it).original_dir) + ? outfile : MakeRelPath(outfile, path); string command = (*it).command; - command = subst(command, "$$FName", infile); - command = subst(command, "$$BaseName", basename); - command = subst(command, "$$OutName", outfile); + command = subst(command, "$$FName", infile2); + command = subst(command, "$$BaseName", from_base); + command = subst(command, "$$OutName", outfile2); if ((*it).from == "dvi" && (*it).to == "ps") command = add_options(command, @@ -344,13 +397,26 @@ bool Converter::Convert(Buffer * buffer, string const & from_file, } } - string result_file = ChangeExtension(from_file, to_format); - if (result_file != to_file) + if (!(*it).result_dir.empty()) { + if (view_file) + *view_file = AddName(subst((*it).result_dir, + "$$BaseName", to_base), + subst((*it).result_file, + "$$BaseName", OnlyFilename(to_base))); + if (from_base != to_base) { + string from = subst((*it).result_dir, + "$$BaseName", from_base); + string to = subst((*it).result_dir, + "$$BaseName", to_base); + return lyx::rename(from.c_str(), to.c_str()); + } + + } else if (outfile != to_file) if ((*it).from == "tex" && ( (*it).to == "dvi" || (*it).to == "pdf") ) - return lyx::copy(result_file.c_str(), to_file.c_str()); + return lyx::copy(outfile.c_str(), to_file.c_str()); else - return lyx::rename(result_file.c_str(), to_file.c_str()); + return lyx::rename(outfile.c_str(), to_file.c_str()); return true; } @@ -466,6 +532,8 @@ string Converter::dvips_options(Buffer * buffer) result += ',' + buffer->params.paperheight; } else { string paper_option = dvi_papersize(buffer); + if (paper_option == "us") + paper_option = "letter"; if (paper_option != "letter" || buffer->params.orientation != BufferParams::ORIENTATION_LANDSCAPE) { // dvips won't accept -t letter -t landscape. In all other diff --git a/src/converter.h b/src/converter.h index dc151dba05..8556952a6c 100644 --- a/src/converter.h +++ b/src/converter.h @@ -25,17 +25,25 @@ class Buffer; /// struct Command { /// - Command(string const & f, string const & t, string const & c, - bool o) - : from(f), to(t), command(c), original_dir(o) {} + Command(string const & f, string const & t, string const & c) + : from(f), to(t), command(c), + original_dir(false), need_aux(false) {} /// string from; /// string to; /// string command; - /// + /// Do we need to run the converter in the original directory? bool original_dir; + /// This converter needs the .aux files + bool need_aux; + /// If the converter put the result in a directory, then result_dir + /// is the name of the directory + string result_dir; + /// 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; /// bool visited; /// @@ -98,7 +106,8 @@ public: /// static bool Convert(Buffer * buffer, string const & from_file, - string const & to_file, string const & using_format); + string const & to_file, string const & using_format, + string * view_file = 0); static string const SplitFormat(string const & str, string & format); /// @@ -114,6 +123,9 @@ private: /// static std::vector commands; + /// + static + string latex_command; }; #endif diff --git a/src/exporter.C b/src/exporter.C index 419ae57380..2ce558e6ca 100644 --- a/src/exporter.C +++ b/src/exporter.C @@ -19,17 +19,19 @@ #include "buffer.h" #include "lyx_cb.h" //ShowMessage() #include "support/filetools.h" +#include "lyxrc.h" using std::vector; using std::pair; bool Exporter::Export(Buffer * buffer, string const & format0, - bool put_in_tempdir) + bool put_in_tempdir, string * view_file) { string format; string using_format = Converter::SplitFormat(format0, format); - string backend_format = BufferExtension(buffer); + string backend_format = (format == "txt") + ? format : BufferExtension(buffer); bool only_backend = backend_format == format; string filename = buffer->getLatexName(false); @@ -37,8 +39,16 @@ bool Exporter::Export(Buffer * buffer, string const & format0, filename = AddName(buffer->tmppath, filename); filename = ChangeExtension(filename, backend_format); - if (buffer->isLinuxDoc()) - buffer->makeLinuxDocFile(filename, only_backend); + // Ascii backend + if (backend_format == "txt") + buffer->writeFileAscii(filename, lyxrc.ascii_linelen); + // Linuxdoc backend + else if (buffer->isLinuxDoc()) + buffer->makeLinuxDocFile(filename, true); + // Docbook backend + else if (buffer->isDocBook()) + buffer->makeDocBookFile(filename, true); + // LaTeX backend else if (only_backend) buffer->makeLaTeXFile(filename, string(), true); else @@ -48,7 +58,8 @@ bool Exporter::Export(Buffer * buffer, string const & format0, ? ChangeExtension(filename, format) : ChangeExtension(buffer->getLatexName(false), format); - if (!Converter::Convert(buffer, filename, outfile, using_format)) + if (!Converter::Convert(buffer, filename, outfile, using_format, + view_file)) return false; if (!put_in_tempdir) @@ -63,31 +74,33 @@ bool Exporter::Export(Buffer * buffer, string const & format0, bool Exporter::Preview(Buffer * buffer, string const & format0) { - if (!Export(buffer, format0, true)) + string view_file; + if (!Export(buffer, format0, true, &view_file)) return false; - string format; - Converter::SplitFormat(format0, format); - - string filename = buffer->getLatexName(false); - if (!buffer->tmppath.empty()) - filename = AddName(buffer->tmppath, filename); - filename = ChangeExtension(filename, format); - return Formats::View(buffer, filename); + return Formats::View(buffer, view_file); } vector > const Exporter::GetExportableFormats(Buffer const * buffer) { - return Converter::GetReachable(BufferExtension(buffer), false); + vector > result = + Converter::GetReachable(BufferExtension(buffer), false); + result.push_back(pair("txt", "Ascii")); + return result; } vector > const Exporter::GetViewableFormats(Buffer const * buffer) { - return Converter::GetReachable(BufferExtension(buffer), true); + vector > result = + Converter::GetReachable(BufferExtension(buffer), false); + Format * format = Formats::GetFormat("txt"); + if (format && !format->viewer.empty()) + result.push_back(pair("txt", "Ascii")); + return result; } @@ -95,6 +108,8 @@ string const Exporter::BufferExtension(Buffer const * buffer) { if (buffer->isLinuxDoc()) return "sgml"; + else if (buffer->isDocBook()) + return "docbook"; else return "tex"; } diff --git a/src/exporter.h b/src/exporter.h index fb286f7a2d..b052f591b3 100644 --- a/src/exporter.h +++ b/src/exporter.h @@ -27,7 +27,7 @@ public: /// static bool Export(Buffer * buffer, string const & format, - bool put_in_tempdir); + bool put_in_tempdir, string * view_file = 0); /// static bool Preview(Buffer * buffer, string const & format); diff --git a/src/frontends/Liason.C b/src/frontends/Liason.C index dd9be1651d..c0a4b31fc3 100644 --- a/src/frontends/Liason.C +++ b/src/frontends/Liason.C @@ -145,8 +145,6 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp) command2 += QuoteName(psname); // First run dvips. // If successful, then spool command - lyxerr << "command1 = " << command << endl; - lyxerr << "command2 = " << command2 << endl; res = one.startscript(Systemcalls::System, command); if (res == 0) res = one.startscript(Systemcalls::SystemDontWait, @@ -161,7 +159,6 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp) command += lyxrc.print_to_file + QuoteName(MakeAbsPath(pp.file_name, path)); command += ' ' + QuoteName(dviname); - lyxerr << "command1 = " << command << endl; res = one.startscript(Systemcalls::SystemDontWait, command); break; } diff --git a/src/frontends/xforms/GUIRunTime.C b/src/frontends/xforms/GUIRunTime.C index 1b1e2338d3..7474250843 100644 --- a/src/frontends/xforms/GUIRunTime.C +++ b/src/frontends/xforms/GUIRunTime.C @@ -49,7 +49,7 @@ int GUIRunTime::initApplication(int argc, char * argv[]) // } int xforms_lib_version = fl_library_version(0, 0); if (xforms_include_version != xforms_lib_version) { - cerr << "You are either running LyX with wrong " + lyxerr << "You are either running LyX with wrong " "version of a dynamic XForms library\n" "or you have build LyX with conflicting header " "and library (different\n" diff --git a/src/lyx_main.C b/src/lyx_main.C index 1b6149b65b..de72dc3678 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -40,10 +40,15 @@ #endif #include "ToolbarDefaults.h" #include "lyxlex.h" +#if 1 +// only to get access to NEW_EXPORT +#include "exporter.h" +#endif using std::endl; extern void LoadLyXFile(string const &); +extern void QuitLyX(); string system_lyxdir; string build_lyxdir; @@ -151,6 +156,7 @@ LyX::LyX(int * argc, char * argv[]) // Maybe we could do something more clever than aborting... if (dispatched) { lyxerr << "We are done!" << endl; + QuitLyX(); return; } @@ -750,7 +756,9 @@ bool LyX::easyParse(int * argc, char * argv[]) if (i + 1 < *argc) { string type(argv[i+1]); removeargs = 2; - +#ifdef NEW_EXPORT + batch_command = "buffer-export " + type; +#else if (type == "tex") type = "latex"; else if (type == "ps") @@ -766,6 +774,7 @@ bool LyX::easyParse(int * argc, char * argv[]) lyxerr << _("Unknown file type '") << type << _("' after ") << arg << _(" switch!") << endl; +#endif } else lyxerr << _("Missing file type [eg latex, " "ps...] after ") diff --git a/src/support/filetools.C b/src/support/filetools.C index 85f5d826d5..e4c2ee6096 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -387,6 +387,7 @@ int DeleteAllFilesInDir (string const & path) return -1; } struct dirent * de; + int return_value = 0; while ((de = readdir(dir))) { string temp = de->d_name; if (temp == "." || temp == "..") @@ -395,12 +396,18 @@ int DeleteAllFilesInDir (string const & path) lyxerr.debug() << "Deleting file: " << unlinkpath << endl; - if (remove(unlinkpath.c_str())) + bool deleted = true; + if (FileInfo(unlinkpath).isDir()) + deleted = (DeleteAllFilesInDir(unlinkpath) == 0); + deleted &= (remove(unlinkpath.c_str()) == 0); + if (!deleted) { WriteFSAlert (_("Error! Could not remove file:"), unlinkpath); + return_value = -1; + } } closedir(dir); - return 0; + return return_value; }