Skip to content

Commit

Permalink
FifoPlayer: Copy selected object commands to clipboard when pressing …
Browse files Browse the repository at this point in the history
…ctrl+c
  • Loading branch information
neobrain committed Oct 22, 2012
1 parent aece531 commit f7edfc0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinWX/Src/FifoPlayerDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class FifoPlayerDlg : public wxDialog
void OnFrameListSelectionChanged(wxCommandEvent& event);
void OnObjectListSelectionChanged(wxCommandEvent& event);
void OnObjectCmdListSelectionChanged(wxCommandEvent& event);
void OnObjectCmdListSelectionCopy(wxCommandEvent& WXUNUSED(event));

void UpdatePlayGui();
void UpdateRecorderGui();
Expand Down

0 comments on commit f7edfc0

Please sign in to comment.