From 24b0ef52a01db29c35e3126ec50f6c77c99f3ffb Mon Sep 17 00:00:00 2001 From: gnick79 Date: Mon, 18 Apr 2011 16:30:46 +0000 Subject: [PATCH] - fixed a bug on GameList's MenuPopups (Windows Seven/Vista platforms, issue 4403) - fixed a problem/crash which occurs with some gcc versions (in general on Linux systems, issue 4400) - other minor GUI changes git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7472 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/GameListCtrl.cpp | 8 ++++++-- Source/Core/DolphinWX/Src/GameListCtrl.h | 5 +++++ Source/Core/DolphinWX/Src/ISOProperties.cpp | 12 ------------ Source/Core/DolphinWX/Src/ISOProperties.h | 1 - Source/Core/DolphinWX/Src/VideoConfigDiag.cpp | 13 +++++-------- 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index e88fe456b2..6f69b3006a 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -136,7 +136,7 @@ BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl) EVT_MENU(IDM_INSTALLWAD, CGameListCtrl::OnInstallWAD) END_EVENT_TABLE() - +int CGameListCtrl::MarginWidth(wxOwnerDrawn().GetMarginWidth()); CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxListCtrl(parent, id, pos, size, style), toolTip(0) @@ -962,6 +962,11 @@ void CGameListCtrl::OnLeftClick(wxMouseEvent& event) void CGameListCtrl::OnRightClick(wxMouseEvent& event) { + // [HACK] + // Restore initial ms_nLastMarginWidth's value. + // This should be done whenever a popup menu is created at run-time + wxOwnerDrawn().SetMarginWidth(MarginWidth); + // Focus the clicked item. int flags; long item = HitTest(event.GetPosition(), flags); @@ -974,7 +979,6 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event) } SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); } - if (GetSelectedItemCount() == 1) { const GameListItem *selected_iso = GetSelectedISO(); diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.h b/Source/Core/DolphinWX/Src/GameListCtrl.h index 3d02830f72..87be47eabc 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.h +++ b/Source/Core/DolphinWX/Src/GameListCtrl.h @@ -95,6 +95,11 @@ private: void InsertItemInReportView(long _Index); void SetBackgroundColor(); void ScanForISOs(); + + // stores inital ms_nLastMarginWidth's value. This is a static/shared wxWidgets member + // affected by an 'illegal' access from the wxCheckListBox controls. + // NOTE: workaround valid and necessary only with v.2.8.x, since newer versions have fixed this issue. + static int MarginWidth; DECLARE_EVENT_TABLE() diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 1485ede158..4774edc0f6 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -76,7 +76,6 @@ BEGIN_EVENT_TABLE(CISOProperties, wxDialog) EVT_MENU(IDM_EXTRACTAPPLOADER, CISOProperties::OnExtractDataFromHeader) EVT_MENU(IDM_EXTRACTDOL, CISOProperties::OnExtractDataFromHeader) EVT_CHOICE(ID_LANG, CISOProperties::OnChangeBannerLang) - EVT_CHECKBOX(ID_PHACKENABLE, CISOProperties::OnCheckBoxClicked) END_EVENT_TABLE() CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) @@ -566,16 +565,6 @@ void CISOProperties::CreateGUIControls(bool IsWad) SetFocus(); } -void CISOProperties::OnCheckBoxClicked(wxCommandEvent& event) -{ - bool choice = (event.GetInt() != 0); - - if (event.GetId() == ID_PHACKENABLE) - { - PHSettings->Enable(choice); - } -} - void CISOProperties::OnClose(wxCloseEvent& WXUNUSED (event)) { if (!SaveGameConfig()) @@ -907,7 +896,6 @@ void CISOProperties::LoadGameConfig() GameIni.Get("Video", "ProjectionHack", &bTemp); PHackEnable->Set3StateValue((wxCheckBoxState)bTemp); - PHSettings->Enable(bTemp); GameIni.Get("Video", "PH_SZNear", &PHack_Data.PHackSZNear); GameIni.Get("Video", "PH_SZFar", &PHack_Data.PHackSZFar); diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index b84b74dca5..291f515ee1 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -186,7 +186,6 @@ private: void OnExtractDataFromHeader(wxCommandEvent& event); void SetRefresh(wxCommandEvent& event); void OnChangeBannerLang(wxCommandEvent& event); - void OnCheckBoxClicked(wxCommandEvent& event); void PHackButtonClicked(wxCommandEvent& event); GameListItem *OpenGameListItem; diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index 71118a8735..53a8c53a76 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -80,8 +80,11 @@ void StringSettingChoice::UpdateValue(wxCommandEvent& ev) } else // Choice ctrl without 3RD option { + if (ev.GetInt() == 0) + m_setting.clear(); if (m_uistate) - if (!*m_uistate) *d_setting = m_setting; + if (!*m_uistate) + *d_setting = m_setting; } } ev.Skip(); @@ -118,13 +121,10 @@ SettingChoice::SettingChoice(wxWindow* parent, V &setting, V &def_setting, bo , m_index(cur_index) { SetToolTip(tooltip); - void *p = &m_setting; - if (sizeof(m_setting) == sizeof(int)) Select(*(int*)p); - if (sizeof(m_setting) == sizeof(std::string)) SetStringSelection(wxString::FromAscii((*(std::string*)p).c_str())); _connect_macro_(this, SettingChoice::UpdateValue, wxEVT_COMMAND_CHOICE_SELECTED, this); } -// without 3sate support +// without 3state support template SettingChoice::SettingChoice(wxWindow* parent, V &setting, const wxString& tooltip, int num, const wxString choices[], long style) : _pattern(0, only_2State) @@ -134,9 +134,6 @@ SettingChoice::SettingChoice(wxWindow* parent, V &setting, const wxString& to , m_index(setting) { SetToolTip(tooltip); - void *p = &m_setting; - if (sizeof(m_setting) == sizeof(int)) Select(*(int*)p); - if (sizeof(m_setting) == sizeof(std::string)) SetStringSelection(wxString::FromAscii((*(std::string*)p).c_str())); _connect_macro_(this, SettingChoice::UpdateValue, wxEVT_COMMAND_CHOICE_SELECTED, this); }