void dlgManageMacros::SetMacro(bool silent) { int item; wxString key, Name, query; item = lstKeys->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item == -1) return; key = lstKeys->GetItemText(item); Name = txtName->GetValue().Trim(); query = txtSqlBox->GetText().Trim(); if (Name.IsEmpty() && query.IsEmpty()) { DeleteMacro(item); } else if (Name.IsEmpty() || query.IsEmpty()) { if (!silent) wxMessageBox(_("You must specify a query and a name for the macro"), _("Save macro"), wxICON_EXCLAMATION | wxOK); return; } else { macros->AddOrUpdateMacro(key, Name, query); anythingChanged = true; thisMacroChanged = false; lstKeys->SetItem(item, 1, Name); btnClear->Enable(); btnSave->Disable(); } }
void CMacroList::DeleteAll(void) { while (Macros() != 0) { DeleteMacro(0); } }
void dlgManageMacros::OnClear(wxCommandEvent &ev) { int item; item = lstKeys->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item == -1) return; DeleteMacro(item); }
void CMacroList::DeleteMacro(LPCSTR pName) { int nMacros = Macros(); for (int nMacro = 0; nMacro < nMacros; nMacro++) { CMacro* pMacro = Macro(nMacro); if (pMacro->Name() == pName) { DeleteMacro(nMacro); return; } } }