Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ctrl+A support in the action replay code editing menu.
Makes adding/editing codes less of a pain in the ass. You don't need to manually highlight everything anymore.
  • Loading branch information
lioncash committed Jan 21, 2013
1 parent 45a7fa2 commit 0c1ea60
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
Expand Up @@ -48,11 +48,13 @@ CARCodeAddEdit::CARCodeAddEdit(int _selection, wxWindow* parent, wxWindowID id,

wxStaticText* EditCheatNameText = new wxStaticText(this, ID_EDITCHEAT_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize);
EditCheatName = new wxTextCtrl(this, ID_EDITCHEAT_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
EditCheatName->Bind(wxEVT_KEY_DOWN, &CARCodeAddEdit::OnKey, this);
EditCheatName->SetValue(currentName);
EntrySelection = new wxSpinButton(this, ID_ENTRY_SELECT, wxDefaultPosition, wxDefaultSize, wxVERTICAL);
EntrySelection->SetRange(1, ((int)arCodes.size()) > 0 ? (int)arCodes.size() : 1);
EntrySelection->SetValue((int)(arCodes.size() - selection));
EditCheatCode = new wxTextCtrl(this, ID_EDITCHEAT_CODE, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE);
EditCheatCode->Bind(wxEVT_KEY_DOWN, &CARCodeAddEdit::OnKey, this);
UpdateTextCtrl(tempEntries);

sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER|wxALL, 5);
Expand Down Expand Up @@ -174,3 +176,25 @@ void CARCodeAddEdit::UpdateTextCtrl(ActionReplay::ARCode arCode)
else
EditCheatCode->SetValue(_("Insert Encrypted or Decrypted code here..."));
}

void CARCodeAddEdit::OnKey(wxKeyEvent& event)
{
// Technically you can extend this to whatever bindings you want.
switch (event.GetKeyCode())
{
case 'a':
case 'A':
{
if (event.ControlDown() && FindFocus() == EditCheatCode)
{
EditCheatCode->SetSelection(0, EditCheatCode->GetValue().Length());
}

if (event.ControlDown() && FindFocus() == EditCheatName)
{
EditCheatName->SetSelection(0, EditCheatName->GetValue().Length());
}
}
break;
}
}
1 change: 1 addition & 0 deletions Source/Core/DolphinWX/Src/ARCodeAddEdit.h
Expand Up @@ -49,6 +49,7 @@ class CARCodeAddEdit : public wxDialog
void SaveCheatData(wxCommandEvent& event);
void ChangeEntry(wxSpinEvent& event);
void UpdateTextCtrl(ActionReplay::ARCode arCode);
void OnKey(wxKeyEvent& event);

int selection;

Expand Down

0 comments on commit 0c1ea60

Please sign in to comment.