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,9 +1025,10 @@ void Pcsx2App::InitDefaultGlobalAccelerators()
|
|||
|
||||
GlobalAccels->Map(AAC(WXK_ESCAPE), "Sys_SuspendResume");
|
||||
|
||||
// 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_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");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -404,11 +412,11 @@ void MainEmuFrame::CreatePcsx2Menu()
|
|||
|
||||
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());
|
||||
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* MainSaveStateLabel = m_menuSys.Append(MenuId_Sys_SaveStates, _("&Save state"), &m_SaveStatesSubmenu);
|
||||
AppendShortcutToMenuOption(*MainSaveStateLabel, wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_FreezeCurrentSlot").toTitleizedString());
|
||||
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);
|
||||
|
||||
|
@ -479,13 +487,21 @@ 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());
|
||||
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.
|
||||
// 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);
|
||||
|
|
Loading…
Reference in New Issue