00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifdef HAVE_CONFIG_H
00026 #include <config.h>
00027 #endif
00028
00029 #include <wx/wxprec.h>
00030
00031 #ifndef WX_PRECOMP
00032 #include <wx/wx.h>
00033 #endif
00034
00035 #include <iostream>
00036 #include <sys/stat.h>
00037
00038 #include "GenApp.hh"
00039 #include "view/MainFrame.hh"
00040
00041 using namespace emuWorks;
00042
00043 const wxString *GenApp::APP_NAME =
00044 new wxString(wxT(PACKAGE_NAME));
00045
00046 const wxString *GenApp::APP_FULL_NAME =
00047 new wxString(wxT(PACKAGE_FULL_NAME));
00048
00049 const wxString *GenApp::APP_VERSION =
00050 new wxString(wxT(PACKAGE_VERSION));
00051
00052 const wxString *GenApp::APP_COPYRIGHT =
00053 new wxString(wxT("Copyright (C) 2004-2005 emuWorks"));
00054
00055 const wxString *GenApp::APP_URL =
00056 new wxString(wxT("http://games.technoplaza.net/"));
00057
00058 IMPLEMENT_APP(GenApp)
00059 IMPLEMENT_CLASS(GenApp, wxApp)
00060
00061 bool GenApp::OnInit() {
00062 wxString *xrcfile;
00063
00064 if (argc == 2) {
00065 xrcfile = new wxString(argv[1]);
00066 } else {
00067 xrcfile = new wxString(XRC_FILE);
00068 }
00069
00070 struct stat xrcstats;
00071
00072 if (stat(xrcfile->mb_str(), &xrcstats) != 0) {
00073 std::cerr << "error: unable to locate XRC file " <<
00074 xrcfile->mb_str() << std::endl;
00075 return false;
00076 }
00077
00078 wxXmlResource::Get()->InitAllHandlers();
00079 wxXmlResource::Get()->Load(*xrcfile);
00080
00081 MainFrame *frame = new MainFrame;
00082 frame->SetTitle(*APP_FULL_NAME + wxT(' ') + *APP_VERSION);
00083 frame->Show(true);
00084 SetTopWindow(frame);
00085
00086 return true;
00087 }