| 1213 | } |
| 1214 | |
| 1215 | void MacrosWindow::OnEditCommandParams(wxCommandEvent & WXUNUSED(event)) |
| 1216 | { |
| 1217 | int item = mList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); |
| 1218 | |
| 1219 | // LAST command in list is END. |
| 1220 | // If nothing selected, add at END. |
| 1221 | // If END selected, add at END. |
| 1222 | // When adding at end we use InsertCommandAt, so that a new command |
| 1223 | // can be chosen. |
| 1224 | int lastItem = mList->GetItemCount()-1; |
| 1225 | if( (item<0) || (item+1) == mList->GetItemCount() ) |
| 1226 | { |
| 1227 | InsertCommandAt( lastItem ); |
| 1228 | return; |
| 1229 | } |
| 1230 | |
| 1231 | // Just edit the parameters, and not the command. |
| 1232 | auto command = mMacroCommands.GetCommand(item); |
| 1233 | wxString params = mMacroCommands.GetParams(item); |
| 1234 | wxString oldParams = params; |
| 1235 | |
| 1236 | params = MacroCommands::PromptForParamsFor(command, params, mProject).Trim(); |
| 1237 | Raise(); |
| 1238 | |
| 1239 | if (oldParams == params) |
| 1240 | return; // They did not actually make any changes.. |
| 1241 | |
| 1242 | mMacroCommands.DeleteFromMacro(item); |
| 1243 | mMacroCommands.AddToMacro(command, |
| 1244 | params, |
| 1245 | item); |
| 1246 | |
| 1247 | mChanged = true; |
| 1248 | mSave->Enable( mChanged ); |
| 1249 | |
| 1250 | mSelectedCommand = item; |
| 1251 | PopulateList(); |
| 1252 | } |
| 1253 | |
| 1254 | /// |
| 1255 | void MacrosWindow::OnDelete(wxCommandEvent & WXUNUSED(event)) |
nothing calls this directly
no test coverage detected