Audacity  2.3.1
Public Member Functions | Public Attributes | Private Member Functions | List of all members
GetInfoCommand Class Reference

Command which outputs a list of available menu commands on the status channel. More...

#include <GetInfoCommand.h>

Inheritance diagram for GetInfoCommand:
AudacityCommand ComponentInterface

Public Member Functions

ComponentInterfaceSymbol GetSymbol () override
 
wxString GetDescription () override
 
bool DefineParams (ShuttleParams &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
wxString ManualPage () override
 
bool Apply (const CommandContext &context) override
 
bool ApplyInner (const CommandContext &context)
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
wxString GetPath () override
 
ComponentInterfaceSymbol GetVendor () override
 
wxString GetVersion () override
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
virtual bool Apply ()
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
virtual void SetHostUI (EffectUIHostInterface *WXUNUSED(host))
 
bool PopulateUI (wxWindow *parent)
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
bool DoAudacityCommand (wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const wxString &message, long style=DefaultMessageBoxStyle, const wxString &titleStr=wxString{})
 
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipAudacityCommand ()
 
virtual void End ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
const wxString & GetTranslatedName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 

Public Attributes

int mInfoType
 
int mFormat
 

Private Member Functions

bool SendCommands (const CommandContext &context, int flags)
 
bool SendMenus (const CommandContext &context)
 
bool SendPreferences (const CommandContext &context)
 
bool SendTracks (const CommandContext &context)
 
bool SendLabels (const CommandContext &context)
 
bool SendClips (const CommandContext &context)
 
bool SendEnvelopes (const CommandContext &context)
 
bool SendBoxes (const CommandContext &context)
 
void ExploreMenu (const CommandContext &context, wxMenu *pMenu, int Id, int depth)
 
void ExploreTrackPanel (const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
 
void ExploreAdornments (const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
 
void ExploreWindows (const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
 

Additional Inherited Members

- Public Types inherited from AudacityCommand
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 

Detailed Description

Command which outputs a list of available menu commands on the status channel.

Definition at line 31 of file GetInfoCommand.h.

Member Function Documentation

bool GetInfoCommand::Apply ( const CommandContext context)
override

Definition at line 111 of file GetInfoCommand.cpp.

References ApplyInner(), CommandContext::GetProject(), kBrief, kJson, kLisp, mFormat, and CommandContext::pOutput.

112 {
113  if( mFormat == kJson )
114  return ApplyInner( context );
115 
116  if( mFormat == kLisp )
117  {
118  CommandContext LispyContext(
119  *(context.GetProject()),
120  std::make_unique<LispifiedCommandOutputTargets>( *context.pOutput.get() )
121  );
122  return ApplyInner( LispyContext );
123  }
124 
125  if( mFormat == kBrief )
126  {
127  CommandContext BriefContext(
128  *(context.GetProject()),
129  std::make_unique<BriefCommandOutputTargets>( *context.pOutput.get() )
130  );
131  return ApplyInner( BriefContext );
132  }
133 
134  return false;
135 }
AudacityProject * GetProject() const
std::unique_ptr< CommandOutputTargets > pOutput
CommandContext provides addiitonal information to an 'Apply()' command. It provides the project...
bool ApplyInner(const CommandContext &context)
bool GetInfoCommand::ApplyInner ( const CommandContext context)

Definition at line 137 of file GetInfoCommand.cpp.

References kBoxes, kClips, kCommands, kEnvelopes, kLabels, kMenus, kPreferences, kTracks, mInfoType, SendBoxes(), SendClips(), SendCommands(), SendEnvelopes(), SendLabels(), SendMenus(), SendPreferences(), SendTracks(), and CommandContext::Status().

Referenced by Apply().

138 {
139  switch( mInfoType ){
140  case kCommands : return SendCommands( context, 0 );
141  //case kCommandsPlus : return SendCommands( context, 1 );
142  case kMenus : return SendMenus( context );
143  case kPreferences : return SendPreferences( context );
144  case kTracks : return SendTracks( context );
145  case kClips : return SendClips( context );
146  case kEnvelopes : return SendEnvelopes( context );
147  case kLabels : return SendLabels( context );
148  case kBoxes : return SendBoxes( context );
149  default:
150  context.Status( "Command options not recognised" );
151  }
152  return false;
153 }
bool SendMenus(const CommandContext &context)
bool SendTracks(const CommandContext &context)
bool SendEnvelopes(const CommandContext &context)
virtual void Status(const wxString &message, bool bFlush=false) const
bool SendPreferences(const CommandContext &context)
bool SendBoxes(const CommandContext &context)
bool SendCommands(const CommandContext &context, int flags)
bool SendLabels(const CommandContext &context)
bool SendClips(const CommandContext &context)
bool GetInfoCommand::DefineParams ( ShuttleParams S)
override

Definition at line 91 of file GetInfoCommand.cpp.

References ShuttleParams::DefineEnum(), mFormat, mInfoType, nFormats, and nTypes.

91  {
92  S.DefineEnum( mInfoType, wxT("Type"), 0, kTypes, nTypes );
93  S.DefineEnum( mFormat, wxT("Format"), 0, kFormats, nFormats );
94  return true;
95 }
kTypes
Definition: Noise.cpp:30
static const ComponentInterfaceSymbol kFormats[nFormats]
virtual void DefineEnum(int &var, const wxChar *key, const int vdefault, const ComponentInterfaceSymbol strings[], size_t nStrings)
Definition: Shuttle.cpp:345
void GetInfoCommand::ExploreAdornments ( const CommandContext context,
wxPoint  P,
wxWindow *  pWin,
int  Id,
int  depth 
)
private

Definition at line 449 of file GetInfoCommand.cpp.

References CommandContext::AddItem(), CommandContext::EndArray(), CommandContext::EndField(), CommandContext::EndStruct(), CommandContext::StartArray(), CommandContext::StartField(), and CommandContext::StartStruct().

Referenced by SendBoxes().

451 {
452  // Dang! wxMenuBar returns bogus screen rect.
453  // We're going to have to fake it instead.
454  //wxMenuBar * pBar = context.GetProject()->GetMenuBar();
455  //wxRect R = pBar->GetScreenRect();
456  //R.SetPosition( R.GetPosition() - P );
457 
458  wxRect R1 = pWin->GetScreenRect();
459  wxSize s = pWin->GetWindowBorderSize();
460  wxRect R( 2,32, R1.GetWidth() - s.GetWidth() * 2 -16, 22 );
461 
462  context.StartStruct();
463  context.AddItem( depth, "depth" );
464  context.AddItem( "MenuBar", "label" );
465  context.StartField( "box" );
466  context.StartArray();
467  context.AddItem( R.GetLeft() );
468  context.AddItem( R.GetTop() );
469  context.AddItem( R.GetRight() );
470  context.AddItem( R.GetBottom() );
471  context.EndArray();
472  context.EndField();
473  context.EndStruct();
474 }
void AddItem(const wxString &value, const wxString &name="") const
void StartField(const wxString &name) const
void StartStruct() const
void EndArray() const
void StartArray() const
void EndStruct() const
void EndField() const
void GetInfoCommand::ExploreMenu ( const CommandContext context,
wxMenu *  pMenu,
int  Id,
int  depth 
)
private

Definition at line 402 of file GetInfoCommand.cpp.

References CommandContext::AddItem(), CommandContext::EndStruct(), AudacityProject::GetCommandManager(), CommandManager::GetNameFromID(), CommandContext::GetProject(), Label, and CommandContext::StartStruct().

Referenced by SendMenus().

402  {
403  static_cast<void>(Id);//compiler food.
404  if( !pMenu )
405  return;
406 
407  CommandManager * pMan = context.GetProject()->GetCommandManager();
408 
409  wxMenuItemList list = pMenu->GetMenuItems();
410  size_t lcnt = list.GetCount();
411  wxMenuItem * item;
412  wxString Label;
413  wxString Accel;
414  wxString Name;
415 
416  for (size_t lndx = 0; lndx < lcnt; lndx++) {
417  item = list.Item(lndx)->GetData();
418  Label = item->GetItemLabelText();
419  Name = pMan->GetNameFromID( item->GetId() );
420  Accel = item->GetItemLabel();
421  if( Accel.Contains("\t") )
422  Accel = Accel.AfterLast('\t');
423  else
424  Accel = "";
425  if( item->IsSeparator() )
426  Label = "----";
427  int flags = 0;
428  if (item->IsSubMenu())
429  flags +=1;
430  if (item->IsCheck() && item->IsChecked())
431  flags +=2;
432 
433  context.StartStruct();
434  context.AddItem( depth, "depth" );
435  context.AddItem( flags, "flags" );
436  context.AddItem( Label, "label" );
437  context.AddItem( Accel, "accel" );
438  if( !Name.IsEmpty() )
439  context.AddItem( Name, "id" );// It is called Scripting ID outside Audacity.
440  context.EndStruct();
441 
442  if (item->IsSubMenu()) {
443  pMenu = item->GetSubMenu();
444  ExploreMenu( context, pMenu, item->GetId(), depth+1 );
445  }
446  }
447 }
AudacityProject * GetProject() const
void ExploreMenu(const CommandContext &context, wxMenu *pMenu, int Id, int depth)
wxString GetNameFromID(int id)
void AddItem(const wxString &value, const wxString &name="") const
CommandManager * GetCommandManager()
Definition: Project.h:362
void StartStruct() const
CommandManager implements a system for organizing all user-callable commands.
void EndStruct() const
void GetInfoCommand::ExploreTrackPanel ( const CommandContext context,
wxPoint  P,
wxWindow *  pWin,
int  Id,
int  depth 
)
private

Definition at line 476 of file GetInfoCommand.cpp.

References CommandContext::AddItem(), TrackList::Any(), CommandContext::EndArray(), CommandContext::EndField(), CommandContext::EndStruct(), Track::GetHeight(), TrackPanel::GetLabelWidth(), Track::GetLink(), CommandContext::GetProject(), Overlay::GetRectangle(), AudacityProject::GetTrackPanel(), AudacityProject::GetTracks(), TrackPanel::GetVRulerOffset(), TrackPanel::GetVRulerWidth(), kBottomMargin, kLeftInset, kTopInset, kTopMargin, CellularPanel::mViewInfo, CommandContext::StartArray(), CommandContext::StartField(), CommandContext::StartStruct(), CommandContext::Status(), and ZoomInfo::vpos.

Referenced by ExploreWindows().

478 {
479  AudacityProject * pProj = context.GetProject();
480  TrackPanel * pTP = pProj->GetTrackPanel();
481 
482  wxRect trackRect = pWin->GetRect();
483 
484  for (auto t : pProj->GetTracks()->Any() + IsVisibleTrack{ pProj }) {
485  trackRect.y = t->GetY() - pTP->mViewInfo->vpos;
486  trackRect.height = t->GetHeight();
487 
488 #if 0
489  // Work in progress on getting the TCP button positions and sizes.
490  wxRect rect = trackRect;
491  Track *l = t->GetLink();
492 
493  if (t->GetLinked()) {
494  rect.height += l->GetHeight();
495  }
496 
497  switch (t->GetKind()) {
498  case Track::Wave:
499  {
500  break;
501  }
502 #ifdef USE_MIDI
503  case Track::Note:
504  {
505  break;
506  }
507 #endif // USE_MIDI
508  case Track::Label:
509  break;
510  case Track::Time:
511  break;
512  }
513  {
514  // Start with whole track rect
515  wxRect R = trackRect;
516 
517  // Now exclude left, right, and top insets
518  R.x += kLeftInset;
519  R.y += kTopInset;
520  R.width -= kLeftInset * 2;
521  R.height -= kTopInset;
522 
523  int labelw = pTP->GetLabelWidth();
524  int vrul = pTP->GetVRulerOffset();
525  bool bIsWave = true;
526  //mTrackInfo.DrawBackground(dc, R, t->GetSelected(), bIsWave, labelw, vrul);
527 
528 
529  for (Overlay * pOverlay : pTP->mOverlays) {
530  auto R2(pOverlay->GetRectangle(trackRect.GetSize()).first);
531  context.Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
532  depth, R2.GetLeft(), R2.GetTop(), R2.GetRight(), R2.GetBottom(), "Overthing" ));
533  }
534  }
535 #endif
536 
537  // The VRuler.
538  {
539  wxRect R = trackRect;
540  R.x += pTP->GetVRulerOffset();
541  R.y += kTopMargin;
542  R.width = pTP->GetVRulerWidth();
543  R.height -= (kTopMargin + kBottomMargin);
544  R.SetPosition( R.GetPosition() + P );
545 
546  context.StartStruct();
547  context.AddItem( depth, "depth" );
548  context.AddItem( "VRuler", "label" );
549  context.StartField("box");
550  context.StartArray();
551  context.AddItem( R.GetLeft() );
552  context.AddItem( R.GetTop() );
553  context.AddItem( R.GetRight() );
554  context.AddItem( R.GetBottom() );
555  context.EndArray();
556  context.EndField();
557  context.EndStruct();
558  }
559  }
560 }
int GetLabelWidth() const
Definition: TrackPanel.h:357
AudacityProject * GetProject() const
ViewInfo * mViewInfo
virtual void Status(const wxString &message, bool bFlush=false) const
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1246
void AddItem(const wxString &value, const wxString &name="") const
int GetVRulerWidth() const
std::pair< wxRect, bool > GetRectangle(wxSize size)
Definition: Overlay.cpp:17
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:174
void StartField(const wxString &name) const
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:248
void StartStruct() const
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:191
void EndArray() const
int vpos
Definition: ViewInfo.h:45
Track * GetLink() const
Definition: Track.cpp:272
TrackPanel * GetTrackPanel()
Definition: Project.h:324
TrackList * GetTracks()
Definition: Project.h:209
void StartArray() const
void EndStruct() const
int GetHeight() const
Definition: Track.cpp:183
void EndField() const
int GetVRulerOffset() const
Definition: TrackPanel.h:354
void GetInfoCommand::ExploreWindows ( const CommandContext context,
wxPoint  P,
wxWindow *  pWin,
int  Id,
int  depth 
)
private

Definition at line 563 of file GetInfoCommand.cpp.

References CommandContext::AddItem(), CommandContext::EndArray(), CommandContext::EndField(), CommandContext::EndStruct(), ExploreTrackPanel(), CommandContext::StartArray(), CommandContext::StartField(), and CommandContext::StartStruct().

Referenced by SendBoxes().

565 {
566  static_cast<void>(Id);//Compiler food.
567 
568  if( pWin->GetName() == "Track Panel" )
569  {
570  wxRect R = pWin->GetScreenRect();
571  ExploreTrackPanel( context, R.GetPosition()-P, pWin, Id, depth );
572  return;
573  }
574  wxWindowList list = pWin->GetChildren();
575  size_t lcnt = list.GetCount();
576 
577  for (size_t lndx = 0; lndx < lcnt; lndx++) {
578  wxWindow * item = list[lndx];
579  if( !item->IsShown() )
580  continue;
581  wxRect R = item->GetScreenRect();
582  R.SetPosition( R.GetPosition() - P );
583  wxString Name = item->GetName();
584  // Ignore staticLine and StaticBitmap.
585  if( Name.StartsWith( "static" ) )
586  continue;
587  // Ignore anonymous panels.
588  if( Name == "panel" )
589  continue;
590  if( Name.IsEmpty() )
591  Name = wxString("*") + item->GetToolTipText();
592 
593  context.StartStruct();
594  context.AddItem( depth, "depth" );
595  context.AddItem( Name, "label" );
596  context.AddItem( item->GetId(), "id" );
597  context.StartField( "box" );
598  context.StartArray();
599  context.AddItem( R.GetLeft() );
600  context.AddItem( R.GetTop() );
601  context.AddItem( R.GetRight() );
602  context.AddItem( R.GetBottom() );
603  context.EndArray();
604  context.EndField();
605  context.EndStruct();
606 
607  ExploreWindows( context, P, item, item->GetId(), depth+1 );
608  }
609 }
void ExploreTrackPanel(const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
void AddItem(const wxString &value, const wxString &name="") const
void StartField(const wxString &name) const
void ExploreWindows(const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
void StartStruct() const
void EndArray() const
void StartArray() const
void EndStruct() const
void EndField() const
wxString GetInfoCommand::GetDescription ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 36 of file GetInfoCommand.h.

References _().

36 {return _("Gets information in JSON format.");};
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
ComponentInterfaceSymbol GetInfoCommand::GetSymbol ( )
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 35 of file GetInfoCommand.h.

References GET_INFO_PLUGIN_SYMBOL.

35 {return GET_INFO_PLUGIN_SYMBOL;};
#define GET_INFO_PLUGIN_SYMBOL
wxString GetInfoCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 41 of file GetInfoCommand.h.

41 {return wxT("Extra_Menu:_Scriptables_II#get_info");};
void GetInfoCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 97 of file GetInfoCommand.cpp.

References _(), ShuttleGui::AddSpace(), ShuttleGuiBase::EndMultiColumn(), LocalizedStrings(), mFormat, mInfoType, nFormats, nTypes, ShuttleGuiBase::StartMultiColumn(), and ShuttleGuiBase::TieChoice().

98 {
99  auto types = LocalizedStrings( kTypes, nTypes );
100  auto formats = LocalizedStrings( kFormats, nFormats );
101  S.AddSpace(0, 5);
102 
103  S.StartMultiColumn(2, wxALIGN_CENTER);
104  {
105  S.TieChoice( _("Type:"), mInfoType, &types);
106  S.TieChoice( _("Format:"), mFormat, &formats);
107  }
108  S.EndMultiColumn();
109 }
wxChoice * TieChoice(const wxString &Prompt, WrappedType &WrappedRef, const wxArrayString *pChoices)
void EndMultiColumn()
kTypes
Definition: Noise.cpp:30
static const ComponentInterfaceSymbol kFormats[nFormats]
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxArrayString LocalizedStrings(const ComponentInterfaceSymbol strings[], size_t nStrings)
Definition: Internat.cpp:303
wxSizerItem * AddSpace(int width, int height)
bool GetInfoCommand::SendBoxes ( const CommandContext context)
private

Definition at line 218 of file GetInfoCommand.cpp.

References CommandContext::AddItem(), CommandContext::EndArray(), CommandContext::EndField(), CommandContext::EndStruct(), ExploreAdornments(), ExploreWindows(), CommandContext::GetProject(), CommandContext::StartArray(), CommandContext::StartField(), and CommandContext::StartStruct().

Referenced by ApplyInner().

219 {
220  //context.Status("Boxes");
221  wxWindow * pWin = context.GetProject();
222 
223  context.StartArray();
224  wxRect R = pWin->GetScreenRect();
225 
226  //R.SetPosition( wxPoint(0,0) );
227 
228  //wxString Name = pWin->GetName();
229  context.StartStruct();
230  context.AddItem( 0, "depth" );
231  context.AddItem( "Audacity Window", "name" );
232  context.StartField( "box" );
233  context.StartArray( );
234  context.AddItem( R.GetLeft() );
235  context.AddItem( R.GetTop() );
236  context.AddItem( R.GetRight() );
237  context.AddItem( R.GetBottom() );
238  context.EndArray( );
239  context.EndField();
240  context.EndStruct( );
241 
242  ExploreAdornments( context, pWin->GetPosition()+wxSize( 6,-1), pWin, pWin->GetId(), 1 );
243  ExploreWindows( context, pWin->GetPosition()+wxSize( 6,-1), pWin, pWin->GetId(), 1 );
244  context.EndArray( );
245  return true;
246 }
AudacityProject * GetProject() const
void AddItem(const wxString &value, const wxString &name="") const
void StartField(const wxString &name) const
void ExploreAdornments(const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
void ExploreWindows(const CommandContext &context, wxPoint P, wxWindow *pWin, int Id, int depth)
void StartStruct() const
void EndArray() const
void StartArray() const
void EndStruct() const
void EndField() const
bool GetInfoCommand::SendClips ( const CommandContext context)
private

Definition at line 295 of file GetInfoCommand.cpp.

References CommandContext::AddItem(), CommandContext::EndArray(), CommandContext::EndStruct(), CommandContext::GetProject(), AudacityProject::GetTracks(), TrackList::Leaders(), CommandContext::StartArray(), and CommandContext::StartStruct().

Referenced by ApplyInner().

296 {
297  TrackList *tracks = context.GetProject()->GetTracks();
298  int i=0;
299  context.StartArray();
300  for (auto waveTrack : tracks->Leaders<WaveTrack>()) {
301  WaveClipPointers ptrs( waveTrack->SortedClipArray());
302  for(WaveClip * pClip : ptrs ) {
303  context.StartStruct();
304  context.AddItem( (double)i, "track" );
305  context.AddItem( pClip->GetStartTime(), "start" );
306  context.AddItem( pClip->GetEndTime(), "end" );
307  context.AddItem( pClip->GetColourIndex(), "color" );
308  context.EndStruct();
309  }
310  i++;
311  }
312  context.EndArray();
313 
314  return true;
315 }
AudacityProject * GetProject() const
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1280
void AddItem(const wxString &value, const wxString &name="") const
void StartStruct() const
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:176
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
void EndArray() const
std::vector< WaveClip * > WaveClipPointers
Definition: WaveClip.h:126
TrackList * GetTracks()
Definition: Project.h:209
void StartArray() const
void EndStruct() const
bool GetInfoCommand::SendCommands ( const CommandContext context,
int  flags 
)
private

Send the list of commands.

Definition at line 198 of file GetInfoCommand.cpp.

References CommandContext::EndArray(), EffectManager::Get(), PluginManager::Get(), EffectManager::GetCommandDefinition(), EffectManager::GetCommandIdentifier(), PluginManager::GetFirstPlugin(), PluginDescriptor::GetID(), PluginManager::GetNextPlugin(), PluginTypeAudacityCommand, PluginTypeEffect, and CommandContext::StartArray().

Referenced by ApplyInner().

199 {
200  context.StartArray();
203  {
205  while (plug)
206  {
207  auto command = em.GetCommandIdentifier(plug->GetID());
208  if (!command.IsEmpty()){
209  em.GetCommandDefinition( plug->GetID(), context, flags );
210  }
212  }
213  }
214  context.EndArray();
215  return true;
216 }
const PluginDescriptor * GetFirstPlugin(int type)
const PluginDescriptor * GetNextPlugin(int type)
void EndArray() const
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:45
static EffectManager & Get()
PluginManager maintains a list of all plug ins. That covers modules, effects, generators, analysis-effects, commands. It also has functions for shared and private configs - which need to move out.
const wxString & GetID() const
wxString GetCommandIdentifier(const PluginID &ID)
static PluginManager & Get()
void StartArray() const
void GetCommandDefinition(const PluginID &ID, const CommandContext &context, int flags)
bool GetInfoCommand::SendEnvelopes ( const CommandContext context)
private

Definition at line 317 of file GetInfoCommand.cpp.

References CommandContext::AddItem(), CommandContext::EndArray(), CommandContext::EndField(), CommandContext::EndStruct(), CommandContext::GetProject(), AudacityProject::GetTracks(), TrackList::Leaders(), Envelope::mEnv, Envelope::mOffset, CommandContext::StartArray(), CommandContext::StartField(), and CommandContext::StartStruct().

Referenced by ApplyInner().

318 {
319  TrackList *tracks = context.GetProject()->GetTracks();
320  int i=0;
321  int j=0;
322  context.StartArray();
323  for (auto waveTrack : tracks->Leaders<WaveTrack>()) {
324  WaveClipPointers ptrs( waveTrack->SortedClipArray());
325  for(WaveClip * pClip : ptrs ) {
326  context.StartStruct();
327  context.AddItem( (double)i, "track" );
328  context.AddItem( (double)j, "clip" );
329  context.AddItem( pClip->GetStartTime(), "start" );
330  Envelope * pEnv = pClip->GetEnvelope();
331  context.StartField( "points" );
332  context.StartArray();
333  double offset = pEnv->mOffset;
334  for( size_t k=0;k<pEnv->mEnv.size(); k++)
335  {
336  context.StartStruct( );
337  context.AddItem( pEnv->mEnv[k].GetT()+offset, "t" );
338  context.AddItem( pEnv->mEnv[k].GetVal(), "y" );
339  context.EndStruct();
340  }
341  context.EndArray();
342  context.EndField();
343  context.AddItem( pClip->GetEndTime(), "end" );
344  context.EndStruct();
345  j++;
346  }
347  }
348  context.EndArray();
349 
350  return true;
351 }
AudacityProject * GetProject() const
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1280
Draggable curve used in TrackPanel for varying amplification.
Definition: Envelope.h:77
void AddItem(const wxString &value, const wxString &name="") const
void StartField(const wxString &name) const
void StartStruct() const
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:176
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
void EndArray() const
double mOffset
The time at which the envelope starts, i.e. the start offset.
Definition: Envelope.h:257
std::vector< WaveClip * > WaveClipPointers
Definition: WaveClip.h:126
TrackList * GetTracks()
Definition: Project.h:209
void StartArray() const
void EndStruct() const
EnvArray mEnv
Definition: Envelope.h:254
void EndField() const
bool GetInfoCommand::SendLabels ( const CommandContext context)
private

Definition at line 354 of file GetInfoCommand.cpp.

References CommandContext::AddItem(), CommandContext::EndArray(), CommandContext::EndStruct(), CommandContext::GetProject(), AudacityProject::GetTracks(), label, TrackList::Leaders(), LabelTrack::mLabels, CommandContext::StartArray(), and CommandContext::StartStruct().

Referenced by ApplyInner().

355 {
356  TrackList *tracks = context.GetProject()->GetTracks();
357  int i=0;
358  context.StartArray();
359  for (auto t : tracks->Leaders()) {
360  t->TypeSwitch( [&](LabelTrack *labelTrack) {
361 #ifdef VERBOSE_LABELS_FORMATTING
362  for (int nn = 0; nn< (int)labelTrack->mLabels.size(); nn++) {
363  const auto &label = labelTrack->mLabels[nn];
364  context.StartStruct();
365  context.AddItem( (double)i, "track" );
366  context.AddItem( label.getT0(), "start" );
367  context.AddItem( label.getT1(), "end" );
368  context.AddItem( label.title, "text" );
369  context.EndStruct();
370  }
371 #else
372  context.StartArray();
373  context.AddItem( (double)i ); // Track number.
374  context.StartArray();
375  for (int nn = 0; nn< (int)labelTrack->mLabels.size(); nn++) {
376  const auto &label = labelTrack->mLabels[nn];
377  context.StartArray();
378  context.AddItem( label.getT0() ); // start
379  context.AddItem( label.getT1() ); // end
380  context.AddItem( label.title ); //text.
381  context.EndArray();
382  }
383  context.EndArray();
384  context.EndArray();
385 #endif
386  } );
387  // Per track numbering counts all tracks
388  i++;
389  }
390  context.EndArray();
391 
392 
393 
394  return true;
395 }
AudacityProject * GetProject() const
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1280
wxString label
Definition: Tags.cpp:733
void AddItem(const wxString &value, const wxString &name="") const
LabelArray mLabels
Displacement of mouse cursor from the centre being dragged.
Definition: LabelTrack.h:287
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
void StartStruct() const
void EndArray() const
TrackList * GetTracks()
Definition: Project.h:209
void StartArray() const
void EndStruct() const
bool GetInfoCommand::SendMenus ( const CommandContext context)
private

Definition at line 155 of file GetInfoCommand.cpp.

References CommandContext::AddItem(), CommandContext::EndArray(), CommandContext::EndStruct(), ExploreMenu(), CommandContext::GetProject(), Label, CommandContext::StartArray(), and CommandContext::StartStruct().

Referenced by ApplyInner().

156 {
157  wxMenuBar * pBar = context.GetProject()->GetMenuBar();
158  if(!pBar ){
159  wxLogDebug("No menus");
160  return false;
161  }
162 
163  size_t cnt = pBar->GetMenuCount();
164  size_t i;
165  wxString Label;
166  context.StartArray();
167  for(i=0;i<cnt;i++)
168  {
169  Label = pBar->GetMenuLabelText( i );
170  context.StartStruct();
171  context.AddItem( 0, "depth" );
172  context.AddItem( 0, "flags" );
173  context.AddItem( Label, "label" );
174  context.AddItem( "", "accel" );
175  context.EndStruct();
176  ExploreMenu( context, pBar->GetMenu( i ), pBar->GetId(), 1 );
177  }
178  context.EndArray();
179  return true;
180 }
AudacityProject * GetProject() const
void ExploreMenu(const CommandContext &context, wxMenu *pMenu, int Id, int depth)
void AddItem(const wxString &value, const wxString &name="") const
void StartStruct() const
void EndArray() const
void StartArray() const
void EndStruct() const
bool GetInfoCommand::SendPreferences ( const CommandContext context)
private

Definition at line 182 of file GetInfoCommand.cpp.

References CommandContext::EndArray(), CommandContext::GetProject(), CommandContext::pOutput, and CommandContext::StartArray().

Referenced by ApplyInner().

183 {
184  context.StartArray();
185  GlobalPrefsDialog dialog( context.GetProject() );
186  // wxCommandEvent Evt;
187  //dialog.Show();
188  wxWindow * pWin = context.GetProject();
189  ShuttleGuiGetDefinition S(pWin, *((context.pOutput)->mStatusTarget) );
190  dialog.ShuttleAll( S );
191  context.EndArray();
192  return true;
193 }
AudacityProject * GetProject() const
std::unique_ptr< CommandOutputTargets > pOutput
Shuttle that retrieves a JSON format definition of a command's parameters.
Definition: ShuttleGui.h:432
void EndArray() const
void StartArray() const
bool GetInfoCommand::SendTracks ( const CommandContext context)
private

Definition at line 248 of file GetInfoCommand.cpp.

References CommandContext::AddBool(), CommandContext::AddItem(), TrackList::Channels(), CommandContext::EndArray(), CommandContext::EndStruct(), WaveTrack::GetDisplayBounds(), WaveTrack::GetEndTime(), TrackPanel::GetFocusedTrack(), WaveTrack::GetGain(), PlayableTrack::GetMute(), WaveTrack::GetPan(), CommandContext::GetProject(), PlayableTrack::GetSolo(), WaveTrack::GetStartTime(), AudacityProject::GetTrackPanel(), AudacityProject::GetTracks(), TrackList::Leaders(), CommandContext::StartArray(), and CommandContext::StartStruct().

Referenced by ApplyInner().

249 {
250  TrackList *projTracks = context.GetProject()->GetTracks();
251  context.StartArray();
252  for (auto trk : projTracks->Leaders())
253  {
254  TrackPanel *panel = context.GetProject()->GetTrackPanel();
255  Track * fTrack = panel->GetFocusedTrack();
256 
257  context.StartStruct();
258  context.AddItem( trk->GetName(), "name" );
259  context.AddBool( (trk == fTrack), "focused");
260  context.AddBool( trk->GetSelected(), "selected" );
261  //JKC: Possibly add later...
262  //context.AddItem( trk->GetHeight(), "height" );
263  trk->TypeSwitch( [&] (const WaveTrack* t ) {
264  float vzmin, vzmax;
265  t->GetDisplayBounds(&vzmin, &vzmax);
266  context.AddItem( "wave", "kind" );
267  context.AddItem( t->GetStartTime(), "start" );
268  context.AddItem( t->GetEndTime(), "end" );
269  context.AddItem( t->GetPan() , "pan");
270  context.AddItem( t->GetGain() , "gain");
271  context.AddItem( TrackList::Channels(t).size(), "channels");
272  context.AddBool( t->GetSolo(), "solo" );
273  context.AddBool( t->GetMute(), "mute");
274  context.AddItem( vzmin, "VZoomMin");
275  context.AddItem( vzmax, "VZoomMax");
276  },
277 #if defined(USE_MIDI)
278  [&](const NoteTrack *) {
279  context.AddItem( "note", "kind" );
280  },
281 #endif
282  [&](const LabelTrack *) {
283  context.AddItem( "label", "kind" );
284  },
285  [&](const TimeTrack *) {
286  context.AddItem( "time", "kind" );
287  }
288  );
289  context.EndStruct();
290  }
291  context.EndArray();
292  return true;
293 }
bool GetSolo() const
Definition: Track.h:777
AudacityProject * GetProject() const
float GetPan() const
Definition: WaveTrack.cpp:431
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1280
void AddItem(const wxString &value, const wxString &name="") const
double GetEndTime() const override
Get the time at which the last clip in the track ends, plus recorded stuff.
Definition: WaveTrack.cpp:1894
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
void GetDisplayBounds(float *min, float *max) const
Definition: WaveTrack.cpp:328
double GetStartTime() const override
Get the time at which the first clip in the track starts.
Definition: WaveTrack.cpp:1874
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:248
void StartStruct() const
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:191
void EndArray() const
Track * GetFocusedTrack()
TrackPanel * GetTrackPanel()
Definition: Project.h:324
bool GetMute() const
Definition: Track.h:776
float GetGain() const
Definition: WaveTrack.cpp:418
TrackList * GetTracks()
Definition: Project.h:209
void StartArray() const
void EndStruct() const
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1356
void AddBool(const bool value, const wxString &name="") const
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:66

Member Data Documentation

int GetInfoCommand::mFormat

Definition at line 47 of file GetInfoCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

int GetInfoCommand::mInfoType

Definition at line 46 of file GetInfoCommand.h.

Referenced by ApplyInner(), DefineParams(), and PopulateOrExchange().


The documentation for this class was generated from the following files: