| 174 | } |
| 175 | |
| 176 | void MacroCommandDialog::OnItemSelected(wxListEvent &event) |
| 177 | { |
| 178 | const auto &command = mCatalog[ event.GetIndex() ]; |
| 179 | |
| 180 | EffectManager & em = EffectManager::Get(); |
| 181 | PluginID ID = |
| 182 | PluginManager::Get().GetByCommandIdentifier(command.name.Internal()); |
| 183 | |
| 184 | // If ID is empty, then the effect wasn't found, in which case, the user must have |
| 185 | // selected one of the "special" commands. |
| 186 | mEditParams->Enable(!ID.empty()); |
| 187 | mUsePreset->Enable(em.HasPresets(ID)); |
| 188 | |
| 189 | auto value = command.name.StrippedTranslation(); |
| 190 | if ( value == mCommand->GetValue() ) |
| 191 | // This uses the assumption of uniqueness of translated names! |
| 192 | return; |
| 193 | |
| 194 | mCommand->SetValue(value); |
| 195 | mInternalCommandName = command.name.Internal(); |
| 196 | |
| 197 | wxString params = MacroCommands::GetCurrentParamsFor(mInternalCommandName); |
| 198 | if (params.empty()) |
| 199 | { |
| 200 | params = em.GetDefaultPreset(ID); |
| 201 | } |
| 202 | |
| 203 | // using GET to expose a CommandID to the user! |
| 204 | // Cryptic command and category. |
| 205 | // Later we can put help information there, perhaps. |
| 206 | // Macro command details are one place that we do expose Identifier |
| 207 | // to (more sophisticated) users |
| 208 | mDetails->SetValue( |
| 209 | mInternalCommandName.GET() + "\r\n" + command.category.Translation() ); |
| 210 | mParameters->SetValue(params); |
| 211 | } |
| 212 | |
| 213 | void MacroCommandDialog::OnEditParams(wxCommandEvent & WXUNUSED(event)) |
| 214 | { |
nothing calls this directly
no test coverage detected