mirror of https://github.com/PCSX2/pcsx2.git
GUI: Visually alter status bar and Boot menu option while an input recording is active
+ Defines GSPanel method for generating the string keycode for a command
This commit is contained in:
parent
c664a48f26
commit
ceb7eaaf47
|
@ -141,18 +141,23 @@ void GSPanel::InitRecordingAccelerators()
|
|||
|
||||
GetMainFramePtr()->initializeRecordingMenuItem(
|
||||
MenuId_Recording_FrameAdvance,
|
||||
m_Accels->findKeycodeWithCommandId("FrameAdvance").toTitleizedString());
|
||||
GetAssociatedKeyCode("FrameAdvance"));
|
||||
GetMainFramePtr()->initializeRecordingMenuItem(
|
||||
MenuId_Recording_TogglePause,
|
||||
m_Accels->findKeycodeWithCommandId("TogglePause").toTitleizedString());
|
||||
GetAssociatedKeyCode("TogglePause"));
|
||||
GetMainFramePtr()->initializeRecordingMenuItem(
|
||||
MenuId_Recording_ToggleRecordingMode,
|
||||
m_Accels->findKeycodeWithCommandId("InputRecordingModeToggle").toTitleizedString(),
|
||||
GetAssociatedKeyCode("InputRecordingModeToggle"),
|
||||
g_InputRecording.IsActive());
|
||||
|
||||
inputRec::consoleLog("Initialized Input Recording Key Bindings");
|
||||
}
|
||||
|
||||
wxString GSPanel::GetAssociatedKeyCode(const char* id)
|
||||
{
|
||||
return m_Accels->findKeycodeWithCommandId(id).toTitleizedString();
|
||||
}
|
||||
|
||||
void GSPanel::RemoveRecordingAccelerators()
|
||||
{
|
||||
m_Accels.reset(new AcceleratorDictionary);
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
|
||||
#include "svnrev.h"
|
||||
#include "Saveslots.h"
|
||||
#ifndef DISABLE_RECORDING
|
||||
# include "Recording/InputRecording.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "fmt/core.h"
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -65,11 +69,18 @@ void MainEmuFrame::UpdateStatusBar()
|
|||
{
|
||||
wxString temp(wxEmptyString);
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
if (g_InputRecording.IsActive() && g_InputRecording.GetInputRecordingData().FromSaveState())
|
||||
temp += "Base Savestate - " + g_InputRecording.GetInputRecordingData().GetFilename() + "_SaveState.p2s";
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (g_Conf->EnableFastBoot)
|
||||
temp += "Fast Boot - ";
|
||||
|
||||
if (g_Conf->CdvdSource == CDVD_SourceType::Iso)
|
||||
temp += "Load: '" + wxFileName(g_Conf->CurrentIso).GetFullName() + "' ";
|
||||
}
|
||||
|
||||
m_statusbar.SetStatusText(temp, 0);
|
||||
m_statusbar.SetStatusText(CDVD_SourceLabels[enum_cast(g_Conf->CdvdSource)], 1);
|
||||
|
@ -100,6 +111,10 @@ void MainEmuFrame::UpdateCdvdSrcSelection()
|
|||
jNO_DEFAULT
|
||||
}
|
||||
sMenuBar.Check(cdsrc, true);
|
||||
#ifndef DISABLE_RECORDING
|
||||
if (!g_InputRecording.IsActive())
|
||||
#endif
|
||||
ApplyCDVDStatus();
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
||||
|
@ -348,7 +363,7 @@ void MainEmuFrame::DispatchEvent(const CoreThreadStatus& status)
|
|||
{
|
||||
if (!pxAssertMsg(GetMenuBar() != NULL, "Mainframe menu bar is NULL!"))
|
||||
return;
|
||||
ApplyCoreStatus();
|
||||
ApplySuspendStatus();
|
||||
}
|
||||
|
||||
void MainEmuFrame::AppStatusEvent_OnSettingsApplied()
|
||||
|
@ -735,12 +750,16 @@ void MainEmuFrame::OnActivate(wxActivateEvent& evt)
|
|||
|
||||
void MainEmuFrame::ApplyCoreStatus()
|
||||
{
|
||||
wxMenuBar& menubar(*GetMenuBar());
|
||||
ApplySuspendStatus();
|
||||
ApplyCDVDStatus();
|
||||
}
|
||||
|
||||
void MainEmuFrame::ApplySuspendStatus()
|
||||
{
|
||||
// [TODO] : Ideally each of these items would bind a listener instance to the AppCoreThread
|
||||
// dispatcher, and modify their states accordingly. This is just a hack (for now) -- air
|
||||
|
||||
if (wxMenuItem* susres = menubar.FindItem(MenuId_Sys_SuspendResume))
|
||||
if (wxMenuItem* susres = GetMenuBar()->FindItem(MenuId_Sys_SuspendResume))
|
||||
{
|
||||
if (!CoreThread.IsClosing())
|
||||
{
|
||||
|
@ -766,10 +785,13 @@ void MainEmuFrame::ApplyCoreStatus()
|
|||
// Re-init keybinding after changing the label.
|
||||
AppendShortcutToMenuOption(*susres, wxGetApp().GlobalAccels->findKeycodeWithCommandId("Sys_SuspendResume").toTitleizedString());
|
||||
}
|
||||
}
|
||||
|
||||
void MainEmuFrame::ApplyCDVDStatus()
|
||||
{
|
||||
const CDVD_SourceType Source = g_Conf->CdvdSource;
|
||||
|
||||
wxMenuItem* cdvd_menu = menubar.FindItem(MenuId_Boot_CDVD);
|
||||
wxMenuItem* cdvd_menu = GetMenuBar()->FindItem(MenuId_Boot_CDVD);
|
||||
|
||||
wxString label;
|
||||
wxString help_text = _("Use fast boot to skip PS2 startup and splash screens.");
|
||||
|
|
|
@ -163,7 +163,9 @@ public:
|
|||
void CreateConfigMenu();
|
||||
void CreateWindowsMenu();
|
||||
void CreateCaptureMenu();
|
||||
#ifndef DISABLE_RECORDING
|
||||
void CreateRecordMenu();
|
||||
#endif
|
||||
void CreateHelpMenu();
|
||||
|
||||
bool Destroy();
|
||||
|
@ -186,6 +188,8 @@ protected:
|
|||
//Apply here is from config to GUI.
|
||||
void ApplySettings();
|
||||
void ApplyCoreStatus();
|
||||
void ApplySuspendStatus();
|
||||
void ApplyCDVDStatus();
|
||||
|
||||
void InitLogBoxPosition(AppConfig::ConsoleLogOptions& conf);
|
||||
|
||||
|
@ -262,6 +266,7 @@ protected:
|
|||
void Menu_Recording_New_Click(wxCommandEvent& event);
|
||||
void Menu_Recording_Play_Click(wxCommandEvent& event);
|
||||
void Menu_Recording_Stop_Click(wxCommandEvent& event);
|
||||
void ApplyFirstFrameStatus();
|
||||
void Menu_Recording_TogglePause_Click(wxCommandEvent& event);
|
||||
void Menu_Recording_FrameAdvance_Click(wxCommandEvent& event);
|
||||
void Menu_Recording_ToggleRecordingMode_Click(wxCommandEvent& event);
|
||||
|
|
|
@ -461,6 +461,10 @@ void MainEmuFrame::Menu_CdvdSource_Click(wxCommandEvent& event)
|
|||
}
|
||||
|
||||
SwapOrReset_CdvdSrc(this, newsrc);
|
||||
#ifndef DISABLE_RECORDING
|
||||
if (!g_InputRecording.IsActive())
|
||||
#endif
|
||||
ApplyCDVDStatus();
|
||||
}
|
||||
|
||||
void MainEmuFrame::Menu_BootCdvd_Click(wxCommandEvent& event)
|
||||
|
@ -1020,6 +1024,24 @@ void MainEmuFrame::Menu_Recording_Play_Click(wxCommandEvent& event)
|
|||
StartInputRecording();
|
||||
}
|
||||
|
||||
void MainEmuFrame::ApplyFirstFrameStatus()
|
||||
{
|
||||
wxMenuItem* cdvd_menu = m_menuSys.FindChildItem(MenuId_Boot_CDVD);
|
||||
|
||||
wxString keyCodeStr;
|
||||
if (GSFrame* gsFrame = wxGetApp().GetGsFramePtr())
|
||||
if (GSPanel* viewport = gsFrame->GetViewport())
|
||||
keyCodeStr = '\t' + viewport->GetAssociatedKeyCode(("GoToFirstFrame"));
|
||||
|
||||
cdvd_menu->SetItemLabel(L"Restart Recording" + keyCodeStr);
|
||||
if (g_InputRecording.GetInputRecordingData().FromSaveState())
|
||||
cdvd_menu->SetHelp(L"Loads the savestate that accompanies the active input recording");
|
||||
else
|
||||
cdvd_menu->SetHelp(L"Reboots Emulation");
|
||||
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
||||
void MainEmuFrame::Menu_Recording_Stop_Click(wxCommandEvent& event)
|
||||
{
|
||||
StopInputRecording();
|
||||
|
@ -1030,6 +1052,7 @@ void MainEmuFrame::StartInputRecording()
|
|||
m_menuRecording.FindChildItem(MenuId_Recording_New)->Enable(false);
|
||||
m_menuRecording.FindChildItem(MenuId_Recording_Stop)->Enable(true);
|
||||
m_menuRecording.FindChildItem(MenuId_Recording_ToggleRecordingMode)->Enable(true);
|
||||
ApplyFirstFrameStatus();
|
||||
}
|
||||
|
||||
void MainEmuFrame::StopInputRecording()
|
||||
|
@ -1040,6 +1063,7 @@ void MainEmuFrame::StopInputRecording()
|
|||
m_menuRecording.FindChildItem(MenuId_Recording_New)->Enable(true);
|
||||
m_menuRecording.FindChildItem(MenuId_Recording_Stop)->Enable(false);
|
||||
m_menuRecording.FindChildItem(MenuId_Recording_ToggleRecordingMode)->Enable(false);
|
||||
ApplyCDVDStatus();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue