Add Stop Play/Recording Input Menu

This commit is contained in:
Chris Burgener 2017-02-11 14:39:07 -05:00
parent 3cbbd48da9
commit 28c9f2a44d
4 changed files with 40 additions and 0 deletions

View File

@ -260,6 +260,7 @@ private:
void OnReset(wxCommandEvent& event);
void OnRecord(wxCommandEvent& event);
void OnPlayRecording(wxCommandEvent& event);
void OnStopRecording(wxCommandEvent& event);
void OnRecordExport(wxCommandEvent& event);
void OnRecordReadOnly(wxCommandEvent& event);
void OnTASInput(wxCommandEvent& event);

View File

@ -141,6 +141,7 @@ void CFrame::BindMenuBarEvents()
// Movie menu
Bind(wxEVT_MENU, &CFrame::OnRecord, this, IDM_RECORD);
Bind(wxEVT_MENU, &CFrame::OnPlayRecording, this, IDM_PLAY_RECORD);
Bind(wxEVT_MENU, &CFrame::OnStopRecording, this, IDM_STOP_RECORD);
Bind(wxEVT_MENU, &CFrame::OnRecordExport, this, IDM_RECORD_EXPORT);
Bind(wxEVT_MENU, &CFrame::OnRecordReadOnly, this, IDM_RECORD_READ_ONLY);
Bind(wxEVT_MENU, &CFrame::OnTASInput, this, IDM_TAS_INPUT);
@ -496,6 +497,30 @@ void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED(event))
BootGame("");
}
void CFrame::OnStopRecording(wxCommandEvent& WXUNUSED(event))
{
if (Movie::IsRecordingInput())
{
const bool was_paused = Core::GetState() == Core::State::Paused;
DoRecordingSave();
const bool is_paused = Core::GetState() == Core::State::Paused;
if (is_paused && !was_paused)
CPU::EnableStepping(false);
}
if (!Movie::IsReadOnly())
{
// let's make the read-only flag consistent at the start of a movie.
Movie::SetReadOnly(true);
GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Check();
}
Movie::EndPlayInput(false);
GetMenuBar()->FindItem(IDM_STOP_RECORD)->Enable(Movie::IsMovieActive());
GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Movie::IsMovieActive());
}
void CFrame::OnRecordExport(wxCommandEvent& WXUNUSED(event))
{
DoRecordingSave();
@ -1404,6 +1429,7 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_RESET)->Enable(Running || Paused);
GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Movie::IsRecordingInput());
GetMenuBar()->FindItem(IDM_PLAY_RECORD)->Enable(!Initialized);
GetMenuBar()->FindItem(IDM_STOP_RECORD)->Enable(Movie::IsMovieActive());
GetMenuBar()->FindItem(IDM_RECORD_EXPORT)->Enable(Movie::IsMovieActive());
GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(Running || Paused);
GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused);
@ -1488,6 +1514,9 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_RECORD)->Enable();
GetMenuBar()->FindItem(IDM_PLAY_RECORD)->Enable();
}
// Reset the stop playing/recording input menu item
GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Playing/Recording Input"));
}
else if (Initialized)
{
@ -1497,6 +1526,14 @@ void CFrame::UpdateGUI()
// Reset game loading flag
m_bGameLoading = false;
// Rename the stop playing/recording menu item depending on current movie state
if (Movie::IsRecordingInput())
GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Recording Input"));
else if (Movie::IsPlayingInput())
GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Playing Input"));
else
GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Playing/Recording Input"));
}
GetToolBar()->Refresh(false);

View File

@ -70,6 +70,7 @@ enum
// Movie menu
IDM_RECORD,
IDM_PLAY_RECORD,
IDM_STOP_RECORD,
IDM_RECORD_EXPORT,
IDM_RECORD_READ_ONLY,
IDM_TAS_INPUT,

View File

@ -140,6 +140,7 @@ wxMenu* MainMenuBar::CreateMovieMenu() const
movie_menu->Append(IDM_RECORD, _("Start Re&cording Input"));
movie_menu->Append(IDM_PLAY_RECORD, _("P&lay Input Recording..."));
movie_menu->Append(IDM_STOP_RECORD, _("Stop Playing/Recording Input"));
movie_menu->Append(IDM_RECORD_EXPORT, _("Export Recording..."));
movie_menu->AppendCheckItem(IDM_RECORD_READ_ONLY, _("&Read-Only Mode"));
movie_menu->Append(IDM_TAS_INPUT, _("TAS Input"));