From c38c5ce72a67b0e24a5d406ce550e1fabd589af6 Mon Sep 17 00:00:00 2001 From: "avihal@gmail.com" Date: Wed, 6 Apr 2011 08:03:13 +0000 Subject: [PATCH] GS Window: Zoom Keyboard control: Now works with CTRL/CMD (leaves the numpad keys available for the pad plugin). Zoom In: CTRL + NUMPAD-PLUS Zoom Out: CTRL + NUMPAD-MINUS Toggle 100%/Auto-zoom: CTRL + NUMPAD-* git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4534 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/gui/FrameForGS.cpp | 33 +++------------------------------ pcsx2/gui/GlobalCommands.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index 028c80f424..166a41e721 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -47,9 +47,9 @@ void GSPanel::InitDefaultAccelerators() m_Accels->Map( AAC( WXK_F6 ), "GSwindow_CycleAspectRatio" ); - m_Accels->Map( AAC( WXK_NUMPAD_ADD ), "GSwindow_ZoomIn" ); - m_Accels->Map( AAC( WXK_NUMPAD_SUBTRACT ), "GSwindow_ZoomOut" ); - m_Accels->Map( AAC( WXK_NUMPAD_MULTIPLY ), "GSwindow_ZoomToggle" ); + m_Accels->Map( AAC( WXK_NUMPAD_ADD ).Cmd(), "GSwindow_ZoomIn" ); //CTRL on Windows (probably linux too), CMD on OSX + m_Accels->Map( AAC( WXK_NUMPAD_SUBTRACT ).Cmd(), "GSwindow_ZoomOut" ); + m_Accels->Map( AAC( WXK_NUMPAD_MULTIPLY ).Cmd(), "GSwindow_ZoomToggle" ); m_Accels->Map( AAC( WXK_ESCAPE ), "Sys_Suspend" ); m_Accels->Map( AAC( WXK_F8 ), "Sys_TakeSnapshot" ); @@ -151,33 +151,6 @@ void GSPanel::DoResize() zoom = max( (float)arr, (float)(1.0/arr) ); viewport.Scale(zoom, zoom); -/* - - switch( g_Conf->GSWindow.AspectRatio ) - { - case AspectRatio_Stretch: - // Default to matching client size. - // Add a few pixels here, so the outermost pixels of the GS plugin output are "hidden". - // This avoids issues with flashing pixels on the edges, especially when Anti Aliasing is used. - viewport.x+=4; - viewport.y+=4; - break; - - case AspectRatio_4_3: - if( client.x/4 <= client.y/3 ) - viewport.y = (int)(client.x * (3.0/4.0)); - else - viewport.x = (int)(client.y * (4.0/3.0)); - break; - - case AspectRatio_16_9: - if( client.x/16 <= client.y/9 ) - viewport.y = (int)(client.x * (9.0/16.0)); - else - viewport.x = (int)(client.y * (16.0/9.0)); - break; - } -*/ SetSize( viewport ); CenterOnParent(); } diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index de71fa94db..725d1ecbe8 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -182,7 +182,13 @@ namespace Implementations return; g_Conf->GSWindow.Zoom = zoom; Console.WriteLn(L"GSwindow: set zoom: %f", zoom); - AppApplySettings(); + + //AppApplySettings() would have been nicer, since it also immidiately affects the GUI (if open). + //However, the events sequence it generates also "depresses" Shift/CTRL/etc, so consecutive zoom with CTRL down breaks. + //Since zoom only affects the window viewport anyway, we can live with directly calling it. + if (GSFrame* gsFrame = wxGetApp().GetGsFramePtr()) + if (GSPanel* woot = gsFrame->GetViewport()) + woot->DoResize(); }