pcsx2-gui: Clang format - pcsx2\gui\AppAccelerators.h - pcsx2\gui\GlobalCommands.cpp - pcsx2\gui\MainFrame.cpp - pcsx2\gui\MainFrame.h - pcsx2\gui\Panels\GSWindowPanel.cpp - pcsx2\gui\Panels\VideoPanel.cpp

This commit is contained in:
RedDevilus 2020-12-13 03:57:45 +01:00 committed by refractionpcsx2
parent ee54396670
commit 028f468d26
5 changed files with 144 additions and 148 deletions

View File

@ -30,29 +30,35 @@ struct KeyAcceleratorCode
{
struct
{
u16 keycode;
u16 win:1, // win32 only.
cmd:1, // ctrl in win32, Command in Mac
alt:1,
shift:1;
u16 keycode;
u16 win : 1, // win32 only.
cmd : 1, // ctrl in win32, Command in Mac
alt : 1,
shift : 1;
};
u32 val32;
u32 val32;
};
KeyAcceleratorCode() : val32( 0 ) {}
KeyAcceleratorCode( const wxKeyEvent& evt );
KeyAcceleratorCode()
: val32(0)
{
}
KeyAcceleratorCode(const wxKeyEvent& evt);
//grab event attributes only
KeyAcceleratorCode( const wxAcceleratorEntry& right)
KeyAcceleratorCode(const wxAcceleratorEntry& right)
{
val32 = 0;
keycode = right.GetKeyCode();
if( right.GetFlags() & wxACCEL_ALT ) Alt();
if( right.GetFlags() & wxACCEL_CMD ) Cmd();
if( right.GetFlags() & wxACCEL_SHIFT ) Shift();
if (right.GetFlags() & wxACCEL_ALT)
Alt();
if (right.GetFlags() & wxACCEL_CMD)
Cmd();
if (right.GetFlags() & wxACCEL_SHIFT)
Shift();
}
KeyAcceleratorCode( wxKeyCode code )
KeyAcceleratorCode(wxKeyCode code)
{
val32 = 0;
keycode = code;
@ -133,15 +139,15 @@ struct KeyAcceleratorCode
struct GlobalCommandDescriptor
{
const char* Id; // Identifier string
void (*Invoke)(); // Do it!! Do it NOW!!!
const char* Id; // Identifier string
void (*Invoke)(); // Do it!! Do it NOW!!!
const wxChar* Fullname; // Name displayed in pulldown menus
const wxChar* Tooltip; // text displayed in toolbar tooltips and menu status bars.
const wxChar* Fullname; // Name displayed in pulldown menus
const wxChar* Tooltip; // text displayed in toolbar tooltips and menu status bars.
bool AlsoApplyToGui; // Indicates that the GUI should be updated if possible.
bool AlsoApplyToGui; // Indicates that the GUI should be updated if possible.
wxString keycodeString;
wxString keycodeString;
};
// --------------------------------------------------------------------------------------
@ -152,28 +158,26 @@ class CommandDictionary : public std::unordered_map<std::string, const GlobalCom
typedef std::unordered_map<std::string, const GlobalCommandDescriptor*> _parent;
protected:
public:
using _parent::operator[];
virtual ~CommandDictionary() = default;
};
// --------------------------------------------------------------------------------------
//
//
// --------------------------------------------------------------------------------------
class AcceleratorDictionary : public std::unordered_map<int, const GlobalCommandDescriptor*>
{
typedef std::unordered_map<int, const GlobalCommandDescriptor*> _parent;
protected:
public:
using _parent::operator[];
virtual ~AcceleratorDictionary() = default;
void Map( const KeyAcceleratorCode& acode, const char *searchfor );
void Map(const KeyAcceleratorCode& acode, const char* searchfor);
// Searches the dictionary _by the value (command ID string)_ and returns
// the associated KeyAcceleratorCode. Do not expect constant time lookup
// Returns a blank KeyAcceleratorCode if nothing is found
KeyAcceleratorCode findKeycodeWithCommandId(const char *commandId);
KeyAcceleratorCode findKeycodeWithCommandId(const char* commandId);
};

View File

@ -390,7 +390,7 @@ namespace Implementations
void Sys_TakeSnapshot()
{
if (GSmakeSnapshot(g_Conf->Folders.Snapshots.ToUTF8()))
OSDlog(ConsoleColors::Color_Black, true, "Snapshot taken");
OSDlog(ConsoleColors::Color_Black, true, "Snapshot taken");
}
void Sys_RenderToggle()
@ -865,7 +865,6 @@ void AcceleratorDictionary::Map(const KeyAcceleratorCode& _acode, const char* se
KeyAcceleratorCode acode = _acode;
wxString overrideStr;
wxAcceleratorEntry codeParser; //Provides string parsing capabilities
wxString ye = GetUiKeysFilename();
wxFileConfig cfg(L"", L"", L"", GetUiKeysFilename(), wxCONFIG_USE_GLOBAL_FILE);
if (cfg.Read(wxString::FromUTF8(searchfor), &overrideStr))
{
@ -1013,9 +1012,9 @@ void Pcsx2App::InitDefaultGlobalAccelerators()
GlobalAccels->Map(AAC(WXK_F4), "Framelimiter_MasterToggle");
GlobalAccels->Map(AAC(WXK_F4).Shift(), "Frameskip_Toggle");
// Doesn't read from the ini file at this point because `AppConfig::GetUiKeysFilename` is blank at this point!
// Used for custom hotkeys in the GUI.
// It will read from the PCSX2_keys.ini in the ini folder based on PCSX2_keys.ini.default which get overridden
// Doesn't read from the ini file at this point because `AppConfig::GetUiKeysFilename` is blank at this point!
// Used for custom hotkeys in the GUI.
// It will read from the PCSX2_keys.ini in the ini folder based on PCSX2_keys.ini.default which get overridden
GlobalAccels->Map(AAC(WXK_TAB), "Framelimiter_TurboToggle");
GlobalAccels->Map(AAC(WXK_TAB).Shift(), "Framelimiter_SlomoToggle");
@ -1024,12 +1023,12 @@ void Pcsx2App::InitDefaultGlobalAccelerators()
GlobalAccels->Map(AAC(WXK_ESCAPE), "Sys_SuspendResume");
GlobalAccels->Map(AAC( WXK_F8 ),"Sys_TakeSnapshot");
GlobalAccels->Map(AAC( WXK_F8 ).Shift(), "Sys_TakeSnapshot");
GlobalAccels->Map(AAC( WXK_F8 ).Shift().Cmd(),"Sys_TakeSnapshot");
GlobalAccels->Map(AAC( WXK_F9 ), "Sys_RenderswitchToggle");
GlobalAccels->Map(AAC(WXK_F8), "Sys_TakeSnapshot");
GlobalAccels->Map(AAC(WXK_F8).Shift(), "Sys_TakeSnapshot");
GlobalAccels->Map(AAC(WXK_F8).Shift().Cmd(), "Sys_TakeSnapshot");
GlobalAccels->Map(AAC(WXK_F9), "Sys_RenderswitchToggle");
// GlobalAccels->Map(AAC(WXK_F10), "Sys_LoggingToggle");
// GlobalAccels->Map(AAC(WXK_F11), "Sys_FreezeGS");
GlobalAccels->Map(AAC(WXK_F12), "Sys_RecordingToggle");
// GlobalAccels->Map(AAC(WXK_F10), "Sys_LoggingToggle");
// GlobalAccels->Map(AAC(WXK_F11), "Sys_FreezeGS");
GlobalAccels->Map(AAC(WXK_F12), "Sys_RecordingToggle");
}

View File

@ -403,10 +403,10 @@ void MainEmuFrame::CreatePcsx2Menu()
m_GameSettingsSubmenu.Append(MenuId_Debug_CreateBlockdump, _("Create &Blockdump"), _("Creates a block dump for debugging purposes."), wxITEM_CHECK);
m_menuSys.AppendSeparator();
// Implement custom hotkeys (F3) with translatable string intact + not blank in GUI.
// Implement custom hotkeys (F3) with translatable string intact + not blank in GUI.
wxMenuItem* MainLoadStateLabel = m_menuSys.Append(MenuId_Sys_LoadStates, _("&Load state"), &m_LoadStatesSubmenu);
AppendShortcutToMenuOption(*MainLoadStateLabel, wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_DefrostCurrentSlot").toTitleizedString());
// Implement custom hotkeys (F1) with translatable string intact + not blank in GUI.
// Implement custom hotkeys (F1) with translatable string intact + not blank in GUI.
wxMenuItem* MainSaveStateLabel = m_menuSys.Append(MenuId_Sys_SaveStates, _("&Save state"), &m_SaveStatesSubmenu);
AppendShortcutToMenuOption(*MainSaveStateLabel, wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_FreezeCurrentSlot").toTitleizedString());
@ -445,7 +445,7 @@ void MainEmuFrame::CreateConfigMenu()
m_menuConfig.Append(MenuId_Config_McdSettings, _("&Memory Cards..."));
m_menuConfig.Append(MenuId_Config_BIOS, _("&Plugin/BIOS Selector..."));
m_menuConfig.Append(MenuId_Config_SPU2, _("&Audio Settings..."));
m_menuConfig.Append(MenuId_Config_DEV9, _("&Network and HDD Settings...") );
m_menuConfig.Append(MenuId_Config_DEV9, _("&Network and HDD Settings..."));
m_menuConfig.Append(MenuId_Config_USB, _("&USB Settings..."));
m_menuConfig.Append(MenuId_Config_PAD, _("&GamePad Settings..."));
@ -478,11 +478,11 @@ void MainEmuFrame::CreateWindowsMenu()
void MainEmuFrame::CreateCaptureMenu()
{
m_menuCapture.Append(MenuId_Capture_Video, _("Video"), &m_submenuVideoCapture);
// Implement custom hotkeys (F12) with translatable string intact + not blank in GUI.
// Implement custom hotkeys (F12) with translatable string intact + not blank in GUI.
wxMenuItem* MainVideoCaptureLabel = m_submenuVideoCapture.Append(MenuId_Capture_Video_Record, _("Start Screenrecorder"));
AppendShortcutToMenuOption(*MainVideoCaptureLabel, wxGetApp().GlobalAccels->findKeycodeWithCommandId("Sys_RecordingToggle").toTitleizedString());
m_submenuVideoCapture.Append(MenuId_Capture_Video_Stop, _("Stop Screenrecorder"))->Enable(false);
// Implement custom hotkeys (F8) + (Shift + F8) + (Ctrl + Shift + F8) with translatable string intact + not blank in GUI.
// Implement custom hotkeys (F8) + (Shift + F8) + (Ctrl + Shift + F8) with translatable string intact + not blank in GUI.
m_menuCapture.Append(MenuId_Capture_Screenshot, _("Screenshot"), &m_submenuScreenshot);
wxMenuItem* MainScreenShotLabel = m_submenuScreenshot.Append(MenuId_Capture_Screenshot_Screenshot, _("Take Screenshot"));
AppendShortcutToMenuOption(*MainScreenShotLabel, wxGetApp().GlobalAccels->findKeycodeWithCommandId("Sys_TakeSnapshot").toTitleizedString());
@ -813,13 +813,13 @@ void MainEmuFrame::CommitPreset_noTrigger()
void MainEmuFrame::AppendShortcutToMenuOption(wxMenuItem& item, wxString keyCodeStr)
{
if (&item == nullptr)
{
return;
}
wxString text = item.GetItemLabel();
const size_t tabPos = text.rfind(L'\t');
item.SetItemLabel(text.Mid(0, tabPos) + L"\t" + keyCodeStr);
if (&item == nullptr)
{
return;
}
wxString text = item.GetItemLabel();
const size_t tabPos = text.rfind(L'\t');
item.SetItemLabel(text.Mid(0, tabPos) + L"\t" + keyCodeStr);
}
#ifndef DISABLE_RECORDING

View File

@ -115,9 +115,9 @@ protected:
wxMenu& m_menuConfig;
wxMenu& m_menuWindow;
wxMenu& m_menuCapture;
wxMenu& m_submenuVideoCapture;
wxMenu& m_submenuScreenshot;
wxMenu& m_menuCapture;
wxMenu& m_submenuVideoCapture;
wxMenu& m_submenuScreenshot;
#ifndef DISABLE_RECORDING
wxMenu& m_menuRecording;
@ -193,7 +193,7 @@ protected:
void OnActivate(wxActivateEvent& evt);
void Menu_SysSettings_Click(wxCommandEvent& event);
void Menu_NetworkSettings_Click(wxCommandEvent &event);
void Menu_NetworkSettings_Click(wxCommandEvent& event);
void Menu_AudioSettings_Click(wxCommandEvent& event);
void Menu_USBSettings_Click(wxCommandEvent& event);
void Menu_PADSettings_Click(wxCommandEvent& event);
@ -260,10 +260,10 @@ protected:
void Menu_Recording_New_Click(wxCommandEvent& event);
void Menu_Recording_Play_Click(wxCommandEvent& event);
void Menu_Recording_Stop_Click(wxCommandEvent& event);
void Menu_Recording_TogglePause_Click(wxCommandEvent &event);
void Menu_Recording_FrameAdvance_Click(wxCommandEvent &event);
void Menu_Recording_ToggleRecordingMode_Click(wxCommandEvent &event);
void Menu_Recording_VirtualPad_Open_Click(wxCommandEvent &event);
void Menu_Recording_TogglePause_Click(wxCommandEvent& event);
void Menu_Recording_FrameAdvance_Click(wxCommandEvent& event);
void Menu_Recording_ToggleRecordingMode_Click(wxCommandEvent& event);
void Menu_Recording_VirtualPad_Open_Click(wxCommandEvent& event);
#endif
void _DoBootCdvd();

View File

@ -26,94 +26,87 @@ using namespace pxSizerFlags;
// GSWindowSetting Implementation
// --------------------------------------------------------------------------------------
Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
: BaseApplicableConfigPanel_SpecificConfig( parent )
Panels::GSWindowSettingsPanel::GSWindowSettingsPanel(wxWindow* parent)
: BaseApplicableConfigPanel_SpecificConfig(parent)
{
const wxString aspect_ratio_labels[] =
{
_("Fit to Window/Screen"),
_("Standard (4:3)"),
_("Widescreen (16:9)")
};
{
_("Fit to Window/Screen"),
_("Standard (4:3)"),
_("Widescreen (16:9)")};
const wxString fmv_aspect_ratio_switch_labels[] =
{
_("Off (Default)"),
_("Standard (4:3)"),
_("Widescreen (16:9)")
};
{
_("Off (Default)"),
_("Standard (4:3)"),
_("Widescreen (16:9)")};
// Warning must match the order of the VsyncMode Enum
const wxString vsync_label[] =
{
_("Disabled"),
_("Standard"),
_("Adaptive"),
};
{
_("Disabled"),
_("Standard"),
_("Adaptive"),
};
m_text_Zoom = CreateNumericalTextCtrl( this, 5 );
m_text_Zoom = CreateNumericalTextCtrl(this, 5);
m_combo_AspectRatio = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
ArraySize(aspect_ratio_labels), aspect_ratio_labels, wxCB_READONLY );
m_combo_AspectRatio = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
ArraySize(aspect_ratio_labels), aspect_ratio_labels, wxCB_READONLY);
m_combo_FMVAspectRatioSwitch = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
ArraySize(fmv_aspect_ratio_switch_labels), fmv_aspect_ratio_switch_labels, wxCB_READONLY);
ArraySize(fmv_aspect_ratio_switch_labels), fmv_aspect_ratio_switch_labels, wxCB_READONLY);
m_combo_vsync = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
ArraySize(vsync_label), vsync_label, wxCB_READONLY );
m_combo_vsync = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
ArraySize(vsync_label), vsync_label, wxCB_READONLY);
m_text_WindowWidth = CreateNumericalTextCtrl( this, 5 );
m_text_WindowHeight = CreateNumericalTextCtrl( this, 5 );
m_text_WindowWidth = CreateNumericalTextCtrl(this, 5);
m_text_WindowHeight = CreateNumericalTextCtrl(this, 5);
// Linux/Mac note: Exclusive Fullscreen mode is probably Microsoft specific, though
// I'm not yet 100% certain of that.
m_check_SizeLock = new pxCheckBox( this, _("Disable window resize border") );
m_check_HideMouse = new pxCheckBox( this, _("Always hide mouse cursor") );
m_check_CloseGS = new pxCheckBox( this, _("Hide window when paused") );
// Implement custom hotkeys (Alt + Enter) with translatable string intact + not blank in GUI.
m_check_Fullscreen = new pxCheckBox( this, _("Start in fullscreen mode by default") + wxString(" (") + wxGetApp().GlobalAccels->findKeycodeWithCommandId("FullscreenToggle").toTitleizedString()+ wxString(")") );
m_check_DclickFullscreen = new pxCheckBox( this, _("Double-click toggles fullscreen mode") );
m_check_SizeLock = new pxCheckBox(this, _("Disable window resize border"));
m_check_HideMouse = new pxCheckBox(this, _("Always hide mouse cursor"));
m_check_CloseGS = new pxCheckBox(this, _("Hide window when paused"));
// Implement custom hotkeys (Alt + Enter) with translatable string intact + not blank in GUI.
m_check_Fullscreen = new pxCheckBox(this, _("Start in fullscreen mode by default") + wxString(" (") + wxGetApp().GlobalAccels->findKeycodeWithCommandId("FullscreenToggle").toTitleizedString() + wxString(")"));
m_check_DclickFullscreen = new pxCheckBox(this, _("Double-click toggles fullscreen mode"));
m_combo_FMVAspectRatioSwitch->SetToolTip( pxEt( L"Off: Disables temporary aspect ratio switch. (It will use the above setting from Aspect Ratio instead of FMV Aspect Ratio Override.)\n\n"
L"4:3: Temporarily switch to a 4:3 aspect ratio while an FMV plays to correctly display an 4:3 FMV.\n\n"
L"16:9: Temporarily switch to a 16:9 aspect ratio while an FMV plays to correctly display a widescreen 16:9 FMV.") );
m_combo_FMVAspectRatioSwitch->SetToolTip(pxEt(L"Off: Disables temporary aspect ratio switch. (It will use the above setting from Aspect Ratio instead of FMV Aspect Ratio Override.)\n\n"
L"4:3: Temporarily switch to a 4:3 aspect ratio while an FMV plays to correctly display an 4:3 FMV.\n\n"
L"16:9: Temporarily switch to a 16:9 aspect ratio while an FMV plays to correctly display a widescreen 16:9 FMV."));
m_text_Zoom->SetToolTip( pxEt( L"Zoom = 100: Fit the entire image to the window without any cropping.\n"
L"Above/Below 100: Zoom In/Out.\n\n"
L"0: Automatic-Zoom-In until the black-bars are gone (Aspect ratio is kept, some of the image goes out of screen).\n\n"
L"NOTE: Some games draw their own black-bars, which will not be removed with '0'.\n\n"
L"Keyboard: \n"
L"CTRL + NUMPAD-PLUS: Zoom-In, \n"
L"CTRL + NUMPAD-MINUS: Zoom-Out, \nCTRL + NUMPAD-*: Toggle 100/0"
) );
m_text_Zoom->SetToolTip(pxEt(L"Zoom = 100: Fit the entire image to the window without any cropping.\n"
L"Above/Below 100: Zoom In/Out.\n\n"
L"0: Automatic-Zoom-In until the black-bars are gone (Aspect ratio is kept, some of the image goes out of screen).\n\n"
L"NOTE: Some games draw their own black-bars, which will not be removed with '0'.\n\n"
L"Keyboard: \n"
L"CTRL + NUMPAD-PLUS: Zoom-In, \n"
L"CTRL + NUMPAD-MINUS: Zoom-Out, \nCTRL + NUMPAD-*: Toggle 100/0"));
m_combo_vsync->SetToolTip( pxEt( L"Vsync eliminates screen tearing but typically has a big performance hit. It usually only applies to fullscreen mode, and may not work with all GS plugins."
) );
m_combo_vsync->SetToolTip(pxEt(L"Vsync eliminates screen tearing but typically has a big performance hit. It usually only applies to fullscreen mode, and may not work with all GS plugins."));
m_check_HideMouse->SetToolTip( pxEt( L"Check this to force the mouse cursor invisible inside the GS window; useful if using the mouse as a primary control device for gaming. By default the mouse auto-hides after 2 seconds of inactivity."
) );
m_check_HideMouse->SetToolTip(pxEt(L"Check this to force the mouse cursor invisible inside the GS window; useful if using the mouse as a primary control device for gaming. By default the mouse auto-hides after 2 seconds of inactivity."));
m_check_Fullscreen->SetToolTip( pxEt( L"Enables automatic mode switch to fullscreen when starting or resuming emulation. You can still toggle fullscreen display at any time using \n"
L"Alt-Enter or double clicking the output window (game)."
) );
m_check_Fullscreen->SetToolTip(pxEt(L"Enables automatic mode switch to fullscreen when starting or resuming emulation. You can still toggle fullscreen display at any time using \n"
L"Alt-Enter or double clicking the output window (game)."));
m_check_CloseGS->SetToolTip( pxEt( L"Completely closes the often large and bulky GS window when pressing ESC or pausing the emulator."
) );
m_check_CloseGS->SetToolTip(pxEt(L"Completely closes the often large and bulky GS window when pressing ESC or pausing the emulator."));
// ----------------------------------------------------------------------------
// Layout and Positioning
wxBoxSizer& s_customsize( *new wxBoxSizer( wxHORIZONTAL ) );
wxBoxSizer& s_customsize(*new wxBoxSizer(wxHORIZONTAL));
s_customsize += m_text_WindowWidth;
s_customsize += Label( L"x" ) | StdExpand();
s_customsize += Label(L"x") | StdExpand();
s_customsize += m_text_WindowHeight;
wxFlexGridSizer& s_AspectRatio( *new wxFlexGridSizer( 2, StdPadding, StdPadding ) );
wxFlexGridSizer& s_AspectRatio(*new wxFlexGridSizer(2, StdPadding, StdPadding));
//s_AspectRatio.AddGrowableCol( 0 );
s_AspectRatio.AddGrowableCol( 1 );
s_AspectRatio.AddGrowableCol(1);
// Implement custom hotkeys (F6) with translatable string intact + not blank in GUI.
// Implement custom hotkeys (F6) with translatable string intact + not blank in GUI.
s_AspectRatio += Label(_("Aspect Ratio:") + wxString(" ") + fmt::format("({})", wxGetApp().GlobalAccels->findKeycodeWithCommandId("GSwindow_CycleAspectRatio").toTitleizedString())) | pxMiddle;
s_AspectRatio += m_combo_AspectRatio | pxAlignRight;
s_AspectRatio += Label(_("FMV Aspect Ratio Override:")) | pxMiddle;
@ -124,57 +117,57 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel( wxWindow* parent )
s_AspectRatio += Label(_("Zoom:")) | pxMiddle;
s_AspectRatio += m_text_Zoom | pxAlignRight;
wxFlexGridSizer& s_vsync( *new wxFlexGridSizer( 2, StdPadding, StdPadding ) );
s_vsync.AddGrowableCol( 1 );
wxFlexGridSizer& s_vsync(*new wxFlexGridSizer(2, StdPadding, StdPadding));
s_vsync.AddGrowableCol(1);
s_vsync += Label(_("Wait for Vsync on refresh:")) | pxMiddle;
s_vsync += m_combo_vsync | pxAlignRight;
*this += s_AspectRatio | StdExpand();
*this += new wxStaticLine( this ) | StdExpand();
*this += new wxStaticLine(this) | StdExpand();
*this += m_check_SizeLock;
*this += m_check_HideMouse;
*this += m_check_CloseGS;
*this += new wxStaticLine( this ) | StdExpand();
*this += new wxStaticLine(this) | StdExpand();
*this += m_check_Fullscreen;
*this += m_check_DclickFullscreen;
*this += new wxStaticLine( this ) | StdExpand();
*this += new wxStaticLine(this) | StdExpand();
*this += s_vsync | StdExpand();
wxBoxSizer* centerSizer = new wxBoxSizer( wxVERTICAL );
*centerSizer += GetSizer() | pxCenter;
SetSizer( centerSizer, false );
wxBoxSizer* centerSizer = new wxBoxSizer(wxVERTICAL);
*centerSizer += GetSizer() | pxCenter;
SetSizer(centerSizer, false);
AppStatusEvent_OnSettingsApplied();
}
void Panels::GSWindowSettingsPanel::AppStatusEvent_OnSettingsApplied()
{
ApplyConfigToGui( *g_Conf );
ApplyConfigToGui(*g_Conf);
}
void Panels::GSWindowSettingsPanel::ApplyConfigToGui( AppConfig& configToApply, int flags )
void Panels::GSWindowSettingsPanel::ApplyConfigToGui(AppConfig& configToApply, int flags)
{
const AppConfig::GSWindowOptions& conf( configToApply.GSWindow );
const AppConfig::GSWindowOptions& conf(configToApply.GSWindow);
if( !(flags & AppConfig::APPLY_FLAG_FROM_PRESET) )
{//Presets don't control these values
m_check_CloseGS ->SetValue( conf.CloseOnEsc );
m_check_Fullscreen ->SetValue( conf.DefaultToFullscreen );
m_check_HideMouse ->SetValue( conf.AlwaysHideMouse );
m_check_SizeLock ->SetValue( conf.DisableResizeBorders );
if (!(flags & AppConfig::APPLY_FLAG_FROM_PRESET))
{ //Presets don't control these values
m_check_CloseGS->SetValue(conf.CloseOnEsc);
m_check_Fullscreen->SetValue(conf.DefaultToFullscreen);
m_check_HideMouse->SetValue(conf.AlwaysHideMouse);
m_check_SizeLock->SetValue(conf.DisableResizeBorders);
m_combo_AspectRatio ->SetSelection( (int)conf.AspectRatio );
m_combo_FMVAspectRatioSwitch->SetSelection( enum_cast( conf.FMVAspectRatioSwitch ) );
m_text_Zoom ->ChangeValue( conf.Zoom.ToString() );
m_combo_AspectRatio->SetSelection((int)conf.AspectRatio);
m_combo_FMVAspectRatioSwitch->SetSelection(enum_cast(conf.FMVAspectRatioSwitch));
m_text_Zoom->ChangeValue(conf.Zoom.ToString());
m_check_DclickFullscreen ->SetValue( conf.IsToggleFullscreenOnDoubleClick );
m_check_DclickFullscreen->SetValue(conf.IsToggleFullscreenOnDoubleClick);
m_text_WindowWidth ->ChangeValue( wxsFormat( L"%d", conf.WindowSize.GetWidth() ) );
m_text_WindowHeight ->ChangeValue( wxsFormat( L"%d", conf.WindowSize.GetHeight() ) );
m_text_WindowWidth->ChangeValue(wxsFormat(L"%d", conf.WindowSize.GetWidth()));
m_text_WindowHeight->ChangeValue(wxsFormat(L"%d", conf.WindowSize.GetHeight()));
}
m_combo_vsync->SetSelection(enum_cast(configToApply.EmuOptions.GS.VsyncEnable));
@ -183,17 +176,17 @@ void Panels::GSWindowSettingsPanel::ApplyConfigToGui( AppConfig& configToApply,
void Panels::GSWindowSettingsPanel::Apply()
{
AppConfig::GSWindowOptions& appconf( g_Conf->GSWindow );
Pcsx2Config::GSOptions& gsconf( g_Conf->EmuOptions.GS );
AppConfig::GSWindowOptions& appconf(g_Conf->GSWindow);
Pcsx2Config::GSOptions& gsconf(g_Conf->EmuOptions.GS);
appconf.CloseOnEsc = m_check_CloseGS ->GetValue();
appconf.DefaultToFullscreen = m_check_Fullscreen->GetValue();
appconf.AlwaysHideMouse = m_check_HideMouse ->GetValue();
appconf.DisableResizeBorders = m_check_SizeLock ->GetValue();
appconf.CloseOnEsc = m_check_CloseGS->GetValue();
appconf.DefaultToFullscreen = m_check_Fullscreen->GetValue();
appconf.AlwaysHideMouse = m_check_HideMouse->GetValue();
appconf.DisableResizeBorders = m_check_SizeLock->GetValue();
appconf.AspectRatio = (AspectRatioType)m_combo_AspectRatio->GetSelection();
appconf.AspectRatio = (AspectRatioType)m_combo_AspectRatio->GetSelection();
appconf.FMVAspectRatioSwitch = (FMVAspectRatioSwitchType)m_combo_FMVAspectRatioSwitch->GetSelection();
appconf.Zoom = Fixed100::FromString( m_text_Zoom->GetValue() );
appconf.Zoom = Fixed100::FromString(m_text_Zoom->GetValue());
gsconf.VsyncEnable = static_cast<VsyncMode>(m_combo_vsync->GetSelection());
@ -201,11 +194,11 @@ void Panels::GSWindowSettingsPanel::Apply()
long xr, yr = 1;
if( !m_text_WindowWidth->GetValue().ToLong( &xr ) || !m_text_WindowHeight->GetValue().ToLong( &yr ) )
throw Exception::CannotApplySettings( this )
if (!m_text_WindowWidth->GetValue().ToLong(&xr) || !m_text_WindowHeight->GetValue().ToLong(&yr))
throw Exception::CannotApplySettings(this)
.SetDiagMsg(L"User submitted non-numeric window size parameters!")
.SetUserMsg(_("Invalid window dimensions specified: Size cannot contain non-numeric digits! >_<"));
appconf.WindowSize.x = xr;
appconf.WindowSize.y = yr;
appconf.WindowSize.x = xr;
appconf.WindowSize.y = yr;
}