--- AE/Installer/trunk/source/main_window.cpp 2009/05/26 18:51:14 325 +++ 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) @@ -1032,12 +1035,14 @@ void MainWindow::Init() /* * Control creation for MainWindow */ -wxStatusBar* TheStatusBar; +wxStatusBar **TheStatusBar; wxButton* TheInstallButton; wxGauge* TheProgressBar; void MainWindow::CreateControls() { ////@begin MainWindow content construction + // Generated by DialogBlocks, 31/05/2009 19:03:55 (unregistered) + MainWindow* itemFrame1 = this; wxMenuBar* menuBar = new wxMenuBar; @@ -1123,7 +1128,7 @@ void MainWindow::CreateControls() itemStaticLine17->Show(false); itemBoxSizer11->Add(itemStaticLine17, 0, wxGROW|wxALL, 5); - descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_RICH2 ); + descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_AUTO_URL ); descriptionText->SetName(_T("DescriptionName")); descriptionText->SetBackgroundColour(wxColour(240, 240, 240)); itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5); @@ -1140,11 +1145,11 @@ void MainWindow::CreateControls() wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 0); - ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxDefaultSize, wxGA_SMOOTH ); + ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxSize(-1, 30), wxGA_SMOOTH ); ProgressBar->SetValue(0); itemBoxSizer20->Add(ProgressBar, 1, wxGROW|wxALL, 0); - InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxDefaultSize, 0 ); + InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxSize(-1, 30), 0 ); itemBoxSizer20->Add(InstallButton, 0, wxGROW|wxALL, 0); wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL); @@ -1216,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(); @@ -1336,11 +1341,11 @@ wxIcon MainWindow::GetIconResource( cons void MainWindow::OnModsCheckboxList1Selected( wxCommandEvent& event ) { //event.GetSelection - titleText->SetLabel(wxT(globalPackages[event.GetSelection()].name.c_str())); - creatorText->SetLabel(globalPackages[event.GetSelection()].creator.c_str()); - descriptionText->SetLabel(globalPackages[event.GetSelection()].readme.c_str()); + titleText->SetValue(globalPackages[event.GetSelection()].name.c_str()); + creatorText->SetValue(globalPackages[event.GetSelection()].creator.c_str()); + descriptionText->SetValue(globalPackages[event.GetSelection()].readme.c_str()); - creatorText->Refresh(); + //creatorText->Refresh(); } @@ -1422,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); @@ -1439,7 +1451,7 @@ void setStatusArea( string s ) { //StatusBar->SetLabel(s); //->SetLabel(s); -} +}*/ void setProgressBar( int i ) { //TheProgressBar->SetValue( @@ -1633,3 +1645,16 @@ globalizeData(); setStatusArea("Done!"); } + +/* + * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton + */ + +/*void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event ) +{ +////@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 Separated_RadioButton in MainWindow. +}*/ +