[356] | 1 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 2 | // Name: aeinstallerapp.cpp
|
---|
| 3 | // Purpose:
|
---|
| 4 | // Author:
|
---|
| 5 | // Modified by:
|
---|
| 6 | // Created: 07/05/2009 17:23:39
|
---|
| 7 | // RCS-ID:
|
---|
| 8 | // Copyright:
|
---|
| 9 | // Licence:
|
---|
| 10 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 11 |
|
---|
| 12 | #include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
|
---|
| 13 | #include "boost/lexical_cast.hpp" //int -> string
|
---|
| 14 | using namespace boost::filesystem;
|
---|
| 15 | // For compilers that support precompilation, includes "wx/wx.h".
|
---|
| 16 | #include "wx/wxprec.h"
|
---|
| 17 |
|
---|
| 18 | #ifdef __BORLANDC__
|
---|
| 19 | #pragma hdrstop
|
---|
| 20 | #endif
|
---|
| 21 |
|
---|
| 22 | #ifndef WX_PRECOMP
|
---|
| 23 | #include "wx/wx.h"
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
| 26 | ////@begin includes
|
---|
| 27 | ////@end includes
|
---|
| 28 |
|
---|
| 29 | #include "aeinstallerapp.h"
|
---|
| 30 | #include <string>
|
---|
| 31 |
|
---|
| 32 | ////@begin XPM images
|
---|
| 33 | ////@end XPM images
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | /*
|
---|
| 37 | * Application instance implementation
|
---|
| 38 | */
|
---|
| 39 |
|
---|
| 40 | ////@begin implement app
|
---|
| 41 | IMPLEMENT_APP( AEInstallerApp )
|
---|
| 42 | ////@end implement app
|
---|
| 43 |
|
---|
| 44 |
|
---|
| 45 | /*
|
---|
| 46 | * AEInstallerApp type definition
|
---|
| 47 | */
|
---|
| 48 |
|
---|
| 49 | IMPLEMENT_CLASS( AEInstallerApp, wxApp )
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | /*
|
---|
| 53 | * AEInstallerApp event table definition
|
---|
| 54 | */
|
---|
| 55 |
|
---|
| 56 | BEGIN_EVENT_TABLE( AEInstallerApp, wxApp )
|
---|
| 57 |
|
---|
| 58 | ////@begin AEInstallerApp event table entries
|
---|
| 59 | ////@end AEInstallerApp event table entries
|
---|
| 60 |
|
---|
| 61 | END_EVENT_TABLE()
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | /*
|
---|
| 65 | * Constructor for AEInstallerApp
|
---|
| 66 | */
|
---|
| 67 |
|
---|
| 68 | AEInstallerApp::AEInstallerApp()
|
---|
| 69 | {
|
---|
| 70 | Init();
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 |
|
---|
| 74 | /*
|
---|
| 75 | * Member initialisation
|
---|
| 76 | */
|
---|
| 77 |
|
---|
| 78 | void AEInstallerApp::Init()
|
---|
| 79 | {
|
---|
| 80 | ////@begin AEInstallerApp member initialisation
|
---|
| 81 | ////@end AEInstallerApp member initialisation
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | /*
|
---|
| 85 | * Initialisation for AEInstallerApp
|
---|
| 86 | */
|
---|
| 87 |
|
---|
| 88 | bool AEInstallerApp::OnInit()
|
---|
| 89 | {
|
---|
| 90 | ////@begin AEInstallerApp initialisation
|
---|
| 91 | // Remove the comment markers above and below this block
|
---|
| 92 | // to make permanent changes to the code.
|
---|
| 93 |
|
---|
| 94 | #if wxUSE_XPM
|
---|
| 95 | wxImage::AddHandler(new wxXPMHandler);
|
---|
| 96 | #endif
|
---|
| 97 | #if wxUSE_LIBPNG
|
---|
| 98 | wxImage::AddHandler(new wxPNGHandler);
|
---|
| 99 | #endif
|
---|
| 100 | #if wxUSE_LIBJPEG
|
---|
| 101 | wxImage::AddHandler(new wxJPEGHandler);
|
---|
| 102 | #endif
|
---|
| 103 | #if wxUSE_GIF
|
---|
| 104 | wxImage::AddHandler(new wxGIFHandler);
|
---|
| 105 | #endif
|
---|
| 106 | MainWindow* mainWindow = new MainWindow( NULL );
|
---|
| 107 | mainWindow->Show(true);
|
---|
| 108 | ////@end AEInstallerApp initialisation
|
---|
| 109 | TheWindow = mainWindow;
|
---|
| 110 |
|
---|
| 111 | //anything after this is done after the window appears...
|
---|
| 112 | if ( !exists("../GameDataFolder") ) {
|
---|
| 113 | wxMessageDialog* YesNoDialog = new wxMessageDialog(TheWindow, "You haven't globalized yet! \nYou must globalize to use the Anniversary Edition framework. \nWould you like to globalize now? (This could take a while...)\n(Selecting \"No\" will exit this program...)", "AE Installer Alert", wxYES_NO | wxICON_EXCLAMATION , wxDefaultPosition);
|
---|
| 114 |
|
---|
| 115 | if (YesNoDialog->ShowModal() == wxID_NO) { //if the user said no...
|
---|
| 116 | TheWindow->Close();
|
---|
| 117 | }
|
---|
| 118 | else {
|
---|
| 119 | //globalize...
|
---|
| 120 | }
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 | return true;
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | void setStatusArea( string s ) {
|
---|
| 128 | wxString wxs(s.c_str(), wxConvUTF8);
|
---|
| 129 |
|
---|
| 130 | TheWindow->StatusArea->SetStatusText( wxs );
|
---|
| 131 | //TheWindow->StatusArea->SetStatusText(s.c_str());
|
---|
| 132 | //StatusArea->SetStatusText(_(s.c_str()));
|
---|
| 133 | //(*TheStatusBar)->SetStatusText(_(s.c_str()));
|
---|
| 134 | //AEInstallerApp::
|
---|
| 135 | // TheWindow->StatusArea->SetStatusText("hi");
|
---|
| 136 | //mainWindow
|
---|
| 137 | //itemFrame1->StatusArea->SetStatusText(_"lol");
|
---|
| 138 | //MainWindow.StatusArea->SetStatusText("hi");
|
---|
| 139 | // class AbstractStatusNotifier { public: virtual void NotifyStatus(const wxString &statusString) = 0; };
|
---|
| 140 | //class StatusBarStatusNotifier : public AbstractStatusNotifier { wxStatusBar *statusbar; StatusBarStatusNotifier(wxStatusBar *bar) : statusbar(bar) { } ;
|
---|
| 141 | //void NotifyStatus(const wxString &status) { statusbar->SetStatus(status); } }
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 | //MainWindow::StatusArea->
|
---|
| 145 | //MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1);
|
---|
| 146 |
|
---|
| 147 | //MainWindow::StatusBar->SetLabel("Importing Files...");
|
---|
| 148 | //StatusBar->SetLabel(s);
|
---|
| 149 | //->SetLabel(s);
|
---|
| 150 |
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 |
|
---|
| 154 | /*
|
---|
| 155 | * Cleanup for AEInstallerApp
|
---|
| 156 | */
|
---|
| 157 |
|
---|
| 158 | int AEInstallerApp::OnExit()
|
---|
| 159 | {
|
---|
| 160 | ////@begin AEInstallerApp cleanup
|
---|
| 161 | return wxApp::OnExit();
|
---|
| 162 | ////@end AEInstallerApp cleanup
|
---|
| 163 | }
|
---|
| 164 | void doglobalizeData() {
|
---|
| 165 | //TheWindow->Disable();
|
---|
| 166 | globalizeData();
|
---|
| 167 | #ifdef WIN32
|
---|
| 168 | while(1) Sleep(-1);
|
---|
| 169 | #endif
|
---|
| 170 | //TheWindow->Enable();
|
---|
| 171 | //setStatusArea((string)"Test1");
|
---|
| 172 | }
|
---|