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:
parent
45a7fa293b
commit
0c1ea605d5
|
@ -48,11 +48,13 @@ CARCodeAddEdit::CARCodeAddEdit(int _selection, wxWindow* parent, wxWindowID id,
|
||||||
|
|
||||||
wxStaticText* EditCheatNameText = new wxStaticText(this, ID_EDITCHEAT_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize);
|
wxStaticText* EditCheatNameText = new wxStaticText(this, ID_EDITCHEAT_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize);
|
||||||
EditCheatName = new wxTextCtrl(this, ID_EDITCHEAT_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
EditCheatName = new wxTextCtrl(this, ID_EDITCHEAT_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
EditCheatName->Bind(wxEVT_KEY_DOWN, &CARCodeAddEdit::OnKey, this);
|
||||||
EditCheatName->SetValue(currentName);
|
EditCheatName->SetValue(currentName);
|
||||||
EntrySelection = new wxSpinButton(this, ID_ENTRY_SELECT, wxDefaultPosition, wxDefaultSize, wxVERTICAL);
|
EntrySelection = new wxSpinButton(this, ID_ENTRY_SELECT, wxDefaultPosition, wxDefaultSize, wxVERTICAL);
|
||||||
EntrySelection->SetRange(1, ((int)arCodes.size()) > 0 ? (int)arCodes.size() : 1);
|
EntrySelection->SetRange(1, ((int)arCodes.size()) > 0 ? (int)arCodes.size() : 1);
|
||||||
EntrySelection->SetValue((int)(arCodes.size() - selection));
|
EntrySelection->SetValue((int)(arCodes.size() - selection));
|
||||||
EditCheatCode = new wxTextCtrl(this, ID_EDITCHEAT_CODE, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE);
|
EditCheatCode = new wxTextCtrl(this, ID_EDITCHEAT_CODE, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE);
|
||||||
|
EditCheatCode->Bind(wxEVT_KEY_DOWN, &CARCodeAddEdit::OnKey, this);
|
||||||
UpdateTextCtrl(tempEntries);
|
UpdateTextCtrl(tempEntries);
|
||||||
|
|
||||||
sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER|wxALL, 5);
|
sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER|wxALL, 5);
|
||||||
|
@ -174,3 +176,25 @@ void CARCodeAddEdit::UpdateTextCtrl(ActionReplay::ARCode arCode)
|
||||||
else
|
else
|
||||||
EditCheatCode->SetValue(_("Insert Encrypted or Decrypted code here..."));
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ class CARCodeAddEdit : public wxDialog
|
||||||
void SaveCheatData(wxCommandEvent& event);
|
void SaveCheatData(wxCommandEvent& event);
|
||||||
void ChangeEntry(wxSpinEvent& event);
|
void ChangeEntry(wxSpinEvent& event);
|
||||||
void UpdateTextCtrl(ActionReplay::ARCode arCode);
|
void UpdateTextCtrl(ActionReplay::ARCode arCode);
|
||||||
|
void OnKey(wxKeyEvent& event);
|
||||||
|
|
||||||
int selection;
|
int selection;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue