- 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
This commit is contained in:
gnick79 2011-04-18 16:30:46 +00:00
parent 58e1d90a3e
commit 24b0ef52a0
5 changed files with 16 additions and 23 deletions

View File

@ -136,7 +136,7 @@ BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl)
EVT_MENU(IDM_INSTALLWAD, CGameListCtrl::OnInstallWAD) EVT_MENU(IDM_INSTALLWAD, CGameListCtrl::OnInstallWAD)
END_EVENT_TABLE() END_EVENT_TABLE()
int CGameListCtrl::MarginWidth(wxOwnerDrawn().GetMarginWidth());
CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const
wxPoint& pos, const wxSize& size, long style) wxPoint& pos, const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style), toolTip(0) : wxListCtrl(parent, id, pos, size, style), toolTip(0)
@ -962,6 +962,11 @@ void CGameListCtrl::OnLeftClick(wxMouseEvent& event)
void CGameListCtrl::OnRightClick(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. // Focus the clicked item.
int flags; int flags;
long item = HitTest(event.GetPosition(), flags); long item = HitTest(event.GetPosition(), flags);
@ -974,7 +979,6 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
} }
SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
} }
if (GetSelectedItemCount() == 1) if (GetSelectedItemCount() == 1)
{ {
const GameListItem *selected_iso = GetSelectedISO(); const GameListItem *selected_iso = GetSelectedISO();

View File

@ -96,6 +96,11 @@ private:
void SetBackgroundColor(); void SetBackgroundColor();
void ScanForISOs(); 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() DECLARE_EVENT_TABLE()
// events // events

View File

@ -76,7 +76,6 @@ BEGIN_EVENT_TABLE(CISOProperties, wxDialog)
EVT_MENU(IDM_EXTRACTAPPLOADER, CISOProperties::OnExtractDataFromHeader) EVT_MENU(IDM_EXTRACTAPPLOADER, CISOProperties::OnExtractDataFromHeader)
EVT_MENU(IDM_EXTRACTDOL, CISOProperties::OnExtractDataFromHeader) EVT_MENU(IDM_EXTRACTDOL, CISOProperties::OnExtractDataFromHeader)
EVT_CHOICE(ID_LANG, CISOProperties::OnChangeBannerLang) EVT_CHOICE(ID_LANG, CISOProperties::OnChangeBannerLang)
EVT_CHECKBOX(ID_PHACKENABLE, CISOProperties::OnCheckBoxClicked)
END_EVENT_TABLE() END_EVENT_TABLE()
CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) 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(); 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)) void CISOProperties::OnClose(wxCloseEvent& WXUNUSED (event))
{ {
if (!SaveGameConfig()) if (!SaveGameConfig())
@ -907,7 +896,6 @@ void CISOProperties::LoadGameConfig()
GameIni.Get("Video", "ProjectionHack", &bTemp); GameIni.Get("Video", "ProjectionHack", &bTemp);
PHackEnable->Set3StateValue((wxCheckBoxState)bTemp); PHackEnable->Set3StateValue((wxCheckBoxState)bTemp);
PHSettings->Enable(bTemp);
GameIni.Get("Video", "PH_SZNear", &PHack_Data.PHackSZNear); GameIni.Get("Video", "PH_SZNear", &PHack_Data.PHackSZNear);
GameIni.Get("Video", "PH_SZFar", &PHack_Data.PHackSZFar); GameIni.Get("Video", "PH_SZFar", &PHack_Data.PHackSZFar);

View File

@ -186,7 +186,6 @@ private:
void OnExtractDataFromHeader(wxCommandEvent& event); void OnExtractDataFromHeader(wxCommandEvent& event);
void SetRefresh(wxCommandEvent& event); void SetRefresh(wxCommandEvent& event);
void OnChangeBannerLang(wxCommandEvent& event); void OnChangeBannerLang(wxCommandEvent& event);
void OnCheckBoxClicked(wxCommandEvent& event);
void PHackButtonClicked(wxCommandEvent& event); void PHackButtonClicked(wxCommandEvent& event);
GameListItem *OpenGameListItem; GameListItem *OpenGameListItem;

View File

@ -80,8 +80,11 @@ void StringSettingChoice::UpdateValue(wxCommandEvent& ev)
} }
else // Choice ctrl without 3RD option else // Choice ctrl without 3RD option
{ {
if (ev.GetInt() == 0)
m_setting.clear();
if (m_uistate) if (m_uistate)
if (!*m_uistate) *d_setting = m_setting; if (!*m_uistate)
*d_setting = m_setting;
} }
} }
ev.Skip(); ev.Skip();
@ -118,13 +121,10 @@ SettingChoice<V>::SettingChoice(wxWindow* parent, V &setting, V &def_setting, bo
, m_index(cur_index) , m_index(cur_index)
{ {
SetToolTip(tooltip); 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); _connect_macro_(this, SettingChoice::UpdateValue, wxEVT_COMMAND_CHOICE_SELECTED, this);
} }
// without 3sate support // without 3state support
template <typename V> template <typename V>
SettingChoice<V>::SettingChoice(wxWindow* parent, V &setting, const wxString& tooltip, int num, const wxString choices[], long style) SettingChoice<V>::SettingChoice(wxWindow* parent, V &setting, const wxString& tooltip, int num, const wxString choices[], long style)
: _pattern(0, only_2State) : _pattern(0, only_2State)
@ -134,9 +134,6 @@ SettingChoice<V>::SettingChoice(wxWindow* parent, V &setting, const wxString& to
, m_index(setting) , m_index(setting)
{ {
SetToolTip(tooltip); 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); _connect_macro_(this, SettingChoice::UpdateValue, wxEVT_COMMAND_CHOICE_SELECTED, this);
} }