mirror of https://github.com/PCSX2/pcsx2.git
GS Window: Add proper zoom control and get rid of the "automatic" 4-pixel zoom in stretch-mode.
Zoom = 100: Exact fit to window without cropping anything. Zoom above/below 100: Zoom In/Out. Zoom = 0: Automatic zoom in until the black-bars are gone. Keyboard: NUMPAD-PLUS: Zoom-In, NUMPAD-MINUS: Zoom-Out, NUMPAD-*: Toggle 100/0 git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4531 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
20e6dc39e1
commit
921c2352ef
|
@ -712,6 +712,7 @@ AppConfig::GSWindowOptions::GSWindowOptions()
|
||||||
DisableScreenSaver = true;
|
DisableScreenSaver = true;
|
||||||
|
|
||||||
AspectRatio = AspectRatio_4_3;
|
AspectRatio = AspectRatio_4_3;
|
||||||
|
Zoom = 100;
|
||||||
|
|
||||||
WindowSize = wxSize( 640, 480 );
|
WindowSize = wxSize( 640, 480 );
|
||||||
WindowPos = wxDefaultPosition;
|
WindowPos = wxDefaultPosition;
|
||||||
|
@ -765,6 +766,7 @@ void AppConfig::GSWindowOptions::LoadSave( IniInterface& ini )
|
||||||
};
|
};
|
||||||
|
|
||||||
ini.EnumEntry( L"AspectRatio", AspectRatio, AspectRatioNames, AspectRatio );
|
ini.EnumEntry( L"AspectRatio", AspectRatio, AspectRatioNames, AspectRatio );
|
||||||
|
IniEntry( Zoom );
|
||||||
|
|
||||||
if( ini.IsLoading() ) SanityCheck();
|
if( ini.IsLoading() ) SanityCheck();
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,7 @@ public:
|
||||||
bool DisableScreenSaver;
|
bool DisableScreenSaver;
|
||||||
|
|
||||||
AspectRatioType AspectRatio;
|
AspectRatioType AspectRatio;
|
||||||
|
Fixed100 Zoom;
|
||||||
|
|
||||||
wxSize WindowSize;
|
wxSize WindowSize;
|
||||||
wxPoint WindowPos;
|
wxPoint WindowPos;
|
||||||
|
|
|
@ -47,6 +47,10 @@ void GSPanel::InitDefaultAccelerators()
|
||||||
|
|
||||||
m_Accels->Map( AAC( WXK_F6 ), "GSwindow_CycleAspectRatio" );
|
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_ESCAPE ), "Sys_Suspend" );
|
m_Accels->Map( AAC( WXK_ESCAPE ), "Sys_Suspend" );
|
||||||
m_Accels->Map( AAC( WXK_F8 ), "Sys_TakeSnapshot" );
|
m_Accels->Map( AAC( WXK_F8 ), "Sys_TakeSnapshot" );
|
||||||
m_Accels->Map( AAC( WXK_F8 ).Shift(), "Sys_TakeSnapshot");
|
m_Accels->Map( AAC( WXK_F8 ).Shift(), "Sys_TakeSnapshot");
|
||||||
|
@ -127,6 +131,28 @@ void GSPanel::DoResize()
|
||||||
wxSize client = GetParent()->GetClientSize();
|
wxSize client = GetParent()->GetClientSize();
|
||||||
wxSize viewport = client;
|
wxSize viewport = client;
|
||||||
|
|
||||||
|
double clientAr = (double)client.GetWidth()/(double)client.GetHeight();
|
||||||
|
|
||||||
|
double targetAr = clientAr;
|
||||||
|
if( g_Conf->GSWindow.AspectRatio == AspectRatio_4_3 )
|
||||||
|
targetAr = 4.0/3.0;
|
||||||
|
else if( g_Conf->GSWindow.AspectRatio == AspectRatio_16_9 )
|
||||||
|
targetAr = 16.0/9.0;
|
||||||
|
|
||||||
|
double arr = targetAr / clientAr;
|
||||||
|
|
||||||
|
if( arr < 1 )
|
||||||
|
viewport.x = (int)( (double)viewport.x*arr + 0.5);
|
||||||
|
else if( arr > 1 )
|
||||||
|
viewport.y = (int)( (double)viewport.y/arr + 0.5);
|
||||||
|
|
||||||
|
float zoom = g_Conf->GSWindow.Zoom.ToFloat()/100.0;
|
||||||
|
if( zoom == 0 )//auto zoom in untill black-bars are gone (while keeping the aspect ratio).
|
||||||
|
zoom = max( (float)arr, (float)(1.0/arr) );
|
||||||
|
|
||||||
|
viewport.Scale(zoom, zoom);
|
||||||
|
/*
|
||||||
|
|
||||||
switch( g_Conf->GSWindow.AspectRatio )
|
switch( g_Conf->GSWindow.AspectRatio )
|
||||||
{
|
{
|
||||||
case AspectRatio_Stretch:
|
case AspectRatio_Stretch:
|
||||||
|
@ -151,7 +177,7 @@ void GSPanel::DoResize()
|
||||||
viewport.x = (int)(client.y * (16.0/9.0));
|
viewport.x = (int)(client.y * (16.0/9.0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
SetSize( viewport );
|
SetSize( viewport );
|
||||||
CenterOnParent();
|
CenterOnParent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,6 +176,39 @@ namespace Implementations
|
||||||
AppApplySettings();
|
AppApplySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetZoom(float zoom)
|
||||||
|
{
|
||||||
|
if( zoom < 0 )
|
||||||
|
return;
|
||||||
|
g_Conf->GSWindow.Zoom = zoom;
|
||||||
|
Console.WriteLn(L"GSwindow: set zoom: %f", zoom);
|
||||||
|
AppApplySettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GSwindow_ZoomIn()
|
||||||
|
{
|
||||||
|
float z = g_Conf->GSWindow.Zoom.ToFloat();
|
||||||
|
if( z==0 ) z = 100;
|
||||||
|
z++;
|
||||||
|
SetZoom( z );
|
||||||
|
}
|
||||||
|
void GSwindow_ZoomOut()
|
||||||
|
{
|
||||||
|
float z = g_Conf->GSWindow.Zoom.ToFloat();
|
||||||
|
if( z==0 ) z = 100;
|
||||||
|
z--;
|
||||||
|
SetZoom( z );
|
||||||
|
}
|
||||||
|
void GSwindow_ZoomToggle()
|
||||||
|
{
|
||||||
|
float z = g_Conf->GSWindow.Zoom.ToFloat();
|
||||||
|
if( z==100 ) z = 0;
|
||||||
|
else z = 100;
|
||||||
|
|
||||||
|
SetZoom( z );
|
||||||
|
}
|
||||||
|
|
||||||
void Sys_Suspend()
|
void Sys_Suspend()
|
||||||
{
|
{
|
||||||
CoreThread.Suspend();
|
CoreThread.Suspend();
|
||||||
|
@ -338,6 +371,24 @@ static const GlobalCommandDescriptor CommandDeclarations[] =
|
||||||
NULL,
|
NULL,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ "GSwindow_ZoomIn",
|
||||||
|
Implementations::GSwindow_ZoomIn,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ "GSwindow_ZoomOut",
|
||||||
|
Implementations::GSwindow_ZoomOut,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ "GSwindow_ZoomToggle",
|
||||||
|
Implementations::GSwindow_ZoomToggle,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
},
|
||||||
|
|
||||||
{ "Sys_Suspend",
|
{ "Sys_Suspend",
|
||||||
Implementations::Sys_Suspend,
|
Implementations::Sys_Suspend,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -264,6 +264,8 @@ namespace Panels
|
||||||
protected:
|
protected:
|
||||||
wxComboBox* m_combo_AspectRatio;
|
wxComboBox* m_combo_AspectRatio;
|
||||||
|
|
||||||
|
wxTextCtrl* m_text_Zoom;
|
||||||
|
|
||||||
pxCheckBox* m_check_CloseGS;
|
pxCheckBox* m_check_CloseGS;
|
||||||
pxCheckBox* m_check_SizeLock;
|
pxCheckBox* m_check_SizeLock;
|
||||||
pxCheckBox* m_check_VsyncEnable;
|
pxCheckBox* m_check_VsyncEnable;
|
||||||
|
|
|
@ -32,6 +32,8 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
|
||||||
_("Widescreen (16:9)")
|
_("Widescreen (16:9)")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
m_text_Zoom = CreateNumericalTextCtrl( this, 5 );
|
||||||
|
|
||||||
m_combo_AspectRatio = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
m_combo_AspectRatio = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||||
ArraySize(aspect_ratio_labels), aspect_ratio_labels, wxCB_READONLY );
|
ArraySize(aspect_ratio_labels), aspect_ratio_labels, wxCB_READONLY );
|
||||||
|
|
||||||
|
@ -50,6 +52,14 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
|
||||||
m_check_DclickFullscreen = new pxCheckBox( this, _("Double-click toggles fullscreen mode") );
|
m_check_DclickFullscreen = new pxCheckBox( this, _("Double-click toggles fullscreen mode") );
|
||||||
//m_check_ExclusiveFS = new pxCheckBox( this, _("Use exclusive fullscreen mode (if available)") );
|
//m_check_ExclusiveFS = new pxCheckBox( this, _("Use exclusive fullscreen mode (if available)") );
|
||||||
|
|
||||||
|
m_text_Zoom->SetToolTip( pxEt( "!ContextTip:Window:Zoom",
|
||||||
|
L"Zoom = 100: Fit the entire image to the window without any cropping.\n"
|
||||||
|
L"Above/Below 100: Zoom In/Out\n"
|
||||||
|
L"0: Automatic-Zoom-In untill the black-bars are gone (Aspect ratio is kept, some of the image goes out of screen).\n"
|
||||||
|
L" NOTE: Some games draw their own black-bars, which will not be removed with '0'.\n\n"
|
||||||
|
L"Keyboard: NUMPAD-PLUS: Zoom-In, NUMPAD-MINUS: Zoom-Out, NUMPAD-*: Toggle 100/0"
|
||||||
|
) );
|
||||||
|
|
||||||
m_check_VsyncEnable->SetToolTip( pxEt( "!ContextTip:Window:Vsync",
|
m_check_VsyncEnable->SetToolTip( pxEt( "!ContextTip:Window:Vsync",
|
||||||
L"Vsync eliminates screen tearing but typically has a big performance hit. "
|
L"Vsync eliminates screen tearing but typically has a big performance hit. "
|
||||||
L"It usually only applies to fullscreen mode, and may not work with all GS plugins."
|
L"It usually only applies to fullscreen mode, and may not work with all GS plugins."
|
||||||
|
@ -102,6 +112,10 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
|
||||||
s_AspectRatio += Label(_("Custom Window Size:"))| pxMiddle;
|
s_AspectRatio += Label(_("Custom Window Size:"))| pxMiddle;
|
||||||
s_AspectRatio += s_customsize | pxAlignRight;
|
s_AspectRatio += s_customsize | pxAlignRight;
|
||||||
|
|
||||||
|
s_AspectRatio += Label(_("Zoom:")) | StdExpand();
|
||||||
|
s_AspectRatio += m_text_Zoom;
|
||||||
|
|
||||||
|
|
||||||
*this += s_AspectRatio | StdExpand();
|
*this += s_AspectRatio | StdExpand();
|
||||||
*this += m_check_SizeLock;
|
*this += m_check_SizeLock;
|
||||||
*this += m_check_HideMouse;
|
*this += m_check_HideMouse;
|
||||||
|
@ -109,7 +123,7 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
|
||||||
*this += new wxStaticLine( this ) | StdExpand();
|
*this += new wxStaticLine( this ) | StdExpand();
|
||||||
|
|
||||||
*this += m_check_Fullscreen;
|
*this += m_check_Fullscreen;
|
||||||
*this += m_check_DclickFullscreen;;
|
*this += m_check_DclickFullscreen;
|
||||||
|
|
||||||
//*this += m_check_ExclusiveFS;
|
//*this += m_check_ExclusiveFS;
|
||||||
*this += new wxStaticLine( this ) | StdExpand();
|
*this += new wxStaticLine( this ) | StdExpand();
|
||||||
|
@ -141,6 +155,7 @@ void Panels::GSWindowSettingsPanel::ApplyConfigToGui( AppConfig& configToApply,
|
||||||
m_check_SizeLock ->SetValue( conf.DisableResizeBorders );
|
m_check_SizeLock ->SetValue( conf.DisableResizeBorders );
|
||||||
|
|
||||||
m_combo_AspectRatio ->SetSelection( (int)conf.AspectRatio );
|
m_combo_AspectRatio ->SetSelection( (int)conf.AspectRatio );
|
||||||
|
m_text_Zoom ->SetValue( conf.Zoom.ToString() );
|
||||||
|
|
||||||
m_check_DclickFullscreen ->SetValue ( conf.IsToggleFullscreenOnDoubleClick );
|
m_check_DclickFullscreen ->SetValue ( conf.IsToggleFullscreenOnDoubleClick );
|
||||||
|
|
||||||
|
@ -166,6 +181,7 @@ void Panels::GSWindowSettingsPanel::Apply()
|
||||||
appconf.DisableResizeBorders = m_check_SizeLock ->GetValue();
|
appconf.DisableResizeBorders = m_check_SizeLock ->GetValue();
|
||||||
|
|
||||||
appconf.AspectRatio = (AspectRatioType)m_combo_AspectRatio->GetSelection();
|
appconf.AspectRatio = (AspectRatioType)m_combo_AspectRatio->GetSelection();
|
||||||
|
appconf.Zoom = Fixed100::FromString( m_text_Zoom->GetValue() );
|
||||||
|
|
||||||
gsconf.VsyncEnable = m_check_VsyncEnable->GetValue();
|
gsconf.VsyncEnable = m_check_VsyncEnable->GetValue();
|
||||||
gsconf.ManagedVsync = m_check_ManagedVsync->GetValue();
|
gsconf.ManagedVsync = m_check_ManagedVsync->GetValue();
|
||||||
|
|
Loading…
Reference in New Issue