mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-03 22:19:07 +02:00
Effect commands store PluginID in CommandEntry parameter, not functor
This commit is contained in:
parent
05984e8bfb
commit
1e3ab82a01
@ -1875,9 +1875,9 @@ void AudacityProject::AddEffectMenuItemGroup(CommandManager *c,
|
||||
wxString item = PluginManager::Get().GetPlugin(plugs[i])->GetPath();
|
||||
c->AddItem(item,
|
||||
item,
|
||||
FNS(OnEffect, plugs[i]),
|
||||
FN(OnEffect),
|
||||
flags[i],
|
||||
flags[i]);
|
||||
flags[i], plugs[i]);
|
||||
|
||||
i++;
|
||||
}
|
||||
@ -1888,9 +1888,9 @@ void AudacityProject::AddEffectMenuItemGroup(CommandManager *c,
|
||||
{
|
||||
c->AddItem(names[i],
|
||||
names[i],
|
||||
FNS(OnEffect, plugs[i]),
|
||||
FN(OnEffect),
|
||||
flags[i],
|
||||
flags[i]);
|
||||
flags[i], plugs[i]);
|
||||
}
|
||||
|
||||
if (max > 0)
|
||||
|
@ -127,15 +127,14 @@ template<typename OBJ>
|
||||
class PluginFunctor final : public CommandFunctor
|
||||
{
|
||||
public:
|
||||
explicit PluginFunctor(OBJ *This, const PluginID &id, audCommandPluginFunction<OBJ> pfn)
|
||||
: mPluginID{ id }, mThis{ This }, mCommandPluginFunction{ pfn } {}
|
||||
explicit PluginFunctor(OBJ *This, audCommandPluginFunction<OBJ> pfn)
|
||||
: mThis{ This }, mCommandPluginFunction{ pfn } {}
|
||||
void operator () (const CommandContext &context) override
|
||||
{ (mThis->*mCommandPluginFunction)
|
||||
(mPluginID,
|
||||
(context.parameter,
|
||||
0 // AudacityProject::OnEffectFlags::kNone
|
||||
); }
|
||||
private:
|
||||
const PluginID mPluginID;
|
||||
OBJ *const mThis;
|
||||
const audCommandPluginFunction<OBJ> mCommandPluginFunction;
|
||||
};
|
||||
@ -162,15 +161,13 @@ inline CommandFunctorPointer MakeFunctor(OBJ *This,
|
||||
{ return CommandFunctorPointer{ safenew ListFunctor<OBJ>{ This, pfn } }; }
|
||||
|
||||
template<typename OBJ>
|
||||
inline CommandFunctorPointer MakeFunctor(OBJ *This, const PluginID &id,
|
||||
inline CommandFunctorPointer MakeFunctor(OBJ *This,
|
||||
audCommandPluginFunction<OBJ> pfn)
|
||||
{ return CommandFunctorPointer{ safenew PluginFunctor<OBJ>{ This, id, pfn } }; }
|
||||
{ return CommandFunctorPointer{ safenew PluginFunctor<OBJ>{ This, pfn } }; }
|
||||
|
||||
// Now define the macro abbreviations that call the factory
|
||||
#define FNT(OBJ, This, X) (MakeFunctor<OBJ>(This, X ))
|
||||
#define FNTS(OBJ, This, X, S) (MakeFunctor<OBJ>(This, (S), X ))
|
||||
|
||||
#define FN(X) FNT(AudacityProject, this, & AudacityProject :: X)
|
||||
#define FNS(X, S) FNTS(AudacityProject, this, & AudacityProject :: X, S)
|
||||
|
||||
#endif
|
||||
|
@ -783,9 +783,10 @@ void CommandManager::AddItem(const wxChar *name,
|
||||
const wxChar *label,
|
||||
const CommandFunctorPointer &callback,
|
||||
CommandFlag flags,
|
||||
CommandMask mask)
|
||||
CommandMask mask,
|
||||
const CommandParameter ¶meter)
|
||||
{
|
||||
AddItem(name, label, callback, wxT(""), flags, mask);
|
||||
AddItem(name, label, callback, wxT(""), flags, mask, -1, parameter);
|
||||
}
|
||||
|
||||
void CommandManager::AddItem(const wxChar *name,
|
||||
|
@ -149,7 +149,8 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
||||
const wxChar *label,
|
||||
const CommandFunctorPointer &callback,
|
||||
CommandFlag flags = NoFlagsSpecifed,
|
||||
CommandMask mask = NoFlagsSpecifed);
|
||||
CommandMask mask = NoFlagsSpecifed,
|
||||
const CommandParameter ¶meter = {});
|
||||
|
||||
void AddItem(const wxChar *name,
|
||||
const wxChar *label_in,
|
||||
|
Loading…
x
Reference in New Issue
Block a user