From c0a86df00e973af3d56cc3b67f01e49abde3690e Mon Sep 17 00:00:00 2001 From: skidau Date: Tue, 19 Jan 2010 13:43:51 +0000 Subject: [PATCH] GUI fixes * Fixed log window docking * Fixed multi-selection in the game list * Fixed last filename selection. Dolphin remembers the last game/elf/file that you loaded and will load that if you press the Play button without a default ISO selected and without selecting anything from the game list. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4887 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/Frame.cpp | 4 ---- Source/Core/DolphinWX/Src/FrameTools.cpp | 8 ++++++++ Source/Core/DolphinWX/Src/GameListCtrl.cpp | 20 ++++++++++++++++++++ Source/Core/DolphinWX/Src/GameListCtrl.h | 1 + 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index e21de4ddac..5e8f2389f8 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -806,10 +806,6 @@ void CFrame::OnMotion(wxMouseEvent& event) #if wxUSE_TIMER void CFrame::Update() { - // Update the GUI while a game has not yet been loaded - if (!Core::isRunning()) - UpdateGUI(); - // Check if auto hide is on, or if we are already hiding the cursor all the time if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor || SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) return; diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index c45ca9f905..a006e9f32d 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -1067,6 +1067,14 @@ void CFrame::UpdateGUI() m_ToolBar->EnableTool(IDM_PLAY, true); GetMenuBar()->FindItem(IDM_PLAY)->Enable(true); } + // Prepare to load last selected file, enable play button + else if (!SConfig::GetInstance().m_LastFilename.empty() + && wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8))) + { + if (m_ToolBar) + m_ToolBar->EnableTool(IDM_PLAY, true); + GetMenuBar()->FindItem(IDM_PLAY)->Enable(true); + } else { // No game has been selected yet, disable play button diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index 4fbdbe4dc5..1eedef77cd 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -33,6 +33,7 @@ #include "FileUtil.h" #include "CDUtils.h" #include "WxUtils.h" +#include "main.h" #if USE_XPM_BITMAPS #include "../resources/Flag_Europe.xpm" @@ -99,6 +100,7 @@ END_EVENT_TABLE() BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl) EVT_SIZE(CGameListCtrl::OnSize) EVT_RIGHT_DOWN(CGameListCtrl::OnRightClick) +// EVT_LEFT_DOWN(CGameListCtrl::OnLeftClick) // Disabled as stops multi-selection in the game list EVT_LIST_KEY_DOWN(LIST_CTRL, CGameListCtrl::OnKeyPress) EVT_MOTION(CGameListCtrl::OnMouseMotion) EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, CGameListCtrl::OnColBeginDrag) @@ -779,6 +781,24 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event) event.Skip(); } +void CGameListCtrl::OnLeftClick(wxMouseEvent& event) +{ + // Focus the clicked item. + int flags; + long item = HitTest(event.GetPosition(), flags); + if (item != wxNOT_FOUND) + { + if (GetItemState(item, wxLIST_STATE_SELECTED) != wxLIST_STATE_SELECTED) + { + UnselectAll(); + SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); + } + SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); + } + + wxGetApp().GetCFrame()->UpdateGUI(); +} + void CGameListCtrl::OnRightClick(wxMouseEvent& event) { // Focus the clicked item. diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.h b/Source/Core/DolphinWX/Src/GameListCtrl.h index f969c5a683..c50f467a0f 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.h +++ b/Source/Core/DolphinWX/Src/GameListCtrl.h @@ -89,6 +89,7 @@ private: DECLARE_EVENT_TABLE() // events + void OnLeftClick(wxMouseEvent& event); void OnRightClick(wxMouseEvent& event); void OnMouseMotion(wxMouseEvent& event); void OnColumnClick(wxListEvent& event);