]> git.lyx.org Git - features.git/commitdiff
Synching my tree with cvs.
authorAngus Leeming <leeming@lyx.org>
Mon, 18 Feb 2002 19:13:48 +0000 (19:13 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 18 Feb 2002 19:13:48 +0000 (19:13 +0000)
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

38 files changed:
src/ChangeLog
src/Chktex.C
src/LaTeX.C
src/LyXAction.C
src/LyXSendto.C
src/LyXView.C
src/LyXView.h
src/XFormsView.C
src/commandtags.h
src/converter.C
src/frontends/ChangeLog
src/frontends/Dialogs.h
src/frontends/Liason.C
src/frontends/Timeout.C
src/frontends/Timeout.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlTexinfo.C
src/frontends/controllers/helper_funcs.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/Timeout_pimpl.C
src/frontends/xforms/Timeout_pimpl.h
src/insets/ChangeLog
src/insets/insetexternal.C
src/lyx_cb.C
src/lyxfunc.C
src/mathed/ChangeLog
src/mathed/formula.C
src/minibuffer.C
src/minibuffer.h
src/support/ChangeLog
src/support/Makefile.am
src/support/filetools.C
src/support/syscall.C [deleted file]
src/support/syscall.h [deleted file]
src/support/systemcall.C [new file with mode: 0644]
src/support/systemcall.h [new file with mode: 0644]
src/vc-backend.C
src/vc-backend.h

index 2761c1366227e6a2dfb89b9fff09fd963ce0d1e3..055c69a0fe5b444ac96dabc6bed29f43b7c3069a 100644 (file)
@@ -1,3 +1,31 @@
+2002-02-18  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * 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  <jamatos@fep.up.pt>
 
        * 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:
index 74ee7ac09ac9924c1cb94b05c41230f3be561bd9..6b86ed68504b3956c4d36512d66b4dd2b7d50e80 100644 (file)
@@ -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 {
index 1ceeda1b00ab7e9fb058ae8956f4538d6616d410..41e7d6149400c25b033ac85e33f2eb87beaaeb75 100644 (file)
 #include <fstream>
 
 #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<Aux_Info> 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;
index b2c6953240e68640b4cadcf05f0cce0b141665b6..50efd7dad2e86767f23371365f6d6a419217e370 100644 (file)
@@ -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 }
        };
 
index e7fcebc4b55510d49294fe86ed9e840dbf3438d3..7619a2e0cdb9448df4a49c9d5bcfb1a7636b8510 100644 (file)
@@ -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);    
 }
 
 
index 3b049a538c0a549dafbb1f439de028f76e67f647..6f6a8982ab6107b654467a48c08fcb76cdb87c80 100644 (file)
@@ -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();
 }
 
 
index 0027484b901bdaaa9393027fb52853f4914296db..dafacd8956ff89d545e377b41621529b9c23eeba 100644 (file)
@@ -11,7 +11,6 @@
 #include <sigc++/signal_system.h>
 
 #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();
        ///
index 9dac0798979bb0bbcf45f22b28b7678c406dbf9a..ce655b409019082e1b22768ddbe0449f615f2d3a 100644 (file)
@@ -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);
index 62ffb4b8346185af555395b99fd6afd0a24825e9..2c76063fd7ed3647ffc783e42539bc037bf3c1fc 100644 (file)
@@ -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 */
 };
 
index 17a5d90e19f6e7ec10ed00dc0a5c4260863db319..15f3532ea89c5fc20c909e50eca46c2e4909b6c7 100644 (file)
 
 #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;
                        }
index e01a81ed0c72009a4f76367885f37c200f02f03d..8247781a87be227811e16bf7cd86e2f65fb3f1a1 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-18  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * 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  <a.leeming@ic.ac.uk>
 
        * Liason.C:
index 514aa69145653bafe3aedf23e830b68189b6b443..50c3ccc02e93e2e7011cd24000a650ca168a77c3 100644 (file)
@@ -109,6 +109,8 @@ public:
        SigC::Signal1<void, InsetExternal *> showExternal; 
        /// show the contents of a file.
        SigC::Signal1<void, string const &> showFile;
+       /// show all forked child processes
+       SigC::Signal0<void> showForks;
        ///
        SigC::Signal1<void, InsetGraphics *> showGraphics;
        /// show the details of a LyX file include inset
index e038c8b3f357fdb65ab0ccf19a17d09fc8f1a67a..7b44131dab2930f96071ba7abbcb8629440520ce 100644 (file)
 #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;
index 960e834ddf550b88a14679ba373086714713631f..114d88aa3fd765eba52e0ca82a0c459e9a26ff54 100644 (file)
 
 #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();
index b737b1b978936f98b03015a4f9e964d0d59194e9..3fe96c03449a9a40494300422dfe002161e601c0 100644 (file)
@@ -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
index f5cc9fcf9bc3471978d06229d2ed940623100f0e..2539f6073859de7ce69cb625e52faee902dd8ce2 100644 (file)
@@ -1,3 +1,11 @@
+2002-02-18  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * 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  <a.leeming@ic.ac.uk>
 
        * ControlGraphics.C: remove #include "support/syscall.h" as it's not
index 0166eee2a297980fa173e0440707237e79a2c451..f49d7674b515db2c62d3547fb38781bb2019da66 100644 (file)
@@ -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!"), 
index 3631b692b059b09905e9e274f926a04e66d47706..937e44bd45ed286c3e65edbd10429f46a8eaf77d 100644 (file)
@@ -68,6 +68,8 @@ std::vector<string> const getLatexUnits();
     vector<pair<A,B> >
 */
 
+namespace hide {
+
 template<class Pair>
 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<class Pair>
@@ -86,7 +90,8 @@ std::vector<typename Pair::first_type> const
 getFirst(std::vector<Pair> const & pr)
 {
        std::vector<typename Pair::first_type> tmp(pr.size());
-       std::transform(pr.begin(), pr.end(), tmp.begin(), firster<Pair>());
+       std::transform(pr.begin(), pr.end(), tmp.begin(),
+                      hide::firster<Pair>());
        return tmp;
 }
 
@@ -96,7 +101,8 @@ std::vector<typename Pair::second_type> const
 getSecond(std::vector<Pair> const & pr)
 {
        std::vector<typename Pair::second_type> tmp(pr.size());
-       std::transform(pr.begin(), pr.end(), tmp.begin(), seconder<Pair>());
+       std::transform(pr.begin(), pr.end(), tmp.begin(),
+                      hide::seconder<Pair>());
        return tmp;
 }
 
index a2e57bde47e1a78b2c43926a3962696551f5c58e..d32e2981bc505282e2ffac2b18ef4c9d89911dd9 100644 (file)
@@ -1,3 +1,7 @@
+2002-02-18  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * Timeout_pimpl.[Ch] (running): new method.
+
 2002-02-18  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormParagraph.C:
index ad96ae2d879642e71069dd4c0fb0436ced4e92f7..9a7f26a6340d2142b2cbe4768be4f37a8d15e2ea 100644 (file)
@@ -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)
index b53f5ab9855e11a4cfba196258a76ebbd47cb945..83156e2616d986df92e5bbce3da812512345a5dd 100644 (file)
@@ -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
index 960f2ab39fb3f3ac2c29a2a5d51954640d530eb2..9bffe8986a1ec3de13a6e30b0333c07782f7bf0b 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-18  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * 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  <jamatos@fep.up.pt>
 
        * insetinclude.C (validate): some code only applies to latex buffers,
index c358447417ca0000761f84d3102c22b728563252..ec9047185275278363040ce066eaf3b49adf159f 100644 (file)
@@ -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 <cstdio>
@@ -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);
 }
 
 
index f32d2cb03a79fe4ed38bb7db47ad23fc01315a11..e799cc624df7981e6429b9ff67188f069bb9570b 100644 (file)
@@ -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 <fstream>
@@ -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..."));
index 3691d747cd729edd10e4c39a7bf59ee5b025ac8d..21b21daf2caec4ab9dc1713f38d4eb00d6a5cca7 100644 (file)
@@ -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"
index 75f3791ee5976d70ef53106ec63f7ce50eb6b4b2..1c0595789e22c56ec56b704012d7deb02ab2b39b 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-18  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * 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  <a.leeming@ic.ac.uk>
 
        * formula.C: change Systemcalls::System to Systemcalls::Wait and
index e2b609de654728af63ccee3c954966a5441a339b..36d717c72ec227dd1056bb56e31e3de5cb45cd9d 100644 (file)
@@ -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";
index f660a6e69792f7e2af420f302eb7c64f8df11c2d..5803739f9ce2cc03ca4ec2e0fb49a4ef91a98bcb 100644 (file)
@@ -31,6 +31,7 @@
 #include "gettext.h"
 #include "LyXAction.h"
 #include "BufferView.h"
+#include "frontends/Timeout.h"
 
 #include <cctype>
 
@@ -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();
 }
 
 
index 63dcffd22da2d05d1b38779f2d0388354a4d8a0c..e259e50f462d0b7ef781e67bc6c77f7ca0e1f89a 100644 (file)
@@ -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_;
        ///
index 879cc788e306e0c093c67c2ac4f449d04cd4eb6c..ac88819a6aed47ce6ee6b94c3beefd24156490ef 100644 (file)
@@ -1,3 +1,12 @@
+2002-02-18  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * 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  <lasgouttes@freesurf.fr>
 
        * syscall.C (Systemcalls): include <cstdlib>
index a42cf9b87d731e578dac4d00ad4f682591c1da7e..0a9458471ae15a2464ae72c9431eb4b231c811c2 100644 (file)
@@ -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 \
index a0a16369e9b485bcddee4dcd1659fceaa03a7d33..656e90ea64f9e5df5ec3ce87d349d8036dad3dc6 100644 (file)
@@ -33,7 +33,7 @@
 #include <cerrno>
 #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/syscall.C
deleted file mode 100644 (file)
index 717b2e9..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *  \file syscall.C
- *  Copyright 2002 the LyX Team
- *  Read the file COPYING
- *
- * \author Asger Alstrup
- *
- * Interface cleaned up by
- * \author Angus Leeming <a.leeming@ic.ac.uk>
- *
- * Class Systemcalls 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.
- *
- * The child process is not killed when the Systemcall instance goes out of
- * scope.
- */
-
-#include <config.h>
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include <cstdlib> //for ::system
-
-#include "syscall.h"
-#include "os.h"
-
-#if 0
-Systemcalls::Systemcalls(Starttype how, string const & what)
-{
-       startscript(how, what);
-}
-#endif
-
-
-// Reuse of instance
-int Systemcalls::startscript(Starttype how, string const & what)
-{
-       string command = what;
-
-       if (how == DontWait) {
-               if (os::shell() == os::UNIX) {
-                       command += " &";
-               } else {
-                       command = "start /min/n " + command;
-               }
-       }
-
-       return ::system(command.c_str());
-}
diff --git a/src/support/syscall.h b/src/support/syscall.h
deleted file mode 100644 (file)
index 64bcab2..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-/**
- *  \file syscall.h
- *  Copyright 2002 the LyX Team
- *  Read the file COPYING
- *
- * \author Asger Alstrup
- *
- * Interface cleaned up by
- * \author Angus Leeming <a.leeming@ic.ac.uk>
- *
- * Class Systemcalls 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.
- *
- * The child process is not killed when the Systemcall instance goes out of
- * scope.
- */
-
-#ifndef SYSCALL_H
-#define SYSCALL_H
-
-#include "LString.h"
-
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-class Systemcalls {
-public:
-       ///
-       enum Starttype {
-               ///
-               Wait,
-               ///
-               DontWait
-       };
-       
-       ///
-       Systemcalls() {}
-
-#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);
-#endif
-       
-       /** Start child process.
-        *  This is for reuse of the Systemcalls instance.
-        */
-       int startscript(Starttype how, string const & what);
-};
-
-#endif // SYSCALL_H
diff --git a/src/support/systemcall.C b/src/support/systemcall.C
new file mode 100644 (file)
index 0000000..2372c2f
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ *  \file systemcall.C
+ *  Copyright 2002 the LyX Team
+ *  Read the file COPYING
+ *
+ * \author Asger Alstrup
+ *
+ * Interface cleaned up by
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ *
+ * 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.
+ *
+ * The child process is not killed when the Systemcall instance goes out of
+ * scope.
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "systemcall.h"
+#include "os.h"
+
+#include <cstdlib> //for ::system
+
+
+#if 0
+Systemcall::Systemcall(Starttype how, string const & what)
+{
+       startscript(how, what);
+}
+#endif
+
+
+// Reuse of instance
+int Systemcall::startscript(Starttype how, string const & what)
+{
+       string command = what;
+
+       if (how == DontWait) {
+               if (os::shell() == os::UNIX) {
+                       command += " &";
+               } else {
+                       command = "start /min/n " + command;
+               }
+       }
+
+       return ::system(command.c_str());
+}
diff --git a/src/support/systemcall.h b/src/support/systemcall.h
new file mode 100644 (file)
index 0000000..6d44010
--- /dev/null
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+/**
+ *  \file systemcall.h
+ *  Copyright 2002 the LyX Team
+ *  Read the file COPYING
+ *
+ * \author Asger Alstrup
+ *
+ * Interface cleaned up by
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ *
+ * 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.
+ *
+ * The child process is not killed when the Systemcall instance goes out of
+ * scope.
+ */
+
+#ifndef SYSTEMCALL_H
+#define SYSTEMCALL_H
+
+#include "LString.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+class Systemcall {
+public:
+       ///
+       enum Starttype {
+               ///
+               Wait,
+               ///
+               DontWait
+       };
+       
+#if 0
+       ///
+       Systemcall() {}
+
+       /** Generate instance and start child process.
+        *  The string "what" contains a commandline with arguments separated 
+        *  by spaces.
+        */
+       Systemcall(Starttype how, string const & what);
+#endif
+       
+       /** Start child process.
+        *  The string "what" contains a commandline with arguments separated 
+        *  by spaces.
+        */
+       int startscript(Starttype how, string const & what);
+};
+
+#endif // SYSTEMCALL_H
index 78405f16a83ce342ba7fd5d1bdf3dad700438f84..23d36b25b61d83004d58a9d101507d7a9a7edeef 100644 (file)
@@ -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 <fstream>
 
@@ -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;
 }
 
index 0df186cde299e0123a284491e24831784fce3985..065276b44bcd1fc88021d9cd38b7a3bc94abbd05 100644 (file)
@@ -8,7 +8,6 @@
 #endif
 
 #include "LString.h"
-#include "support/syscall.h"
 
 class Buffer;