Audacity  3.0.3
GetInfoCommand.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity - A Digital Audio Editor
4  Copyright 1999-2018 Audacity Team
5  License: wxWidgets
6 
7  James Crook
8 
9 ******************************************************************//*******************************************************************/
22 
23 
24 #include "GetInfoCommand.h"
25 
26 #include "LoadCommands.h"
27 #include "../Project.h"
28 #include "CommandManager.h"
29 #include "CommandTargets.h"
30 #include "../effects/EffectManager.h"
31 #include "../widgets/Overlay.h"
32 #include "../TrackPanelAx.h"
33 #include "../TrackPanel.h"
34 #include "../WaveClip.h"
35 #include "../ViewInfo.h"
36 #include "../WaveTrack.h"
37 #include "../LabelTrack.h"
38 #include "../Envelope.h"
39 
40 #include "SelectCommand.h"
41 #include "../ShuttleGui.h"
42 #include "CommandContext.h"
43 
44 #include "../prefs/PrefsDialog.h"
45 #include "../Shuttle.h"
46 #include "../PluginManager.h"
47 #include "../tracks/ui/TrackView.h"
48 #include "../ShuttleGui.h"
49 
50 #include <wx/frame.h>
51 #include <wx/menu.h>
52 
54 { XO("Get Info") };
55 
57 enum {
59  //kCommandsPlus,
67  nTypes
68 };
69 
70 static const EnumValueSymbol kTypes[nTypes] =
71 {
72  { XO("Commands") },
73  //{ wxT("CommandsPlus"), XO("Commands Plus") },
74  { XO("Menus") },
75  { XO("Preferences") },
76  { XO("Tracks") },
77  { XO("Clips") },
78  { XO("Envelopes") },
79  { XO("Labels") },
80  { XO("Boxes") },
81 };
82 
83 enum {
87  nFormats
88 };
89 
91 {
92  // These are acceptable dual purpose internal/visible names
93 
94  /* i18n-hint JavaScript Object Notation */
95  { XO("JSON") },
96  /* i18n-hint name of a computer programming language */
97  { XO("LISP") },
98  { XO("Brief") }
99 };
100 
101 
102 
104  S.DefineEnum( mInfoType, wxT("Type"), 0, kTypes, nTypes );
105  S.DefineEnum( mFormat, wxT("Format"), 0, kFormats, nFormats );
106  return true;
107 }
108 
110 {
111  S.AddSpace(0, 5);
112 
113  S.StartMultiColumn(2, wxALIGN_CENTER);
114  {
115  S.TieChoice( XXO("Type:"),
117  S.TieChoice( XXO("Format:"),
119  }
120  S.EndMultiColumn();
121 }
122 
124 {
125  if( mFormat == kJson )
126  return ApplyInner( context );
127 
128  if( mFormat == kLisp )
129  {
130  CommandContext LispyContext(
131  context.project,
132  std::make_unique<LispifiedCommandOutputTargets>( *context.pOutput.get() )
133  );
134  return ApplyInner( LispyContext );
135  }
136 
137  if( mFormat == kBrief )
138  {
139  CommandContext BriefContext(
140  context.project,
141  std::make_unique<BriefCommandOutputTargets>( *context.pOutput.get() )
142  );
143  return ApplyInner( BriefContext );
144  }
145 
146  return false;
147 }
148 
150 {
151  switch( mInfoType ){
152  // flag of 1 to include parameterless commands.
153  case kCommands : return SendCommands( context, 1 );
154  case kMenus : return SendMenus( context );
155  case kPreferences : return SendPreferences( context );
156  case kTracks : return SendTracks( context );
157  case kClips : return SendClips( context );
158  case kEnvelopes : return SendEnvelopes( context );
159  case kLabels : return SendLabels( context );
160  case kBoxes : return SendBoxes( context );
161  default:
162  context.Status( "Command options not recognised" );
163  }
164  return false;
165 }
166 
168 {
169  wxMenuBar * pBar = GetProjectFrame( context.project ).GetMenuBar();
170  if(!pBar ){
171  wxLogDebug("No menus");
172  return false;
173  }
174 
175  size_t cnt = pBar->GetMenuCount();
176  size_t i;
177  wxString Label;
178  context.StartArray();
179  for(i=0;i<cnt;i++)
180  {
181  Label = pBar->GetMenuLabelText( i );
182  context.StartStruct();
183  context.AddItem( 0, "depth" );
184  context.AddItem( 0, "flags" );
185  context.AddItem( Label, "label" );
186  context.AddItem( "", "accel" );
187  context.EndStruct();
188  ExploreMenu( context, pBar->GetMenu( i ), pBar->GetId(), 1 );
189  }
190  context.EndArray();
191  return true;
192 }
193 
194 namespace {
195 
196 /**************************************************************************/
200 {
201 public:
202  ShuttleGuiGetDefinition(wxWindow * pParent,CommandMessageTarget & target );
203  virtual ~ShuttleGuiGetDefinition();
204 
205  wxCheckBox * TieCheckBox(
206  const TranslatableString &Prompt,
207  const SettingSpec< bool > &Setting) override;
208  wxCheckBox * TieCheckBoxOnRight(
209  const TranslatableString &Prompt,
210  const SettingSpec< bool > &Setting) override;
211 
212  wxChoice *TieChoice(
213  const TranslatableString &Prompt,
214  const ChoiceSetting &choiceSetting ) override;
215 
216  wxChoice * TieNumberAsChoice(
217  const TranslatableString &Prompt,
218  const SettingSpec< int > &Setting,
219  const TranslatableStrings & Choices,
220  const std::vector<int> * pInternalChoices, int iNoMatchSelector ) override;
221 
222  wxTextCtrl * TieTextBox(
223  const TranslatableString &Prompt,
224  const SettingSpec< wxString > &Setting,
225  const int nChars) override;
226  wxTextCtrl * TieIntegerTextBox(
227  const TranslatableString & Prompt,
228  const SettingSpec< int > &Setting,
229  const int nChars) override;
230  wxTextCtrl * TieNumericTextBox(
231  const TranslatableString & Prompt,
232  const SettingSpec< double > &Setting,
233  const int nChars) override;
234  wxSlider * TieSlider(
235  const TranslatableString & Prompt,
236  const SettingSpec< int > &Setting,
237  const int max,
238  const int min = 0) override;
239  wxSpinCtrl * TieSpinCtrl(
240  const TranslatableString &Prompt,
241  const SettingSpec< int > &Setting,
242  const int max,
243  const int min) override;
244 };
245 
246 ShuttleGuiGetDefinition::ShuttleGuiGetDefinition(
247  wxWindow * pParent,CommandMessageTarget & target )
248 : ShuttleGui( pParent, eIsGettingMetadata ),
250 {
251 
252 }
254 {
255 }
256 
258  const TranslatableString &Prompt,
259  const SettingSpec< bool > &Setting)
260 {
261  StartStruct();
262  AddItem( Setting.GetPath(), "id" );
263  AddItem( Prompt.Translation(), "prompt" );
264  AddItem( "bool", "type" );
265  AddBool( Setting.GetDefault(), "default" );
266  EndStruct();
267  return ShuttleGui::TieCheckBox( Prompt, Setting );
268 }
269 
271  const TranslatableString &Prompt,
272  const SettingSpec< bool > &Setting)
273 {
274  StartStruct();
275  AddItem( Setting.GetPath(), "id" );
276  AddItem( Prompt.Translation(), "prompt" );
277  AddItem( "bool", "type" );
278  AddBool( Setting.GetDefault(), "default" );
279  EndStruct();
280  return ShuttleGui::TieCheckBoxOnRight( Prompt, Setting );
281 }
282 
284  const TranslatableString &Prompt,
285  const ChoiceSetting &choiceSetting )
286 {
287  StartStruct();
288  AddItem( choiceSetting.Key(), "id" );
289  AddItem( Prompt.Translation(), "prompt" );
290  AddItem( "enum", "type" );
291  AddItem( choiceSetting.Default().Internal(), "default" );
292  StartField( "enum" );
293  StartArray();
294  for ( const auto &choice : choiceSetting.GetSymbols().GetInternals() )
295  AddItem( choice );
296  EndArray();
297  EndField();
298  EndStruct();
299  return ShuttleGui::TieChoice( Prompt, choiceSetting );
300 }
301 
303  const TranslatableString &Prompt,
304  const SettingSpec< int > &Setting,
305  const TranslatableStrings & Choices,
306  const std::vector<int> * pInternalChoices, int iNoMatchSelector)
307 {
308  // Come here for controls that present non-exhaustive choices among some
309  // numbers, with an associated control that allows arbitrary entry of an
310  // "Other..."
311  StartStruct();
312  AddItem( Setting.GetPath(), "id" );
313  AddItem( Prompt.Translation(), "prompt" );
314  AddItem( "number", "type" ); // not "enum" !
315  AddItem( Setting.GetDefault(), "default" );
316  EndStruct();
318  Prompt, Setting, Choices, pInternalChoices, iNoMatchSelector );
319 }
320 
322  const TranslatableString &Prompt,
323  const SettingSpec< wxString > &Setting,
324  const int nChars)
325 {
326  StartStruct();
327  AddItem( Setting.GetPath(), "id" );
328  AddItem( Prompt.Translation(), "prompt" );
329  AddItem( "string", "type" );
330  AddItem( Setting.GetDefault(), "default" );
331  EndStruct();
332  return ShuttleGui::TieTextBox( Prompt, Setting, nChars );
333 }
334 
336  const TranslatableString & Prompt,
337  const SettingSpec< int > &Setting,
338  const int nChars)
339 {
340  StartStruct();
341  AddItem( Setting.GetPath(), "id" );
342  AddItem( Prompt.Translation(), "prompt" );
343  AddItem( "number", "type" );
344  AddItem( Setting.GetDefault(), "default" );
345  EndStruct();
346  return ShuttleGui::TieIntegerTextBox( Prompt, Setting, nChars );
347 }
348 
350  const TranslatableString & Prompt,
351  const SettingSpec< double > &Setting,
352  const int nChars)
353 {
354  StartStruct();
355  AddItem( Setting.GetPath(), "id" );
356  AddItem( Prompt.Translation(), "prompt" );
357  AddItem( "number", "type" );
358  AddItem( Setting.GetDefault(), "default" );
359  EndStruct();
360  return ShuttleGui::TieNumericTextBox( Prompt, Setting, nChars );
361 }
362 
364  const TranslatableString & Prompt,
365  const SettingSpec< int > &Setting,
366  const int max,
367  const int min)
368 {
369  StartStruct();
370  AddItem( Setting.GetPath(), "id" );
371  AddItem( Prompt.Translation(), "prompt" );
372  AddItem( "number", "type" );
373  AddItem( Setting.GetDefault(), "default" );
374  EndStruct();
375  return ShuttleGui::TieSlider( Prompt, Setting, max, min );
376 }
377 
379  const TranslatableString &Prompt,
380  const SettingSpec< int > &Setting,
381  const int max,
382  const int min)
383 {
384  StartStruct();
385  AddItem( Setting.GetPath(), "id" );
386  AddItem( Prompt.Translation(), "prompt" );
387  AddItem( "number", "type" );
388  AddItem( Setting.GetDefault(), "default" );
389  EndStruct();
390  return ShuttleGui::TieSpinCtrl( Prompt, Setting, max, min );
391 }
392 
393 }
394 
396 {
397  context.StartArray();
398  auto pWin = &GetProjectFrame( context.project );
399  GlobalPrefsDialog dialog( pWin, &context.project );
400  // wxCommandEvent Evt;
401  //dialog.Show();
402  ShuttleGuiGetDefinition S(pWin, *((context.pOutput)->mStatusTarget) );
403  dialog.ShuttleAll( S );
404  context.EndArray();
405  return true;
406 }
407 
411 bool GetInfoCommand::SendCommands(const CommandContext &context, int flags )
412 {
413  context.StartArray();
416  {
418  while (plug)
419  {
420  auto command = em.GetCommandIdentifier(plug->GetID());
421  if (!command.empty()){
422  em.GetCommandDefinition( plug->GetID(), context, flags );
423  }
425  }
426  }
427  context.EndArray();
428  return true;
429 }
430 
432 {
433  //context.Status("Boxes");
434  auto pWin = &GetProjectFrame( context.project );
435 
436  context.StartArray();
437  wxRect R = pWin->GetScreenRect();
438 
439  //R.SetPosition( wxPoint(0,0) );
440 
441  //wxString Name = pWin->GetName();
442  context.StartStruct();
443  context.AddItem( 0, "depth" );
444  context.AddItem( "Audacity Window", "name" );
445  context.StartField( "box" );
446  context.StartArray( );
447  context.AddItem( R.GetLeft() );
448  context.AddItem( R.GetTop() );
449  context.AddItem( R.GetRight() );
450  context.AddItem( R.GetBottom() );
451  context.EndArray( );
452  context.EndField();
453  context.EndStruct( );
454 
455  ExploreAdornments( context, pWin->GetPosition()+wxSize( 6,-1), pWin, pWin->GetId(), 1 );
456  ExploreWindows( context, pWin->GetPosition()+wxSize( 6,-1), pWin, pWin->GetId(), 1 );
457  context.EndArray( );
458  return true;
459 }
460 
462 {
463  auto &tracks = TrackList::Get( context.project );
464  context.StartArray();
465  for (auto trk : tracks.Leaders())
466  {
467  auto &trackFocus = TrackFocus::Get( context.project );
468  Track * fTrack = trackFocus.Get();
469 
470  context.StartStruct();
471  context.AddItem( trk->GetName(), "name" );
472  context.AddBool( (trk == fTrack), "focused");
473  context.AddBool( trk->GetSelected(), "selected" );
474  //JKC: Possibly add later...
475  //context.AddItem( TrackView::Get( *trk ).GetHeight(), "height" );
476  trk->TypeSwitch( [&] (const WaveTrack* t ) {
477  float vzmin, vzmax;
478  t->GetDisplayBounds(&vzmin, &vzmax);
479  context.AddItem( "wave", "kind" );
480  context.AddItem( t->GetStartTime(), "start" );
481  context.AddItem( t->GetEndTime(), "end" );
482  context.AddItem( t->GetPan() , "pan");
483  context.AddItem( t->GetGain() , "gain");
484  context.AddItem( TrackList::Channels(t).size(), "channels");
485  context.AddBool( t->GetSolo(), "solo" );
486  context.AddBool( t->GetMute(), "mute");
487  context.AddItem( vzmin, "VZoomMin");
488  context.AddItem( vzmax, "VZoomMax");
489  },
490 #if defined(USE_MIDI)
491  [&](const NoteTrack *) {
492  context.AddItem( "note", "kind" );
493  },
494 #endif
495  [&](const LabelTrack *) {
496  context.AddItem( "label", "kind" );
497  },
498  [&](const TimeTrack *) {
499  context.AddItem( "time", "kind" );
500  }
501  );
502  context.EndStruct();
503  }
504  context.EndArray();
505  return true;
506 }
507 
509 {
510  auto &tracks = TrackList::Get( context.project );
511  int i=0;
512  context.StartArray();
513  for (auto t : tracks.Leaders()) {
514  t->TypeSwitch([&](WaveTrack *waveTrack) {
515  WaveClipPointers ptrs(waveTrack->SortedClipArray());
516  for (WaveClip * pClip : ptrs) {
517  context.StartStruct();
518  context.AddItem((double)i, "track");
519  context.AddItem(pClip->GetStartTime(), "start");
520  context.AddItem(pClip->GetEndTime(), "end");
521  context.AddItem(pClip->GetColourIndex(), "color");
522  context.EndStruct();
523  }
524  });
525  // Per track numbering counts all tracks
526  i++;
527  }
528  context.EndArray();
529 
530  return true;
531 }
532 
534 {
535  auto &tracks = TrackList::Get( context.project );
536  int i=0;
537  int j=0;
538  context.StartArray();
539  for (auto t : tracks.Leaders()) {
540  t->TypeSwitch([&](WaveTrack *waveTrack) {
541  WaveClipPointers ptrs(waveTrack->SortedClipArray());
542  j = 0;
543  for (WaveClip * pClip : ptrs) {
544  context.StartStruct();
545  context.AddItem((double)i, "track");
546  context.AddItem((double)j, "clip");
547  context.AddItem(pClip->GetStartTime(), "start");
548  Envelope * pEnv = pClip->GetEnvelope();
549  context.StartField("points");
550  context.StartArray();
551  double offset = pEnv->GetOffset();
552  for (size_t k = 0; k < pEnv->GetNumberOfPoints(); k++)
553  {
554  context.StartStruct();
555  context.AddItem((*pEnv)[k].GetT() + offset, "t");
556  context.AddItem((*pEnv)[k].GetVal(), "y");
557  context.EndStruct();
558  }
559  context.EndArray();
560  context.EndField();
561  context.AddItem(pClip->GetEndTime(), "end");
562  context.EndStruct();
563  j++;
564  }
565  });
566  // Per track numbering counts all tracks
567  i++;
568  }
569  context.EndArray();
570 
571  return true;
572 }
573 
574 
576 {
577  auto &tracks = TrackList::Get( context.project );
578  int i=0;
579  context.StartArray();
580  for (auto t : tracks.Leaders()) {
581  t->TypeSwitch( [&](LabelTrack *labelTrack) {
582 #ifdef VERBOSE_LABELS_FORMATTING
583  for (int nn = 0; nn< (int)labelTrack->mLabels.size(); nn++) {
584  const auto &label = labelTrack->mLabels[nn];
585  context.StartStruct();
586  context.AddItem( (double)i, "track" );
587  context.AddItem( label.getT0(), "start" );
588  context.AddItem( label.getT1(), "end" );
589  context.AddItem( label.title, "text" );
590  context.EndStruct();
591  }
592 #else
593  context.StartArray();
594  context.AddItem( (double)i ); // Track number.
595  context.StartArray();
596  for ( const auto &label : labelTrack->GetLabels() ) {
597  context.StartArray();
598  context.AddItem( label.getT0() ); // start
599  context.AddItem( label.getT1() ); // end
600  context.AddItem( label.title ); //text.
601  context.EndArray();
602  }
603  context.EndArray();
604  context.EndArray();
605 #endif
606  } );
607  // Per track numbering counts all tracks
608  i++;
609  }
610  context.EndArray();
611 
612  return true;
613 }
614 
615 /*******************************************************************
616 The various Explore functions are called from the Send functions,
617 and may be recursive. 'Send' is the top level.
618 *******************************************************************/
619 
620 void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu, int Id, int depth ){
621  static_cast<void>(Id);//compiler food.
622  if( !pMenu )
623  return;
624 
625  auto &commandManager = CommandManager::Get( context.project );
626 
627  wxMenuItemList list = pMenu->GetMenuItems();
628  size_t lcnt = list.size();
629  wxMenuItem * item;
630  wxString Label;
631  wxString Accel;
632  CommandID Name;
633 
634  for (size_t lndx = 0; lndx < lcnt; lndx++) {
635  item = list.Item(lndx)->GetData();
636  Label = item->GetItemLabelText();
637  Name = commandManager.GetNameFromNumericID( item->GetId() );
638  Accel = item->GetItemLabel();
639  if( Accel.Contains("\t") )
640  Accel = Accel.AfterLast('\t');
641  else
642  Accel = "";
643  if( item->IsSeparator() )
644  Label = "----";
645  int flags = 0;
646  if (item->IsSubMenu())
647  flags +=1;
648  if (item->IsCheck() && item->IsChecked())
649  flags +=2;
650 
651  context.StartStruct();
652  context.AddItem( depth, "depth" );
653  context.AddItem( flags, "flags" );
654  context.AddItem( Label, "label" );
655  context.AddItem( Accel, "accel" );
656  if( !Name.empty() )
657  // using GET to expose CommandID in results of GetInfoCommand...
658  // PRL asks, is that all right?
659  context.AddItem( Name.GET(), "id" );// It is called Scripting ID outside Audacity.
660  context.EndStruct();
661 
662  if (item->IsSubMenu()) {
663  pMenu = item->GetSubMenu();
664  ExploreMenu( context, pMenu, item->GetId(), depth+1 );
665  }
666  }
667 }
668 
670  wxPoint WXUNUSED(P), wxWindow * pWin, int WXUNUSED(Id), int depth )
671 {
672  // Dang! wxMenuBar returns bogus screen rect.
673  // We're going to have to fake it instead.
674  //wxMenuBar * pBar = context.GetProject()->GetMenuBar();
675  //wxRect R = pBar->GetScreenRect();
676  //R.SetPosition( R.GetPosition() - P );
677 
678  wxRect R1 = pWin->GetScreenRect();
679  wxSize s = pWin->GetWindowBorderSize();
680  wxRect R( 2,32, R1.GetWidth() - s.GetWidth() * 2 -16, 22 );
681 
682  context.StartStruct();
683  context.AddItem( depth, "depth" );
684  context.AddItem( "MenuBar", "label" );
685  context.StartField( "box" );
686  context.StartArray();
687  context.AddItem( R.GetLeft() );
688  context.AddItem( R.GetTop() );
689  context.AddItem( R.GetRight() );
690  context.AddItem( R.GetBottom() );
691  context.EndArray();
692  context.EndField();
693  context.EndStruct();
694 }
695 
697  wxPoint P, wxWindow * pWin, int WXUNUSED(Id), int depth )
698 {
699  AudacityProject * pProj = &context.project;
700  auto &tp = TrackPanel::Get( *pProj );
701  auto &viewInfo = ViewInfo::Get( *pProj );
702 
703  wxRect trackRect = pWin->GetRect();
704 
705  for ( auto t : TrackList::Get( *pProj ).Any() + IsVisibleTrack{ pProj } ) {
706  auto &view = TrackView::Get( *t );
707  trackRect.y = view.GetY() - viewInfo.vpos;
708  trackRect.height = view.GetHeight();
709 
710 #if 0
711  // Work in progress on getting the TCP button positions and sizes.
712  wxRect rect = trackRect;
713  Track *l = t->GetLink();
714 
715  if (t->GetLinked()) {
716  rect.height += l->GetHeight();
717  }
718 
719  switch (t->GetKind()) {
720  case Track::Wave:
721  {
722  break;
723  }
724 #ifdef USE_MIDI
725  case Track::Note:
726  {
727  break;
728  }
729 #endif // USE_MIDI
730  case Track::Label:
731  break;
732  case Track::Time:
733  break;
734  }
735  {
736  // Start with whole track rect
737  wxRect R = trackRect;
738 
739  // Now exclude left, right, and top insets
740  R.x += kLeftInset;
741  R.y += kTopInset;
742  R.width -= kLeftInset * 2;
743  R.height -= kTopInset;
744 
745  int labelw = viewInfo.GetLabelWidth();
746  //int vrul = viewInfo.GetVRulerOffset();
747  bool bIsWave = true;
748  //mTrackInfo.DrawBackground(dc, R, t->GetSelected(), bIsWave, labelw, vrul);
749 
750 
751  for (Overlay * pOverlay : pTP->mOverlays) {
752  auto R2(pOverlay->GetRectangle(trackRect.GetSize()).first);
753  context.Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
754  depth, R2.GetLeft(), R2.GetTop(), R2.GetRight(), R2.GetBottom(), "Otherthing" ));
755  }
756  }
757 #endif
758 
759  // The VRuler.
760  {
761  wxRect R = trackRect;
762  R.x += viewInfo.GetVRulerOffset();
763  R.y += kTopMargin;
764  R.width = viewInfo.GetVRulerWidth();
765  R.height -= (kTopMargin + kBottomMargin);
766  R.SetPosition( R.GetPosition() + P );
767 
768  context.StartStruct();
769  context.AddItem( depth, "depth" );
770  context.AddItem( "VRuler", "label" );
771  context.StartField("box");
772  context.StartArray();
773  context.AddItem( R.GetLeft() );
774  context.AddItem( R.GetTop() );
775  context.AddItem( R.GetRight() );
776  context.AddItem( R.GetBottom() );
777  context.EndArray();
778  context.EndField();
779  context.EndStruct();
780  }
781  }
782 }
783 
784 
786  wxPoint P, wxWindow * pWin, int Id, int depth )
787 {
788  static_cast<void>(Id);//Compiler food.
789 
790  if( pWin->GetName() == "Track Panel" )
791  {
792  wxRect R = pWin->GetScreenRect();
793  ExploreTrackPanel( context, R.GetPosition()-P, pWin, Id, depth );
794  return;
795  }
796  wxWindowList list = pWin->GetChildren();
797  size_t lcnt = list.size();
798 
799  for (size_t lndx = 0; lndx < lcnt; lndx++) {
800  wxWindow * item = list[lndx];
801  if( !item->IsShown() )
802  continue;
803  wxRect R = item->GetScreenRect();
804  R.SetPosition( R.GetPosition() - P );
805  wxString Name = item->GetName();
806  // Ignore staticLine and StaticBitmap.
807  if( Name.StartsWith( "static" ) )
808  continue;
809  // Ignore anonymous panels.
810  if( Name == "panel" )
811  continue;
812  if( Name.empty() )
813  Name = wxString("*") + item->GetToolTipText();
814 
815  context.StartStruct();
816  context.AddItem( depth, "depth" );
817  context.AddItem( Name, "label" );
818  context.AddItem( item->GetId(), "id" );
819  context.StartField( "box" );
820  context.StartArray();
821  context.AddItem( R.GetLeft() );
822  context.AddItem( R.GetTop() );
823  context.AddItem( R.GetRight() );
824  context.AddItem( R.GetBottom() );
825  context.EndArray();
826  context.EndField();
827  context.EndStruct();
828 
829  ExploreWindows( context, P, item, item->GetId(), depth+1 );
830  }
831 }
832 
GetInfoCommand::SendClips
bool SendClips(const CommandContext &context)
Definition: GetInfoCommand.cpp:508
kLisp
@ kLisp
Definition: GetInfoCommand.cpp:85
TranslatableString
Definition: Types.h:290
ViewInfo::Get
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:162
SettingSpec::GetDefault
const T & GetDefault() const
Definition: ShuttleGui.h:113
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:68
LoadCommands.h
PlayableTrack::GetSolo
bool GetSolo() const
Definition: Track.h:844
ShuttleGuiBase::TieIntegerTextBox
virtual wxTextCtrl * TieIntegerTextBox(const TranslatableString &Prompt, const SettingSpec< int > &Setting, const int nChars)
Definition: ShuttleGui.cpp:1906
PlayableTrack::GetMute
bool GetMute() const
Definition: Track.h:843
GetInfoCommand::ExploreTrackPanel
void ExploreTrackPanel(const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
Definition: GetInfoCommand.cpp:696
kLeftInset
@ kLeftInset
Definition: ZoomInfo.h:31
GetInfoCommand::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: GetInfoCommand.h:32
TrackView::Get
static TrackView & Get(Track &)
Definition: TrackView.cpp:63
CommandMessageTargetDecorator::StartField
void StartField(const wxString &name={}) override
Definition: CommandTargets.h:109
WaveTrack::GetEndTime
double GetEndTime() const override
Get the time at which the last clip in the track ends, plus recorded stuff.
Definition: WaveTrack.cpp:1797
ChoiceSetting::Key
const wxString & Key() const
Definition: Prefs.h:106
ClientData::Site::Get
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:309
SettingSpec::GetPath
const RegistryPath & GetPath() const
Definition: ShuttleGui.h:112
ShuttleGuiBase::TieCheckBox
wxCheckBox * TieCheckBox(const TranslatableString &Prompt, bool &Var)
Definition: ShuttleGui.cpp:1603
kJson
@ kJson
Definition: GetInfoCommand.cpp:84
TrackList::Channels
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1467
CommandMessageTargetDecorator::EndStruct
void EndStruct() override
Definition: CommandTargets.h:102
CommandContext::EndArray
void EndArray() const
Definition: CommandContext.cpp:94
Envelope
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:71
ShuttleGuiBase::TieSlider
wxSlider * TieSlider(const TranslatableString &Prompt, int &pos, const int max, const int min=0)
Definition: ShuttleGui.cpp:1661
CommandContext::EndField
void EndField() const
Definition: CommandContext.cpp:114
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieNumberAsChoice
wxChoice * TieNumberAsChoice(const TranslatableString &Prompt, const SettingSpec< int > &Setting, const TranslatableStrings &Choices, const std::vector< int > *pInternalChoices, int iNoMatchSelector) override
Definition: GetInfoCommand.cpp:302
Overlay
Definition: Overlay.h:94
CommandManager.h
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2421
GetInfoCommand::SendTracks
bool SendTracks(const CommandContext &context)
Definition: GetInfoCommand.cpp:461
SelectCommand.h
Declarations for SelectCommand and SelectCommandType classes.
TrackPanel::Get
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:222
GetInfoCommand::SendEnvelopes
bool SendEnvelopes(const CommandContext &context)
Definition: GetInfoCommand.cpp:533
XO
#define XO(s)
Definition: Internat.h:32
GetInfoCommand::SendBoxes
bool SendBoxes(const CommandContext &context)
Definition: GetInfoCommand.cpp:431
CommandContext::AddItem
void AddItem(const wxString &value, const wxString &name={}) const
Definition: CommandContext.cpp:119
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:61
LabelTrack
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:88
GetInfoCommand::SendPreferences
bool SendPreferences(const CommandContext &context)
Definition: GetInfoCommand.cpp:395
GetInfoCommand::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: GetInfoCommand.cpp:109
kBoxes
@ kBoxes
Definition: GetInfoCommand.cpp:66
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1212
nFormats
@ nFormats
Definition: GetInfoCommand.cpp:87
WaveClipPointers
std::vector< WaveClip * > WaveClipPointers
Definition: WaveTrack.h:40
EffectManager::Get
static EffectManager & Get()
Definition: EffectManager.cpp:42
CommandContext::AddBool
void AddBool(const bool value, const wxString &name={}) const
Definition: CommandContext.cpp:124
CommandMessageTargetDecorator::AddBool
void AddBool(const bool value, const wxString &name={}) override
Definition: CommandTargets.h:105
GetInfoCommand::ExploreMenu
void ExploreMenu(const CommandContext &context, wxMenu *pMenu, int Id, int depth)
Definition: GetInfoCommand.cpp:620
CommandMessageTargetDecorator::AddItem
void AddItem(const wxString &value, const wxString &name={}) override
Definition: CommandTargets.h:103
CommandMessageTarget
Interface for objects that can receive (string) messages from a command.
Definition: CommandTargets.h:74
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieTextBox
wxTextCtrl * TieTextBox(const TranslatableString &Prompt, const SettingSpec< wxString > &Setting, const int nChars) override
Definition: GetInfoCommand.cpp:321
kEnvelopes
@ kEnvelopes
Definition: GetInfoCommand.cpp:64
EnumValueSymbols::GetInternals
const wxArrayStringEx & GetInternals() const
Definition: Prefs.cpp:218
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterface.h:60
ShuttleGuiBase::TieTextBox
wxTextCtrl * TieTextBox(const TranslatableString &Caption, wxString &Value, const int nChars=0)
Definition: ShuttleGui.cpp:1626
BuiltinCommandsModule::Registration
Definition: LoadCommands.h:41
WaveTrack::SortedClipArray
WaveClipPointers SortedClipArray()
Definition: WaveTrack.cpp:2502
CommandMessageTargetDecorator::EndField
void EndField() override
Definition: CommandTargets.h:111
CommandMessageTargetDecorator
CommandMessageTargetDecorator is a CommandOutputTarget that forwards its work on to another one....
Definition: CommandTargets.h:94
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieIntegerTextBox
wxTextCtrl * TieIntegerTextBox(const TranslatableString &Prompt, const SettingSpec< int > &Setting, const int nChars) override
Definition: GetInfoCommand.cpp:335
Envelope::GetOffset
double GetOffset() const
Definition: Envelope.h:98
ChoiceSetting
Definition: Prefs.h:90
EffectManager::GetCommandIdentifier
CommandID GetCommandIdentifier(const PluginID &ID)
Definition: EffectManager.cpp:122
CommandContext::Status
virtual void Status(const wxString &message, bool bFlush=false) const
Definition: CommandContext.cpp:63
WaveClip
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:172
TranslatableStrings
std::vector< TranslatableString > TranslatableStrings
Definition: Types.h:555
CommandContext.h
XXO
#define XXO(s)
Definition: Internat.h:45
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieCheckBoxOnRight
wxCheckBox * TieCheckBoxOnRight(const TranslatableString &Prompt, const SettingSpec< bool > &Setting) override
Definition: GetInfoCommand.cpp:270
GetInfoCommand::mInfoType
int mInfoType
Definition: GetInfoCommand.h:46
kCommands
@ kCommands
Definition: GetInfoCommand.cpp:58
EffectManager
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:46
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition: CommandContext.h:22
label
TranslatableString label
Definition: Tags.cpp:755
CommandMessageTargetDecorator::EndArray
void EndArray() override
Definition: CommandTargets.h:100
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1203
GetProjectFrame
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
Definition: Project.cpp:186
kTopInset
@ kTopInset
Definition: ViewInfo.h:104
Track::GetLink
Track * GetLink() const
Definition: Track.cpp:199
ShuttleParams::DefineEnum
virtual void DefineEnum(int &var, const wxChar *key, const int vdefault, const EnumValueSymbol strings[], size_t nStrings)
Definition: Shuttle.cpp:339
CommandContext::StartArray
void StartArray() const
Definition: CommandContext.cpp:89
Msgids
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Definition: Internat.cpp:267
GetInfoCommand::ExploreAdornments
void ExploreAdornments(const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
Definition: GetInfoCommand.cpp:669
LabelTrack::GetLabels
const LabelArray & GetLabels() const
Definition: LabelTrack.h:130
GetInfoCommand::ExploreWindows
void ExploreWindows(const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
Definition: GetInfoCommand.cpp:785
IsVisibleTrack
Definition: TrackPanel.h:217
CommandTargets.h
TrackFocus::Get
Track * Get()
Definition: TrackPanelAx.cpp:755
WaveTrack::GetGain
float GetGain() const
Definition: WaveTrack.cpp:377
PluginDescriptor
Definition: PluginManager.h:45
CommandMessageTargetDecorator::StartArray
void StartArray() override
Definition: CommandTargets.h:99
WaveTrack::GetStartTime
double GetStartTime() const override
Get the time at which the first clip in the track starts.
Definition: WaveTrack.cpp:1777
ShuttleGuiBase::TieNumericTextBox
wxTextCtrl * TieNumericTextBox(const TranslatableString &Prompt, int &Value, const int nChars=0)
Definition: ShuttleGui.cpp:1647
kBottomMargin
@ kBottomMargin
Definition: ViewInfo.h:106
PrefsDialog::ShuttleAll
void ShuttleAll(ShuttleGui &S)
Definition: PrefsDialog.cpp:663
GetInfoCommand::Apply
bool Apply(const CommandContext &context) override
Definition: GetInfoCommand.cpp:123
kTopMargin
@ kTopMargin
Definition: ViewInfo.h:105
GetInfoCommand::DefineParams
bool DefineParams(ShuttleParams &S) override
Definition: GetInfoCommand.cpp:103
ChoiceSetting::GetSymbols
const EnumValueSymbols & GetSymbols() const
Definition: Prefs.h:108
kPreferences
@ kPreferences
Definition: GetInfoCommand.cpp:61
ShuttleGuiBase::TieSpinCtrl
wxSpinCtrl * TieSpinCtrl(const TranslatableString &Prompt, int &Value, const int max, const int min=0)
Definition: ShuttleGui.cpp:1619
Identifier::GET
const wxString & GET() const
Definition: Types.h:110
CommandMessageTargetDecorator::StartStruct
void StartStruct() override
Definition: CommandTargets.h:101
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
eIsGettingMetadata
@ eIsGettingMetadata
Definition: ShuttleGui.h:39
PluginDescriptor::GetID
const wxString & GetID() const
Definition: PluginManager.cpp:1155
PluginManager::Get
static PluginManager & Get()
Definition: PluginManager.cpp:1761
CommandContext::StartField
void StartField(const wxString &name) const
Definition: CommandContext.cpp:109
GetInfoCommand::mFormat
int mFormat
Definition: GetInfoCommand.h:47
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:495
ChoiceSetting::Default
const EnumValueSymbol & Default() const
Definition: Prefs.cpp:227
PluginManager
PluginManager maintains a list of all plug ins. That covers modules, effects, generators,...
Definition: PluginManager.h:172
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:238
TaggedIdentifier< CommandIdTag, false >
CommandContext::EndStruct
void EndStruct() const
Definition: CommandContext.cpp:104
GetInfoCommand.h
Contains declaration of GetInfoCommand class.
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:112
kLabels
@ kLabels
Definition: GetInfoCommand.cpp:65
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition
Shuttle that retrieves a JSON format definition of a command's parameters.
Definition: GetInfoCommand.cpp:200
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieSlider
wxSlider * TieSlider(const TranslatableString &Prompt, const SettingSpec< int > &Setting, const int max, const int min=0) override
Definition: GetInfoCommand.cpp:363
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieSpinCtrl
wxSpinCtrl * TieSpinCtrl(const TranslatableString &Prompt, const SettingSpec< int > &Setting, const int max, const int min) override
Definition: GetInfoCommand.cpp:378
ComponentInterfaceSymbol::Internal
const wxString & Internal() const
Definition: ComponentInterface.h:88
GetInfoCommand::ApplyInner
bool ApplyInner(const CommandContext &context)
Definition: GetInfoCommand.cpp:149
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieCheckBox
wxCheckBox * TieCheckBox(const TranslatableString &Prompt, const SettingSpec< bool > &Setting) override
Definition: GetInfoCommand.cpp:257
PluginManager::GetFirstPlugin
const PluginDescriptor * GetFirstPlugin(int type)
Definition: PluginManager.cpp:2544
ShuttleGuiBase::TieNumberAsChoice
virtual wxChoice * TieNumberAsChoice(const TranslatableString &Prompt, const SettingSpec< int > &Setting, const TranslatableStrings &Choices, const std::vector< int > *pInternalChoices=nullptr, int iNoMatchSelector=0)
Definition: ShuttleGui.cpp:1985
kClips
@ kClips
Definition: GetInfoCommand.cpp:63
EffectManager::GetCommandDefinition
void GetCommandDefinition(const PluginID &ID, const CommandContext &context, int flags)
Definition: EffectManager.cpp:163
GlobalPrefsDialog
Definition: PrefsDialog.h:81
TrackKind::Label
@ Label
kTracks
@ kTracks
Definition: GetInfoCommand.cpp:62
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieChoice
wxChoice * TieChoice(const TranslatableString &Prompt, const ChoiceSetting &choiceSetting) override
Definition: GetInfoCommand.cpp:283
GetInfoCommand::SendLabels
bool SendLabels(const CommandContext &context)
Definition: GetInfoCommand.cpp:575
CommandContext::StartStruct
void StartStruct() const
Definition: CommandContext.cpp:99
TranslatableString::Translation
wxString Translation() const
Definition: Types.h:337
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1354
WaveTrack::GetPan
float GetPan() const
Definition: WaveTrack.cpp:390
kFormats
static const EnumValueSymbol kFormats[nFormats]
Definition: GetInfoCommand.cpp:90
WaveTrack::GetDisplayBounds
void GetDisplayBounds(float *min, float *max) const
Definition: WaveTrack.cpp:257
CommandManager::Get
static CommandManager & Get(AudacityProject &project)
Definition: CommandManager.cpp:202
kTypes
kTypes
Definition: Noise.cpp:34
PluginTypeAudacityCommand
@ PluginTypeAudacityCommand
Definition: PluginManager.h:37
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::~ShuttleGuiGetDefinition
virtual ~ShuttleGuiGetDefinition()
Definition: GetInfoCommand.cpp:253
PluginManager::GetNextPlugin
const PluginDescriptor * GetNextPlugin(int type)
Definition: PluginManager.cpp:2568
LabelTrack::mLabels
LabelArray mLabels
Definition: LabelTrack.h:175
CommandContext::project
AudacityProject & project
Definition: CommandContext.h:52
GetInfoCommand::SendCommands
bool SendCommands(const CommandContext &context, int flags)
Definition: GetInfoCommand.cpp:411
kBrief
@ kBrief
Definition: GetInfoCommand.cpp:86
PluginTypeEffect
@ PluginTypeEffect
Definition: PluginManager.h:36
ShuttleGuiBase::TieChoice
wxChoice * TieChoice(const TranslatableString &Prompt, TranslatableString &Selected, const TranslatableStrings &choices)
Definition: ShuttleGui.cpp:1701
ShuttleGuiBase::TieCheckBoxOnRight
wxCheckBox * TieCheckBoxOnRight(const TranslatableString &Prompt, bool &Var)
Definition: ShuttleGui.cpp:1610
anonymous_namespace{GetInfoCommand.cpp}::reg
BuiltinCommandsModule::Registration< GetInfoCommand > reg
Definition: GetInfoCommand.cpp:56
TimeTrack
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24
nTypes
@ nTypes
Definition: GetInfoCommand.cpp:67
Identifier::empty
bool empty() const
Definition: Types.h:104
Envelope::GetNumberOfPoints
size_t GetNumberOfPoints() const
Return number of points.
Definition: Envelope.cpp:692
NoteTrack
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:66
anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieNumericTextBox
wxTextCtrl * TieNumericTextBox(const TranslatableString &Prompt, const SettingSpec< double > &Setting, const int nChars) override
Definition: GetInfoCommand.cpp:349
SettingSpec
Definition: ShuttleGui.h:106
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:638
GetInfoCommand::SendMenus
bool SendMenus(const CommandContext &context)
Definition: GetInfoCommand.cpp:167
kMenus
@ kMenus
Definition: GetInfoCommand.cpp:60
Overlay::GetRectangle
std::pair< wxRect, bool > GetRectangle(wxSize size)
Definition: Overlay.cpp:17
CommandContext::pOutput
std::unique_ptr< CommandOutputTargets > pOutput
Definition: CommandContext.h:53