source: AE/Installer/trunk/source/aeinstallerapp.cpp@ 368

Last change on this file since 368 was 360, checked in by gumby, 15 years ago

Fixed AEInstallerApp::OnInit()

File size: 4.6 KB
Line 
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#include "boost/thread.hpp"
12#include <boost/thread/mutex.hpp>
13
14#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
15#include "boost/lexical_cast.hpp" //int -> string
16using namespace boost::filesystem;
17// For compilers that support precompilation, includes "wx/wx.h".
18#include "wx/wxprec.h"
19
20#ifdef __BORLANDC__
21#pragma hdrstop
22#endif
23
24#ifndef WX_PRECOMP
25#include "wx/wx.h"
26#endif
27
28////@begin includes
29////@end includes
30
31#include "aeinstallerapp.h"
32#include <string>
33
34////@begin XPM images
35////@end XPM images
36
37
38/*
39 * Application instance implementation
40 */
41
42////@begin implement app
43IMPLEMENT_APP( AEInstallerApp )
44////@end implement app
45
46
47/*
48 * AEInstallerApp type definition
49 */
50
51IMPLEMENT_CLASS( AEInstallerApp, wxApp )
52
53
54/*
55 * AEInstallerApp event table definition
56 */
57
58BEGIN_EVENT_TABLE( AEInstallerApp, wxApp )
59
60////@begin AEInstallerApp event table entries
61////@end AEInstallerApp event table entries
62
63END_EVENT_TABLE()
64
65
66/*
67 * Constructor for AEInstallerApp
68 */
69
70AEInstallerApp::AEInstallerApp()
71{
72 Init();
73}
74
75
76/*
77 * Member initialisation
78 */
79
80void AEInstallerApp::Init()
81{
82 ////@begin AEInstallerApp member initialisation
83 ////@end AEInstallerApp member initialisation
84}
85
86/*
87 * Initialisation for AEInstallerApp
88 */
89
90bool AEInstallerApp::OnInit()
91{
92 ////@begin AEInstallerApp initialisation
93 // Remove the comment markers above and below this block
94 // to make permanent changes to the code.
95
96#if wxUSE_XPM
97 wxImage::AddHandler(new wxXPMHandler);
98#endif
99#if wxUSE_LIBPNG
100 wxImage::AddHandler(new wxPNGHandler);
101#endif
102#if wxUSE_LIBJPEG
103 wxImage::AddHandler(new wxJPEGHandler);
104#endif
105#if wxUSE_GIF
106 wxImage::AddHandler(new wxGIFHandler);
107#endif
108 MainWindow* mainWindow = new MainWindow( NULL );
109 mainWindow->Show(true);
110 ////@end AEInstallerApp initialisation
111 TheWindow = mainWindow;
112
113 //anything after this is done after the window appears...
114 if ( !exists("../GameDataFolder") ) {
115 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);
116
117 if (YesNoDialog->ShowModal() == wxID_NO) { //if the user said no...
118 TheWindow->Close();
119 }
120 else {
121 TheWindow->InstallButton->Disable();
122 TheWindow->ReglobalizeButton->Disable();
123
124#ifdef WIN32
125
126 boost::thread thrd3(globalizeData);
127 //globalizeData();
128 //boost::thread::create_thread(&globalizeData);
129 // boost::thread_group Tg;
130 // Tg.create_thread( &globalizeData(), this );
131#else
132 globalizeData();
133#endif
134
135 TheWindow->InstallButton->Enable();
136 TheWindow->ReglobalizeButton->Enable();
137 }
138 }
139
140 return true;
141}
142
143
144void setStatusArea( string s ) {
145 wxString wxs(s.c_str(), wxConvUTF8);
146
147 TheWindow->StatusArea->SetStatusText( wxs );
148 //TheWindow->StatusArea->SetStatusText(s.c_str());
149 //StatusArea->SetStatusText(_(s.c_str()));
150 //(*TheStatusBar)->SetStatusText(_(s.c_str()));
151 //AEInstallerApp::
152 // TheWindow->StatusArea->SetStatusText("hi");
153 //mainWindow
154 //itemFrame1->StatusArea->SetStatusText(_"lol");
155 //MainWindow.StatusArea->SetStatusText("hi");
156 // class AbstractStatusNotifier { public: virtual void NotifyStatus(const wxString &statusString) = 0; };
157 //class StatusBarStatusNotifier : public AbstractStatusNotifier { wxStatusBar *statusbar; StatusBarStatusNotifier(wxStatusBar *bar) : statusbar(bar) { } ;
158 //void NotifyStatus(const wxString &status) { statusbar->SetStatus(status); } }
159
160
161 //MainWindow::StatusArea->
162 //MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1);
163
164 //MainWindow::StatusBar->SetLabel("Importing Files...");
165 //StatusBar->SetLabel(s);
166 //->SetLabel(s);
167
168}
169
170
171/*
172 * Cleanup for AEInstallerApp
173 */
174
175int AEInstallerApp::OnExit()
176{
177 ////@begin AEInstallerApp cleanup
178 return wxApp::OnExit();
179 ////@end AEInstallerApp cleanup
180}
181void doglobalizeData() {
182 //TheWindow->Disable();
183 globalizeData();
184#ifdef WIN32
185 while(1) Sleep(-1);
186#endif
187 //TheWindow->Enable();
188 //setStatusArea((string)"Test1");
189}
Note: See TracBrowser for help on using the repository browser.