Update of /cvsroot/mahogany/M/include
In directory usw-pr-cvs1:/tmp/cvs-serv15792/include
Modified Files:
CmdLineOpts.h MApplication.h Moptions.h
Log Message:
implemented "alweays run only one instance" option and the remote control:
launching Mahogany will simply pass control and the command line options to
the previous instance, if any (and if this option is on)
Index: CmdLineOpts.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/CmdLineOpts.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -u -2 -r1.1 -r1.2
--- CmdLineOpts.h 29 Mar 2002 20:42:21 -0000 1.1
+++ CmdLineOpts.h 13 Apr 2002 23:34:31 -0000 1.2
@@ -19,6 +19,7 @@
#define _CMDLINEOPTS_H_
-struct CmdLineOptions
+class CmdLineOptions
{
+public:
/// parameters of the composer window to be opened on startup
struct Compose
@@ -43,4 +44,24 @@
/// in safe mode, don't do anything on startup
bool safe;
+
+ /**
+ @name Conversion to/from string
+
+ We pass CmdLineOptions objcts between different Mahogany processes: if the
+ "run only one instance" option is on we check if a previous instance of
+ Mahogany is already running and if it is we pass it our command line
+ options as a single string using ToString(). The other process then
+ unpacks the string using FromString() and handles the resulting options as
+ if they were specified on its own command line.
+ */
+ //@{
+
+ /// convert the options to a string
+ String ToString() const;
+
+ /// restore the options from string
+ bool FromString(const String& s);
+
+ //@}
};
Index: MApplication.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MApplication.h,v
retrieving revision 1.92
retrieving revision 1.93
diff -b -u -2 -r1.92 -r1.93
--- MApplication.h 29 Mar 2002 23:07:17 -0000 1.92
+++ MApplication.h 13 Apr 2002 23:34:31 -0000 1.93
@@ -34,4 +34,5 @@
#include "MEvent.h"
+class CmdLineOptions;
class FolderMonitor;
class MAppBase;
@@ -207,5 +208,6 @@
//@}
- /// @name "Away" or unattended mode support
+ /** @name "Away" or unattended mode support
+ */
//@{
@@ -218,4 +220,37 @@
/// exit away mode if necessary
void UpdateAwayMode();
+
+ //@}
+
+ /**
+ @name IPC
+
+ Mahogany can communicate with the other running program instances. The
+ first instance launched sets up a server which can then be used by the
+ subsequently launched copies to either execute their command line
+ arguments or simply to bring the previous appllication window to the
+ foreground.
+ */
+ //@{
+
+ /// return true if a previously launched program copy is already running
+ virtual bool IsAnotherRunning() const = 0;
+
+ /**
+ Execute the actions specified by our command line options (i.e.
+ m_cmdLineOptions) in another process.
+
+ @return true on success, false if it couldn't be done
+ */
+ virtual bool CallAnother() = 0;
+
+ /**
+ Setup the server to reply to the remote calls: this must be done for
+ CallAnother() to work from another process.
+
+ @return true on success, false if an error occured while creating server
+ */
+ virtual bool SetupRemoteCallServer() = 0;
+
//@}
@@ -389,4 +424,13 @@
void InitDirectories();
+ /**
+ Open the composer window(s) as specified by the given options object.
+ Used for handling the options from the command line and also the requests
+ from the remote processes.
+
+ @return true if any composer windows were opened, false otherwise
+ */
+ bool ProcessSendCmdLineOptions(const CmdLineOptions& cmdLineOpts);
+
// global variables stored in the application object
// -------------------------------------------------
@@ -443,5 +487,5 @@
/// the struct containing the command line options
- struct CmdLineOptions *m_cmdLineOptions;
+ CmdLineOptions *m_cmdLineOptions;
private:
Index: Moptions.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/Moptions.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -b -u -2 -r1.45 -r1.46
--- Moptions.h 18 Mar 2002 14:20:06 -0000 1.45
+++ Moptions.h 13 Apr 2002 23:34:31 -0000 1.46
@@ -53,4 +53,5 @@
extern const MOption MP_GLOBALDIR;
+extern const MOption MP_RUNONEONLY;
#ifdef OS_UNIX
@@ -468,5 +469,8 @@
/// the complete path to the glocal M directory
-# define MP_GLOBALDIR_NAME "GlobalDir"
+#define MP_GLOBALDIR_NAME "GlobalDir"
+
+/// run onl one copy of the program at once?
+#define MP_RUNONEONLY_NAME "RunOneOnly"
/// the directory containing the help files
@@ -1239,4 +1243,8 @@
/// the acceptance status of the license
#define MP_LICENSE_ACCEPTED_DEFVAL 0l
+
+/// run onl one copy of the program at once?
+#define MP_RUNONEONLY_DEFVAL 1l
+
// Unix-only entries
#ifdef OS_UNIX
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates