From 6312ccbc307b9058ee171de375a189a9de264dbb Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 24 Sep 2008 00:27:50 +0000 Subject: [PATCH] completed the iso directory path chooser. changed a ini variable name so it is more to sonic's liking, and corrected an #ifndef git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@654 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/ConfigMain.cpp | 49 ++++++++++++++++--- Source/Core/DolphinWX/Src/ConfigMain.h | 4 +- .../Plugin_PadSimple/Src/GUI/ConfigDlg.cpp | 2 +- .../Plugin_PadSimple/Src/PadSimple.cpp | 8 +-- .../Plugin_Wiimote_Test/Src/Wiimote_Test.cpp | 2 +- 5 files changed, 50 insertions(+), 15 deletions(-) diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 5fa554aa3f..c13950db88 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -38,6 +38,8 @@ EVT_CHECKBOX(ID_LOCKTHREADS, CConfigMain::LockThreadsCheck) EVT_CHECKBOX(ID_OPTIMIZEQUANTIZERS, CConfigMain::OptimizeQuantizersCheck) EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::SkipIdleCheck) EVT_CHOICE(ID_CONSOLELANG, CConfigMain::ConsoleLangChanged) +EVT_BUTTON(ID_ADDISOPATH, CConfigMain::AddRemoveISOPaths) +EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths) EVT_FILEPICKER_CHANGED(ID_DEFAULTISO, CConfigMain::DefaultISOChanged) EVT_DIRPICKER_CHANGED(ID_DVDROOT, CConfigMain::DVDRootChanged) EVT_CHOICE(ID_GRAPHIC_CB, CConfigMain::OnSelectionChanged) @@ -133,18 +135,21 @@ void CConfigMain::CreateGUIControls() sGeneral->Layout(); // Paths page - // TODO add gcm paths - the whole point of the page sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories:")); - wxArrayString arrayStringFor_ISOPaths; - ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator); + for(int i = 0; i < SConfig::GetInstance().m_ISOFolder.size(); i++) + { + arrayStringFor_ISOPaths.Add(wxString(SConfig::GetInstance().m_ISOFolder[i].c_str(), wxConvUTF8)); + } + ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxSize(290,150), arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator); AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0); RemoveISOPath = new wxButton(PathsPage, ID_REMOVEISOPATH, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0); - sISOPaths = new wxGridBagSizer(0, 0); - sISOPaths->Add(ISOPaths, wxGBPosition(0, 0), wxGBSpan(1, 3), wxALL|wxEXPAND, 5); - sISOPaths->Add(AddISOPath, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT, 5); - sISOPaths->Add(RemoveISOPath, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT, 5); - sbISOPaths->Add(sISOPaths, 1, wxEXPAND|wxALL, 5); + sISOButtons = new wxBoxSizer(wxHORIZONTAL); + sISOButtons->AddStretchSpacer(1); + sISOButtons->Add(AddISOPath, 0, wxALL, 5); + sISOButtons->Add(RemoveISOPath, 0, wxALL, 5); + sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 5); + sbISOPaths->Add(sISOButtons, 0, wxEXPAND|wxALL, 5); DefaultISOText = new wxStaticText(PathsPage, ID_DEFAULTISO_TEXT, wxT("Default ISO:"), wxDefaultPosition, wxDefaultSize); DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, wxT("Choose a default ISO:"), @@ -281,6 +286,34 @@ void CConfigMain::ConsoleLangChanged(wxCommandEvent& WXUNUSED (event)) SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage = ConsoleLang->GetSelection(); } +void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event) +{ + if(event.GetId() == ID_ADDISOPATH) + { + wxString dirHome; + wxGetHomeDir(&dirHome); + + wxDirDialog dialog(this, _T("Choose a directory to add"), dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); + + if (dialog.ShowModal() == wxID_OK) + { + ISOPaths->Append(dialog.GetPath()); + } + } + else + { + ISOPaths->Delete(ISOPaths->GetSelection()); + } + + //save changes right away + SConfig::GetInstance().m_ISOFolder.clear(); + + for(unsigned int i = 0; i < ISOPaths->GetCount(); i++) + { + SConfig::GetInstance().m_ISOFolder.push_back(std::string(ISOPaths->GetStrings()[i].ToAscii())); + } +} + void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED (event)) { SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = DefaultISO->GetPath().ToAscii(); diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index 0573f49e84..39fe925baa 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -45,7 +45,7 @@ class CConfigMain wxGridBagSizer* sGeneral; wxGridBagSizer* sPaths; wxStaticBoxSizer* sbISOPaths; - wxGridBagSizer* sISOPaths; + wxBoxSizer* sISOButtons; wxGridBagSizer* sPlugins; wxNotebook *Notebook; @@ -66,6 +66,7 @@ class CConfigMain wxStaticText* ConsoleLangText; wxChoice* ConsoleLang; + wxArrayString arrayStringFor_ISOPaths; wxListBox* ISOPaths; wxButton* AddISOPath; wxButton* RemoveISOPath; @@ -144,6 +145,7 @@ class CConfigMain void OptimizeQuantizersCheck(wxCommandEvent& event); void SkipIdleCheck(wxCommandEvent& event); void ConsoleLangChanged(wxCommandEvent& event); + void AddRemoveISOPaths(wxCommandEvent& event); void DefaultISOChanged(wxFileDirPickerEvent& event); void DVDRootChanged(wxFileDirPickerEvent& event); diff --git a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp index 28bd5296e4..197c3d1208 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp @@ -104,7 +104,7 @@ void ConfigDialog::CreateGUIControls() sDeviceBottom[i] = new wxBoxSizer(wxHORIZONTAL); m_DeviceName[i] = new wxChoice(m_Controller[i], ID_DEVICENAME, wxDefaultPosition, wxDefaultSize, arrayStringFor_DeviceName, 0, wxDefaultValidator); m_Attached[i] = new wxCheckBox(m_Controller[i], ID_ATTACHED, wxT("Controller attached"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when window looses focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when dolphin isn't in foreground"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Rumble[i] = new wxCheckBox(m_Controller[i], ID_RUMBLE, wxT("Enable rumble"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Attached[i]->SetValue(pad[i].attached); m_Disable[i]->SetValue(pad[i].disable); diff --git a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp index 59a01e77cd..12520ad9c1 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp @@ -675,7 +675,7 @@ void LoadConfig() //keyboard settings file.Get(SectionName, "Type", &pad[i].type); file.Get(SectionName, "Attached", &pad[i].attached, false); - file.Get(SectionName, "Disable when window looses focus", &pad[i].disable, false); + file.Get(SectionName, "DisableOnBackground", &pad[i].disable, false); for (int x = 0; x < NUMCONTROLS; x++) { @@ -687,7 +687,7 @@ void LoadConfig() //xpad settings file.Get(SectionName, "Type", &pad[i].type); file.Get(SectionName, "Attached", &pad[i].attached, false); - file.Get(SectionName, "Disable when window looses focus", &pad[i].disable, false); + file.Get(SectionName, "DisableOnBackground", &pad[i].disable, false); file.Get(SectionName, "Rumble", &pad[i].rumble, true); file.Get(SectionName, "XPad#", &pad[i].XPad); } @@ -710,7 +710,7 @@ void SaveConfig() //keyboard settings file.Set(SectionName, "Type", pad[i].type); file.Set(SectionName, "Attached", pad[i].attached); - file.Set(SectionName, "Disable when window looses focus", pad[i].disable); + file.Set(SectionName, "DisableOnBackground", pad[i].disable); for (int x = 0; x < NUMCONTROLS; x++) { @@ -722,7 +722,7 @@ void SaveConfig() //xpad settings file.Set(SectionName, "Type", pad[i].type); file.Set(SectionName, "Attached", pad[i].attached); - file.Set(SectionName, "Disable when window looses focus", pad[i].disable); + file.Set(SectionName, "DisableOnBackground", pad[i].disable); file.Set(SectionName, "Rumble", pad[i].rumble); file.Set(SectionName, "XPad#", pad[i].XPad); } diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/Wiimote_Test.cpp b/Source/Plugins/Plugin_Wiimote_Test/Src/Wiimote_Test.cpp index 55e84d0980..e9c866f67f 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/Wiimote_Test.cpp +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/Wiimote_Test.cpp @@ -268,7 +268,7 @@ extern "C" void Wiimote_DoState(void* ptr, int mode) { extern "C" void Wiimote_Shutdown(void) { - #ifdef _WIN32 + #ifndef _WIN32 if(!cwiid_disconnect(WiiMote)) LOG(WIIMOTE,"Couldn't close WiiMote!\n"); #endif