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