MCPcopy Create free account
hub / github.com/audacity/audacity / ExploreMenu

Method ExploreMenu

src/commands/GetInfoCommand.cpp:654–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

652*******************************************************************/
653
654void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu, int Id, int depth ){
655 static_cast<void>(Id);//compiler food.
656 if( !pMenu )
657 return;
658
659 auto &commandManager = CommandManager::Get( context.project );
660
661 wxMenuItemList list = pMenu->GetMenuItems();
662 size_t lcnt = list.size();
663 wxMenuItem * item;
664 wxString Label;
665 wxString Accel;
666 CommandID Name;
667
668 for (size_t lndx = 0; lndx < lcnt; lndx++) {
669 item = list.Item(lndx)->GetData();
670 Label = item->GetItemLabelText();
671 Name = commandManager.GetNameFromNumericID( item->GetId() );
672 Accel = item->GetItemLabel();
673 if( Accel.Contains("\t") )
674 Accel = Accel.AfterLast('\t');
675 else
676 Accel = "";
677 if( item->IsSeparator() )
678 Label = "----";
679 int flags = 0;
680 if (item->IsSubMenu())
681 flags +=1;
682 if (item->IsCheck() && item->IsChecked())
683 flags +=2;
684
685 context.StartStruct();
686 context.AddItem( depth, "depth" );
687 context.AddItem( flags, "flags" );
688 context.AddItem( Label, "label" );
689 context.AddItem( Accel, "accel" );
690 if( !Name.empty() )
691 // using GET to expose CommandID in results of GetInfoCommand...
692 // PRL asks, is that all right?
693 context.AddItem( Name.GET(), "id" );// It is called Scripting ID outside Audacity.
694 context.EndStruct();
695
696 if (item->IsSubMenu()) {
697 pMenu = item->GetSubMenu();
698 ExploreMenu( context, pMenu, item->GetId(), depth+1 );
699 }
700 }
701}
702
703void GetInfoCommand::ExploreAdornments( const CommandContext &context,
704 wxPoint WXUNUSED(P), wxWindow * pWin, int WXUNUSED(Id), int depth )

Callers

nothing calls this directly

Calls 13

GetFunction · 0.85
ItemMethod · 0.80
GetNameFromNumericIDMethod · 0.80
GetIdMethod · 0.80
IsCheckedMethod · 0.80
GetMenuItemsMethod · 0.45
sizeMethod · 0.45
GetDataMethod · 0.45
ContainsMethod · 0.45
StartStructMethod · 0.45
AddItemMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected