From 9da0cc6a91d29d0324b038ab2fcf0c3468e760ca Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Tue, 28 Jul 2020 20:16:32 -0400 Subject: [PATCH] gui: Add `Screenshot As...` option --- pcsx2/gui/App.h | 2 ++ pcsx2/gui/MainFrame.cpp | 8 ++++++-- pcsx2/gui/MainFrame.h | 6 ++++-- pcsx2/gui/MainMenuClicks.cpp | 11 +++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index f19a1e8720..4d5b0a7dd1 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -196,6 +196,8 @@ enum MenuIdentifiers MenuId_Capture_Video_Record, MenuId_Capture_Video_Stop, MenuId_Capture_Screenshot, + MenuId_Capture_Screenshot_Screenshot, + MenuId_Capture_Screenshot_Screenshot_As, #ifndef DISABLE_RECORDING // Input Recording Subsection diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index ccc40cdff5..9503875b5f 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -279,7 +279,8 @@ void MainEmuFrame::ConnectMenus() // Capture Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Video_Record_Click, this, MenuId_Capture_Video_Record); Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Video_Stop_Click, this, MenuId_Capture_Video_Stop); - Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Screenshot_Screenshot_Click, this, MenuId_Capture_Screenshot); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Screenshot_Screenshot_Click, this, MenuId_Capture_Screenshot_Screenshot); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Screenshot_Screenshot_As_Click, this, MenuId_Capture_Screenshot_Screenshot_As); #ifndef DISABLE_RECORDING // Recording @@ -474,7 +475,9 @@ void MainEmuFrame::CreateCaptureMenu() m_submenuVideoCapture.Append(MenuId_Capture_Video_Record, _("Start Screenrecorder")); m_submenuVideoCapture.Append(MenuId_Capture_Video_Stop, _("Stop Screenrecorder"))->Enable(false); - m_menuCapture.Append(MenuId_Capture_Screenshot, _("Screenshot")); + m_menuCapture.Append(MenuId_Capture_Screenshot, _("Screenshot"), &m_submenuScreenshot); + m_submenuScreenshot.Append(MenuId_Capture_Screenshot_Screenshot, _("Screenshot")); + m_submenuScreenshot.Append(MenuId_Capture_Screenshot_Screenshot_As, _("Screenshot As...")); } void MainEmuFrame::CreateRecordMenu() @@ -523,6 +526,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title) , m_menuWindow(*new wxMenu()) , m_menuCapture(*new wxMenu()) , m_submenuVideoCapture(*new wxMenu()) + , m_submenuScreenshot(*new wxMenu()) #ifndef DISABLE_RECORDING , m_menuRecording(*new wxMenu()) #endif diff --git a/pcsx2/gui/MainFrame.h b/pcsx2/gui/MainFrame.h index aeefaedb37..7c57aba06c 100644 --- a/pcsx2/gui/MainFrame.h +++ b/pcsx2/gui/MainFrame.h @@ -115,8 +115,9 @@ protected: wxMenu& m_menuConfig; wxMenu& m_menuWindow; - wxMenu& m_menuCapture; - wxMenu& m_submenuVideoCapture; + wxMenu& m_menuCapture; + wxMenu& m_submenuVideoCapture; + wxMenu& m_submenuScreenshot; #ifndef DISABLE_RECORDING wxMenu& m_menuRecording; @@ -248,6 +249,7 @@ protected: void Menu_Capture_Video_Stop_Click(wxCommandEvent& event); void VideoCaptureUpdate(); void Menu_Capture_Screenshot_Screenshot_Click(wxCommandEvent& event); + void Menu_Capture_Screenshot_Screenshot_As_Click(wxCommandEvent& event); #ifndef DISABLE_RECORDING void Menu_Recording_New_Click(wxCommandEvent& event); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 1f18d649ce..2c182a1eb8 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -919,6 +919,17 @@ void MainEmuFrame::Menu_Capture_Screenshot_Screenshot_Click(wxCommandEvent& even GSmakeSnapshot(g_Conf->Folders.Snapshots.ToAscii()); } +void MainEmuFrame::Menu_Capture_Screenshot_Screenshot_As_Click(wxCommandEvent &event) +{ + if (!CoreThread.IsOpen()) + return; + + wxFileDialog fileDialog(this, "Select a file", g_Conf->Folders.Snapshots.ToAscii(), wxEmptyString, "PNG files (*.png)|*.png", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); + + if (fileDialog.ShowModal() == wxID_OK) + GSmakeSnapshot(fileDialog.GetPath()); +} + #ifndef DISABLE_RECORDING void MainEmuFrame::Menu_Recording_New_Click(wxCommandEvent& event) {