--- AE/Installer/trunk/source/main_window.cpp 2010/01/24 23:58:16 489 +++ AE/Installer/trunk/source/main_window.cpp 2010/06/01 13:13:59 565 @@ -44,11 +44,13 @@ ITaskbarList3 *pTaskbarList3; ////@end XPM images bool busy = false; +int updateStatus; +bool installerJustUpdated = false; vector globalInstalledMods; vector globalPackages; // Variable declarations #ifdef WIN32 -bool splitInstances = true; +bool splitInstances = false; string strImportOption = "-import:nosep"; string strOniSplit = "Onisplit.exe"; #else @@ -102,6 +104,7 @@ BEGIN_EVENT_TABLE( MainWindow, wxFrame ) EVT_MENU( wxID_ABOUT, MainWindow::OnAboutClick ) + EVT_BUTTON( Dir_Button, MainWindow::OnDirButtonClick ) ////@end MainWindow event table entries END_EVENT_TABLE() @@ -112,7 +115,7 @@ END_EVENT_TABLE() */ MainWindow::MainWindow() -{ +{ Init(); } @@ -172,6 +175,8 @@ void MainWindow::Init() SeperatedRadio = NULL; CompleteRadio = NULL; ReglobalizeButton = NULL; + + ChangeDirectoryButton = NULL; ////@end MainWindow member initialisation } @@ -283,7 +288,7 @@ void MainWindow::CreateControls() StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 ); StatusArea->SetName(_T("StatusArea")); StatusArea->SetFieldsCount(1); - string versionText = "AE Installer v" + (string)INSTALLER_VERSION; + string versionText = "AE Installer v" + gInstallerVersion; StatusArea->SetStatusText(versionText.c_str(), 0); itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0); @@ -347,19 +352,29 @@ void MainWindow::CreateControls() ReglobalizeButton->SetName(_T("Reglobalize_Button")); itemBoxSizer34->Add(ReglobalizeButton, 0, wxGROW|wxALL, 5); - // Connect events and objects + wxStaticLine* itemStaticLine100 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + itemBoxSizer25->Add(itemStaticLine100, 0, wxGROW|wxALL, 5); + + ChangeDirectoryButton = new wxButton( OptionsPanel, Dir_Button, _("Change Dir"), wxDefaultPosition, wxDefaultSize, 0 ); + ChangeDirectoryButton->SetName(_T("Dir_Button")); + itemBoxSizer34->Add(ChangeDirectoryButton, 0, wxGROW|wxALL, 5); + + // Connect events and objects Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this); ////@end MainWindow content construction #ifdef WIN32 Handle = (HWND)GetHWND(); ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList); #endif + + updateStatus = GetUpdateStatus(¤tAE, &updateAE, &installerJustUpdated); globalPackages = getPackages(); globalInstalledMods = getInstallString(); - for (unsigned int i = 0; i < globalPackages.size(); i++) { + for (unsigned int i = 0; i < globalPackages.size(); i++) + { Mods_CheckboxList->Append(globalPackages[i].name.c_str()); - if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); + if (binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName)) Mods_CheckboxList->Check(i); } TheStatusBar = &StatusArea; @@ -609,8 +624,8 @@ void MainWindow::OnAboutClick( wxCommand { ////@begin wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. // Before editing this code, remove the block markers. - // TODO: Make About window work again! About* window = new About(this); + window->ShowModal(); window->Destroy(); ////@end wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. } @@ -618,7 +633,7 @@ void MainWindow::OnAboutClick( wxCommand /* * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for NoSep_RadioButton */ - + void MainWindow::OnNoSepRadioButtonSelected( wxCommandEvent& event ) { static_cast("-import:nosep"); @@ -652,6 +667,7 @@ void MainWindow::OnCompleteRadioButtonSe void MainWindow::OnRefreshButtonClick( wxCommandEvent& event ) { + globalPackages = getPackages(); refreshMods(globalInstalledMods); } @@ -659,7 +675,6 @@ void MainWindow::OnRefreshButtonClick( w * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_LOAD */ -// 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 void MainWindow::refreshMods (vector s) { Mods_CheckboxList->Clear(); @@ -772,3 +787,12 @@ void MainWindow::OnSeperatedRadioButtonS { splitInstances = true; } + +void MainWindow::OnDirButtonClick( wxCommandEvent& event ) +{ + wxDirDialog* newDir = new wxDirDialog(this, "Set current directory", "", wxDD_DEFAULT_STYLE, + wxDefaultPosition, wxDefaultSize, "wxDirCtrl"); + newDir->ShowModal(); + if(newDir->GetPath()[0]) current_path( (path)newDir->GetPath() ); + OnRefreshButtonClick(event); +} \ No newline at end of file