|
1 | | -#include "EffectComponent.h" |
| 1 | +#include "EffectComponent.h" |
2 | 2 | #include "../../lookAndFeel/LookAndFeelFactory.h" |
3 | 3 | #include "../../misc/CoreActions.h" |
4 | 4 | #include "../../misc/PluginEditorHub.h" |
@@ -273,19 +273,14 @@ enum EffectMenuActionType { |
273 | 273 |
|
274 | 274 | void EffectComponent::showMenu() { |
275 | 275 | /** Callback */ |
276 | | - auto addCallback = [comp = juce::Component::SafePointer{ this }](const juce::PluginDescription& pluginDes) { |
277 | | - if (comp) { |
278 | | - comp->addEffect(pluginDes); |
279 | | - } |
280 | | - }; |
281 | 276 | auto editCallback = [comp = juce::Component::SafePointer{ this }](const juce::PluginDescription& pluginDes) { |
282 | 277 | if (comp) { |
283 | 278 | comp->replaceEffect(pluginDes); |
284 | 279 | } |
285 | 280 | }; |
286 | 281 |
|
287 | 282 | /** Create Menu */ |
288 | | - auto menu = this->createMenu(addCallback, editCallback); |
| 283 | + auto menu = this->createMenu(editCallback); |
289 | 284 | int result = menu.show(); |
290 | 285 |
|
291 | 286 | switch (result) { |
@@ -324,7 +319,7 @@ void EffectComponent::startDrag() { |
324 | 319 | void EffectComponent::addEffect( |
325 | 320 | const juce::PluginDescription& pluginDes) { |
326 | 321 | CoreActions::insertEffect( |
327 | | - (quickAPI::TrackType)this->type, this->track, this->index + 1, |
| 322 | + (quickAPI::TrackType)this->type, this->track, this->index, |
328 | 323 | pluginDes.createIdentifierString()); |
329 | 324 | } |
330 | 325 |
|
@@ -370,11 +365,9 @@ juce::String EffectComponent::createToolTip() const { |
370 | 365 | } |
371 | 366 |
|
372 | 367 | juce::PopupMenu EffectComponent::createMenu( |
373 | | - const std::function<void(const juce::PluginDescription&)>& addCallback, |
374 | 368 | const std::function<void(const juce::PluginDescription&)>& editCallback) const { |
375 | 369 | juce::PopupMenu menu; |
376 | 370 |
|
377 | | - menu.addSubMenu(TRANS("Add"), this->createAddMenu(addCallback)); |
378 | 371 | menu.addSubMenu(TRANS("Replace"), this->createAddMenu(editCallback)); |
379 | 372 | menu.addItem(EffectMenuActionType::Bypass, TRANS("Bypass"), true, !(this->bypassButton->getToggleState())); |
380 | 373 | menu.addItem(EffectMenuActionType::Remove, TRANS("Remove")); |
|
0 commit comments