From fc7fe0bbcda8aed92c452f4453b78e2fd4f42b2a Mon Sep 17 00:00:00 2001 From: "avihal@gmail.com" Date: Thu, 6 Jan 2011 20:26:10 +0000 Subject: [PATCH] GSdx: Double-click now toggles full screen. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4180 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/gui/FrameForGS.cpp | 25 ++++++++++++++++++++++--- pcsx2/gui/GSFrame.h | 4 ++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index 1125c735a0..ac044487bb 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -23,6 +23,8 @@ #include +static const KeyAcceleratorCode FULLSCREEN_TOGGLE_ACCELERATOR_GSPANEL=KeyAcceleratorCode( WXK_RETURN ).Alt(); + void GSPanel::InitDefaultAccelerators() { // Note! These don't really work yet due to some hacks to get things working for @@ -52,7 +54,7 @@ void GSPanel::InitDefaultAccelerators() m_Accels->Map( AAC( WXK_F11 ), "Sys_FreezeGS" ); m_Accels->Map( AAC( WXK_F12 ), "Sys_RecordingToggle" ); - m_Accels->Map( AAC( WXK_RETURN ).Alt(), "FullscreenToggle" ); + m_Accels->Map( FULLSCREEN_TOGGLE_ACCELERATOR_GSPANEL, "FullscreenToggle" ); } GSPanel::GSPanel( wxWindow* parent ) @@ -93,6 +95,7 @@ GSPanel::GSPanel( wxWindow* parent ) Connect(wxEVT_RIGHT_UP, wxMouseEventHandler (GSPanel::OnShowMouse)); Connect(wxEVT_MOTION, wxMouseEventHandler (GSPanel::OnShowMouse)); Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler (GSPanel::OnShowMouse)); + Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler (GSPanel::OnLeftDclick)); Connect(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler (GSPanel::OnShowMouse)); Connect(wxEVT_RIGHT_DCLICK, wxMouseEventHandler (GSPanel::OnShowMouse)); Connect(wxEVT_MOUSEWHEEL, wxMouseEventHandler (GSPanel::OnShowMouse)); @@ -191,16 +194,21 @@ void GSPanel::OnKeyDown( wxKeyEvent& evt ) DirectKeyCommand( evt ); } -void GSPanel::DirectKeyCommand( wxKeyEvent& evt ) +void GSPanel::DirectKeyCommand( const KeyAcceleratorCode& kac ) { const GlobalCommandDescriptor* cmd = NULL; - m_Accels->TryGetValue( KeyAcceleratorCode( evt ).val32, cmd ); + m_Accels->TryGetValue( kac.val32, cmd ); if( cmd == NULL ) return; DbgCon.WriteLn( "(gsFrame) Invoking command: %s", cmd->Id ); cmd->Invoke(); } +void GSPanel::DirectKeyCommand( wxKeyEvent& evt ) +{ + DirectKeyCommand(KeyAcceleratorCode( evt )); +} + void GSPanel::OnFocus( wxFocusEvent& evt ) { evt.Skip(); @@ -233,12 +241,21 @@ void GSPanel::AppStatusEvent_OnSettingsApplied() Show( !EmuConfig.GS.DisableOutput ); } +void GSPanel::OnLeftDclick(wxMouseEvent& evt) +{ + Console.WriteLn("GSPanel::OnDoubleClick: Invoking Fullscreen-Toggle accelerator."); + DirectKeyCommand(FULLSCREEN_TOGGLE_ACCELERATOR_GSPANEL); +} + + + // -------------------------------------------------------------------------------------- // GSFrame Implementation // -------------------------------------------------------------------------------------- static const uint TitleBarUpdateMs = 333; + GSFrame::GSFrame(wxWindow* parent, const wxString& title) : wxFrame(parent, wxID_ANY, title, g_Conf->GSWindow.WindowPos, wxSize( 640, 480 ), @@ -305,6 +322,8 @@ bool GSFrame::ShowFullScreen(bool show, long style) return retval; } + + wxStaticText* GSFrame::GetLabel_OutputDisabled() const { return (wxStaticText*)FindWindowById( m_id_OutputDisabled ); diff --git a/pcsx2/gui/GSFrame.h b/pcsx2/gui/GSFrame.h index b70f34227e..877e141ee0 100644 --- a/pcsx2/gui/GSFrame.h +++ b/pcsx2/gui/GSFrame.h @@ -51,6 +51,7 @@ public: void DoResize(); void DoShowMouse(); void DirectKeyCommand( wxKeyEvent& evt ); + void DirectKeyCommand( const KeyAcceleratorCode& kac ); protected: void AppStatusEvent_OnSettingsApplied(); @@ -68,6 +69,9 @@ protected: void OnKeyDown( wxKeyEvent& evt ); void OnFocus( wxFocusEvent& evt ); void OnFocusLost( wxFocusEvent& evt ); + + void OnLeftDclick( wxMouseEvent& evt ); + };