mirror of https://github.com/PCSX2/pcsx2.git
GUI: Address review changes + Fix formatting + Misc fixes
- Change the wxitems to reflect a more appropiate name + change comment to explain the process of Custom hotkeys. - Cycling savestates are now in the GUI but they are grayed out because it's only used like labels for now. - The most essential custom hotkeys are now included. - F8 Snapshot needs some future tinkering but atleast shows up correctly now
This commit is contained in:
parent
028f468d26
commit
cf33fb3ca1
|
@ -69,27 +69,27 @@ struct KeyAcceleratorCode
|
|||
val32 = value;
|
||||
}
|
||||
|
||||
KeyAcceleratorCode& Shift()
|
||||
KeyAcceleratorCode& Shift(bool enabled = true)
|
||||
{
|
||||
shift = true;
|
||||
shift = enabled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyAcceleratorCode& Alt()
|
||||
KeyAcceleratorCode& Alt(bool enabled = true)
|
||||
{
|
||||
alt = true;
|
||||
alt = enabled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyAcceleratorCode& Win()
|
||||
KeyAcceleratorCode& Win(bool enabled = true)
|
||||
{
|
||||
win = true;
|
||||
win = enabled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyAcceleratorCode& Cmd()
|
||||
KeyAcceleratorCode& Cmd(bool enabled = true)
|
||||
{
|
||||
cmd = true;
|
||||
cmd = enabled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1012,9 +1012,11 @@ 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
|
||||
// At this early stage of startup, the application assumes installed mode, so portable mode custom keybindings may present issues.
|
||||
// Relevant - https://github.com/PCSX2/pcsx2/blob/678829a5b2b8ca7a3e42d8edc9ab201bf00b0fe9/pcsx2/gui/AppInit.cpp#L479
|
||||
// Compared to L990 of GlobalCommands.cpp which also does an init for the GlobalAccelerators.
|
||||
// The idea was to have: Reading from the PCSX2_keys.ini in the ini folder based on PCSX2_keys.ini.default which get overridden.
|
||||
// We also need to make it easier to do custom hotkeys for both normal/portable PCSX2 in the GUI.
|
||||
GlobalAccels->Map(AAC(WXK_TAB), "Framelimiter_TurboToggle");
|
||||
GlobalAccels->Map(AAC(WXK_TAB).Shift(), "Framelimiter_SlomoToggle");
|
||||
|
||||
|
@ -1023,12 +1025,13 @@ 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");
|
||||
// Fixme: GS Dumps could need a seperate label and hotkey binding or less interlinked with normal screenshots/snapshots , which messes with overloading lots of different mappings, commented the other GlobalAccels for this reason. GSdx hardcodes keybindings.
|
||||
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_F10), "Sys_LoggingToggle");
|
||||
// GlobalAccels->Map(AAC(WXK_F11), "Sys_FreezeGS");
|
||||
GlobalAccels->Map(AAC(WXK_F12), "Sys_RecordingToggle");
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "svnrev.h"
|
||||
#include "Saveslots.h"
|
||||
|
||||
#include "fmt/core.h"
|
||||
// ------------------------------------------------------------------------
|
||||
wxMenu* MainEmuFrame::MakeStatesSubMenu(int baseid, int loadBackupId) const
|
||||
{
|
||||
|
@ -48,8 +49,15 @@ wxMenu* MainEmuFrame::MakeStatesSubMenu(int baseid, int loadBackupId) const
|
|||
wxMenuItem* m = mnuSubstates->Append(loadBackupId, _("Backup"));
|
||||
m->Enable(false);
|
||||
}
|
||||
|
||||
// Implement custom hotkeys (F2) + (Shift + F2) with translatable string intact + not blank in GUI.
|
||||
// baseid in the negatives will order in a different section, so if you want to increase more slots you can still easily do this, as -1 it will have the same function as opening file for savestates, which is bad
|
||||
// For safety i also made them inactive aka grayed out to signify that's it's only for informational purposes
|
||||
// Fixme: In the future this can still be expanded to actually cycle savestates in the GUI.
|
||||
mnuSubstates->Append(baseid - 1, _("File..."));
|
||||
wxMenuItem* CycleNext = mnuSubstates->Append(baseid - 2, _("Cycle to next slot") + wxString(" ") + fmt::format("({})", wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_CycleSlotForward").toTitleizedString()));
|
||||
CycleNext->Enable(false);
|
||||
wxMenuItem* CycleBack = mnuSubstates->Append(baseid - 3, _("Cycle to previous slot") + wxString(" ") + fmt::format("({})", wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_CycleSlotBackward").toTitleizedString()));
|
||||
CycleBack->Enable(false);
|
||||
return mnuSubstates;
|
||||
}
|
||||
|
||||
|
@ -403,12 +411,12 @@ 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.
|
||||
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.
|
||||
wxMenuItem* MainSaveStateLabel = m_menuSys.Append(MenuId_Sys_SaveStates, _("&Save state"), &m_SaveStatesSubmenu);
|
||||
AppendShortcutToMenuOption(*MainSaveStateLabel, wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_FreezeCurrentSlot").toTitleizedString());
|
||||
// Implement custom hotkeys (F3) with translatable string intact + not blank in GUI.
|
||||
wxMenuItem* sysLoadStateItem = m_menuSys.Append(MenuId_Sys_LoadStates, _("&Load state"), &m_LoadStatesSubmenu);
|
||||
AppendShortcutToMenuOption(*sysLoadStateItem, wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_DefrostCurrentSlot").toTitleizedString());
|
||||
// Implement custom hotkeys (F1) with translatable string intact + not blank in GUI.
|
||||
wxMenuItem* sysSaveStateItem = m_menuSys.Append(MenuId_Sys_SaveStates, _("&Save state"), &m_SaveStatesSubmenu);
|
||||
AppendShortcutToMenuOption(*sysSaveStateItem, wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_FreezeCurrentSlot").toTitleizedString());
|
||||
|
||||
m_menuSys.Append(MenuId_EnableBackupStates, _("&Backup before save"), wxEmptyString, wxITEM_CHECK);
|
||||
|
||||
|
@ -478,14 +486,22 @@ 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.
|
||||
wxMenuItem* MainVideoCaptureLabel = m_submenuVideoCapture.Append(MenuId_Capture_Video_Record, _("Start Screenrecorder"));
|
||||
AppendShortcutToMenuOption(*MainVideoCaptureLabel, wxGetApp().GlobalAccels->findKeycodeWithCommandId("Sys_RecordingToggle").toTitleizedString());
|
||||
// Implement custom hotkeys (F12) with translatable string intact + not blank in GUI.
|
||||
wxMenuItem* sysVideoCaptureItem = m_submenuVideoCapture.Append(MenuId_Capture_Video_Record, _("Start Screenrecorder"));
|
||||
AppendShortcutToMenuOption(*sysVideoCaptureItem, 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.
|
||||
// Fixme: GlobalCommands.cpp L1029-L1031 is having issues because FrameForGS already maps the hotkey first.
|
||||
// Fixme: When you uncomment L1029-L1031 on that file; Linux says that Ctrl is already used for something else and will append (Shift + F8) while Windows will (Ctrl + Shift + F8)
|
||||
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());
|
||||
wxMenuItem* sysScreenShotItem = m_submenuScreenshot.Append(MenuId_Capture_Screenshot_Screenshot, _("Take Screenshot"));
|
||||
// HACK: in AcceleratorDictionary::Map the Sys_TakeSnapshot entry gets Shift and Cmd (Ctrl) hardcoded to it because it is similarly hardcoded in GSdx
|
||||
// So... remove such modifiers as the GUI menu entry is only for the base keybinding without modifiers.
|
||||
// We can be confident in doing so, as if a user adds these modifiers themselves, the same function rejects it.
|
||||
KeyAcceleratorCode keyCode = wxGetApp().GlobalAccels->findKeycodeWithCommandId("Sys_TakeSnapshot");
|
||||
keyCode.Shift(false);
|
||||
keyCode.Cmd(false);
|
||||
AppendShortcutToMenuOption(*sysScreenShotItem, keyCode.toTitleizedString());
|
||||
m_submenuScreenshot.Append(MenuId_Capture_Screenshot_Screenshot_As, _("Screenshot As..."));
|
||||
}
|
||||
|
||||
|
@ -734,7 +750,7 @@ void MainEmuFrame::ApplyCoreStatus()
|
|||
susres->SetHelp(_("No emulation state is active; cannot suspend or resume."));
|
||||
}
|
||||
}
|
||||
// Re-init keybinding after changing the label
|
||||
// Re-init keybinding after changing the label.
|
||||
AppendShortcutToMenuOption(*susres, wxGetApp().GlobalAccels->findKeycodeWithCommandId("Sys_SuspendResume").toTitleizedString());
|
||||
}
|
||||
|
||||
|
@ -813,10 +829,6 @@ 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);
|
||||
|
|
|
@ -69,8 +69,8 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel(wxWindow* parent)
|
|||
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(")"));
|
||||
// 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"
|
||||
|
@ -106,8 +106,8 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel(wxWindow* parent)
|
|||
//s_AspectRatio.AddGrowableCol( 0 );
|
||||
s_AspectRatio.AddGrowableCol(1);
|
||||
|
||||
// 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;
|
||||
// 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;
|
||||
s_AspectRatio += m_combo_FMVAspectRatioSwitch | pxAlignRight;
|
||||
|
|
Loading…
Reference in New Issue