FifoPlayer: Copy selected object commands to clipboard when pressing ctrl+c

This commit is contained in:
NeoBrainX 2012-10-22 12:25:41 +02:00
parent aece5310f3
commit f7edfc0118
2 changed files with 18 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "FifoPlayer/FifoRecorder.h"
#include "OpcodeDecoding.h"
#include <wx/spinctrl.h>
#include <wx/clipbrd.h>
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();

View File

@ -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();