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