Exemplo n.º 1
0
void CPatchAddEdit::ChangeEntry(wxSpinEvent& event)
{
	if (!UpdateTempEntryData(itCurEntry))
		return;

	itCurEntry = tempEntries.end() - event.GetPosition() - 1;
	currentItem = (int)tempEntries.size() - event.GetPosition();
	UpdateEntryCtrls(*itCurEntry);
}
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
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;
	}
}
Exemplo n.º 4
0
void CPatchAddEdit::SavePatchData(wxCommandEvent& event)
{
	if (!UpdateTempEntryData(itCurEntry))
		return;

	if (selection == -1)
	{
		PatchEngine::Patch newPatch;
		newPatch.name = WxStrToStr(EditPatchName->GetValue());
		newPatch.entries = tempEntries;
		newPatch.active = true;

		onFrame->push_back(newPatch);
	}
	else
	{
		onFrame->at(selection).name = WxStrToStr(EditPatchName->GetValue());
		onFrame->at(selection).entries = tempEntries;
	}

	AcceptAndClose();
	event.Skip();
}