--- AE/Installer/trunk/source/main_window.cpp 2009/06/01 02:04:33 328 +++ AE/Installer/trunk/source/main_window.cpp 2009/06/14 23:28:58 353 @@ -1,9 +1,12 @@ /* AE/Mod Installer - v1.0 by Gumby and Iritscen */ +// To-do: - Disable Install button when nothing (new) is selected +// - Institute lots of checks into file-handling +// - Clear mod info fields when mod is de-selected + #define DEBUG #include //#include @@ -42,6 +45,7 @@ const string strOniSplit = "mono Onispli string strImportOption = "-import:sep"; const char* strClsCmd = "clear"; const char* strPauseCmd = "read -n 1 -p \"Press any key to continue\""; +void Sleep(int ms) { sleep( ms / 1000 ); } #endif using namespace boost::filesystem; @@ -778,9 +782,8 @@ void recompileAll(vector install writeInstalledMods(installedMods); setProgressBar(1000); setStatusArea("Done!"); - sleep(1000); + Sleep(1000); setProgressBar(0); - } void writeInstalledMods(vector installedMods) @@ -936,7 +939,7 @@ BEGIN_EVENT_TABLE( MainWindow, wxFrame ) EVT_RADIOBUTTON( NoSep_RadioButton, MainWindow::OnNoSepRadioButtonSelected ) - EVT_RADIOBUTTON( Seperated_RadioButton, MainWindow::OnSeperatedRadioButtonSelected ) + EVT_RADIOBUTTON( Separated_RadioButton, MainWindow::OnSeparatedRadioButtonSelected ) EVT_RADIOBUTTON( Complete_RadioButton, MainWindow::OnCompleteRadioButtonSelected ) @@ -1021,7 +1024,7 @@ void MainWindow::Init() OptionsPanel = NULL; SepRadio = NULL; NoSepRadio = NULL; - SeperatedRadio = NULL; + SeparatedRadio = NULL; CompleteRadio = NULL; ReglobalizeButton = NULL; ////@end MainWindow member initialisation @@ -1032,7 +1035,7 @@ void MainWindow::Init() /* * Control creation for MainWindow */ -wxStatusBar* TheStatusBar; +wxStatusBar **TheStatusBar; wxButton* TheInstallButton; wxGauge* TheProgressBar; void MainWindow::CreateControls() @@ -1179,10 +1182,10 @@ void MainWindow::CreateControls() wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL); itemBoxSizer25->Add(itemBoxSizer30, 0, wxGROW|wxALL, 5); - SeperatedRadio = new wxRadioButton( OptionsPanel, Seperated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - SeperatedRadio->SetValue(false); - SeperatedRadio->SetName(_T("Seperated_RadioButton")); - itemBoxSizer30->Add(SeperatedRadio, 0, wxALIGN_LEFT|wxALL, 5); + SeparatedRadio = new wxRadioButton( OptionsPanel, Separated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + SeparatedRadio->SetValue(false); + SeparatedRadio->SetName(_T("Separated_RadioButton")); + itemBoxSizer30->Add(SeparatedRadio, 0, wxALIGN_LEFT|wxALL, 5); CompleteRadio = new wxRadioButton( OptionsPanel, Complete_RadioButton, _("Complete Level0"), wxDefaultPosition, wxDefaultSize, 0 ); CompleteRadio->SetValue(false); @@ -1218,7 +1221,7 @@ void MainWindow::CreateControls() Mods_CheckboxList->Append(globalPackages[i].name.c_str()); if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); } - TheStatusBar = StatusArea; + TheStatusBar = &StatusArea; TheInstallButton = InstallButton; TheProgressBar = ProgressBar; OptionsPanel->Hide(); @@ -1342,7 +1345,7 @@ void MainWindow::OnModsCheckboxList1Sele creatorText->SetValue(globalPackages[event.GetSelection()].creator.c_str()); descriptionText->SetValue(globalPackages[event.GetSelection()].readme.c_str()); - creatorText->Refresh(); + //creatorText->Refresh(); } @@ -1424,16 +1427,23 @@ void MainWindow::OnInstallButtonClick( w //MainWindow::MainWindow().Hide(); // boost::thread thrd2(recompileAll(localPackages) ); //MainWindow::MainWindow().Show(); - recompile packages(localPackages); - boost::thread thrd(packages); +#ifdef WIN32 + recompile packages(localPackages); + boost::thread thrd(packages); +#else + this->Disable(); + recompileAll(localPackages); + this->Enable(); +#endif } } -void setStatusArea( string s ) { - TheStatusBar->SetStatusText(_(s.c_str())); +/*void setStatusArea( string s ) { + //TheStatusBar = MainWindow::StatusArea; + (**TheStatusBar).SetStatusText(_(s.c_str()), 0); //MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1); @@ -1441,7 +1451,7 @@ void setStatusArea( string s ) { //StatusBar->SetLabel(s); //->SetLabel(s); -} +}*/ void setProgressBar( int i ) { //TheProgressBar->SetValue( @@ -1637,14 +1647,14 @@ globalizeData(); /* - * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Seperated_RadioButton + * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton */ -void MainWindow::OnSeperatedRadioButtonSelected( wxCommandEvent& event ) +/*void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event ) { -////@begin wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Seperated_RadioButton in MainWindow. +////@begin wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. // Before editing this code, remove the block markers. event.Skip(); -////@end wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Seperated_RadioButton in MainWindow. -} +////@end wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. +}*/