diff --git a/Source/Core/DolphinWX/Src/AboutDolphin.cpp b/Source/Core/DolphinWX/Src/AboutDolphin.cpp index 627ec8a28a..27aba79aa4 100644 --- a/Source/Core/DolphinWX/Src/AboutDolphin.cpp +++ b/Source/Core/DolphinWX/Src/AboutDolphin.cpp @@ -19,11 +19,6 @@ #include "AboutDolphin.h" #include "../resources/dolphin_logo.cpp" -BEGIN_EVENT_TABLE(AboutDolphin, wxDialog) - EVT_CLOSE(AboutDolphin::OnClose) - EVT_BUTTON(wxID_OK, AboutDolphin::CloseClick) -END_EVENT_TABLE() - AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) @@ -66,34 +61,17 @@ AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id, Message->Wrap(GetSize().GetWidth()); wxBoxSizer* const sInfo = new wxBoxSizer(wxVERTICAL); - sInfo->Add(Message, 1, wxEXPAND|wxALL, 5); + sInfo->Add(Message, 1, wxEXPAND | wxALL, 5); wxBoxSizer* const sMainHor = new wxBoxSizer(wxHORIZONTAL); - sMainHor->Add(sbDolphinLogo); + sMainHor->Add(sbDolphinLogo, 0, wxEXPAND | wxALL, 5); sMainHor->Add(sInfo); - wxBoxSizer* const sButtons = new wxBoxSizer(wxHORIZONTAL); - sButtons->AddStretchSpacer(); - sButtons->Add(new wxButton(this, wxID_OK, _("Close")), 0, wxALL, 5); - wxBoxSizer* const sMain = new wxBoxSizer(wxVERTICAL); sMain->Add(sMainHor, 1, wxEXPAND); - sMain->Add(sButtons, 0, wxEXPAND); + sMain->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); - SetSizer(sMain); - - Layout(); - Fit(); + SetSizerAndFit(sMain); Center(); SetFocus(); } - -void AboutDolphin::OnClose(wxCloseEvent& WXUNUSED(event)) -{ - EndModal(wxID_CLOSE); -} - -void AboutDolphin::CloseClick(wxCommandEvent& WXUNUSED(event)) -{ - Close(); -} diff --git a/Source/Core/DolphinWX/Src/AboutDolphin.h b/Source/Core/DolphinWX/Src/AboutDolphin.h index e81f93b11a..1fa44b53ec 100644 --- a/Source/Core/DolphinWX/Src/AboutDolphin.h +++ b/Source/Core/DolphinWX/Src/AboutDolphin.h @@ -34,12 +34,6 @@ class AboutDolphin : public wxDialog const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); - - private: - DECLARE_EVENT_TABLE(); - - void CloseClick(wxCommandEvent& event); - void OnClose(wxCloseEvent& event); }; #endif //_ABOUTDOLPHIN_H_ diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 4df0353569..73605f7783 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -927,32 +927,23 @@ void CConfigMain::CreateGUIControls() sPathsPage->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5); PathsPage->SetSizer(sPathsPage); - m_Ok = new wxButton(this, wxID_OK); - - wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL); - sButtons->Add(0, 0, 1, wxEXPAND, 5); - sButtons->Add(m_Ok, 0, wxALL, 5); - wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL); sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5); - sMain->Add(sButtons, 0, wxEXPAND, 5); + sMain->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); InitializeGUIValues(); InitializeGUITooltips(); UpdateGUI(); - SetSizer(sMain); - Layout(); - - Fit(); + SetSizerAndFit(sMain); Center(); - Notebook->SetSelection(0); + SetFocus(); } void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event)) { - EndModal((bRefreshList) ? wxID_OK : wxID_CLOSE); + EndModal((bRefreshList) ? wxID_OK : wxID_CANCEL); } void CConfigMain::OnOk(wxCommandEvent& WXUNUSED (event)) diff --git a/Source/Core/DolphinWX/Src/HotkeyDlg.cpp b/Source/Core/DolphinWX/Src/HotkeyDlg.cpp index bd25655c68..ecd4f49ace 100644 --- a/Source/Core/DolphinWX/Src/HotkeyDlg.cpp +++ b/Source/Core/DolphinWX/Src/HotkeyDlg.cpp @@ -63,7 +63,7 @@ void HotkeyConfigDialog::EndGetButtons(void) GetButtonWaitingTimer = 0; GetButtonWaitingID = 0; ClickedButton = NULL; - SetEscapeId(wxID_OK); + SetEscapeId(wxID_ANY); } void HotkeyConfigDialog::OnKeyDown(wxKeyEvent& event) @@ -159,7 +159,7 @@ void HotkeyConfigDialog::OnButtonClick(wxCommandEvent& event) // Get the button ClickedButton = (wxButton *)event.GetEventObject(); - SetEscapeId(wxID_NONE); + SetEscapeId(wxID_CANCEL); // Save old label so we can revert back OldLabel = ClickedButton->GetLabel(); ClickedButton->SetWindowStyle(wxWANTS_CHARS); @@ -281,13 +281,9 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls(void) Page->SetSizer(sPage); } - wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL); - sButtons->AddStretchSpacer(); - sButtons->Add(new wxButton(this, wxID_OK, _("Close")), 0, (wxLEFT), 5); - wxBoxSizer *sMainSizer = new wxBoxSizer(wxVERTICAL); sMainSizer->Add(Notebook, 0, wxEXPAND | wxALL, 5); - sMainSizer->Add(sButtons, 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); + sMainSizer->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT | wxDOWN, 5); SetSizerAndFit(sMainSizer); SetFocus(); } diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 69f805ffe1..0542e3edbe 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -149,7 +149,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW if (GameIni.Load(GameIniFile.c_str())) LoadGameConfig(); else - wxMessageBox(wxString::Format(_("Could not create %s"), wxString::From8BitData(GameIniFile.c_str()).c_str()), _("Error"), wxOK|wxICON_ERROR, this); + wxMessageBox(wxString::Format(_("Could not create %s"), + wxString::From8BitData(GameIniFile.c_str()).c_str()), + _("Error"), wxOK|wxICON_ERROR, this); } // Disk header and apploader @@ -206,35 +208,32 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW wxMouseEventHandler(CISOProperties::RightClickOnBanner), (wxObject*)NULL, this); // Filesystem browser/dumper - if (DiscIO::IsVolumeWiiDisc(OpenISO)) + // TODO : Should we add a way to browse the wad file ? + if (!DiscIO::IsVolumeWadFile(OpenISO)) { - for (u32 i = 0; i < WiiDisc.size(); i++) + if (DiscIO::IsVolumeWiiDisc(OpenISO)) { - WiiPartition partition = WiiDisc.at(i); - wxTreeItemId PartitionRoot = m_Treectrl->AppendItem(RootId, wxString::Format(_("Partition %i"), i), 0, 0, 0); - CreateDirectoryTree(PartitionRoot, partition.Files, 1, partition.Files.at(0)->m_FileSize); - if (i == 1) - m_Treectrl->Expand(PartitionRoot); + for (u32 i = 0; i < WiiDisc.size(); i++) + { + WiiPartition partition = WiiDisc.at(i); + wxTreeItemId PartitionRoot = + m_Treectrl->AppendItem(RootId, wxString::Format(_("Partition %i"), i)); + CreateDirectoryTree(PartitionRoot, partition.Files, 1, partition.Files.at(0)->m_FileSize); + if (i == 1) + m_Treectrl->Expand(PartitionRoot); + } } + else if (!GCFiles.empty()) + CreateDirectoryTree(RootId, GCFiles, 1, GCFiles.at(0)->m_FileSize); + + m_Treectrl->Expand(RootId); } - else - { - // TODO : Should we add a way to browse the wad file ? - if (!DiscIO::IsVolumeWadFile(OpenISO)) - { - if (!GCFiles.empty()) - CreateDirectoryTree(RootId, GCFiles, 1, GCFiles.at(0)->m_FileSize); - } - } - m_Treectrl->Expand(RootId); } CISOProperties::~CISOProperties() { - if (!IsVolumeWiiDisc(OpenISO)) - if (!IsVolumeWadFile(OpenISO)) - if (pFileSystem) - delete pFileSystem; + if (!IsVolumeWiiDisc(OpenISO) && !IsVolumeWadFile(OpenISO) && pFileSystem) + delete pFileSystem; // two vector's items are no longer valid after deleting filesystem WiiDisc.clear(); GCFiles.clear(); @@ -243,9 +242,9 @@ CISOProperties::~CISOProperties() } size_t CISOProperties::CreateDirectoryTree(wxTreeItemId& parent, - std::vector fileInfos, - const size_t _FirstIndex, - const size_t _LastIndex) + std::vector fileInfos, + const size_t _FirstIndex, + const size_t _LastIndex) { size_t CurrentIndex = _FirstIndex; @@ -280,34 +279,30 @@ size_t CISOProperties::CreateDirectoryTree(wxTreeItemId& parent, void CISOProperties::CreateGUIControls(bool IsWad) { - m_Close = new wxButton(this, wxID_OK, _("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - EditConfig = new wxButton(this, ID_EDITCONFIG, _("Edit Config"), wxDefaultPosition, wxDefaultSize); + wxButton * const EditConfig = + new wxButton(this, ID_EDITCONFIG, _("Edit Config"), wxDefaultPosition, wxDefaultSize); EditConfig->SetToolTip(_("This will let you Manually Edit the INI config file")); // Notebook - m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize); - m_GameConfig = new wxPanel(m_Notebook, ID_GAMECONFIG, wxDefaultPosition, wxDefaultSize); + wxNotebook * const m_Notebook = + new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize); + wxPanel * const m_GameConfig = + new wxPanel(m_Notebook, ID_GAMECONFIG, wxDefaultPosition, wxDefaultSize); m_Notebook->AddPage(m_GameConfig, _("GameConfig")); - m_PatchPage = new wxPanel(m_Notebook, ID_PATCH_PAGE, wxDefaultPosition, wxDefaultSize); + wxPanel * const m_PatchPage = + new wxPanel(m_Notebook, ID_PATCH_PAGE, wxDefaultPosition, wxDefaultSize); m_Notebook->AddPage(m_PatchPage, _("Patches")); - m_CheatPage = new wxPanel(m_Notebook, ID_ARCODE_PAGE, wxDefaultPosition, wxDefaultSize); + wxPanel * const m_CheatPage = + new wxPanel(m_Notebook, ID_ARCODE_PAGE, wxDefaultPosition, wxDefaultSize); m_Notebook->AddPage(m_CheatPage, _("AR Codes")); m_geckocode_panel = new Gecko::CodeConfigPanel(m_Notebook); m_Notebook->AddPage(m_geckocode_panel, _("Gecko Codes")); - m_Information = new wxPanel(m_Notebook, ID_INFORMATION, wxDefaultPosition, wxDefaultSize); + wxPanel * const m_Information = + new wxPanel(m_Notebook, ID_INFORMATION, wxDefaultPosition, wxDefaultSize); m_Notebook->AddPage(m_Information, _("Info")); - m_Filesystem = new wxPanel(m_Notebook, ID_FILESYSTEM, wxDefaultPosition, wxDefaultSize); - m_Notebook->AddPage(m_Filesystem, _("Filesystem")); - wxBoxSizer* sButtons; - sButtons = new wxBoxSizer(wxHORIZONTAL); - sButtons->Add(EditConfig, 0, wxALL, 5); - sButtons->Add(0, 0, 1, wxEXPAND, 5); - sButtons->Add(m_Close, 0, wxALL, 5); - - // GameConfig editing - Overrides and emulation state - OverrideText = new wxStaticText(m_GameConfig, ID_OVERRIDE_TEXT, _("These settings override core Dolphin settings.\nUndetermined means the game uses Dolphin's setting."), wxDefaultPosition, wxDefaultSize); + wxStaticText * const OverrideText = new wxStaticText(m_GameConfig, wxID_ANY, _("These settings override core Dolphin settings.\nUndetermined means the game uses Dolphin's setting.")); // Core CPUThread = new wxCheckBox(m_GameConfig, ID_USEDUALCORE, _("Enable Dual Core"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); SkipIdle = new wxCheckBox(m_GameConfig, ID_IDLESKIP, _("Enable Idle Skipping"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); @@ -328,30 +323,32 @@ void CISOProperties::CreateGUIControls(bool IsWad) EnableProgressiveScan = new wxCheckBox(m_GameConfig, ID_ENABLEPROGRESSIVESCAN, _("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); EnableWideScreen = new wxCheckBox(m_GameConfig, ID_ENABLEWIDESCREEN, _("Enable WideScreen"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); // Video - UseZTPSpeedupHack = new wxCheckBox(m_GameConfig, ID_ZTP_SPEEDUP, _("ZTP hack"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); + UseZTPSpeedupHack = new wxCheckBox(m_GameConfig, ID_ZTP_SPEEDUP, _("ZTP hack"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER); UseZTPSpeedupHack->SetToolTip(_("Enable this to speed up The Legend of Zelda: Twilight Princess. Disable for ANY other game.")); // Hack - szrPHackSettings = new wxFlexGridSizer(0); - PHackEnable = new wxCheckBox(m_GameConfig, ID_PHACKENABLE, _("Custom Projection Hack"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE, wxDefaultValidator); + wxFlexGridSizer * const szrPHackSettings = new wxFlexGridSizer(0); + PHackEnable = new wxCheckBox(m_GameConfig, ID_PHACKENABLE, _("Custom Projection Hack"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE); PHackEnable->SetToolTip(_("Enables Custom Projection Hack")); - PHSettings = new wxButton(m_GameConfig, ID_PHSETTINGS, _("Settings..."), wxDefaultPosition, wxDefaultSize, 0); + PHSettings = new wxButton(m_GameConfig, ID_PHSETTINGS, _("Settings...")); PHSettings->SetToolTip(_("Customize some Orthographic Projection parameters.")); - sEmuState = new wxBoxSizer(wxHORIZONTAL); - EmuStateText = new wxStaticText(m_GameConfig, ID_EMUSTATE_TEXT, _("Emulation State: "), wxDefaultPosition, wxDefaultSize); + wxBoxSizer * const sEmuState = new wxBoxSizer(wxHORIZONTAL); + wxStaticText * const EmuStateText = + new wxStaticText(m_GameConfig, wxID_ANY, _("Emulation State: ")); arrayStringFor_EmuState.Add(_("Not Set")); arrayStringFor_EmuState.Add(_("Broken")); arrayStringFor_EmuState.Add(_("Intro")); arrayStringFor_EmuState.Add(_("In Game")); arrayStringFor_EmuState.Add(_("Playable")); arrayStringFor_EmuState.Add(_("Perfect")); - EmuState = new wxChoice(m_GameConfig, ID_EMUSTATE, wxDefaultPosition, wxDefaultSize, arrayStringFor_EmuState, 0, wxDefaultValidator); - EmuIssues = new wxTextCtrl(m_GameConfig, ID_EMU_ISSUES, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + EmuState = new wxChoice(m_GameConfig, ID_EMUSTATE, + wxDefaultPosition, wxDefaultSize, arrayStringFor_EmuState); + EmuIssues = new wxTextCtrl(m_GameConfig, ID_EMU_ISSUES, wxEmptyString); - wxBoxSizer* sConfigPage; - sConfigPage = new wxBoxSizer(wxVERTICAL); - sbCoreOverrides = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Core")); + wxBoxSizer * const sConfigPage = new wxBoxSizer(wxVERTICAL); + wxStaticBoxSizer * const sbCoreOverrides = + new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Core")); sbCoreOverrides->Add(CPUThread, 0, wxLEFT, 5); sbCoreOverrides->Add(SkipIdle, 0, wxLEFT, 5); sbCoreOverrides->Add(MMU, 0, wxLEFT, 5); @@ -362,7 +359,8 @@ void CISOProperties::CreateGUIControls(bool IsWad) sbCoreOverrides->Add(BlockMerging, 0, wxLEFT, 5); sbCoreOverrides->Add(DSPHLE, 0, wxLEFT, 5); - sbWiiOverrides = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console")); + wxStaticBoxSizer * const sbWiiOverrides = + new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console")); if (!DiscIO::IsVolumeWiiDisc(OpenISO) && !DiscIO::IsVolumeWadFile(OpenISO)) { sbWiiOverrides->ShowItems(false); @@ -379,13 +377,15 @@ void CISOProperties::CreateGUIControls(bool IsWad) sbWiiOverrides->Add(EnableProgressiveScan, 0, wxLEFT, 5); sbWiiOverrides->Add(EnableWideScreen, 0, wxLEFT, 5); - sbVideoOverrides = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Video")); + wxStaticBoxSizer * const sbVideoOverrides = + new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Video")); sbVideoOverrides->Add(UseZTPSpeedupHack, 0, wxLEFT, 5); szrPHackSettings->Add(PHackEnable, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5); szrPHackSettings->Add(PHSettings, 0, wxLEFT, 5); sbVideoOverrides->Add(szrPHackSettings, 0, wxEXPAND); - sbGameConfig = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Game-Specific Settings")); + wxStaticBoxSizer * const sbGameConfig = + new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Game-Specific Settings")); sbGameConfig->Add(OverrideText, 0, wxEXPAND|wxALL, 5); sbGameConfig->Add(sbCoreOverrides, 0, wxEXPAND); sbGameConfig->Add(sbWiiOverrides, 0, wxEXPAND); @@ -399,17 +399,17 @@ void CISOProperties::CreateGUIControls(bool IsWad) // Patches - sPatches = new wxBoxSizer(wxVERTICAL); - Patches = new wxCheckListBox(m_PatchPage, ID_PATCHES_LIST, wxDefaultPosition, wxDefaultSize, arrayStringFor_Patches, wxLB_HSCROLL, wxDefaultValidator); - sPatchButtons = new wxBoxSizer(wxHORIZONTAL); - EditPatch = new wxButton(m_PatchPage, ID_EDITPATCH, _("Edit..."), wxDefaultPosition, wxDefaultSize, 0); - AddPatch = new wxButton(m_PatchPage, ID_ADDPATCH, _("Add..."), wxDefaultPosition, wxDefaultSize, 0); - RemovePatch = new wxButton(m_PatchPage, ID_REMOVEPATCH, _("Remove"), wxDefaultPosition, wxDefaultSize, 0); + wxBoxSizer * const sPatches = new wxBoxSizer(wxVERTICAL); + Patches = new wxCheckListBox(m_PatchPage, ID_PATCHES_LIST, wxDefaultPosition, + wxDefaultSize, arrayStringFor_Patches, wxLB_HSCROLL); + wxBoxSizer * const sPatchButtons = new wxBoxSizer(wxHORIZONTAL); + EditPatch = new wxButton(m_PatchPage, ID_EDITPATCH, _("Edit...")); + wxButton * const AddPatch = new wxButton(m_PatchPage, ID_ADDPATCH, _("Add...")); + RemovePatch = new wxButton(m_PatchPage, ID_REMOVEPATCH, _("Remove")); EditPatch->Enable(false); RemovePatch->Enable(false); - wxBoxSizer* sPatchPage; - sPatchPage = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* sPatchPage = new wxBoxSizer(wxVERTICAL); sPatches->Add(Patches, 1, wxEXPAND|wxALL, 0); sPatchButtons->Add(EditPatch, 0, wxEXPAND|wxALL, 0); sPatchButtons->AddStretchSpacer(); @@ -421,17 +421,18 @@ void CISOProperties::CreateGUIControls(bool IsWad) // Action Replay Cheats - sCheats = new wxBoxSizer(wxVERTICAL); - Cheats = new wxCheckListBox(m_CheatPage, ID_CHEATS_LIST, wxDefaultPosition, wxDefaultSize, arrayStringFor_Cheats, wxLB_HSCROLL, wxDefaultValidator); - sCheatButtons = new wxBoxSizer(wxHORIZONTAL); - EditCheat = new wxButton(m_CheatPage, ID_EDITCHEAT, _("Edit..."), wxDefaultPosition, wxDefaultSize, 0); - AddCheat = new wxButton(m_CheatPage, ID_ADDCHEAT, _("Add..."), wxDefaultPosition, wxDefaultSize, 0); - RemoveCheat = new wxButton(m_CheatPage, ID_REMOVECHEAT, _("Remove"), wxDefaultPosition, wxDefaultSize, 0); + wxBoxSizer * const sCheats = new wxBoxSizer(wxVERTICAL); + Cheats = new wxCheckListBox(m_CheatPage, ID_CHEATS_LIST, wxDefaultPosition, + wxDefaultSize, arrayStringFor_Cheats, wxLB_HSCROLL); + wxBoxSizer * const sCheatButtons = new wxBoxSizer(wxHORIZONTAL); + EditCheat = new wxButton(m_CheatPage, ID_EDITCHEAT, _("Edit...")); + wxButton * const AddCheat = new wxButton(m_CheatPage, ID_ADDCHEAT, _("Add...")); + RemoveCheat = new wxButton(m_CheatPage, ID_REMOVECHEAT, _("Remove"), + wxDefaultPosition, wxDefaultSize, 0); EditCheat->Enable(false); RemoveCheat->Enable(false); - wxBoxSizer* sCheatPage; - sCheatPage = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* sCheatPage = new wxBoxSizer(wxVERTICAL); sCheats->Add(Cheats, 1, wxEXPAND|wxALL, 0); sCheatButtons->Add(EditCheat, 0, wxEXPAND|wxALL, 0); sCheatButtons->AddStretchSpacer(); @@ -442,39 +443,51 @@ void CISOProperties::CreateGUIControls(bool IsWad) m_CheatPage->SetSizer(sCheatPage); - m_NameText = new wxStaticText(m_Information, ID_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize); - m_Name = new wxTextCtrl(m_Information, ID_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); - m_GameIDText = new wxStaticText(m_Information, ID_GAMEID_TEXT, _("Game ID:"), wxDefaultPosition, wxDefaultSize); - m_GameID = new wxTextCtrl(m_Information, ID_GAMEID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); - m_CountryText = new wxStaticText(m_Information, ID_COUNTRY_TEXT, _("Country:"), wxDefaultPosition, wxDefaultSize); - m_Country = new wxTextCtrl(m_Information, ID_COUNTRY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); - m_MakerIDText = new wxStaticText(m_Information, ID_MAKERID_TEXT, _("Maker ID:"), wxDefaultPosition, wxDefaultSize); - m_MakerID = new wxTextCtrl(m_Information, ID_MAKERID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); - m_DateText = new wxStaticText(m_Information, ID_DATE_TEXT, _("Date:"), wxDefaultPosition, wxDefaultSize); - m_Date = new wxTextCtrl(m_Information, ID_DATE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); - m_FSTText = new wxStaticText(m_Information, ID_FST_TEXT, _("FST Size:"), wxDefaultPosition, wxDefaultSize); - m_FST = new wxTextCtrl(m_Information, ID_FST, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); + wxStaticText * const m_NameText = + new wxStaticText(m_Information, wxID_ANY, _("Name:")); + m_Name = new wxTextCtrl(m_Information, ID_NAME, wxEmptyString, + wxDefaultPosition, wxDefaultSize, wxTE_READONLY); + wxStaticText * const m_GameIDText = + new wxStaticText(m_Information, wxID_ANY, _("Game ID:")); + m_GameID = new wxTextCtrl(m_Information, ID_GAMEID, wxEmptyString, + wxDefaultPosition, wxDefaultSize, wxTE_READONLY); + wxStaticText * const m_CountryText = + new wxStaticText(m_Information, wxID_ANY, _("Country:")); + m_Country = new wxTextCtrl(m_Information, ID_COUNTRY, wxEmptyString, + wxDefaultPosition, wxDefaultSize, wxTE_READONLY); + wxStaticText * const m_MakerIDText = + new wxStaticText(m_Information, wxID_ANY, _("Maker ID:")); + m_MakerID = new wxTextCtrl(m_Information, ID_MAKERID, wxEmptyString, + wxDefaultPosition, wxDefaultSize, wxTE_READONLY); + wxStaticText * const m_DateText = + new wxStaticText(m_Information, wxID_ANY, _("Date:")); + m_Date = new wxTextCtrl(m_Information, ID_DATE, wxEmptyString, + wxDefaultPosition, wxDefaultSize, wxTE_READONLY); + wxStaticText * const m_FSTText = + new wxStaticText(m_Information, wxID_ANY, _("FST Size:")); + m_FST = new wxTextCtrl(m_Information, ID_FST, wxEmptyString, + wxDefaultPosition, wxDefaultSize, wxTE_READONLY); - m_LangText = new wxStaticText(m_Information, ID_LANG_TEXT, _("Show Language:"), wxDefaultPosition, wxDefaultSize); + wxStaticText * const m_LangText = new wxStaticText(m_Information, wxID_ANY, _("Show Language:")); arrayStringFor_Lang.Add(_("English")); arrayStringFor_Lang.Add(_("German")); arrayStringFor_Lang.Add(_("French")); arrayStringFor_Lang.Add(_("Spanish")); arrayStringFor_Lang.Add(_("Italian")); arrayStringFor_Lang.Add(_("Dutch")); - m_Lang = new wxChoice(m_Information, ID_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_Lang, 0, wxDefaultValidator); + m_Lang = new wxChoice(m_Information, ID_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_Lang); m_Lang->SetSelection((int)SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage); - m_ShortText = new wxStaticText(m_Information, ID_SHORTNAME_TEXT, _("Short Name:"), wxDefaultPosition, wxDefaultSize); + wxStaticText * const m_ShortText = new wxStaticText(m_Information, wxID_ANY, _("Short Name:")); m_ShortName = new wxTextCtrl(m_Information, ID_SHORTNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); - m_MakerText = new wxStaticText(m_Information, ID_MAKER_TEXT, _("Maker:"), wxDefaultPosition, wxDefaultSize); + wxStaticText * const m_MakerText = new wxStaticText(m_Information, wxID_ANY, _("Maker:")); m_Maker = new wxTextCtrl(m_Information, ID_MAKER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); - m_CommentText = new wxStaticText(m_Information, ID_COMMENT_TEXT, _("Comment:"), wxDefaultPosition, wxDefaultSize); + wxStaticText * const m_CommentText = new wxStaticText(m_Information, wxID_ANY, _("Comment:")); m_Comment = new wxTextCtrl(m_Information, ID_COMMENT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY); - m_BannerText = new wxStaticText(m_Information, ID_BANNER_TEXT, _("Banner:"), wxDefaultPosition, wxDefaultSize); + wxStaticText * const m_BannerText = new wxStaticText(m_Information, wxID_ANY, _("Banner:")); m_Banner = new wxStaticBitmap(m_Information, ID_BANNER, wxNullBitmap, wxDefaultPosition, wxSize(96, 32), 0); // ISO Details - sISODetails = new wxGridBagSizer(0, 0); + wxGridBagSizer * const sISODetails = new wxGridBagSizer(0, 0); sISODetails->Add(m_NameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); sISODetails->Add(m_Name, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); sISODetails->Add(m_GameIDText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); @@ -488,11 +501,12 @@ void CISOProperties::CreateGUIControls(bool IsWad) sISODetails->Add(m_FSTText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); sISODetails->Add(m_FST, wxGBPosition(5, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); sISODetails->AddGrowableCol(1); - sbISODetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("ISO Details")); + wxStaticBoxSizer * const sbISODetails = + new wxStaticBoxSizer(wxVERTICAL, m_Information, _("ISO Details")); sbISODetails->Add(sISODetails, 0, wxEXPAND, 5); // Banner Details - sBannerDetails = new wxGridBagSizer(0, 0); + wxGridBagSizer * const sBannerDetails = new wxGridBagSizer(0, 0); sBannerDetails->Add(m_LangText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); sBannerDetails->Add(m_Lang, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); sBannerDetails->Add(m_ShortText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); @@ -504,47 +518,52 @@ void CISOProperties::CreateGUIControls(bool IsWad) sBannerDetails->Add(m_BannerText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 5); sBannerDetails->Add(m_Banner, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); sBannerDetails->AddGrowableCol(1); - sbBannerDetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("Banner Details")); + wxStaticBoxSizer * const sbBannerDetails = + new wxStaticBoxSizer(wxVERTICAL, m_Information, _("Banner Details")); sbBannerDetails->Add(sBannerDetails, 0, wxEXPAND, 5); - wxBoxSizer* sInfoPage; - sInfoPage = new wxBoxSizer(wxVERTICAL); + wxBoxSizer * const sInfoPage = new wxBoxSizer(wxVERTICAL); sInfoPage->Add(sbISODetails, 0, wxEXPAND|wxALL, 5); sInfoPage->Add(sbBannerDetails, 0, wxEXPAND|wxALL, 5); m_Information->SetSizer(sInfoPage); - // Filesystem icons - m_iconList = new wxImageList(16, 16); - m_iconList->Add(wxBitmap(disc_xpm), wxNullBitmap); // 0 - m_iconList->Add(wxBitmap(folder_xpm), wxNullBitmap); // 1 - m_iconList->Add(wxBitmap(file_xpm), wxNullBitmap); // 2 + if (!IsWad) + { + wxPanel * const m_Filesystem = + new wxPanel(m_Notebook, ID_FILESYSTEM, wxDefaultPosition, wxDefaultSize); + m_Notebook->AddPage(m_Filesystem, _("Filesystem")); - // Filesystem tree - m_Treectrl = new wxTreeCtrl(m_Filesystem, ID_TREECTRL, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE, wxDefaultValidator); - m_Treectrl->AssignImageList(m_iconList); - RootId = m_Treectrl->AddRoot(_("Disc"), 0, 0, 0); + // Filesystem icons + wxImageList * const m_iconList = new wxImageList(16, 16); + m_iconList->Add(wxBitmap(disc_xpm), wxNullBitmap); // 0 + m_iconList->Add(wxBitmap(folder_xpm), wxNullBitmap); // 1 + m_iconList->Add(wxBitmap(file_xpm), wxNullBitmap); // 2 - wxBoxSizer* sTreePage; - sTreePage = new wxBoxSizer(wxVERTICAL); - sTreePage->Add(m_Treectrl, 1, wxEXPAND|wxALL, 5); - m_Filesystem->SetSizer(sTreePage); + // Filesystem tree + m_Treectrl = new wxTreeCtrl(m_Filesystem, ID_TREECTRL, + wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE); + m_Treectrl->AssignImageList(m_iconList); + RootId = m_Treectrl->AddRoot(_("Disc"), 0, 0, 0); - // It's a wad file, so we remove the FileSystem page - if (IsWad) - m_Notebook->RemovePage(4); + wxBoxSizer* sTreePage = new wxBoxSizer(wxVERTICAL); + sTreePage->Add(m_Treectrl, 1, wxEXPAND|wxALL, 5); + m_Filesystem->SetSizer(sTreePage); + } + + wxSizer* sButtons = CreateButtonSizer(wxNO_DEFAULT); + sButtons->Prepend(EditConfig, 0, wxALL, 5); + sButtons->Add(new wxButton(this, wxID_OK, _("Close")), 0, wxALL, 5); - m_Notebook->SetSelection(0); - // Add notebook and buttons to the dialog wxBoxSizer* sMain; sMain = new wxBoxSizer(wxVERTICAL); sMain->Add(m_Notebook, 1, wxEXPAND|wxALL, 5); sMain->Add(sButtons, 0, wxEXPAND, 5); - sMain->SetMinSize(wxSize(550, 600)); + sMain->SetMinSize(wxSize(500, -1)); SetSizerAndFit(sMain); - Layout(); Center(); + SetFocus(); } void CISOProperties::OnCheckBoxClicked(wxCommandEvent& event) diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 00276e7986..b84b74dca5 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -48,227 +48,166 @@ struct PHackData class CISOProperties : public wxDialog { - public: - - CISOProperties(const std::string fileName, +public: + CISOProperties(const std::string fileName, wxWindow* parent, wxWindowID id = 1, const wxString& title = _("Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); - virtual ~CISOProperties(); + virtual ~CISOProperties(); - bool bRefreshList; + bool bRefreshList; - void ActionReplayList_Load(); - bool SaveGameConfig(); + void ActionReplayList_Load(); + bool SaveGameConfig(); - PHackData PHack_Data; + PHackData PHack_Data; - private: +private: + DECLARE_EVENT_TABLE(); - DECLARE_EVENT_TABLE(); - - wxStaticBoxSizer *sbGameConfig; - wxStaticBoxSizer *sbCoreOverrides; - wxStaticBoxSizer *sbWiiOverrides; - wxStaticBoxSizer *sbVideoOverrides; - wxBoxSizer *sEmuState; - wxBoxSizer *sPatches; - wxBoxSizer *sPatchButtons; - wxBoxSizer *sCheats; - wxBoxSizer *sCheatButtons; - wxStaticBoxSizer *sbISODetails; - wxGridBagSizer *sISODetails; - wxStaticBoxSizer *sbBannerDetails; - wxGridBagSizer *sBannerDetails; + // Core + wxCheckBox *CPUThread, *SkipIdle, *MMU, *MMUBAT, *TLBHack; + wxCheckBox *VBeam, *FastDiscSpeed, *BlockMerging, *DSPHLE; + // Wii + wxCheckBox *EnableProgressiveScan, *EnableWideScreen; + // Video + wxCheckBox *UseZTPSpeedupHack, *PHackEnable; + wxButton *PHSettings; - wxButton *m_Close; + wxArrayString arrayStringFor_EmuState; + wxChoice *EmuState; + wxTextCtrl *EmuIssues; + wxArrayString arrayStringFor_Patches; + wxCheckListBox *Patches; + wxButton *EditPatch; + wxButton *RemovePatch; + wxArrayString arrayStringFor_Cheats; + wxCheckListBox *Cheats; + wxButton *EditCheat; + wxButton *RemoveCheat; + wxArrayString arrayStringFor_Speedhacks; + wxCheckListBox *Speedhacks; + wxButton *EditSpeedhack; + wxButton *AddSpeedhack; + wxButton *RemoveSpeedhack; - wxNotebook *m_Notebook; - wxPanel *m_GameConfig; - wxPanel *m_PatchPage; - wxPanel *m_CheatPage; - wxPanel *m_Information; - wxPanel *m_Filesystem; + wxTextCtrl *m_Name; + wxTextCtrl *m_GameID; + wxTextCtrl *m_Country; + wxTextCtrl *m_MakerID; + wxTextCtrl *m_Date; + wxTextCtrl *m_FST; + wxArrayString arrayStringFor_Lang; + wxChoice *m_Lang; + wxTextCtrl *m_ShortName; + wxTextCtrl *m_Maker; + wxTextCtrl *m_Comment; + wxStaticBitmap *m_Banner; - wxStaticText *OverrideText; - // Core - wxCheckBox *CPUThread, *SkipIdle, *MMU, *MMUBAT, *TLBHack; - wxCheckBox *VBeam, *FastDiscSpeed, *BlockMerging, *DSPHLE; - // Wii - wxCheckBox *EnableProgressiveScan, *EnableWideScreen; - // Video - wxCheckBox *UseZTPSpeedupHack, *PHackEnable; - wxButton *PHSettings; + wxTreeCtrl *m_Treectrl; + wxTreeItemId RootId; - wxButton *EditConfig; - wxStaticText *EmuStateText; - wxArrayString arrayStringFor_EmuState; - wxChoice *EmuState; - wxTextCtrl *EmuIssues; - wxArrayString arrayStringFor_Patches; - wxCheckListBox *Patches; - wxButton *EditPatch; - wxButton *AddPatch; - wxButton *RemovePatch; - wxArrayString arrayStringFor_Cheats; - wxCheckListBox *Cheats; - wxButton *EditCheat; - wxButton *AddCheat; - wxButton *RemoveCheat; - wxArrayString arrayStringFor_Speedhacks; - wxCheckListBox *Speedhacks; - wxButton *EditSpeedhack; - wxButton *AddSpeedhack; - wxButton *RemoveSpeedhack; + Gecko::CodeConfigPanel *m_geckocode_panel; - wxStaticText *m_NameText; - wxStaticText *m_GameIDText; - wxStaticText *m_CountryText; - wxStaticText *m_MakerIDText; - wxStaticText *m_DateText; - wxStaticText *m_FSTText; - wxStaticText *m_LangText; - wxStaticText *m_ShortText; - wxStaticText *m_MakerText; - wxStaticText *m_CommentText; - wxStaticText *m_BannerText; - wxTextCtrl *m_Name; - wxTextCtrl *m_GameID; - wxTextCtrl *m_Country; - wxTextCtrl *m_MakerID; - wxTextCtrl *m_Date; - wxTextCtrl *m_FST; - wxArrayString arrayStringFor_Lang; - wxChoice *m_Lang; - wxTextCtrl *m_ShortName; - wxTextCtrl *m_Maker; - wxTextCtrl *m_Comment; - wxStaticBitmap *m_Banner; + enum + { + ID_TREECTRL = 1000, - wxTreeCtrl *m_Treectrl; - wxTreeItemId RootId; - wxImageList *m_iconList; + ID_NOTEBOOK, + ID_GAMECONFIG, + ID_PATCH_PAGE, + ID_ARCODE_PAGE, + ID_SPEEDHACK_PAGE, + ID_INFORMATION, + ID_FILESYSTEM, - wxFlexGridSizer *szrPHackSettings; + ID_USEDUALCORE, + ID_IDLESKIP, + ID_MMU, + ID_MMUBAT, + ID_TLBHACK, + ID_VBEAM, + ID_DISCSPEED, + ID_MERGEBLOCKS, + ID_AUDIO_DSP_HLE, + ID_ZTP_SPEEDUP, + ID_PHACKENABLE, + ID_PHSETTINGS, + ID_ENABLEPROGRESSIVESCAN, + ID_ENABLEWIDESCREEN, + ID_EDITCONFIG, + ID_EMUSTATE, + ID_EMU_ISSUES, + ID_PATCHES_LIST, + ID_EDITPATCH, + ID_ADDPATCH, + ID_REMOVEPATCH, + ID_CHEATS_LIST, + ID_EDITCHEAT, + ID_ADDCHEAT, + ID_REMOVECHEAT, - Gecko::CodeConfigPanel *m_geckocode_panel; + ID_NAME, + ID_GAMEID, + ID_COUNTRY, + ID_MAKERID, + ID_DATE, + ID_FST, + ID_VERSION, + ID_LANG, + ID_SHORTNAME, + ID_LONGNAME, + ID_MAKER, + ID_COMMENT, + ID_BANNER, + IDM_EXTRACTDIR, + IDM_EXTRACTALL, + IDM_EXTRACTFILE, + IDM_EXTRACTAPPLOADER, + IDM_EXTRACTDOL, + IDM_BNRSAVEAS + }; - enum - { - ID_TREECTRL = 1000, + void CreateGUIControls(bool); + void OnClose(wxCloseEvent& event); + void OnCloseClick(wxCommandEvent& event); + void OnEditConfig(wxCommandEvent& event); + void ListSelectionChanged(wxCommandEvent& event); + void PatchButtonClicked(wxCommandEvent& event); + void ActionReplayButtonClicked(wxCommandEvent& event); + void RightClickOnBanner(wxMouseEvent& event); + void OnBannerImageSave(wxCommandEvent& event); + void OnRightClickOnTree(wxTreeEvent& event); + void OnExtractFile(wxCommandEvent& event); + void OnExtractDir(wxCommandEvent& event); + void OnExtractDataFromHeader(wxCommandEvent& event); + void SetRefresh(wxCommandEvent& event); + void OnChangeBannerLang(wxCommandEvent& event); + void OnCheckBoxClicked(wxCommandEvent& event); + void PHackButtonClicked(wxCommandEvent& event); - ID_NOTEBOOK, - ID_GAMECONFIG, - ID_PATCH_PAGE, - ID_ARCODE_PAGE, - ID_SPEEDHACK_PAGE, - ID_INFORMATION, - ID_FILESYSTEM, + GameListItem *OpenGameListItem; - ID_OVERRIDE_TEXT, - ID_USEDUALCORE, - ID_IDLESKIP, - ID_MMU, - ID_MMUBAT, - ID_TLBHACK, - ID_VBEAM, - ID_DISCSPEED, - ID_MERGEBLOCKS, - ID_AUDIO_DSP_HLE, - ID_ZTP_SPEEDUP, - ID_PHACKENABLE, - ID_PHSETTINGS, - ID_ENABLEPROGRESSIVESCAN, - ID_ENABLEWIDESCREEN, - ID_EDITCONFIG, - ID_EMUSTATE_TEXT, - ID_EMUSTATE, - ID_EMUISSUES_TEXT, - ID_EMU_ISSUES, - ID_PATCHES_LIST, - ID_EDITPATCH, - ID_ADDPATCH, - ID_REMOVEPATCH, - ID_CHEATS_LIST, - ID_EDITCHEAT, - ID_ADDCHEAT, - ID_REMOVECHEAT, - - ID_NAME_TEXT, - ID_GAMEID_TEXT, - ID_COUNTRY_TEXT, - ID_MAKERID_TEXT, - ID_DATE_TEXT, - ID_FST_TEXT, - ID_VERSION_TEXT, - ID_LANG_TEXT, - ID_SHORTNAME_TEXT, - ID_LONGNAME_TEXT, - ID_MAKER_TEXT, - ID_COMMENT_TEXT, - ID_BANNER_TEXT, - - ID_NAME, - ID_GAMEID, - ID_COUNTRY, - ID_MAKERID, - ID_DATE, - ID_FST, - ID_VERSION, - ID_LANG, - ID_SHORTNAME, - ID_LONGNAME, - ID_MAKER, - ID_COMMENT, - ID_BANNER, - IDM_EXTRACTDIR, - IDM_EXTRACTALL, - IDM_EXTRACTFILE, - IDM_EXTRACTAPPLOADER, - IDM_EXTRACTDOL, - IDM_BNRSAVEAS - }; + std::vector GCFiles; + typedef std::vector::iterator fileIter; - void CreateGUIControls(bool); - void OnClose(wxCloseEvent& event); - void OnCloseClick(wxCommandEvent& event); - void OnEditConfig(wxCommandEvent& event); - void ListSelectionChanged(wxCommandEvent& event); - void PatchButtonClicked(wxCommandEvent& event); - void ActionReplayButtonClicked(wxCommandEvent& event); - void RightClickOnBanner(wxMouseEvent& event); - void OnBannerImageSave(wxCommandEvent& event); - void OnRightClickOnTree(wxTreeEvent& event); - void OnExtractFile(wxCommandEvent& event); - void OnExtractDir(wxCommandEvent& event); - void OnExtractDataFromHeader(wxCommandEvent& event); - void SetRefresh(wxCommandEvent& event); - void OnChangeBannerLang(wxCommandEvent& event); - void OnCheckBoxClicked(wxCommandEvent& event); - void PHackButtonClicked(wxCommandEvent& event); + size_t CreateDirectoryTree(wxTreeItemId& parent, + std::vector fileInfos, + const size_t _FirstIndex, + const size_t _LastIndex); + void ExportDir(const char* _rFullPath, const char* _rExportFilename, + const int partitionNum = 0); - GameListItem *OpenGameListItem; + IniFile GameIni; + std::string GameIniFile; - std::vector GCFiles; - typedef std::vector::iterator fileIter; - - size_t CreateDirectoryTree(wxTreeItemId& parent, - std::vector fileInfos, - const size_t _FirstIndex, - const size_t _LastIndex); - void ExportDir(const char* _rFullPath, const char* _rExportFilename, - const int partitionNum = 0); - - IniFile GameIni; - std::string GameIniFile; - - void LoadGameConfig(); - void PatchList_Load(); - void PatchList_Save(); - void ActionReplayList_Save(); - void ChangeBannerDetails(int lang); + void LoadGameConfig(); + void PatchList_Load(); + void PatchList_Save(); + void ActionReplayList_Save(); + void ChangeBannerDetails(int lang); }; #endif diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp index 18607503b9..87de5db99a 100644 --- a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp @@ -190,11 +190,6 @@ void InputConfigDialog::UpdateControlReferences() (*i)->controller->UpdateReferences(g_controller_interface); } -void InputConfigDialog::ClickCancel(wxCommandEvent& event) -{ - event.Skip(); -} - void InputConfigDialog::ClickSave(wxCommandEvent& event) { m_plugin.SaveConfig(); @@ -495,7 +490,6 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(wxWindow* const parent, wx wxButton* const clear_button = new wxButton(parent, -1, _("Clear")); wxButton* const set_button = new wxButton(parent, -1, _("Set")); - wxButton* const ok_button = new wxButton(parent, wxID_OK, _("OK")); wxButton* const select_button = new wxButton(parent, -1, _("Select")); _connect_macro_(select_button, ControlDialog::SetSelectedControl, wxEVT_COMMAND_BUTTON_CLICKED, parent); @@ -546,16 +540,14 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(wxWindow* const parent, wx ctrls_sizer->Add(control_lbox, 1, wxEXPAND, 0); ctrls_sizer->Add(button_sizer, 0, wxEXPAND, 0); - wxBoxSizer* const bottom_btns_sizer = new wxBoxSizer(wxHORIZONTAL); - bottom_btns_sizer->Add(clear_button, 0, wxLEFT, 5); - bottom_btns_sizer->Add(set_button, 0, wxRIGHT, 5); - bottom_btns_sizer->AddStretchSpacer(1); - bottom_btns_sizer->Add(ok_button, 0, wxRIGHT, 5); + wxSizer* const bottom_btns_sizer = CreateButtonSizer(wxOK); + bottom_btns_sizer->Prepend(set_button, 0, wxRIGHT, 5); + bottom_btns_sizer->Prepend(clear_button, 0, wxLEFT, 5); main_szr->Add(range_sizer, 0, wxEXPAND|wxLEFT|wxRIGHT, 5); main_szr->Add(ctrls_sizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5); main_szr->Add(textctrl, 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5); - main_szr->Add(bottom_btns_sizer, 0, wxEXPAND|wxBOTTOM, 5); + main_szr->Add(bottom_btns_sizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5); main_szr->Add(m_bound_label, 0, wxCENTER, 0); UpdateListContents(); @@ -983,23 +975,16 @@ InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputPlugin& plugin wxButton* const close_button = new wxButton(this, wxID_OK, _("Save")); _connect_macro_(close_button, InputConfigDialog::ClickSave, wxEVT_COMMAND_BUTTON_CLICKED, this); wxButton* const cancel_button = new wxButton(this, wxID_CANCEL, _("Cancel")); - _connect_macro_(cancel_button, InputConfigDialog::ClickCancel, wxEVT_COMMAND_BUTTON_CLICKED, this); - wxBoxSizer* btns = new wxBoxSizer(wxHORIZONTAL); - //btns->Add(new wxStaticText(this, -1, wxString::FromAscii(ver.c_str())), 0, wxLEFT|wxTOP, 5); - btns->AddStretchSpacer(); - btns->Add(cancel_button, 0, 0, 0); - btns->Add(close_button, 0, 0, 0); + wxSizer* btns = CreateButtonSizer(wxNO_DEFAULT); + btns->Add(cancel_button); + btns->Add(close_button); wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL); szr->Add(m_pad_notebook, 0, wxEXPAND|wxTOP|wxLEFT|wxRIGHT, 5); szr->Add(btns, 0, wxEXPAND|wxALL, 5); - SetSizerAndFit(szr); // needed - - // not needed here it seems, but it cant hurt - //Layout(); - + SetSizerAndFit(szr); Center(); // live preview update timer diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.h b/Source/Core/DolphinWX/Src/InputConfigDiag.h index 46101947f8..54f828b952 100644 --- a/Source/Core/DolphinWX/Src/InputConfigDiag.h +++ b/Source/Core/DolphinWX/Src/InputConfigDiag.h @@ -235,7 +235,6 @@ public: bool Destroy(); - void ClickCancel(wxCommandEvent& event); void ClickSave(wxCommandEvent& event); void UpdateDeviceComboBox(); diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index 9445537ed1..1ca0242c2f 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -470,9 +470,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5); szr_main->Add(btn_close, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5); - notebook->SetSelection(0); SetSizerAndFit(szr_main); Center(); + SetFocus(); SetUIValuesFromConfig(); Connect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(VideoConfigDiag::OnUpdateUI), NULL, this); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index 6e49798f1b..dc6e179ce3 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -82,7 +82,7 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin wxButton* const cancel_button = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition); _connect_macro_(cancel_button, WiimoteConfigDiag::Cancel, wxEVT_COMMAND_BUTTON_CLICKED, this); - wxBoxSizer* const button_sizer = new wxBoxSizer(wxHORIZONTAL); + wxSizer* const button_sizer = CreateButtonSizer(wxNO_DEFAULT); button_sizer->Add(cancel_button, 0, wxALIGN_RIGHT | wxRIGHT, 5); button_sizer->Add(ok_button, 0, wxALIGN_RIGHT); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp index 076967efb5..f16d1464b9 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp @@ -144,9 +144,8 @@ void VideoBackend::ShowConfig(void *_hParent) // Clear ppshaders string vector g_Config.backend_info.PPShaders.clear(); - VideoConfigDiag *const diag = new VideoConfigDiag((wxWindow*)_hParent, _trans("Direct3D11"), "gfx_dx11"); - diag->ShowModal(); - diag->Destroy(); + VideoConfigDiag diag((wxWindow*)_hParent, _trans("Direct3D11"), "gfx_dx11"); + diag.ShowModal(); g_Config.backend_info.Adapters.clear(); DX11::D3D::UnloadDXGI(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index 8e1a85f264..191879170b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -125,9 +125,8 @@ void VideoBackend::ShowConfig(void* parent) // Clear ppshaders string vector g_Config.backend_info.PPShaders.clear(); - VideoConfigDiag *const diag = new VideoConfigDiag((wxWindow*)parent, _trans("Direct3D9"), "gfx_dx9"); - diag->ShowModal(); - diag->Destroy(); + VideoConfigDiag diag((wxWindow*)parent, _trans("Direct3D9"), "gfx_dx9"); + diag.ShowModal(); g_Config.backend_info.Adapters.clear(); DX9::D3D::Shutdown(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index d5c8422886..354cf569f1 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -152,9 +152,8 @@ void VideoBackend::ShowConfig(void *_hParent) // pp shaders GetShaders(g_Config.backend_info.PPShaders); - VideoConfigDiag *const diag = new VideoConfigDiag((wxWindow*)_hParent, "OpenGL", "gfx_opengl"); - diag->ShowModal(); - diag->Destroy(); + VideoConfigDiag diag((wxWindow*)_hParent, "OpenGL", "gfx_opengl"); + diag.ShowModal(); #endif } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp index d0478c2f61..a2567ad820 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp @@ -57,9 +57,8 @@ void *DllDebugger(void *_hParent, bool Show) void VideoBackend::ShowConfig(void *_hParent) { #if defined(HAVE_WX) && HAVE_WX - VideoConfigDialog* const diag = new VideoConfigDialog((wxWindow*)_hParent, "Software", "gfx_software"); - diag->ShowModal(); - diag->Destroy(); + VideoConfigDialog diag((wxWindow*)_hParent, "Software", "gfx_software"); + diag.ShowModal(); #endif } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp index b0a39191a6..11bc20d99f 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp @@ -105,27 +105,17 @@ VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title, page_general->SetSizerAndFit(szr_general); } - wxButton* const btn_close = new wxButton(this, -1, wxT("Close"), wxDefaultPosition); - _connect_macro_(btn_close, VideoConfigDialog::Event_ClickClose, wxEVT_COMMAND_BUTTON_CLICKED, this); - - Connect(-1, wxEVT_CLOSE_WINDOW, wxCloseEventHandler(VideoConfigDialog::Event_Close), (wxObject*)0, this); - wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL); szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5); - szr_main->Add(btn_close, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5); + szr_main->Add(new wxButton(this, wxID_OK, wxT("Close"), wxDefaultPosition), + 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5); SetSizerAndFit(szr_main); Center(); + SetFocus(); } -void VideoConfigDialog::Event_ClickClose(wxCommandEvent&) -{ - Close(); -} - -void VideoConfigDialog::Event_Close(wxCloseEvent& ev) +VideoConfigDialog::~VideoConfigDialog() { g_SWVideoConfig.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); - - EndModal(wxID_OK); } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.h b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.h index ef1c823333..bff0351c7f 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.h @@ -37,11 +37,9 @@ class VideoConfigDialog : public wxDialog { public: VideoConfigDialog(wxWindow* parent, const std::string &title, const std::string& ininame); + ~VideoConfigDialog(); protected: - void Event_ClickClose(wxCommandEvent&); - void Event_Close(wxCloseEvent&); - SWVideoConfig& vconfig; std::string ininame; };