| 1 | /***************************************************************************\ | 
 
 
 
 
 | 2 | | Project: AE Installer                                                                                                         | | 
 
 
 
 
 | 3 | | By: Gumby & Iritscen                                                                                                          | | 
 
 
 
 
 | 4 | | File: Main_Window.cpp                                                                                                         | | 
 
 
 
 
 | 5 | | Function: Handles the GUI.                                                                                            | | 
 
 
 
 
 | 6 | | Created: 07/05/2009 20:38:25                                                                                          | | 
 
 
 
 
 | 7 | \***************************************************************************/ | 
 
 
 
 
 | 8 |  | 
 
 
 
 
 | 9 | #ifndef NTDDI_VERSION | 
 
 
 
 
 | 10 | #define NTDDI_VERSION NTDDI_WIN7 | 
 
 
 
 
 | 11 | #endif | 
 
 
 
 
 | 12 | #ifdef WIN32 | 
 
 
 
 
 | 13 | #include <windows.h> | 
 
 
 
 
 | 14 | #include <shobjidl.h> | 
 
 
 
 
 | 15 | HWND Handle; | 
 
 
 
 
 | 16 | ITaskbarList *pTaskbarList; | 
 
 
 
 
 | 17 | ITaskbarList3 *pTaskbarList3; | 
 
 
 
 
 | 18 | #endif | 
 
 
 
 
 | 19 |  | 
 
 
 
 
 | 20 | #include <boost/thread/mutex.hpp> | 
 
 
 
 
 | 21 | // For compilers that support precompilation, includes "wx/wx.h". | 
 
 
 
 
 | 22 | #include "wx/wxprec.h" | 
 
 
 
 
 | 23 |  | 
 
 
 
 
 | 24 | #ifdef __BORLANDC__ | 
 
 
 
 
 | 25 | #pragma hdrstop | 
 
 
 
 
 | 26 | #endif | 
 
 
 
 
 | 27 |  | 
 
 
 
 
 | 28 | #ifndef WX_PRECOMP | 
 
 
 
 
 | 29 | #include "wx/wx.h" | 
 
 
 
 
 | 30 | #endif | 
 
 
 
 
 | 31 |  | 
 
 
 
 
 | 32 | ////@begin includes | 
 
 
 
 
 | 33 | #include "about.h" | 
 
 
 
 
 | 34 | #include "main_window.h" | 
 
 
 
 
 | 35 | #include "installer.h" | 
 
 
 
 
 | 36 | ////@end includes | 
 
 
 
 
 | 37 |  | 
 
 
 
 
 | 38 | ////@begin XPM images | 
 
 
 
 
 | 39 | #include "aelogosmall.xpm" | 
 
 
 
 
 | 40 | #include "undo.xpm" | 
 
 
 
 
 | 41 | #include "fileopen.xpm" | 
 
 
 
 
 | 42 | #include "filesaveas.xpm" | 
 
 
 
 
 | 43 | #include "quit.xpm" | 
 
 
 
 
 | 44 | ////@end XPM images | 
 
 
 
 
 | 45 |  | 
 
 
 
 
 | 46 | bool busy = false; | 
 
 
 
 
 | 47 | vector<string> globalInstalledMods; | 
 
 
 
 
 | 48 | vector<ModPackage> globalPackages; | 
 
 
 
 
 | 49 | // Variable declarations | 
 
 
 
 
 | 50 | #ifdef WIN32 | 
 
 
 
 
 | 51 | bool splitInstances = true; | 
 
 
 
 
 | 52 | string strImportOption = "-import:nosep"; | 
 
 
 
 
 | 53 | string strOniSplit = "Onisplit.exe"; | 
 
 
 
 
 | 54 | #else | 
 
 
 
 
 | 55 | bool splitInstances = false; | 
 
 
 
 
 | 56 | string strImportOption = "-import:sep"; | 
 
 
 
 
 | 57 | string strOniSplit = "mono Onisplit.exe"; | 
 
 
 
 
 | 58 | #endif | 
 
 
 
 
 | 59 |  | 
 
 
 
 
 | 60 | /* | 
 
 
 
 
 | 61 | * MainWindow type definition | 
 
 
 
 
 | 62 | */ | 
 
 
 
 
 | 63 |  | 
 
 
 
 
 | 64 | IMPLEMENT_CLASS( MainWindow, wxFrame ) | 
 
 
 
 
 | 65 |  | 
 
 
 
 
 | 66 |  | 
 
 
 
 
 | 67 | /* | 
 
 
 
 
 | 68 | * MainWindow event table definition | 
 
 
 
 
 | 69 | */ | 
 
 
 
 
 | 70 |  | 
 
 
 
 
 | 71 | BEGIN_EVENT_TABLE( MainWindow, wxFrame ) | 
 
 
 
 
 | 72 |  | 
 
 
 
 
 | 73 | ////@begin MainWindow event table entries | 
 
 
 
 
 | 74 | EVT_CHECKBOX( SelectAll_Checkbox, MainWindow::OnSelectAllCheckboxClick ) | 
 
 
 
 
 | 75 |  | 
 
 
 
 
 | 76 | EVT_BUTTON( Refresh_Button, MainWindow::OnRefreshButtonClick ) | 
 
 
 
 
 | 77 |  | 
 
 
 
 
 | 78 | EVT_LISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Selected ) | 
 
 
 
 
 | 79 | EVT_CHECKLISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Toggled ) | 
 
 
 
 
 | 80 |  | 
 
 
 
 
 | 81 | EVT_UPDATE_UI( ID_STATUSBAR, MainWindow::OnStatusbarUpdate ) | 
 
 
 
 
 | 82 |  | 
 
 
 
 
 | 83 | EVT_BUTTON( Install_Button, MainWindow::OnInstallButtonClick ) | 
 
 
 
 
 | 84 |  | 
 
 
 
 
 | 85 | EVT_RADIOBUTTON( Sep_RadioButton, MainWindow::OnSepRadioButtonSelected ) | 
 
 
 
 
 | 86 |  | 
 
 
 
 
 | 87 | EVT_RADIOBUTTON( NoSep_RadioButton, MainWindow::OnNoSepRadioButtonSelected ) | 
 
 
 
 
 | 88 |  | 
 
 
 
 
 | 89 | EVT_RADIOBUTTON( Seperated_RadioButton, MainWindow::OnSeperatedRadioButtonSelected ) | 
 
 
 
 
 | 90 |  | 
 
 
 
 
 | 91 | EVT_RADIOBUTTON( Complete_RadioButton, MainWindow::OnCompleteRadioButtonSelected ) | 
 
 
 
 
 | 92 |  | 
 
 
 
 
 | 93 | EVT_BUTTON( ReGlobalize_Button, MainWindow::OnReGlobalizeButtonClick ) | 
 
 
 
 
 | 94 |  | 
 
 
 
 
 | 95 | EVT_MENU( wxID_LOAD, MainWindow::OnLoadClick ) | 
 
 
 
 
 | 96 |  | 
 
 
 
 
 | 97 | EVT_MENU( wxID_SAVE, MainWindow::OnSaveClick ) | 
 
 
 
 
 | 98 |  | 
 
 
 
 
 | 99 | EVT_MENU( wxID_EXIT, MainWindow::OnExitClick ) | 
 
 
 
 
 | 100 |  | 
 
 
 
 
 | 101 | EVT_MENU( wxID_OPTIONS, MainWindow::OnOptionsClick ) | 
 
 
 
 
 | 102 |  | 
 
 
 
 
 | 103 | EVT_MENU( wxID_ABOUT, MainWindow::OnAboutClick ) | 
 
 
 
 
 | 104 |  | 
 
 
 
 
 | 105 | ////@end MainWindow event table entries | 
 
 
 
 
 | 106 |  | 
 
 
 
 
 | 107 | END_EVENT_TABLE() | 
 
 
 
 
 | 108 |  | 
 
 
 
 
 | 109 |  | 
 
 
 
 
 | 110 | /* | 
 
 
 
 
 | 111 | * MainWindow constructors | 
 
 
 
 
 | 112 | */ | 
 
 
 
 
 | 113 |  | 
 
 
 
 
 | 114 | MainWindow::MainWindow() | 
 
 
 
 
 | 115 | { | 
 
 
 
 
 | 116 | Init(); | 
 
 
 
 
 | 117 | } | 
 
 
 
 
 | 118 |  | 
 
 
 
 
 | 119 | MainWindow::MainWindow( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) | 
 
 
 
 
 | 120 | { | 
 
 
 
 
 | 121 | Init(); | 
 
 
 
 
 | 122 | Create( parent, id, caption, pos, size, style ); | 
 
 
 
 
 | 123 | } | 
 
 
 
 
 | 124 |  | 
 
 
 
 
 | 125 |  | 
 
 
 
 
 | 126 | /* | 
 
 
 
 
 | 127 | * MainWindow creator | 
 
 
 
 
 | 128 | */ | 
 
 
 
 
 | 129 |  | 
 
 
 
 
 | 130 | bool MainWindow::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) | 
 
 
 
 
 | 131 | { | 
 
 
 
 
 | 132 | ////@begin MainWindow creation | 
 
 
 
 
 | 133 | wxFrame::Create( parent, id, caption, pos, size, style ); | 
 
 
 
 
 | 134 |  | 
 
 
 
 
 | 135 | CreateControls(); | 
 
 
 
 
 | 136 | SetIcon(GetIconResource(wxT("aelogosmall.png"))); | 
 
 
 
 
 | 137 | Centre(); | 
 
 
 
 
 | 138 | ////@end MainWindow creation | 
 
 
 
 
 | 139 | return true; | 
 
 
 
 
 | 140 | } | 
 
 
 
 
 | 141 |  | 
 
 
 
 
 | 142 | /* | 
 
 
 
 
 | 143 | * MainWindow destructor | 
 
 
 
 
 | 144 | */ | 
 
 
 
 
 | 145 |  | 
 
 
 
 
 | 146 | MainWindow::~MainWindow() | 
 
 
 
 
 | 147 | { | 
 
 
 
 
 | 148 | ////@begin MainWindow destruction | 
 
 
 
 
 | 149 | ////@end MainWindow destruction | 
 
 
 
 
 | 150 | } | 
 
 
 
 
 | 151 |  | 
 
 
 
 
 | 152 | /* | 
 
 
 
 
 | 153 | * Member initialisation | 
 
 
 
 
 | 154 | */ | 
 
 
 
 
 | 155 |  | 
 
 
 
 
 | 156 | void MainWindow::Init() | 
 
 
 
 
 | 157 | { | 
 
 
 
 
 | 158 | ////@begin MainWindow member initialisation | 
 
 
 
 
 | 159 | MainSplitter = NULL; | 
 
 
 
 
 | 160 | SelectAll = NULL; | 
 
 
 
 
 | 161 | RefreshButton = NULL; | 
 
 
 
 
 | 162 | Mods_CheckboxList = NULL; | 
 
 
 
 
 | 163 | titleText = NULL; | 
 
 
 
 
 | 164 | creatorText = NULL; | 
 
 
 
 
 | 165 | descriptionText = NULL; | 
 
 
 
 
 | 166 | StatusArea = NULL; | 
 
 
 
 
 | 167 | ProgressBar = NULL; | 
 
 
 
 
 | 168 | InstallButton = NULL; | 
 
 
 
 
 | 169 | OptionsPanel = NULL; | 
 
 
 
 
 | 170 | SepRadio = NULL; | 
 
 
 
 
 | 171 | NoSepRadio = NULL; | 
 
 
 
 
 | 172 | SeperatedRadio = NULL; | 
 
 
 
 
 | 173 | CompleteRadio = NULL; | 
 
 
 
 
 | 174 | ReglobalizeButton = NULL; | 
 
 
 
 
 | 175 | ////@end MainWindow member initialisation | 
 
 
 
 
 | 176 | } | 
 
 
 
 
 | 177 |  | 
 
 
 
 
 | 178 | /* | 
 
 
 
 
 | 179 | * Control creation for MainWindow | 
 
 
 
 
 | 180 | */ | 
 
 
 
 
 | 181 | wxStatusBar **TheStatusBar; | 
 
 
 
 
 | 182 | wxButton* TheInstallButton; | 
 
 
 
 
 | 183 | wxGauge* TheProgressBar; | 
 
 
 
 
 | 184 | void MainWindow::CreateControls() | 
 
 
 
 
 | 185 | { | 
 
 
 
 
 | 186 | ////@begin MainWindow content construction | 
 
 
 
 
 | 187 | MainWindow* itemFrame1 = this; | 
 
 
 
 
 | 188 |  | 
 
 
 
 
 | 189 | wxMenuBar* menuBar = new wxMenuBar; | 
 
 
 
 
 | 190 | wxMenu* itemMenu37 = new wxMenu; | 
 
 
 
 
 | 191 | { | 
 
 
 
 
 | 192 | wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_LOAD, _("&Load Configuration..."), wxEmptyString, wxITEM_NORMAL); | 
 
 
 
 
 | 193 | wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("fileopen.xpm"))); | 
 
 
 
 
 | 194 | menuItem->SetBitmap(bitmap); | 
 
 
 
 
 | 195 | itemMenu37->Append(menuItem); | 
 
 
 
 
 | 196 | } | 
 
 
 
 
 | 197 | { | 
 
 
 
 
 | 198 | wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_SAVE, _("&Save Configuration..."), wxEmptyString, wxITEM_NORMAL); | 
 
 
 
 
 | 199 | wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("filesaveas.xpm"))); | 
 
 
 
 
 | 200 | menuItem->SetBitmap(bitmap); | 
 
 
 
 
 | 201 | itemMenu37->Append(menuItem); | 
 
 
 
 
 | 202 | } | 
 
 
 
 
 | 203 | itemMenu37->AppendSeparator(); | 
 
 
 
 
 | 204 | { | 
 
 
 
 
 | 205 | wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_EXIT, _("Exit"), wxEmptyString, wxITEM_NORMAL); | 
 
 
 
 
 | 206 | wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("quit.xpm"))); | 
 
 
 
 
 | 207 | menuItem->SetBitmap(bitmap); | 
 
 
 
 
 | 208 | itemMenu37->Append(menuItem); | 
 
 
 
 
 | 209 | } | 
 
 
 
 
 | 210 | menuBar->Append(itemMenu37, _("&File")); | 
 
 
 
 
 | 211 | wxMenu* itemMenu42 = new wxMenu; | 
 
 
 
 
 | 212 | itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK); | 
 
 
 
 
 | 213 | menuBar->Append(itemMenu42, _("Options")); | 
 
 
 
 
 | 214 | //#ifdef WIN32 | 
 
 
 
 
 | 215 | //      itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); | 
 
 
 
 
 | 216 | //      menuBar->Append(itemMenu44, _("Help")); | 
 
 
 
 
 | 217 | //#else | 
 
 
 
 
 | 218 | itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); | 
 
 
 
 
 | 219 | //#endif | 
 
 
 
 
 | 220 |  | 
 
 
 
 
 | 221 | itemFrame1->SetMenuBar(menuBar); | 
 
 
 
 
 | 222 |  | 
 
 
 
 
 | 223 | wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); | 
 
 
 
 
 | 224 | itemFrame1->SetSizer(itemBoxSizer2); | 
 
 
 
 
 | 225 |  | 
 
 
 
 
 | 226 | MainSplitter = new wxSplitterWindow( itemFrame1, ID_SPLITTERWINDOW, wxDefaultPosition, wxSize(100, 100), wxSP_LIVE_UPDATE|wxNO_BORDER ); | 
 
 
 
 
 | 227 | MainSplitter->SetMinimumPaneSize(1); | 
 
 
 
 
 | 228 | MainSplitter->SetName(_T("MainSplitter")); | 
 
 
 
 
 | 229 |  | 
 
 
 
 
 | 230 | wxPanel* itemPanel4 = new wxPanel( MainSplitter, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); | 
 
 
 
 
 | 231 | wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); | 
 
 
 
 
 | 232 | itemPanel4->SetSizer(itemBoxSizer5); | 
 
 
 
 
 | 233 |  | 
 
 
 
 
 | 234 | wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL); | 
 
 
 
 
 | 235 | itemBoxSizer5->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0); | 
 
 
 
 
 | 236 | SelectAll = new wxCheckBox( itemPanel4, SelectAll_Checkbox, _("Select All/None"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); | 
 
 
 
 
 | 237 | SelectAll->SetValue(false); | 
 
 
 
 
 | 238 | SelectAll->SetName(_T("SelectAll_Checkbox")); | 
 
 
 
 
 | 239 | itemBoxSizer6->Add(SelectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | 
 
 
 
 
 | 240 |  | 
 
 
 
 
 | 241 | RefreshButton = new wxBitmapButton( itemPanel4, Refresh_Button, itemFrame1->GetBitmapResource(wxT("undo.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); | 
 
 
 
 
 | 242 | RefreshButton->SetName(_T("RefreshButton")); | 
 
 
 
 
 | 243 | itemBoxSizer6->Add(RefreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); | 
 
 
 
 
 | 244 |  | 
 
 
 
 
 | 245 | wxArrayString Mods_CheckboxListStrings; | 
 
 
 
 
 | 246 | Mods_CheckboxList = new wxCheckListBox( itemPanel4, Mods_CheckboxList1, wxDefaultPosition, wxDefaultSize, Mods_CheckboxListStrings, wxLB_HSCROLL ); | 
 
 
 
 
 | 247 | Mods_CheckboxList->SetName(_T("Mods_CheckboxList")); | 
 
 
 
 
 | 248 | itemBoxSizer5->Add(Mods_CheckboxList, 1, wxGROW|wxALL, 0); | 
 
 
 
 
 | 249 |  | 
 
 
 
 
 | 250 | wxPanel* itemPanel10 = new wxPanel( MainSplitter, DescriptionHolder_Panel, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); | 
 
 
 
 
 | 251 | itemPanel10->SetName(_T("DescriptionHolder_Panel")); | 
 
 
 
 
 | 252 | wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL); | 
 
 
 
 
 | 253 | itemPanel10->SetSizer(itemBoxSizer11); | 
 
 
 
 
 | 254 |  | 
 
 
 
 
 | 255 | wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL); | 
 
 
 
 
 | 256 | itemBoxSizer11->Add(itemBoxSizer12, 0, wxGROW|wxALL, 0); | 
 
 
 
 
 | 257 | wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL); | 
 
 
 
 
 | 258 | itemBoxSizer12->Add(itemBoxSizer13, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0); | 
 
 
 
 
 | 259 | titleText = new wxTextCtrl( itemPanel10, Title_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); | 
 
 
 
 
 | 260 | titleText->SetName(_T("Title_Text")); | 
 
 
 
 
 | 261 | titleText->SetBackgroundColour(wxColour(240, 240, 240)); | 
 
 
 
 
 | 262 | itemBoxSizer13->Add(titleText, 1, wxGROW|wxLEFT, 5); | 
 
 
 
 
 | 263 |  | 
 
 
 
 
 | 264 | wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL); | 
 
 
 
 
 | 265 | itemBoxSizer12->Add(itemBoxSizer15, 1, wxGROW|wxALL, 0); | 
 
 
 
 
 | 266 | creatorText = new wxTextCtrl( itemPanel10, Author_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RIGHT ); | 
 
 
 
 
 | 267 | creatorText->SetName(_T("Author_Text")); | 
 
 
 
 
 | 268 | creatorText->SetBackgroundColour(wxColour(240, 240, 240)); | 
 
 
 
 
 | 269 | itemBoxSizer15->Add(creatorText, 1, wxGROW|wxRIGHT, 5); | 
 
 
 
 
 | 270 |  | 
 
 
 
 
 | 271 | wxStaticLine* itemStaticLine17 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); | 
 
 
 
 
 | 272 | itemStaticLine17->Show(false); | 
 
 
 
 
 | 273 | itemBoxSizer11->Add(itemStaticLine17, 0, wxGROW|wxALL, 5); | 
 
 
 
 
 | 274 |  | 
 
 
 
 
 | 275 | descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_RICH2 ); | 
 
 
 
 
 | 276 | descriptionText->SetName(_T("DescriptionName")); | 
 
 
 
 
 | 277 | descriptionText->SetBackgroundColour(wxColour(240, 240, 240)); | 
 
 
 
 
 | 278 | itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5); | 
 
 
 
 
 | 279 |  | 
 
 
 
 
 | 280 | MainSplitter->SplitVertically(itemPanel4, itemPanel10, 200); | 
 
 
 
 
 | 281 | itemBoxSizer2->Add(MainSplitter, 1, wxGROW|wxALL, 0); | 
 
 
 
 
 | 282 |  | 
 
 
 
 
 | 283 | StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 ); | 
 
 
 
 
 | 284 | StatusArea->SetName(_T("StatusArea")); | 
 
 
 
 
 | 285 | StatusArea->SetFieldsCount(1); | 
 
 
 
 
 | 286 | string versionText = "AE Installer v" + (string)INSTALLER_VERSION; | 
 
 
 
 
 | 287 | StatusArea->SetStatusText(versionText.c_str(), 0); | 
 
 
 
 
 | 288 | itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0); | 
 
 
 
 
 | 289 |  | 
 
 
 
 
 | 290 | wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); | 
 
 
 
 
 | 291 | itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 0); | 
 
 
 
 
 | 292 |  | 
 
 
 
 
 | 293 | ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxDefaultSize, wxGA_SMOOTH ); | 
 
 
 
 
 | 294 | ProgressBar->SetValue(0); | 
 
 
 
 
 | 295 | itemBoxSizer20->Add(ProgressBar, 1, wxGROW|wxALL, 0); | 
 
 
 
 
 | 296 |  | 
 
 
 
 
 | 297 | InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxDefaultSize, 0 ); | 
 
 
 
 
 | 298 | itemBoxSizer20->Add(InstallButton, 0, wxGROW|wxALL, 0); | 
 
 
 
 
 | 299 |  | 
 
 
 
 
 | 300 | wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL); | 
 
 
 
 
 | 301 | itemBoxSizer2->Add(itemBoxSizer23, 0, wxGROW|wxALL, 0); | 
 
 
 
 
 | 302 |  | 
 
 
 
 
 | 303 | OptionsPanel = new wxPanel( itemFrame1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); | 
 
 
 
 
 | 304 | itemBoxSizer2->Add(OptionsPanel, 0, wxGROW, 0); | 
 
 
 
 
 | 305 |  | 
 
 
 
 
 | 306 | wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL); | 
 
 
 
 
 | 307 | OptionsPanel->SetSizer(itemBoxSizer25); | 
 
 
 
 
 | 308 |  | 
 
 
 
 
 | 309 | wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL); | 
 
 
 
 
 | 310 | itemBoxSizer25->Add(itemBoxSizer26, 0, wxGROW|wxALL, 5); | 
 
 
 
 
 | 311 |  | 
 
 
 
 
 | 312 | SepRadio = new wxRadioButton( OptionsPanel, Sep_RadioButton, _("Sep"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); | 
 
 
 
 
 | 313 | SepRadio->SetValue(false); | 
 
 
 
 
 | 314 | if (MainWindow::ShowToolTips()) | 
 
 
 
 
 | 315 | SepRadio->SetToolTip(_("For PC Demo and Mac")); | 
 
 
 
 
 | 316 | itemBoxSizer26->Add(SepRadio, 0, wxALIGN_LEFT|wxALL, 5); | 
 
 
 
 
 | 317 |  | 
 
 
 
 
 | 318 | NoSepRadio = new wxRadioButton( OptionsPanel, NoSep_RadioButton, _("NoSep"), wxDefaultPosition, wxDefaultSize, 0 ); | 
 
 
 
 
 | 319 | NoSepRadio->SetValue(false); | 
 
 
 
 
 | 320 | if (MainWindow::ShowToolTips()) | 
 
 
 
 
 | 321 | NoSepRadio->SetToolTip(_("For PC Retail")); | 
 
 
 
 
 | 322 | itemBoxSizer26->Add(NoSepRadio, 0, wxALIGN_LEFT|wxALL, 5); | 
 
 
 
 
 | 323 |  | 
 
 
 
 
 | 324 | wxStaticLine* itemStaticLine29 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); | 
 
 
 
 
 | 325 | itemBoxSizer25->Add(itemStaticLine29, 0, wxGROW|wxALL, 5); | 
 
 
 
 
 | 326 |  | 
 
 
 
 
 | 327 | wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL); | 
 
 
 
 
 | 328 | itemBoxSizer25->Add(itemBoxSizer30, 0, wxGROW|wxALL, 5); | 
 
 
 
 
 | 329 |  | 
 
 
 
 
 | 330 | SeperatedRadio = new wxRadioButton( OptionsPanel, Seperated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); | 
 
 
 
 
 | 331 | SeperatedRadio->SetValue(false); | 
 
 
 
 
 | 332 | SeperatedRadio->SetName(_T("Seperated_RadioButton")); | 
 
 
 
 
 | 333 | itemBoxSizer30->Add(SeperatedRadio, 0, wxALIGN_LEFT|wxALL, 5); | 
 
 
 
 
 | 334 |  | 
 
 
 
 
 | 335 | CompleteRadio = new wxRadioButton( OptionsPanel, Complete_RadioButton, _("Complete Level0"), wxDefaultPosition, wxDefaultSize, 0 ); | 
 
 
 
 
 | 336 | CompleteRadio->SetValue(false); | 
 
 
 
 
 | 337 | CompleteRadio->SetName(_T("Complete_RadioButton")); | 
 
 
 
 
 | 338 | itemBoxSizer30->Add(CompleteRadio, 0, wxALIGN_LEFT|wxALL, 5); | 
 
 
 
 
 | 339 |  | 
 
 
 
 
 | 340 | wxStaticLine* itemStaticLine33 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); | 
 
 
 
 
 | 341 | itemBoxSizer25->Add(itemStaticLine33, 0, wxGROW|wxALL, 5); | 
 
 
 
 
 | 342 |  | 
 
 
 
 
 | 343 | wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL); | 
 
 
 
 
 | 344 | itemBoxSizer25->Add(itemBoxSizer34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | 
 
 
 
 
 | 345 |  | 
 
 
 
 
 | 346 | ReglobalizeButton = new wxButton( OptionsPanel, ReGlobalize_Button, _("Reglobalize"), wxDefaultPosition, wxDefaultSize, 0 ); | 
 
 
 
 
 | 347 | ReglobalizeButton->SetName(_T("Reglobalize_Button")); | 
 
 
 
 
 | 348 | itemBoxSizer34->Add(ReglobalizeButton, 0, wxGROW|wxALL, 5); | 
 
 
 
 
 | 349 |  | 
 
 
 
 
 | 350 | // Connect events and objects | 
 
 
 
 
 | 351 | Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this); | 
 
 
 
 
 | 352 | ////@end MainWindow content construction | 
 
 
 
 
 | 353 | #ifdef WIN32 | 
 
 
 
 
 | 354 | Handle = (HWND)GetHWND(); | 
 
 
 
 
 | 355 | ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList); | 
 
 
 
 
 | 356 | #endif | 
 
 
 
 
 | 357 |  | 
 
 
 
 
 | 358 | globalPackages = getPackages(); | 
 
 
 
 
 | 359 | globalInstalledMods = getInstallString(); | 
 
 
 
 
 | 360 | for (unsigned int i = 0; i < globalPackages.size(); i++) { | 
 
 
 
 
 | 361 | Mods_CheckboxList->Append(globalPackages[i].name.c_str()); | 
 
 
 
 
 | 362 | if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); | 
 
 
 
 
 | 363 | } | 
 
 
 
 
 | 364 |  | 
 
 
 
 
 | 365 | TheStatusBar = &StatusArea; | 
 
 
 
 
 | 366 | TheInstallButton = InstallButton; | 
 
 
 
 
 | 367 | TheProgressBar = ProgressBar; | 
 
 
 
 
 | 368 | OptionsPanel->Hide(); | 
 
 
 
 
 | 369 |  | 
 
 
 
 
 | 370 | if(splitInstances) SeperatedRadio->SetValue(true); | 
 
 
 
 
 | 371 | else CompleteRadio->SetValue(true); | 
 
 
 
 
 | 372 | if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true); | 
 
 
 
 
 | 373 | else SepRadio->SetValue(true); | 
 
 
 
 
 | 374 |  | 
 
 
 
 
 | 375 | #ifdef WIN32 | 
 
 
 
 
 | 376 | RedirectIOToConsole(); | 
 
 
 
 
 | 377 | HWND hWnd = GetConsoleWindow(); | 
 
 
 
 
 | 378 | ShowWindow( hWnd, SW_HIDE ); | 
 
 
 
 
 | 379 | #endif | 
 
 
 
 
 | 380 | } | 
 
 
 
 
 | 381 |  | 
 
 
 
 
 | 382 | /* | 
 
 
 
 
 | 383 | * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for SelectAll_Checkbox | 
 
 
 
 
 | 384 | */ | 
 
 
 
 
 | 385 |  | 
 
 
 
 
 | 386 | void MainWindow::OnSelectAllCheckboxClick( wxCommandEvent& event ) | 
 
 
 
 
 | 387 | { | 
 
 
 
 
 | 388 | switch(SelectAll->Get3StateValue()) { | 
 
 
 
 
 | 389 | case wxCHK_UNCHECKED: | 
 
 
 
 
 | 390 | for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); | 
 
 
 
 
 | 391 | break; | 
 
 
 
 
 | 392 | case wxCHK_CHECKED: | 
 
 
 
 
 | 393 | for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true); | 
 
 
 
 
 | 394 | break; | 
 
 
 
 
 | 395 | case wxCHK_UNDETERMINED: | 
 
 
 
 
 | 396 | for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); | 
 
 
 
 
 | 397 | break; | 
 
 
 
 
 | 398 | } | 
 
 
 
 
 | 399 | } | 
 
 
 
 
 | 400 |  | 
 
 
 
 
 | 401 | /* | 
 
 
 
 
 | 402 | * wxEVT_CREATE event handler for Mods_CheckboxList | 
 
 
 
 
 | 403 | */ | 
 
 
 
 
 | 404 |  | 
 
 
 
 
 | 405 | void MainWindow::ModList_OnCreate( wxWindowCreateEvent& event ) | 
 
 
 
 
 | 406 | { | 
 
 
 
 
 | 407 |  | 
 
 
 
 
 | 408 | } | 
 
 
 
 
 | 409 |  | 
 
 
 
 
 | 410 |  | 
 
 
 
 
 | 411 | /* | 
 
 
 
 
 | 412 | * Should we show tooltips? | 
 
 
 
 
 | 413 | */ | 
 
 
 
 
 | 414 |  | 
 
 
 
 
 | 415 | bool MainWindow::ShowToolTips() | 
 
 
 
 
 | 416 | { | 
 
 
 
 
 | 417 | return true; | 
 
 
 
 
 | 418 | } | 
 
 
 
 
 | 419 |  | 
 
 
 
 
 | 420 | /* | 
 
 
 
 
 | 421 | * Get bitmap resources | 
 
 
 
 
 | 422 | */ | 
 
 
 
 
 | 423 |  | 
 
 
 
 
 | 424 | wxBitmap MainWindow::GetBitmapResource( const wxString& name ) | 
 
 
 
 
 | 425 | { | 
 
 
 
 
 | 426 | // Bitmap retrieval | 
 
 
 
 
 | 427 | ////@begin MainWindow bitmap retrieval | 
 
 
 
 
 | 428 | wxUnusedVar(name); | 
 
 
 
 
 | 429 | if (name == _T("undo.xpm")) | 
 
 
 
 
 | 430 | { | 
 
 
 
 
 | 431 | wxBitmap bitmap( undo_xpm); | 
 
 
 
 
 | 432 | return bitmap; | 
 
 
 
 
 | 433 | } | 
 
 
 
 
 | 434 | else if (name == _T("fileopen.xpm")) | 
 
 
 
 
 | 435 | { | 
 
 
 
 
 | 436 | wxBitmap bitmap( fileopen_xpm); | 
 
 
 
 
 | 437 | return bitmap; | 
 
 
 
 
 | 438 | } | 
 
 
 
 
 | 439 | else if (name == _T("filesaveas.xpm")) | 
 
 
 
 
 | 440 | { | 
 
 
 
 
 | 441 | wxBitmap bitmap( filesaveas_xpm); | 
 
 
 
 
 | 442 | return bitmap; | 
 
 
 
 
 | 443 | } | 
 
 
 
 
 | 444 | else if (name == _T("quit.xpm")) | 
 
 
 
 
 | 445 | { | 
 
 
 
 
 | 446 | wxBitmap bitmap( quit_xpm); | 
 
 
 
 
 | 447 | return bitmap; | 
 
 
 
 
 | 448 | } | 
 
 
 
 
 | 449 | return wxNullBitmap; | 
 
 
 
 
 | 450 | ////@end MainWindow bitmap retrieval | 
 
 
 
 
 | 451 | } | 
 
 
 
 
 | 452 |  | 
 
 
 
 
 | 453 | /* | 
 
 
 
 
 | 454 | * Get icon resources | 
 
 
 
 
 | 455 | */ | 
 
 
 
 
 | 456 |  | 
 
 
 
 
 | 457 | wxIcon MainWindow::GetIconResource( const wxString& name ) | 
 
 
 
 
 | 458 | { | 
 
 
 
 
 | 459 | // Icon retrieval | 
 
 
 
 
 | 460 | ////@begin MainWindow icon retrieval | 
 
 
 
 
 | 461 | wxUnusedVar(name); | 
 
 
 
 
 | 462 | if (name == _T("aelogosmall.png")) | 
 
 
 
 
 | 463 | { | 
 
 
 
 
 | 464 | wxIcon icon(aelogosmall_xpm); | 
 
 
 
 
 | 465 | return icon; | 
 
 
 
 
 | 466 | } | 
 
 
 
 
 | 467 | return wxNullIcon; | 
 
 
 
 
 | 468 | ////@end MainWindow icon retrieval | 
 
 
 
 
 | 469 | } | 
 
 
 
 
 | 470 |  | 
 
 
 
 
 | 471 | /* | 
 
 
 
 
 | 472 | * wxEVT_COMMAND_LISTBOX_SELECTED event handler for Mods_CheckboxList1 | 
 
 
 
 
 | 473 | */ | 
 
 
 
 
 | 474 |  | 
 
 
 
 
 | 475 | void MainWindow::OnModsCheckboxList1Selected( wxCommandEvent& event ) | 
 
 
 
 
 | 476 | { | 
 
 
 
 
 | 477 | titleText->SetValue(globalPackages[event.GetSelection()].name.c_str()); | 
 
 
 
 
 | 478 | creatorText->SetValue(globalPackages[event.GetSelection()].creator.c_str()); | 
 
 
 
 
 | 479 | descriptionText->SetValue(globalPackages[event.GetSelection()].readme.c_str()); | 
 
 
 
 
 | 480 | } | 
 
 
 
 
 | 481 |  | 
 
 
 
 
 | 482 | /* | 
 
 
 
 
 | 483 | * wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event handler for Mods_CheckboxList1 | 
 
 
 
 
 | 484 | */ | 
 
 
 
 
 | 485 |  | 
 
 
 
 
 | 486 | void MainWindow::OnModsCheckboxList1Toggled( wxCommandEvent& event ) | 
 
 
 
 
 | 487 | { | 
 
 
 
 
 | 488 | SelectAll->Set3StateValue(wxCHK_UNDETERMINED); | 
 
 
 
 
 | 489 | if(event.GetInt()) { | 
 
 
 
 
 | 490 | /* | 
 
 
 
 
 | 491 | switch(SelectAll->Get3StateValue()) { | 
 
 
 
 
 | 492 | case wxCHK_UNCHECKED: | 
 
 
 
 
 | 493 | break; | 
 
 
 
 
 | 494 | case wxCHK_CHECKED: | 
 
 
 
 
 | 495 | break; | 
 
 
 
 
 | 496 | case wxCHK_UNDETERMINED : | 
 
 
 
 
 | 497 | break; | 
 
 
 
 
 | 498 | } | 
 
 
 
 
 | 499 | */ | 
 
 
 
 
 | 500 | } | 
 
 
 
 
 | 501 | } | 
 
 
 
 
 | 502 |  | 
 
 
 
 
 | 503 |  | 
 
 
 
 
 | 504 | /* | 
 
 
 
 
 | 505 | * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_OPTIONS | 
 
 
 
 
 | 506 | */ | 
 
 
 
 
 | 507 |  | 
 
 
 
 
 | 508 | void MainWindow::OnOptionsClick( wxCommandEvent& event ) | 
 
 
 
 
 | 509 | { | 
 
 
 
 
 | 510 | if (!event.GetInt() ) { | 
 
 
 
 
 | 511 | OptionsPanel->Hide(); | 
 
 
 
 
 | 512 |  | 
 
 
 
 
 | 513 | this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());} | 
 
 
 
 
 | 514 | else { | 
 
 
 
 
 | 515 | wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: These options are for advanced users only, use with caution.", | 
 
 
 
 
 | 516 | "AE Installer Alert",  wxOK | wxICON_EXCLAMATION     , wxDefaultPosition); | 
 
 
 
 
 | 517 | YesNoDialog->ShowModal(); | 
 
 
 
 
 | 518 | OptionsPanel->Show(); | 
 
 
 
 
 | 519 | this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight()+1); | 
 
 
 
 
 | 520 | this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-1); | 
 
 
 
 
 | 521 | } | 
 
 
 
 
 | 522 | } | 
 
 
 
 
 | 523 |  | 
 
 
 
 
 | 524 | /* | 
 
 
 
 
 | 525 | * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT | 
 
 
 
 
 | 526 | */ | 
 
 
 
 
 | 527 |  | 
 
 
 
 
 | 528 | void MainWindow::OnExitClick( wxCommandEvent& event ) | 
 
 
 
 
 | 529 | { | 
 
 
 
 
 | 530 | exit(0); | 
 
 
 
 
 | 531 | } | 
 
 
 
 
 | 532 |  | 
 
 
 
 
 | 533 | /* | 
 
 
 
 
 | 534 | * wxEVT_COMMAND_BUTTON_CLICKED event handler for Install_Button | 
 
 
 
 
 | 535 | */ | 
 
 
 
 
 | 536 |  | 
 
 
 
 
 | 537 | struct recompile | 
 
 
 
 
 | 538 | { | 
 
 
 
 
 | 539 | recompile(vector<string> localPackages) : thePackages(localPackages) { } | 
 
 
 
 
 | 540 | void operator()() | 
 
 
 
 
 | 541 | { | 
 
 
 
 
 | 542 | TheInstallButton->Disable(); | 
 
 
 
 
 | 543 | recompileAll(thePackages); | 
 
 
 
 
 | 544 | TheInstallButton->Enable(); | 
 
 
 
 
 | 545 |  | 
 
 
 
 
 | 546 | } | 
 
 
 
 
 | 547 | vector<string> thePackages; | 
 
 
 
 
 | 548 | }; | 
 
 
 
 
 | 549 |  | 
 
 
 
 
 | 550 | void globalize2(void) { | 
 
 
 
 
 | 551 | TheInstallButton->Disable(); | 
 
 
 
 
 | 552 | globalizeData(); | 
 
 
 
 
 | 553 | TheInstallButton->Enable(); | 
 
 
 
 
 | 554 | } | 
 
 
 
 
 | 555 |  | 
 
 
 
 
 | 556 | void MainWindow::OnInstallButtonClick( wxCommandEvent& event ) | 
 
 
 
 
 | 557 | { | 
 
 
 
 
 | 558 | vector<string> localPackages; | 
 
 
 
 
 | 559 | localPackages.push_back("00000Globalize"); | 
 
 
 
 
 | 560 | for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); | 
 
 
 
 
 | 561 | if ( !localPackages.empty() )   { | 
 
 
 
 
 | 562 | sort(localPackages.begin(), localPackages.end()); | 
 
 
 
 
 | 563 | localPackages[0] = "Globalize"; | 
 
 
 
 
 | 564 | this->InstallButton->Disable(); | 
 
 
 
 
 | 565 | this->ReglobalizeButton->Disable(); | 
 
 
 
 
 | 566 | #ifdef WIN32 | 
 
 
 
 
 | 567 | recompile packages(localPackages); | 
 
 
 
 
 | 568 | boost::thread thrd(packages); | 
 
 
 
 
 | 569 | #else | 
 
 
 
 
 | 570 | recompileAll(localPackages); | 
 
 
 
 
 | 571 | #endif | 
 
 
 
 
 | 572 | this->InstallButton->Enable(); | 
 
 
 
 
 | 573 | this->ReglobalizeButton->Enable(); | 
 
 
 
 
 | 574 | } | 
 
 
 
 
 | 575 | } | 
 
 
 
 
 | 576 |  | 
 
 
 
 
 | 577 | void setProgressBar( int i ) | 
 
 
 
 
 | 578 | { | 
 
 
 
 
 | 579 | #ifdef WIN32 | 
 
 
 
 
 | 580 | if (SUCCEEDED(pTaskbarList->QueryInterface(IID_ITaskbarList3, (void **)&pTaskbarList3))) | 
 
 
 
 
 | 581 | { | 
 
 
 
 
 | 582 | pTaskbarList3->SetProgressValue(Handle,i, 1000); | 
 
 
 
 
 | 583 | if ( i == 0 ) | 
 
 
 
 
 | 584 | { | 
 
 
 
 
 | 585 | pTaskbarList3->SetProgressState(Handle,TBPF_NOPROGRESS); | 
 
 
 
 
 | 586 | } | 
 
 
 
 
 | 587 | } | 
 
 
 
 
 | 588 | #endif | 
 
 
 
 
 | 589 | TheProgressBar->SetValue(i); | 
 
 
 
 
 | 590 | } | 
 
 
 
 
 | 591 |  | 
 
 
 
 
 | 592 | /* | 
 
 
 
 
 | 593 | * wxEVT_UPDATE_UI event handler for ID_STATUSBAR | 
 
 
 
 
 | 594 | */ | 
 
 
 
 
 | 595 |  | 
 
 
 
 
 | 596 | void MainWindow::OnStatusbarUpdate( wxUpdateUIEvent& event ) | 
 
 
 
 
 | 597 | { | 
 
 
 
 
 | 598 | ////@begin wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow. | 
 
 
 
 
 | 599 | // Before editing this code, remove the block markers. | 
 
 
 
 
 | 600 | event.Skip(); | 
 
 
 
 
 | 601 | ////@end wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow. | 
 
 
 
 
 | 602 | } | 
 
 
 
 
 | 603 |  | 
 
 
 
 
 | 604 | /* | 
 
 
 
 
 | 605 | * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT | 
 
 
 
 
 | 606 | */ | 
 
 
 
 
 | 607 |  | 
 
 
 
 
 | 608 | void MainWindow::OnAboutClick( wxCommandEvent& event ) | 
 
 
 
 
 | 609 | { | 
 
 
 
 
 | 610 | ////@begin wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. | 
 
 
 
 
 | 611 | // Before editing this code, remove the block markers. | 
 
 
 
 
 | 612 | // TODO: Make About window work again! | 
 
 
 
 
 | 613 | About* window = new About(this); | 
 
 
 
 
 | 614 | window->Destroy(); | 
 
 
 
 
 | 615 | ////@end wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. | 
 
 
 
 
 | 616 | } | 
 
 
 
 
 | 617 |  | 
 
 
 
 
 | 618 | /* | 
 
 
 
 
 | 619 | * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for NoSep_RadioButton | 
 
 
 
 
 | 620 | */ | 
 
 
 
 
 | 621 |  | 
 
 
 
 
 | 622 | void MainWindow::OnNoSepRadioButtonSelected( wxCommandEvent& event ) | 
 
 
 
 
 | 623 | { | 
 
 
 
 
 | 624 | static_cast<string>("-import:nosep"); | 
 
 
 
 
 | 625 | } | 
 
 
 
 
 | 626 |  | 
 
 
 
 
 | 627 | /* | 
 
 
 
 
 | 628 | * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Sep_RadioButton | 
 
 
 
 
 | 629 | */ | 
 
 
 
 
 | 630 |  | 
 
 
 
 
 | 631 | void MainWindow::OnSepRadioButtonSelected( wxCommandEvent& event ) | 
 
 
 
 
 | 632 | { | 
 
 
 
 
 | 633 | static_cast<string>("-import:sep"); | 
 
 
 
 
 | 634 | } | 
 
 
 
 
 | 635 |  | 
 
 
 
 
 | 636 | /* | 
 
 
 
 
 | 637 | * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton | 
 
 
 
 
 | 638 | */ | 
 
 
 
 
 | 639 |  | 
 
 
 
 
 | 640 | /* | 
 
 
 
 
 | 641 | * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Complete_RadioButton | 
 
 
 
 
 | 642 | */ | 
 
 
 
 
 | 643 |  | 
 
 
 
 
 | 644 | void MainWindow::OnCompleteRadioButtonSelected( wxCommandEvent& event ) | 
 
 
 
 
 | 645 | { | 
 
 
 
 
 | 646 | splitInstances = false; | 
 
 
 
 
 | 647 | } | 
 
 
 
 
 | 648 |  | 
 
 
 
 
 | 649 | /* | 
 
 
 
 
 | 650 | * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BITMAPBUTTON | 
 
 
 
 
 | 651 | */ | 
 
 
 
 
 | 652 |  | 
 
 
 
 
 | 653 | void MainWindow::OnRefreshButtonClick( wxCommandEvent& event ) | 
 
 
 
 
 | 654 | { | 
 
 
 
 
 | 655 | refreshMods(globalInstalledMods); | 
 
 
 
 
 | 656 | } | 
 
 
 
 
 | 657 |  | 
 
 
 
 
 | 658 | /* | 
 
 
 
 
 | 659 | * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_LOAD | 
 
 
 
 
 | 660 | */ | 
 
 
 
 
 | 661 |  | 
 
 
 
 
 | 662 | // TODO: Make refreshMods actually refresh the list in the window of available mods so we can see any new package info and deleted mods are removed from the list | 
 
 
 
 
 | 663 | void MainWindow::refreshMods (vector<string> s) | 
 
 
 
 
 | 664 | { | 
 
 
 
 
 | 665 | Mods_CheckboxList->Clear(); | 
 
 
 
 
 | 666 | for (unsigned int i = 0; i < globalPackages.size(); i++) { | 
 
 
 
 
 | 667 | Mods_CheckboxList->Append(globalPackages[i].name.c_str()); | 
 
 
 
 
 | 668 | if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) | 
 
 
 
 
 | 669 | Mods_CheckboxList->Check(i); | 
 
 
 
 
 | 670 | } | 
 
 
 
 
 | 671 | } | 
 
 
 
 
 | 672 |  | 
 
 
 
 
 | 673 | void MainWindow::OnLoadClick( wxCommandEvent& event ) | 
 
 
 
 
 | 674 | { | 
 
 
 
 
 | 675 | if (busy == 1) return; | 
 
 
 
 
 | 676 | static const wxChar *FILETYPES = _T( | 
 
 
 
 
 | 677 | "Mod Loadouts (*.cfg)|*.cfg|" | 
 
 
 
 
 | 678 | "All files (*.*)|*.*" | 
 
 
 
 
 | 679 | ); | 
 
 
 
 
 | 680 |  | 
 
 
 
 
 | 681 | wxFileDialog* openFileDialog = | 
 
 
 
 
 | 682 | new wxFileDialog( this, _("Open Mod Loadout"), "", "", FILETYPES, | 
 
 
 
 
 | 683 | wxOPEN, wxDefaultPosition); | 
 
 
 
 
 | 684 |  | 
 
 
 
 
 | 685 | if ( openFileDialog->ShowModal() == wxID_OK ) | 
 
 
 
 
 | 686 | { | 
 
 
 
 
 | 687 | refreshMods(getInstallString( string(openFileDialog->GetPath()) )); | 
 
 
 
 
 | 688 | } | 
 
 
 
 
 | 689 | } | 
 
 
 
 
 | 690 |  | 
 
 
 
 
 | 691 | /* | 
 
 
 
 
 | 692 | * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_SAVE | 
 
 
 
 
 | 693 | */ | 
 
 
 
 
 | 694 |  | 
 
 
 
 
 | 695 | void MainWindow::OnSaveClick( wxCommandEvent& event ) | 
 
 
 
 
 | 696 | { | 
 
 
 
 
 | 697 | if (busy == 1) return; | 
 
 
 
 
 | 698 | static const wxChar *FILETYPES = _T( | 
 
 
 
 
 | 699 | "Mod Loadouts (*.cfg)|*.cfg|" | 
 
 
 
 
 | 700 | "All files (*.*)|*.*" | 
 
 
 
 
 | 701 | ); | 
 
 
 
 
 | 702 |  | 
 
 
 
 
 | 703 | wxFileDialog* openFileDialog = | 
 
 
 
 
 | 704 | new wxFileDialog( this, _("Open file"), "", "", FILETYPES, | 
 
 
 
 
 | 705 | wxSAVE, wxDefaultPosition); | 
 
 
 
 
 | 706 |  | 
 
 
 
 
 | 707 | if ( openFileDialog->ShowModal() == wxID_OK ) | 
 
 
 
 
 | 708 | { | 
 
 
 
 
 | 709 | if ( exists( openFileDialog->GetPath().c_str() ) ) | 
 
 
 
 
 | 710 | { | 
 
 
 
 
 | 711 | remove( openFileDialog->GetPath().c_str() ); | 
 
 
 
 
 | 712 | } | 
 
 
 
 
 | 713 |  | 
 
 
 
 
 | 714 | ofstream file(openFileDialog->GetPath().c_str()); | 
 
 
 
 
 | 715 |  | 
 
 
 
 
 | 716 | vector<string>list; | 
 
 
 
 
 | 717 | for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); | 
 
 
 
 
 | 718 | vector<string>::iterator begin_iter = list.begin(); | 
 
 
 
 
 | 719 | vector<string>::iterator end_iter = list.end(); | 
 
 
 
 
 | 720 |  | 
 
 
 
 
 | 721 | sort( list.begin(), list.end() ); | 
 
 
 
 
 | 722 |  | 
 
 
 
 
 | 723 | for( ; begin_iter != end_iter; ++begin_iter) { | 
 
 
 
 
 | 724 | file << *begin_iter << " "; | 
 
 
 
 
 | 725 | } | 
 
 
 
 
 | 726 |  | 
 
 
 
 
 | 727 | file.close(); | 
 
 
 
 
 | 728 | file.clear(); | 
 
 
 
 
 | 729 | } | 
 
 
 
 
 | 730 | } | 
 
 
 
 
 | 731 |  | 
 
 
 
 
 | 732 | /* | 
 
 
 
 
 | 733 | * wxEVT_COMMAND_BUTTON_CLICKED event handler for ReGlobalize_Button | 
 
 
 
 
 | 734 | */ | 
 
 
 
 
 | 735 |  | 
 
 
 
 
 | 736 | void MainWindow::OnReGlobalizeButtonClick( wxCommandEvent& event ) | 
 
 
 
 
 | 737 | { | 
 
 
 
 
 | 738 | string YesNoMsg = "WARNING: This will DELETE the Edition's GameDataFolder and recreate it from the vanilla Oni game data.\n"; | 
 
 
 
 
 | 739 | YesNoMsg = YesNoMsg + "Are you SURE you want to do this?"; | 
 
 
 
 
 | 740 | wxMessageDialog* YesNoDialog = new wxMessageDialog(this, YesNoMsg.c_str(), "AE Installer Alert",  wxYES_NO | wxICON_EXCLAMATION , wxDefaultPosition); | 
 
 
 
 
 | 741 |  | 
 
 
 
 
 | 742 | if (YesNoDialog->ShowModal() == wxID_NO) | 
 
 
 
 
 | 743 | { | 
 
 
 
 
 | 744 | //if the user said no... | 
 
 
 
 
 | 745 | } | 
 
 
 
 
 | 746 | else | 
 
 
 
 
 | 747 | { | 
 
 
 
 
 | 748 | this->InstallButton->Disable(); | 
 
 
 
 
 | 749 | this->ReglobalizeButton->Disable(); | 
 
 
 
 
 | 750 | #ifdef WIN32 | 
 
 
 
 
 | 751 | boost::thread thrd2(globalizeData); | 
 
 
 
 
 | 752 | //globalizeData(); | 
 
 
 
 
 | 753 | //boost::thread::create_thread(&globalizeData); | 
 
 
 
 
 | 754 | //       boost::thread_group Tg; | 
 
 
 
 
 | 755 | // Tg.create_thread( &globalizeData(), this ); | 
 
 
 
 
 | 756 | #else | 
 
 
 
 
 | 757 | globalizeData(); | 
 
 
 
 
 | 758 | #endif | 
 
 
 
 
 | 759 | this->InstallButton->Enable(); | 
 
 
 
 
 | 760 | this->ReglobalizeButton->Enable(); | 
 
 
 
 
 | 761 | } | 
 
 
 
 
 | 762 | } | 
 
 
 
 
 | 763 | /* | 
 
 
 
 
 | 764 | * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton | 
 
 
 
 
 | 765 | */ | 
 
 
 
 
 | 766 |  | 
 
 
 
 
 | 767 | /* | 
 
 
 
 
 | 768 | * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Seperated_RadioButton | 
 
 
 
 
 | 769 | */ | 
 
 
 
 
 | 770 |  | 
 
 
 
 
 | 771 | void MainWindow::OnSeperatedRadioButtonSelected( wxCommandEvent& event ) | 
 
 
 
 
 | 772 | { | 
 
 
 
 
 | 773 | splitInstances = true; | 
 
 
 
 
 | 774 | } |