void CPatchAddEdit::AddEntry(wxCommandEvent& event) { if (!UpdateTempEntryData(itCurEntry)) return; PatchEngine::PatchEntry peEmptyEntry(PatchEngine::PATCH_8BIT, 0x00000000, 0x00000000); ++itCurEntry; currentItem++; itCurEntry = tempEntries.insert(itCurEntry, peEmptyEntry); EntrySelection->SetRange(EntrySelection->GetMin(), EntrySelection->GetMax() + 1); UpdateEntryCtrls(*itCurEntry); EntryRemove->Enable(); EntrySelection->Enable(); }
void CPatchAddEdit::AddRemoveEntry(wxCommandEvent& event) { switch (event.GetId()) { case ID_ENTRY_ADD: { if (!UpdateTempEntryData(itCurEntry)) break; PatchEngine::PatchEntry peEmptyEntry(PatchEngine::PATCH_8BIT, 0x00000000, 0x00000000); ++itCurEntry; currentItem++; itCurEntry = tempEntries.insert(itCurEntry, peEmptyEntry); EntrySelection->SetRange(EntrySelection->GetMin(), EntrySelection->GetMax() + 1); UpdateEntryCtrls(*itCurEntry); EntryRemove->Enable(); EntrySelection->Enable(); } break; case ID_ENTRY_REMOVE: { itCurEntry = tempEntries.erase(itCurEntry); if (itCurEntry != tempEntries.begin()) { --itCurEntry; currentItem--; } else { EntrySelection->SetValue(EntrySelection->GetValue() - 1); } EntrySelection->SetRange(EntrySelection->GetMin(), EntrySelection->GetMax() - 1); UpdateEntryCtrls(*itCurEntry); if ((int)tempEntries.size() <= 1) { EntryRemove->Disable(); EntrySelection->Disable(); } } break; } }