/[pcsx2_0.9.7]/trunk/pcsx2/gui/Panels/GSWindowPanel.cpp
ViewVC logotype

Contents of /trunk/pcsx2/gui/Panels/GSWindowPanel.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 2 months ago) by william
File size: 6163 byte(s)
re-commit (had local access denied errors when committing)
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16 #include "PrecompiledHeader.h"
17 #include "ConfigurationPanels.h"
18
19 using namespace pxSizerFlags;
20
21 // --------------------------------------------------------------------------------------
22 // GSWindowSetting Implementation
23 // --------------------------------------------------------------------------------------
24
25 Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
26 : BaseApplicableConfigPanel( parent )
27 {
28 const wxString aspect_ratio_labels[] =
29 {
30 _("Fit to Window/Screen"),
31 _("Standard (4:3)"),
32 _("Widescreen (16:9)")
33 };
34
35 m_combo_AspectRatio = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
36 ArraySize(aspect_ratio_labels), aspect_ratio_labels, wxCB_READONLY );
37
38 m_text_WindowWidth = CreateNumericalTextCtrl( this, 5 );
39 m_text_WindowHeight = CreateNumericalTextCtrl( this, 5 );
40
41 // Linux/Mac note: Exclusive Fullscreen mode is probably Microsoft specific, though
42 // I'm not yet 100% certain of that.
43
44 m_check_SizeLock = new pxCheckBox( this, _("Disable window resize border") );
45 m_check_HideMouse = new pxCheckBox( this, _("Always hide mouse cursor") );
46 m_check_CloseGS = new pxCheckBox( this, _("Hide window on suspend") );
47 m_check_Fullscreen = new pxCheckBox( this, _("Default to fullscreen mode on open") );
48 m_check_VsyncEnable = new pxCheckBox( this, _("Wait for vsync on refresh") );
49 m_check_ExclusiveFS = new pxCheckBox( this, _("Use exclusive fullscreen mode (if available)") );
50
51 m_check_VsyncEnable->SetToolTip( pxEt( "!ContextTip:Window:Vsync",
52 L"Vsync eliminates screen tearing but typically has a big performance hit. "
53 L"It usually only applies to fullscreen mode, and may not work with all GS plugins."
54 ) );
55
56 m_check_HideMouse->SetToolTip( pxEt( "!ContextTip:Window:HideMouse",
57 L"Check this to force the mouse cursor invisible inside the GS window; useful if using "
58 L"the mouse as a primary control device for gaming. By default the mouse auto-hides after "
59 L"2 seconds of inactivity."
60 ) );
61
62 m_check_Fullscreen->SetToolTip( pxEt( "!ContextTip:Window:Fullscreen",
63 L"Enables automatic mode switch to fullscreen when starting or resuming emulation. "
64 L"You can still toggle fullscreen display at any time using alt-enter."
65 ) );
66
67 m_check_ExclusiveFS->SetToolTip( pxEt( "!ContextTip:Window:FullscreenExclusive",
68 L"Fullscreen Exclusive Mode may look better on older CRTs and might be a little faster on older video cards, "
69 L"but typically can lead to memory leaks or random crashes when entering/leaving fullscreen mode."
70 ) );
71
72 m_check_CloseGS->SetToolTip( pxEt( "!ContextTip:Window:HideGS",
73 L"Completely closes the often large and bulky GS window when pressing "
74 L"ESC or suspending the emulator."
75 ) );
76
77 // ----------------------------------------------------------------------------
78 // Layout and Positioning
79
80 wxBoxSizer& s_customsize( *new wxBoxSizer( wxHORIZONTAL ) );
81 s_customsize += m_text_WindowWidth;
82 s_customsize += Label( L"x" ) | StdExpand();
83 s_customsize += m_text_WindowHeight;
84
85 wxFlexGridSizer& s_AspectRatio( *new wxFlexGridSizer( 2, StdPadding, StdPadding ) );
86 //s_AspectRatio.AddGrowableCol( 0 );
87 s_AspectRatio.AddGrowableCol( 1 );
88
89 s_AspectRatio += Label(_("Aspect Ratio:")) | pxMiddle;
90 s_AspectRatio += m_combo_AspectRatio | pxExpand;
91 s_AspectRatio += Label(_("Custom Window Size:"))| pxMiddle;
92 s_AspectRatio += s_customsize | pxAlignRight;
93
94 *this += s_AspectRatio | StdExpand();
95 *this += m_check_SizeLock;
96 *this += m_check_HideMouse;
97 *this += m_check_CloseGS;
98 *this += new wxStaticLine( this ) | StdExpand();
99
100 *this += m_check_Fullscreen;
101 *this += m_check_ExclusiveFS;
102 *this += m_check_VsyncEnable;
103
104 wxBoxSizer* centerSizer = new wxBoxSizer( wxVERTICAL );
105 *centerSizer += GetSizer() | pxCenter;
106 SetSizer( centerSizer, false );
107
108 AppStatusEvent_OnSettingsApplied();
109 }
110
111 void Panels::GSWindowSettingsPanel::AppStatusEvent_OnSettingsApplied()
112 {
113 const AppConfig::GSWindowOptions& conf( g_Conf->GSWindow );
114
115 m_check_CloseGS ->SetValue( conf.CloseOnEsc );
116 m_check_Fullscreen ->SetValue( conf.DefaultToFullscreen );
117 m_check_HideMouse ->SetValue( conf.AlwaysHideMouse );
118 m_check_SizeLock ->SetValue( conf.DisableResizeBorders );
119
120 m_combo_AspectRatio ->SetSelection( (int)conf.AspectRatio );
121
122 m_check_VsyncEnable ->SetValue( g_Conf->EmuOptions.GS.VsyncEnable );
123
124 m_text_WindowWidth ->SetValue( wxsFormat( L"%d", conf.WindowSize.GetWidth() ) );
125 m_text_WindowHeight ->SetValue( wxsFormat( L"%d", conf.WindowSize.GetHeight() ) );
126 }
127
128 void Panels::GSWindowSettingsPanel::Apply()
129 {
130 AppConfig::GSWindowOptions& appconf( g_Conf->GSWindow );
131 Pcsx2Config::GSOptions& gsconf( g_Conf->EmuOptions.GS );
132
133 appconf.CloseOnEsc = m_check_CloseGS ->GetValue();
134 appconf.DefaultToFullscreen = m_check_Fullscreen->GetValue();
135 appconf.AlwaysHideMouse = m_check_HideMouse ->GetValue();
136 appconf.DisableResizeBorders = m_check_SizeLock ->GetValue();
137
138 appconf.AspectRatio = (AspectRatioType)m_combo_AspectRatio->GetSelection();
139
140 gsconf.VsyncEnable = m_check_VsyncEnable->GetValue();
141
142 long xr, yr;
143
144 if( !m_text_WindowWidth->GetValue().ToLong( &xr ) || !m_text_WindowHeight->GetValue().ToLong( &yr ) )
145 throw Exception::CannotApplySettings( this )
146 .SetDiagMsg(L"User submitted non-numeric window size parameters!")
147 .SetUserMsg(_("Invalid window dimensions specified: Size cannot contain non-numeric digits! >_<"));
148
149 appconf.WindowSize.x = xr;
150 appconf.WindowSize.y = yr;
151 }

  ViewVC Help
Powered by ViewVC 1.1.22