From d0a3af12d9ae8b208f7a70099db29632ad8a7dba Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 18 Feb 2002 19:13:48 +0000 Subject: [PATCH] Synching my tree with cvs. I'm committing all the little, but uncontroversial, changes that have built up in my tree. This will result in an almost total recompilation for you all but will mean that things are less painfull when the other changes go in! * Rename files syscall.[Ch] as systemcall.[Ch]. * Rename class Systemcalls as class Systemcall as one instance of the class represents a single child process. Remove the default constructor too. * Add a running() method to class Timeout. Results in recompilation of almost the entire tree because pretty well everything depends on LyXView.h which #includes "frontends/Timeout.h", so... * Make the Timeout instances in classes LyXView and minibuffer pointers, allowing us to forward declare class Timeout. * Add LFUN_FORKS_SHOW and LFUN_FORKS_KILL to commandtags.h in anticipation of something wonderful! * Add a signal showForks to Dialogs.h, again anticipating some real code. * wrap the structs firster, seconder in frontends/controllers/helper_funcs.h in a namespace to prevent a clash with similarly named structs in support/lyxalgo.h As you see, lots of irritating bits and pieces which don't make much sense in themselves but do in light of the other changes I've got here. I'll post the big changes to the list for proper perusal. Angus git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3566 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 30 +++++++++++++++++++++- src/Chktex.C | 6 ++--- src/LaTeX.C | 30 +++++++++++----------- src/LyXAction.C | 4 +++ src/LyXSendto.C | 13 +++++----- src/LyXView.C | 7 ++++- src/LyXView.h | 4 +-- src/XFormsView.C | 7 ++--- src/commandtags.h | 2 ++ src/converter.C | 24 +++++++++-------- src/frontends/ChangeLog | 11 ++++++++ src/frontends/Dialogs.h | 2 ++ src/frontends/Liason.C | 22 ++++++++-------- src/frontends/Timeout.C | 12 ++++----- src/frontends/Timeout.h | 4 +-- src/frontends/controllers/ChangeLog | 8 ++++++ src/frontends/controllers/ControlTexinfo.C | 10 ++++---- src/frontends/controllers/helper_funcs.h | 10 ++++++-- src/frontends/xforms/ChangeLog | 4 +++ src/frontends/xforms/Timeout_pimpl.C | 6 +++++ src/frontends/xforms/Timeout_pimpl.h | 2 ++ src/insets/ChangeLog | 5 ++++ src/insets/insetexternal.C | 6 ++--- src/lyx_cb.C | 6 ++--- src/lyxfunc.C | 1 - src/mathed/ChangeLog | 5 ++++ src/mathed/formula.C | 6 ++--- src/minibuffer.C | 21 +++++++++------ src/minibuffer.h | 6 ++--- src/support/ChangeLog | 9 +++++++ src/support/Makefile.am | 4 +-- src/support/filetools.C | 6 ++--- src/support/{syscall.C => systemcall.C} | 13 +++++----- src/support/{syscall.h => systemcall.h} | 23 +++++++++-------- src/vc-backend.C | 6 ++--- src/vc-backend.h | 1 - 36 files changed, 223 insertions(+), 113 deletions(-) rename src/support/{syscall.C => systemcall.C} (77%) rename src/support/{syscall.h => systemcall.h} (66%) diff --git a/src/ChangeLog b/src/ChangeLog index 2761c13662..055c69a0fe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,31 @@ +2002-02-18 Angus Leeming + + * Chktex.C: + * LaTeX.C: + * LyXSendto.C: + * converter.C: + * lyx_cb.C: + * vc-backend.C: Changes due to the renaming of support/syscall.[Ch] as + support/systemcall.[Ch] and of class Systemcalls as class SystemCall. + + * lyxfunc.C: + * vc-backend.h: remove #include "support/syscall.h" + + * LaTeX.C: + * LyXSendto.C: + * converter.C: rearrange #includes in Lars' approved fashion. + + * LyXView.[Ch]: make autosave_timeout a pointer to Timeout. Can thus + forward declare class Timeout in the header file. + + * XFormsView.C: changes due to the above. + + * minibuffer.[Ch]: make timer and stored_timer pointers to Timeout, + similar to LyXView. + + * commandtags.h: add LFUN_FORKS_SHOW and LFUN_FORKS_KILL to the enum. + * LyXAction.C (init): add LFUN_FORKS_SHOW and LFUN_FORKS_KILL to items[] + 2002-02-18 José Matos * buffer.C (simpleDocBookOnePar): if paragraph style is CDATA escapes @@ -15,7 +43,7 @@ * Chktex.C: * buffer.C: - remove #include "support/syscall.h" as it's redundant. Always has been. + remove #include "support/syscontr.h" as it's redundant. Always has been. * Chktex.C: * LaTeX.C: diff --git a/src/Chktex.C b/src/Chktex.C index 74ee7ac09a..6b86ed6850 100644 --- a/src/Chktex.C +++ b/src/Chktex.C @@ -25,7 +25,7 @@ #include "support/FileInfo.h" #include "support/filetools.h" -#include "support/syscall.h" +#include "support/systemcall.h" #include "support/path.h" #include "support/lstrings.h" @@ -49,8 +49,8 @@ int Chktex::run(TeXErrors &terr) // run bibtex string log = OnlyFilename(ChangeExtension(file, ".log")); string tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log; - Systemcalls one; - int result= one.startscript(Systemcalls::Wait, tmp); + Systemcall one; + int result= one.startscript(Systemcall::Wait, tmp); if (result == 0) { result = scanLogFile(terr); } else { diff --git a/src/LaTeX.C b/src/LaTeX.C index 1ceeda1b00..41e7d61494 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -19,20 +19,20 @@ #include #include "LaTeX.h" +#include "bufferlist.h" +#include "gettext.h" +#include "lyx_gui_misc.h" +#include "lyxfunc.h" +#include "debug.h" #include "support/filetools.h" -#include "support/os.h" #include "support/FileInfo.h" -#include "debug.h" -#include "support/lyxlib.h" -#include "support/syscall.h" -#include "support/path.h" #include "support/LRegex.h" #include "support/LSubstring.h" #include "support/lstrings.h" -#include "bufferlist.h" -#include "gettext.h" -#include "lyx_gui_misc.h" -#include "lyxfunc.h" +#include "support/lyxlib.h" +#include "support/systemcall.h" +#include "support/os.h" +#include "support/path.h" using std::ifstream; using std::getline; @@ -358,8 +358,8 @@ int LaTeX::operator()() #else // cmd.exe (OS/2) causes SYS0003 error at "/dev/null" string tmp = cmd + ' ' + file + " > nul"; #endif - Systemcalls one; - return one.startscript(Systemcalls::Wait, tmp); + Systemcall one; + return one.startscript(Systemcall::Wait, tmp); } @@ -375,8 +375,8 @@ bool LaTeX::runMakeIndex(string const & f) // to come for a later time. (0.13 perhaps?) string tmp = "makeindex -c -q "; tmp += f; - Systemcalls one; - one.startscript(Systemcalls::Wait, tmp); + Systemcall one; + one.startscript(Systemcall::Wait, tmp); return true; } @@ -506,8 +506,8 @@ bool LaTeX::runBibTeX(vector const & bibtex_info) string tmp = "bibtex "; tmp += OnlyFilename(ChangeExtension(it->aux_file, string())); - Systemcalls one; - one.startscript(Systemcalls::Wait, tmp); + Systemcall one; + one.startscript(Systemcall::Wait, tmp); } // Return whether bibtex was run return result; diff --git a/src/LyXAction.C b/src/LyXAction.C index b2c6953240..50efd7dad2 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -434,6 +434,10 @@ void LyXAction::init() N_("Display information about LyX"), NoBuffer }, { LFUN_HELP_TEXINFO, "help-Texinfo", N_("Display information about the TeX installation"), NoBuffer }, + { LFUN_FORKS_SHOW, "show-forks", + N_("Show the processes forked by LyX"), NoBuffer }, + { LFUN_FORKS_KILL, "kill-forks", + N_("Kill the forked process with this PID"), NoBuffer }, { LFUN_NOACTION, "", "", Noop } }; diff --git a/src/LyXSendto.C b/src/LyXSendto.C index e7fcebc4b5..7619a2e0cd 100644 --- a/src/LyXSendto.C +++ b/src/LyXSendto.C @@ -5,17 +5,18 @@ #include "lyx_main.h" #include "lyxrc.h" #include "LString.h" -#include "support/filetools.h" -#include "support/path.h" #include "buffer.h" #include "lyx_gui_misc.h" -#include "support/syscall.h" -#include "support/lstrings.h" #include "gettext.h" #include "bufferview_funcs.h" #include "exporter.h" #include "BufferView.h" +#include "support/filetools.h" +#include "support/lstrings.h" +#include "support/path.h" +#include "support/systemcall.h" + extern FD_form_sendto * fd_form_sendto; extern BufferView * current_view; extern int MakeLaTeXOutput(Buffer * buffer); @@ -95,8 +96,8 @@ void SendtoApplyCB(FL_OBJECT *, long) // create the .txt file in tmp_dir if this filetype is requested if (fl_get_button(fd_form_sendto->radio_ftype_ascii)) buffer->writeFileAscii(fname, lyxrc.ascii_linelen); - Systemcalls one; - one.startscript(Systemcalls::Wait, command); + Systemcall one; + one.startscript(Systemcall::Wait, command); } diff --git a/src/LyXView.C b/src/LyXView.C index 3b049a538c..6f6a8982ab 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -31,6 +31,7 @@ #include "frontends/Dialogs.h" #include "frontends/Toolbar.h" +#include "frontends/Timeout.h" #include "frontends/Menubar.h" #include "support/filetools.h" // OnlyFilename() @@ -54,6 +55,9 @@ LyXView::LyXView() intl = new Intl; + // Give the timeout some default sensible value. + autosave_timeout = new Timeout(5000); + dialogs_ = new Dialogs(this); // temporary until all dialogs moved into Dialogs. dialogs_->updateBufferDependent @@ -73,6 +77,7 @@ LyXView::~LyXView() delete minibuffer; delete lyxfunc; delete intl; + delete autosave_timeout; delete dialogs_; } @@ -180,7 +185,7 @@ void LyXView::AutoSave() void LyXView::resetAutosaveTimer() { if (lyxrc.autosave) - autosave_timeout.restart(); + autosave_timeout->restart(); } diff --git a/src/LyXView.h b/src/LyXView.h index 0027484b90..dafacd8956 100644 --- a/src/LyXView.h +++ b/src/LyXView.h @@ -11,7 +11,6 @@ #include #include "LString.h" -#include "frontends/Timeout.h" #include "support/types.h" class Buffer; @@ -23,6 +22,7 @@ class Menubar; class BufferView; class Dialogs; class LyXFunc; +class Timeout; /// class LyXView : public SigC::Object, boost::noncopyable { @@ -112,7 +112,7 @@ protected: /// Intl * intl; /// - Timeout autosave_timeout; + Timeout * autosave_timeout; /// A callback void AutoSave(); /// diff --git a/src/XFormsView.C b/src/XFormsView.C index 9dac079897..ce655b4090 100644 --- a/src/XFormsView.C +++ b/src/XFormsView.C @@ -26,6 +26,7 @@ #include "support/filetools.h" // OnlyFilename() #include "frontends/Toolbar.h" #include "frontends/Menubar.h" +#include "frontends/Timeout.h" #include "MenuBackend.h" #include "ToolbarDefaults.h" #include "lyxfunc.h" @@ -164,7 +165,7 @@ void XFormsView::create_form_form_main(int width, int height) // TIMERS // - autosave_timeout.timeout.connect(SigC::slot(this, &XFormsView::AutoSave)); + autosave_timeout->timeout.connect(SigC::slot(this, &XFormsView::AutoSave)); // // Misc @@ -204,8 +205,8 @@ void XFormsView::init() // Start autosave timer if (lyxrc.autosave) { - autosave_timeout.setTimeout(lyxrc.autosave * 1000); - autosave_timeout.start(); + autosave_timeout->setTimeout(lyxrc.autosave * 1000); + autosave_timeout->start(); } intl->InitKeyMapper(lyxrc.use_kbmap); diff --git a/src/commandtags.h b/src/commandtags.h index 62ffb4b834..2c76063fd7 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -297,6 +297,8 @@ enum kb_action { LFUN_HELP_ABOUTLYX, // Edwin 20010712 LFUN_THESAURUS_ENTRY, // Levon 20010720 LFUN_HELP_TEXINFO, // Herbert 20011001 + LFUN_FORKS_SHOW, // Angus 16 Feb 2002 + LFUN_FORKS_KILL, // Angus 16 Feb 2002 LFUN_LASTACTION /* this marks the end of the table */ }; diff --git a/src/converter.C b/src/converter.C index 17a5d90e19..15f3532ea8 100644 --- a/src/converter.C +++ b/src/converter.C @@ -18,21 +18,23 @@ #include "converter.h" #include "lyxrc.h" -#include "support/syscall.h" -#include "support/path.h" -#include "support/filetools.h" #include "buffer.h" #include "bufferview_funcs.h" #include "LaTeX.h" #include "LyXView.h" #include "lyx_gui_misc.h" #include "lyx_cb.h" // ShowMessage() -#include "support/lyxfunctional.h" -#include "frontends/Alert.h" #include "gettext.h" #include "BufferView.h" #include "debug.h" +#include "frontends/Alert.h" + +#include "support/filetools.h" +#include "support/lyxfunctional.h" +#include "support/path.h" +#include "support/systemcall.h" + using std::vector; using std::queue; using std::endl; @@ -195,8 +197,8 @@ bool Formats::view(Buffer const * buffer, string const & filename, ShowMessage(buffer, _("Executing command:"), command); Path p(OnlyPath(filename)); - Systemcalls one; - int const res = one.startscript(Systemcalls::DontWait, command); + Systemcall one; + int const res = one.startscript(Systemcall::DontWait, command); if (res) { Alert::alert(_("Cannot view file"), @@ -644,9 +646,9 @@ bool Converters::convert(Buffer const * buffer, if (buffer) ShowMessage(buffer, _("Executing command:"), command); - Systemcalls::Starttype type = (dummy) - ? Systemcalls::DontWait : Systemcalls::Wait; - Systemcalls one; + Systemcall::Starttype type = (dummy) + ? Systemcall::DontWait : Systemcall::Wait; + Systemcall one; int res; if (conv.original_dir && buffer) { Path p(buffer->filePath()); @@ -659,7 +661,7 @@ bool Converters::convert(Buffer const * buffer, string const command2 = conv.parselog + " < " + QuoteName(infile2 + ".out") + " > " + QuoteName(logfile); - one.startscript(Systemcalls::Wait, command2); + one.startscript(Systemcall::Wait, command2); if (!scanLog(buffer, command, logfile)) return false; } diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index e01a81ed0c..8247781a87 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,14 @@ +2002-02-18 Angus Leeming + + * Liason.C: Changes due to the renaming of support/syscall.[Ch] as + support/systemcall.[Ch] and of class Systemcalls as class SystemCall. + Rearrange #includes in Lars' approved fashion. + + * Timeout.[Ch] (running): new method. + (default c-tor): removed. + + * Dialogs.h: added a new signal, showForks. + 2002-02-16 Angus Leeming * Liason.C: diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 514aa69145..50c3ccc02e 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -109,6 +109,8 @@ public: SigC::Signal1 showExternal; /// show the contents of a file. SigC::Signal1 showFile; + /// show all forked child processes + SigC::Signal0 showForks; /// SigC::Signal1 showGraphics; /// show the details of a LyX file include inset diff --git a/src/frontends/Liason.C b/src/frontends/Liason.C index e038c8b3f3..7b44131dab 100644 --- a/src/frontends/Liason.C +++ b/src/frontends/Liason.C @@ -15,19 +15,21 @@ #endif #include "Liason.h" +#include "lyxrc.h" +#include "PrinterParams.h" + #include "LyXView.h" #include "BufferView.h" #include "buffer.h" -#include "lyxrc.h" -#include "PrinterParams.h" +#include "exporter.h" +#include "converter.h" #include "lyx_gui_misc.h" + #include "support/LAssert.h" #include "support/lstrings.h" #include "support/filetools.h" #include "support/path.h" -#include "exporter.h" -#include "converter.h" -#include "support/syscall.h" +#include "support/systemcall.h" using std::endl; @@ -116,7 +118,7 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp) // 1. we print to a file // 2. we print direct to a printer // 3. we print using a spool command (print to file first) - Systemcalls one; + Systemcall one; int res = 0; string dviname = ChangeExtension(buffer->getLatexName(true), "dvi"); switch (pp.target) { @@ -134,13 +136,13 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp) command2 += QuoteName(psname); // First run dvips. // If successful, then spool command - res = one.startscript(Systemcalls::Wait, command); + res = one.startscript(Systemcall::Wait, command); if (res == 0) - res = one.startscript(Systemcalls::DontWait, + res = one.startscript(Systemcall::DontWait, command2); } else // case 2 - res = one.startscript(Systemcalls::DontWait, + res = one.startscript(Systemcall::DontWait, command + QuoteName(dviname)); break; @@ -149,7 +151,7 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp) command += lyxrc.print_to_file + QuoteName(MakeAbsPath(pp.file_name, path)); command += ' ' + QuoteName(dviname); - res = one.startscript(Systemcalls::DontWait, command); + res = one.startscript(Systemcall::DontWait, command); break; } return res == 0; diff --git a/src/frontends/Timeout.C b/src/frontends/Timeout.C index 960e834ddf..114d88aa3f 100644 --- a/src/frontends/Timeout.C +++ b/src/frontends/Timeout.C @@ -17,12 +17,6 @@ #include "Timeout_pimpl.h" -Timeout::Timeout() - : type(ONETIME), timeout_ms(0) -{ - pimpl_ = new Pimpl(this); -} - Timeout::Timeout(unsigned int msec, Type t) : type(t), timeout_ms(msec) @@ -38,6 +32,12 @@ Timeout::~Timeout() } +bool Timeout::running() const +{ + return pimpl_->running(); +} + + void Timeout::start() { pimpl_->start(); diff --git a/src/frontends/Timeout.h b/src/frontends/Timeout.h index b737b1b978..3fe96c0344 100644 --- a/src/frontends/Timeout.h +++ b/src/frontends/Timeout.h @@ -29,11 +29,11 @@ public: CONTINUOUS }; /// - Timeout(); - /// Timeout(unsigned int msec, Type = ONETIME); /// ~Timeout(); + /// Is the timer running? + bool running() const; /// start the timer void start(); /// stop the timer diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index f5cc9fcf9b..2539f60738 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,11 @@ +2002-02-18 Angus Leeming + + * helper_funcs.h: wrap the structs firster and seconder up in a + namespace to avoid clashes with those in lyxalgo,h. + + * ControlTexinfo.C Changes due to the renaming of support/syscall.[Ch] + as support/systemcall.[Ch] and of class Systemcalls as class SystemCall. + 2002-02-16 Angus Leeming * ControlGraphics.C: remove #include "support/syscall.h" as it's not diff --git a/src/frontends/controllers/ControlTexinfo.C b/src/frontends/controllers/ControlTexinfo.C index 0166eee2a2..f49d7674b5 100644 --- a/src/frontends/controllers/ControlTexinfo.C +++ b/src/frontends/controllers/ControlTexinfo.C @@ -25,7 +25,7 @@ #include "BufferView.h" #include "gettext.h" #include "support/filetools.h" // FileSearch -#include "support/syscall.h" +#include "support/systemcall.h" #include "support/path.h" #include "helper_funcs.h" #include "support/lstrings.h" @@ -46,8 +46,8 @@ void ControlTexinfo::rescanStyles() const { // Run rescan in user lyx directory Path p(user_lyxdir); - Systemcalls one; - one.startscript(Systemcalls::Wait, + Systemcall one; + one.startscript(Systemcall::Wait, LibFileSearch("scripts", "TeXFiles.sh")); p.pop(); } @@ -59,8 +59,8 @@ void ControlTexinfo::runTexhash() const Path p(user_lyxdir); //path to texhash through system - Systemcalls one; - one.startscript(Systemcalls::Wait, "texhash"); + Systemcall one; + one.startscript(Systemcall::Wait, "texhash"); p.pop(); // Alert::alert(_("texhash run!"), diff --git a/src/frontends/controllers/helper_funcs.h b/src/frontends/controllers/helper_funcs.h index 3631b692b0..937e44bd45 100644 --- a/src/frontends/controllers/helper_funcs.h +++ b/src/frontends/controllers/helper_funcs.h @@ -68,6 +68,8 @@ std::vector const getLatexUnits(); vector > */ +namespace hide { + template struct firster { typedef typename Pair::first_type first_type; @@ -79,6 +81,8 @@ struct seconder { typedef typename Pair::second_type second_type; second_type const & operator()(Pair const & p) { return p.second; } }; + +} /// template @@ -86,7 +90,8 @@ std::vector const getFirst(std::vector const & pr) { std::vector tmp(pr.size()); - std::transform(pr.begin(), pr.end(), tmp.begin(), firster()); + std::transform(pr.begin(), pr.end(), tmp.begin(), + hide::firster()); return tmp; } @@ -96,7 +101,8 @@ std::vector const getSecond(std::vector const & pr) { std::vector tmp(pr.size()); - std::transform(pr.begin(), pr.end(), tmp.begin(), seconder()); + std::transform(pr.begin(), pr.end(), tmp.begin(), + hide::seconder()); return tmp; } diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index a2e57bde47..d32e2981bc 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2002-02-18 Angus Leeming + + * Timeout_pimpl.[Ch] (running): new method. + 2002-02-18 Angus Leeming * FormParagraph.C: diff --git a/src/frontends/xforms/Timeout_pimpl.C b/src/frontends/xforms/Timeout_pimpl.C index ad96ae2d87..9a7f26a634 100644 --- a/src/frontends/xforms/Timeout_pimpl.C +++ b/src/frontends/xforms/Timeout_pimpl.C @@ -48,6 +48,12 @@ void Timeout::Pimpl::reset() } +bool Timeout::Pimpl::running() const +{ + return timeout_id != -1; +} + + void Timeout::Pimpl::start() { if (timeout_id != -1) diff --git a/src/frontends/xforms/Timeout_pimpl.h b/src/frontends/xforms/Timeout_pimpl.h index b53f5ab985..83156e2616 100644 --- a/src/frontends/xforms/Timeout_pimpl.h +++ b/src/frontends/xforms/Timeout_pimpl.h @@ -26,6 +26,8 @@ struct Timeout::Pimpl { public: /// Pimpl(Timeout * owner_); + /// Is the timer running? + bool running() const; /// start the timer void start(); /// stop the timer diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 960f2ab39f..9bffe8986a 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2002-02-18 Angus Leeming + + * insetexternal.C Changes due to the renaming of support/syscall.[Ch] + as support/systemcall.[Ch] and of class Systemcalls as class SystemCall. + 2002-02-18 José Matos * insetinclude.C (validate): some code only applies to latex buffers, diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index c358447417..ec90471852 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -29,7 +29,7 @@ #include "support/filetools.h" #include "support/lstrings.h" #include "support/path.h" -#include "support/syscall.h" +#include "support/systemcall.h" #include "support/FileInfo.h" #include @@ -220,12 +220,12 @@ void InsetExternal::executeCommand(string const & s, Buffer const * buffer) const { Path p(buffer->filePath()); - Systemcalls one; + Systemcall one; if (lyxerr.debugging()) { lyxerr << "Executing '" << s << "' in '" << buffer->filePath() << "'" << endl; } - one.startscript(Systemcalls::Wait, s); + one.startscript(Systemcall::Wait, s); } diff --git a/src/lyx_cb.C b/src/lyx_cb.C index f32d2cb03a..e799cc624d 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -33,7 +33,7 @@ #include "support/FileInfo.h" #include "support/filetools.h" #include "support/path.h" -#include "support/syscall.h" +#include "support/systemcall.h" #include "support/lstrings.h" #include @@ -537,8 +537,8 @@ void Reconfigure(BufferView * bv) // Run configure in user lyx directory Path p(user_lyxdir); - Systemcalls one; - one.startscript(Systemcalls::Wait, + Systemcall one; + one.startscript(Systemcall::Wait, AddName(system_lyxdir, "configure")); p.pop(); bv->owner()->message(_("Reloading configuration...")); diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 3691d747cd..21b21daf2c 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -88,7 +88,6 @@ #include "support/LAssert.h" #include "support/filetools.h" #include "support/FileInfo.h" -#include "support/syscall.h" #include "support/lstrings.h" #include "support/path.h" #include "support/lyxfunctional.h" diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 75f3791ee5..1c0595789e 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,8 @@ +2002-02-18 Angus Leeming + + * formula.C Changes due to the renaming of support/syscall.[Ch] + as support/systemcall.[Ch] and of class Systemcalls as class SystemCall. + 2002-02-16 Angus Leeming * formula.C: change Systemcalls::System to Systemcalls::Wait and diff --git a/src/mathed/formula.C b/src/mathed/formula.C index e2b609de65..36d717c72e 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -34,7 +34,7 @@ #include "support/LOstream.h" #include "support/LAssert.h" #include "support/lyxlib.h" -#include "support/syscall.h" +#include "support/systemcall.h" #include "support/lstrings.h" #include "support/filetools.h" // LibFileSearch #include "LyXView.h" @@ -60,8 +60,8 @@ namespace { string outfile = lyx::tempName(string(), "mathextern"); string full = "echo '" + data + "' | (" + cmd + ") > " + outfile; lyxerr << "calling: " << full << "\n"; - Systemcalls dummy; - dummy.startscript(Systemcalls::Wait, full); + Systemcall dummy; + dummy.startscript(Systemcall::Wait, full); string out = GetFileContents(outfile); lyx::unlink(outfile); lyxerr << "result: '" << out << "'\n"; diff --git a/src/minibuffer.C b/src/minibuffer.C index f660a6e697..5803739f9c 100644 --- a/src/minibuffer.C +++ b/src/minibuffer.C @@ -31,6 +31,7 @@ #include "gettext.h" #include "LyXAction.h" #include "BufferView.h" +#include "frontends/Timeout.h" #include @@ -61,10 +62,12 @@ MiniBuffer::MiniBuffer(LyXView * o, FL_Coord x, FL_Coord y, : stored_(false), owner_(o), state_(spaces) { add(FL_NORMAL_INPUT, x, y, h, w); - timer.setTimeout(6000); - timer.timeout.connect(slot(this, &MiniBuffer::init)); - stored_timer.setTimeout(1500); - stored_timer.timeout.connect(slot(this, &MiniBuffer::stored_slot)); + + timer = new Timeout(600); + timer->timeout.connect(slot(this, &MiniBuffer::init)); + + stored_timer = new Timeout(1500); + stored_timer->timeout.connect(slot(this, &MiniBuffer::stored_slot)); deactivate(); } @@ -80,6 +83,8 @@ void MiniBuffer::dd_init() MiniBuffer::~MiniBuffer() { + delete timer; + delete stored_timer; delete dropdown_; } @@ -97,7 +102,7 @@ void MiniBuffer::stored_set(string const & str) { stored_input = str; stored_ = true; - stored_timer.start(); + stored_timer->start(); } @@ -112,7 +117,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) char const * tmp = fl_get_input(ob); string input = tmp ? tmp : ""; if (stored_) { - stored_timer.stop(); + stored_timer->stop(); input = stored_input; set_input(input); stored_ = false; @@ -315,7 +320,7 @@ FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y, void MiniBuffer::message(string const & str) { - timer.restart(); + timer->restart(); string const ntext = strip(str); if (!the_buffer->focus) { set_input(ntext); @@ -366,7 +371,7 @@ void MiniBuffer::init() return; timeout.emit(); - timer.stop(); + timer->stop(); } diff --git a/src/minibuffer.h b/src/minibuffer.h index 63dcffd22d..e259e50f46 100644 --- a/src/minibuffer.h +++ b/src/minibuffer.h @@ -7,7 +7,6 @@ #include FORMS_H_LOCATION #include "LString.h" -#include "frontends/Timeout.h" #ifdef __GNUG__ #pragma interface @@ -15,6 +14,7 @@ class LyXView; class DropDown; +class Timeout; /// class MiniBuffer : public SigC::Object { @@ -95,9 +95,9 @@ private: /// FL_OBJECT * add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord); /// - Timeout timer; + Timeout * timer; /// - Timeout stored_timer; + Timeout * stored_timer; /// the dropdown menu DropDown * dropdown_; /// diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 879cc788e3..ac88819a6a 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,12 @@ +2002-02-18 Angus Leeming + + * syscall.[Ch]: renamed as systemcall.[Ch]. class Systemcalls renamed + as class SystemCall because one Systemcall instance represents a + single child process. + + * filetools.C: + * Makefile.am: associated changes. + 2002-02-18 Jean-Marc Lasgouttes * syscall.C (Systemcalls): include diff --git a/src/support/Makefile.am b/src/support/Makefile.am index a42cf9b87d..0a9458471a 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -63,8 +63,8 @@ libsupport_o_SOURCES = \ snprintf.h \ snprintf.c \ sstream.h \ - $(REGEX) syscall.C \ - syscall.h \ + $(REGEX) systemcall.C \ + systemcall.h \ tempname.C \ textutils.h \ translator.h \ diff --git a/src/support/filetools.C b/src/support/filetools.C index a0a16369e9..656e90ea64 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -33,7 +33,7 @@ #include #include "debug.h" #include "support/lstrings.h" -#include "support/syscall.h" +#include "support/systemcall.h" #include "filetools.h" #include "LSubstring.h" @@ -1061,8 +1061,8 @@ string const unzipFile(string const & zipped_file) string const tempfile = lyx::tempName(string(), file); // Run gunzip string const command = "gunzip -c " + zipped_file + " > " + tempfile; - Systemcalls one; - one.startscript(Systemcalls::Wait, command); + Systemcall one; + one.startscript(Systemcall::Wait, command); // test that command was executed successfully (anon) // yes, please do. (Lgb) return tempfile; diff --git a/src/support/syscall.C b/src/support/systemcall.C similarity index 77% rename from src/support/syscall.C rename to src/support/systemcall.C index 717b2e9e63..2372c2fd45 100644 --- a/src/support/syscall.C +++ b/src/support/systemcall.C @@ -1,5 +1,5 @@ /** - * \file syscall.C + * \file systemcall.C * Copyright 2002 the LyX Team * Read the file COPYING * @@ -8,7 +8,7 @@ * Interface cleaned up by * \author Angus Leeming * - * Class Systemcalls uses "system" to launch the child process. + * Class Systemcall uses "system" to launch the child process. * The user can choose to wait or not wait for the process to complete, but no * callback is invoked upon completion of the child. * @@ -22,13 +22,14 @@ #pragma implementation #endif +#include "systemcall.h" +#include "os.h" + #include //for ::system -#include "syscall.h" -#include "os.h" #if 0 -Systemcalls::Systemcalls(Starttype how, string const & what) +Systemcall::Systemcall(Starttype how, string const & what) { startscript(how, what); } @@ -36,7 +37,7 @@ Systemcalls::Systemcalls(Starttype how, string const & what) // Reuse of instance -int Systemcalls::startscript(Starttype how, string const & what) +int Systemcall::startscript(Starttype how, string const & what) { string command = what; diff --git a/src/support/syscall.h b/src/support/systemcall.h similarity index 66% rename from src/support/syscall.h rename to src/support/systemcall.h index 64bcab242c..6d44010db8 100644 --- a/src/support/syscall.h +++ b/src/support/systemcall.h @@ -1,6 +1,6 @@ // -*- C++ -*- /** - * \file syscall.h + * \file systemcall.h * Copyright 2002 the LyX Team * Read the file COPYING * @@ -9,7 +9,9 @@ * Interface cleaned up by * \author Angus Leeming * - * Class Systemcalls uses "system" to launch the child process. + * An instance of Class Systemcall represents a single child process. + * + * Class Systemcall uses system() to launch the child process. * The user can choose to wait or not wait for the process to complete, but no * callback is invoked upon completion of the child. * @@ -17,8 +19,8 @@ * scope. */ -#ifndef SYSCALL_H -#define SYSCALL_H +#ifndef SYSTEMCALL_H +#define SYSTEMCALL_H #include "LString.h" @@ -26,7 +28,7 @@ #pragma interface #endif -class Systemcalls { +class Systemcall { public: /// enum Starttype { @@ -36,21 +38,22 @@ public: DontWait }; +#if 0 /// - Systemcalls() {} + Systemcall() {} -#if 0 /** Generate instance and start child process. * The string "what" contains a commandline with arguments separated * by spaces. */ - Systemcalls(Starttype how, string const & what); + Systemcall(Starttype how, string const & what); #endif /** Start child process. - * This is for reuse of the Systemcalls instance. + * The string "what" contains a commandline with arguments separated + * by spaces. */ int startscript(Starttype how, string const & what); }; -#endif // SYSCALL_H +#endif // SYSTEMCALL_H diff --git a/src/vc-backend.C b/src/vc-backend.C index 78405f16a8..23d36b25b6 100644 --- a/src/vc-backend.C +++ b/src/vc-backend.C @@ -17,7 +17,7 @@ #include "support/path.h" #include "support/filetools.h" #include "support/lstrings.h" -#include "support/syscall.h" +#include "support/systemcall.h" #include @@ -28,9 +28,9 @@ using std::getline; int VCS::doVCCommand(string const & cmd, string const & path) { lyxerr[Debug::LYXVC] << "doVCCommand: " << cmd << endl; - Systemcalls one; + Systemcall one; Path p(path); - int const ret = one.startscript(Systemcalls::Wait, cmd); + int const ret = one.startscript(Systemcall::Wait, cmd); return ret; } diff --git a/src/vc-backend.h b/src/vc-backend.h index 0df186cde2..065276b44b 100644 --- a/src/vc-backend.h +++ b/src/vc-backend.h @@ -8,7 +8,6 @@ #endif #include "LString.h" -#include "support/syscall.h" class Buffer; -- 2.39.2