mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 14:02:57 +02:00
Fix Automation listing
- Now correctly shows optional fields - Now includes the zero-parameter commands. - Fetches the Short-Names for menu commands.
This commit is contained in:
committed by
Paul Licameli
parent
78fbb6e21f
commit
5c2f35d96f
@@ -1665,6 +1665,15 @@ void CommandManager::GetAllCommandData(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxString CommandManager::GetNameFromID(int id)
|
||||
{
|
||||
CommandListEntry *entry = mCommandIDHash[id];
|
||||
if (!entry)
|
||||
return wxT("");
|
||||
return entry->name;
|
||||
}
|
||||
|
||||
wxString CommandManager::GetLabelFromName(const wxString &name)
|
||||
{
|
||||
CommandListEntry *entry = mCommandNameHash[name];
|
||||
|
@@ -262,6 +262,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
||||
#endif
|
||||
bool includeMultis);
|
||||
|
||||
wxString GetNameFromID( int id );
|
||||
wxString GetLabelFromName(const wxString &name);
|
||||
wxString GetPrefixedLabelFromName(const wxString &name);
|
||||
wxString GetCategoryFromName(const wxString &name);
|
||||
|
@@ -277,6 +277,9 @@ public:
|
||||
|
||||
/// Used to aggregate the various output targets a command may have.
|
||||
/// Assumes responsibility for pointers passed into it.
|
||||
/// mProgressTarget is a unique pointer, but mStatusTraget and
|
||||
/// mErrorTarget are shared ones, because they may both point to the same
|
||||
/// output
|
||||
class CommandOutputTargets
|
||||
{
|
||||
public:
|
||||
@@ -284,6 +287,9 @@ public:
|
||||
std::shared_ptr<CommandMessageTarget> mStatusTarget;
|
||||
std::shared_ptr<CommandMessageTarget> mErrorTarget;
|
||||
public:
|
||||
// && is not a reference to a reference, but rather a way to allow reference to a temporary
|
||||
// that will be gone or transfered after we have taken it. It's a reference to an xvalue,
|
||||
// or 'expiring value'.
|
||||
CommandOutputTargets(std::unique_ptr<CommandProgressTarget> &&pt = TargetFactory::ProgressDefault(),
|
||||
std::shared_ptr<CommandMessageTarget> &&st = TargetFactory::MessageDefault(),
|
||||
std::shared_ptr<CommandMessageTarget> &&et = TargetFactory::MessageDefault())
|
||||
|
@@ -320,15 +320,19 @@ void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu,
|
||||
if( !pMenu )
|
||||
return;
|
||||
|
||||
CommandManager * pMan = context.GetProject()->GetCommandManager();
|
||||
|
||||
wxMenuItemList list = pMenu->GetMenuItems();
|
||||
size_t lcnt = list.GetCount();
|
||||
wxMenuItem * item;
|
||||
wxString Label;
|
||||
wxString Accel;
|
||||
wxString Name;
|
||||
|
||||
for (size_t lndx = 0; lndx < lcnt; lndx++) {
|
||||
item = list.Item(lndx)->GetData();
|
||||
Label = item->GetItemLabelText();
|
||||
Name = pMan->GetNameFromID( item->GetId() );
|
||||
Accel = item->GetItemLabel();
|
||||
if( Accel.Contains("\t") )
|
||||
Accel = Accel.AfterLast('\t');
|
||||
@@ -342,12 +346,14 @@ void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu,
|
||||
if (item->IsCheck() && item->IsChecked())
|
||||
flags +=2;
|
||||
|
||||
context.StartArray();
|
||||
context.AddItem( depth );
|
||||
context.AddItem( flags );
|
||||
context.AddItem( Label );
|
||||
context.AddItem( Accel );
|
||||
context.EndArray();
|
||||
context.StartStruct();
|
||||
context.AddItem( depth, "0" );
|
||||
context.AddItem( flags, "1" );
|
||||
context.AddItem( Label, "2" );
|
||||
context.AddItem( Accel, "3" );
|
||||
if( !Name.IsEmpty() )
|
||||
context.AddItem( Name, "id" );// It is called Automation ID outside Audacity.
|
||||
context.EndStruct();
|
||||
|
||||
if (item->IsSubMenu()) {
|
||||
pMenu = item->GetSubMenu();
|
||||
|
@@ -63,7 +63,7 @@ bool SetClipCommand::DefineParams( ShuttleParams & S ){
|
||||
S.Optional( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours );
|
||||
// Allowing a negative start time is not a mistake.
|
||||
// It will be used in demonstrating time before zero.
|
||||
S.Optional( bHasT0 ).Define( mT0, wxT("Start"), -5.0, 0.0, 1000000.0);
|
||||
S.Optional( bHasT0 ).Define( mT0, wxT("Start"), 0.0, -5.0, 1000000.0);
|
||||
return true;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user