| 652 | *******************************************************************/ |
| 653 | |
| 654 | void 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 | |
| 703 | void GetInfoCommand::ExploreAdornments( const CommandContext &context, |
| 704 | wxPoint WXUNUSED(P), wxWindow * pWin, int WXUNUSED(Id), int depth ) |
nothing calls this directly
no test coverage detected