2003-05-22 15:25:25 +00:00
|
|
|
#include "../xvaga/wxinc.h"
|
2003-04-30 15:43:51 +00:00
|
|
|
|
2008-06-13 08:48:18 +00:00
|
|
|
#include "xvt.h"
|
|
|
|
|
2008-03-28 10:19:02 +00:00
|
|
|
#include <wx/filename.h>
|
|
|
|
#include <wx/snglinst.h>
|
2007-09-26 12:56:57 +00:00
|
|
|
|
2003-05-22 15:25:25 +00:00
|
|
|
extern int xvt_main(int argc, char** argv);
|
2003-04-30 15:43:51 +00:00
|
|
|
|
|
|
|
class TMainApp : public wxApp
|
|
|
|
{
|
2007-10-08 13:45:54 +00:00
|
|
|
wxSingleInstanceChecker* m_sic;
|
2005-10-24 15:21:30 +00:00
|
|
|
|
2005-09-23 15:55:44 +00:00
|
|
|
protected:
|
2003-04-30 15:43:51 +00:00
|
|
|
virtual bool OnInit();
|
2007-09-26 12:56:57 +00:00
|
|
|
virtual int OnExit();
|
2006-04-12 13:11:23 +00:00
|
|
|
virtual void OnTimer(wxTimerEvent& event);
|
2003-04-30 15:43:51 +00:00
|
|
|
|
2008-01-17 11:04:08 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2003-04-30 15:43:51 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(TMainApp);
|
|
|
|
};
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(TMainApp, wxApp)
|
|
|
|
|
|
|
|
IMPLEMENT_APP(TMainApp)
|
|
|
|
|
2006-04-12 13:11:23 +00:00
|
|
|
#define TIMER_ID 883
|
|
|
|
|
2005-09-23 15:55:44 +00:00
|
|
|
BEGIN_EVENT_TABLE(TMainApp, wxApp)
|
2006-04-12 13:11:23 +00:00
|
|
|
EVT_TIMER(TIMER_ID, TMainApp::OnTimer)
|
2005-09-23 15:55:44 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2006-04-12 13:11:23 +00:00
|
|
|
void TMainApp::OnTimer(wxTimerEvent& event)
|
2003-04-30 15:43:51 +00:00
|
|
|
{
|
2008-06-13 08:48:18 +00:00
|
|
|
xvt_app_pre_create();
|
2006-04-12 13:11:23 +00:00
|
|
|
xvt_main(argc, argv);
|
2003-04-30 15:43:51 +00:00
|
|
|
}
|
|
|
|
|
2005-09-23 15:55:44 +00:00
|
|
|
bool TMainApp::OnInit()
|
2003-04-30 15:43:51 +00:00
|
|
|
{
|
2007-10-05 09:28:22 +00:00
|
|
|
wxFileName strWrk = argv[0];
|
|
|
|
const wxString strApp = strWrk.GetName().Lower();
|
2007-09-26 12:56:57 +00:00
|
|
|
m_sic = new wxSingleInstanceChecker(strApp);
|
2008-03-28 10:19:02 +00:00
|
|
|
|
2007-10-08 13:45:54 +00:00
|
|
|
wxTimerEvent evt(TIMER_ID);
|
2006-04-12 13:11:23 +00:00
|
|
|
AddPendingEvent(evt);
|
2007-10-08 13:45:54 +00:00
|
|
|
return true;
|
2003-04-30 15:43:51 +00:00
|
|
|
}
|
2005-09-23 15:55:44 +00:00
|
|
|
|
2007-09-26 12:56:57 +00:00
|
|
|
int TMainApp::OnExit()
|
|
|
|
{
|
|
|
|
delete m_sic;
|
|
|
|
m_sic = NULL;
|
2008-03-28 10:19:02 +00:00
|
|
|
|
2007-09-26 12:56:57 +00:00
|
|
|
return wxApp::OnExit();
|
2008-01-17 11:04:08 +00:00
|
|
|
}
|