Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv444
Modified Files:
AudacityApp.cpp AudacityApp.h
Log Message:
Add ability to open additional Audacity projects by double clicking in Explorer
when Audacity is already active.
Index: AudacityApp.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudacityApp.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- AudacityApp.h 31 Jul 2006 16:37:48 -0000 1.32
+++ AudacityApp.h 10 Apr 2007 03:57:47 -0000 1.33
@@ -18,6 +18,7 @@
class wxLocale;
class wxSingleInstanceChecker;
+class IPCServ;
void SaveWindowSize();
@@ -124,6 +125,9 @@
wxString mAppHomeDir;
wxString mPresetsDir;
+#if defined(__WXMSW__)
+ IPCServ *mIPCServ;
+#endif
public:
DECLARE_EVENT_TABLE()
};
Index: AudacityApp.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudacityApp.cpp,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -d -r1.165 -r1.166
--- AudacityApp.cpp 29 Mar 2007 04:32:45 -0000 1.165
+++ AudacityApp.cpp 10 Apr 2007 03:57:47 -0000 1.166
@@ -22,6 +22,7 @@
#include <wx/app.h>
#include <wx/docview.h>
#include <wx/event.h>
+#include <wx/ipc.h>
#include <wx/log.h>
#include <wx/window.h>
#include <wx/intl.h>
@@ -245,6 +246,67 @@
QuitAudacity(false);
}
+#if defined(__WXMSW__)
+
+#define IPC_APPL wxT("audacity")
+#define IPC_TOPIC wxT("System")
+
+class IPCConn : public wxConnection
+{
+public:
+ IPCConn()
+ : wxConnection()
+ {
+ };
+
+ ~IPCConn()
+ {
+ };
+
+ bool OnExecute(const wxString & topic,
+ wxChar *data,
+ int size,
+ wxIPCFormat format)
+ {
+ if (!gInited) {
+ return false;
+ }
+
+ AudacityProject *project = GetActiveProject();
+ if (project == NULL || !project->GetTracks()->IsEmpty()) {
+ project = CreateNewAudacityProject(gParentWindow);
+ }
+ project->OpenFile(wxString(data));
+
+ return true;
+ };
+};
+
+class IPCServ : public wxServer
+{
+public:
+ IPCServ()
+ : wxServer()
+ {
+ Create(wxT("audacity"));
+ };
+
+ ~IPCServ()
+ {
+ };
+
+ wxConnectionBase *OnAcceptConnection(const wxString & topic)
+ {
+ if (topic != IPC_TOPIC) {
+ return NULL;
+ }
+
+ return new IPCConn();
+ };
+};
+
+#endif
+
IMPLEMENT_APP(AudacityApp)
#ifdef __WXMAC__
@@ -800,6 +862,10 @@
#endif // Cygwin command-line parser
+#if defined(__WXMSW__)
+ mIPCServ = new IPCServ();
+#endif
+
gInited = true;
return TRUE;
@@ -1085,6 +1151,10 @@
Dispatch();
}
+#if defined(__WXMSW__)
+ delete mIPCServ;
+#endif
+
if(gPrefs)
{
bool bFalse = false;
@@ -1280,6 +1350,24 @@
associateFileTypes.Create(true);
associateFileTypes = (wxString)argv[0] + (wxString)wxT("
\"%1\"");
}
+
+ associateFileTypes.SetName(root_key +
wxT("Audacity.Project\\shell\\open\\ddeexec"));
+ if(!associateFileTypes.Exists()) {
+ associateFileTypes.Create(true);
+ associateFileTypes = wxT("%1");
+ }
+
+ associateFileTypes.SetName(root_key +
wxT("Audacity.Project\\shell\\open\\ddeexec\\Application"));
+ if(!associateFileTypes.Exists()) {
+ associateFileTypes.Create(true);
+ associateFileTypes = IPC_APPL;
+ }
+
+ associateFileTypes.SetName(root_key +
wxT("Audacity.Project\\shell\\open\\ddeexec\\Topic"));
+ if(!associateFileTypes.Exists()) {
+ associateFileTypes.Create(true);
+ associateFileTypes = IPC_TOPIC;
+ }
}
} else {
// User said no. Set a pref so we don't keep asking.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs