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.
This commit is contained in:
Lioncash 2013-01-20 23:24:56 -05:00
parent 45a7fa293b
commit 0c1ea605d5
2 changed files with 25 additions and 0 deletions

View File

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

View File

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