From f7edfc0118afe02f06ddb5fe6a2462414c7edd79 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 22 Oct 2012 12:25:41 +0200 Subject: [PATCH] FifoPlayer: Copy selected object commands to clipboard when pressing ctrl+c --- Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp | 17 +++++++++++++++++ Source/Core/DolphinWX/Src/FifoPlayerDlg.h | 1 + 2 files changed, 18 insertions(+) diff --git a/Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp b/Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp index cb467389ee..4579af762a 100644 --- a/Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp +++ b/Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp @@ -23,6 +23,7 @@ #include "FifoPlayer/FifoRecorder.h" #include "OpcodeDecoding.h" #include +#include DECLARE_EVENT_TYPE(RECORDING_FINISHED_EVENT, -1) DEFINE_EVENT_TYPE(RECORDING_FINISHED_EVENT) @@ -323,6 +324,13 @@ void FifoPlayerDlg::CreateGUIControls() m_searchField->Connect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(FifoPlayerDlg::OnBeginSearch), NULL, this); m_searchField->Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(FifoPlayerDlg::OnSearchFieldTextChanged), NULL, this); + // Setup command copying + wxAcceleratorEntry entry; + entry.Set(wxACCEL_CTRL, (int)'C', wxID_COPY); + wxAcceleratorTable accel(1, &entry); + m_objectCmdList->SetAcceleratorTable(accel); + m_objectCmdList->Connect(wxID_COPY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FifoPlayerDlg::OnObjectCmdListSelectionCopy), NULL, this); + Connect(RECORDING_FINISHED_EVENT, wxCommandEventHandler(FifoPlayerDlg::OnRecordingFinished), NULL, this); Connect(FRAME_WRITTEN_EVENT, wxCommandEventHandler(FifoPlayerDlg::OnFrameWritten), NULL, this); @@ -763,6 +771,15 @@ void FifoPlayerDlg::OnObjectCmdListSelectionChanged(wxCommandEvent& event) Fit(); } +void FifoPlayerDlg::OnObjectCmdListSelectionCopy(wxCommandEvent& WXUNUSED(event)) +{ + if (wxTheClipboard->Open()) + { + wxTheClipboard->SetData(new wxTextDataObject(m_objectCmdList->GetStringSelection())); + wxTheClipboard->Close(); + } +} + void FifoPlayerDlg::OnCloseClick(wxCommandEvent& WXUNUSED(event)) { Hide(); diff --git a/Source/Core/DolphinWX/Src/FifoPlayerDlg.h b/Source/Core/DolphinWX/Src/FifoPlayerDlg.h index 4e2c24fdd6..eb5f9a33e9 100644 --- a/Source/Core/DolphinWX/Src/FifoPlayerDlg.h +++ b/Source/Core/DolphinWX/Src/FifoPlayerDlg.h @@ -57,6 +57,7 @@ private: void OnFrameListSelectionChanged(wxCommandEvent& event); void OnObjectListSelectionChanged(wxCommandEvent& event); void OnObjectCmdListSelectionChanged(wxCommandEvent& event); + void OnObjectCmdListSelectionCopy(wxCommandEvent& WXUNUSED(event)); void UpdatePlayGui(); void UpdateRecorderGui();