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 CommandDefinitionInterface IdentInterface ParamsInterface

Public Member Functions

IdentInterfaceSymbol 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
 
IdentInterfaceSymbol 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 CommandDefinitionInterface
virtual ~CommandDefinitionInterface ()
 
- Public Member Functions inherited from IdentInterface
virtual ~IdentInterface ()
 
const wxString & GetTranslatedName ()
 
- Public Member Functions inherited from ParamsInterface
virtual ~ParamsInterface ()
 
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 }
static const IdentInterfaceSymbol kFormats[nFormats]
kTypes
Definition: Noise.cpp:30
virtual void DefineEnum(int &var, const wxChar *key, const int vdefault, const IdentInterfaceSymbol 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 434 of file GetInfoCommand.cpp.

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

Referenced by SendBoxes().

436 {
437  // Dang! wxMenuBar returns bogus screen rect.
438  // We're going to have to fake it instead.
439  //wxMenuBar * pBar = context.GetProject()->GetMenuBar();
440  //wxRect R = pBar->GetScreenRect();
441  //R.SetPosition( R.GetPosition() - P );
442 
443  wxRect R1 = pWin->GetScreenRect();
444  wxSize s = pWin->GetWindowBorderSize();
445  wxRect R( 2,32, R1.GetWidth() - s.GetWidth() * 2 -16, 22 );
446 
447  context.StartStruct();
448  context.AddItem( depth, "depth" );
449  context.AddItem( "MenuBar", "label" );
450  context.StartField( "box" );
451  context.StartArray();
452  context.AddItem( R.GetLeft() );
453  context.AddItem( R.GetTop() );
454  context.AddItem( R.GetRight() );
455  context.AddItem( R.GetBottom() );
456  context.EndArray();
457  context.EndField();
458  context.EndStruct();
459 }
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 387 of file GetInfoCommand.cpp.

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

Referenced by SendMenus().

387  {
388  static_cast<void>(Id);//compiler food.
389  if( !pMenu )
390  return;
391 
392  CommandManager * pMan = context.GetProject()->GetCommandManager();
393 
394  wxMenuItemList list = pMenu->GetMenuItems();
395  size_t lcnt = list.GetCount();
396  wxMenuItem * item;
397  wxString Label;
398  wxString Accel;
399  wxString Name;
400 
401  for (size_t lndx = 0; lndx < lcnt; lndx++) {
402  item = list.Item(lndx)->GetData();
403  Label = item->GetItemLabelText();
404  Name = pMan->GetNameFromID( item->GetId() );
405  Accel = item->GetItemLabel();
406  if( Accel.Contains("\t") )
407  Accel = Accel.AfterLast('\t');
408  else
409  Accel = "";
410  if( item->IsSeparator() )
411  Label = "----";
412  int flags = 0;
413  if (item->IsSubMenu())
414  flags +=1;
415  if (item->IsCheck() && item->IsChecked())
416  flags +=2;
417 
418  context.StartStruct();
419  context.AddItem( depth, "depth" );
420  context.AddItem( flags, "flags" );
421  context.AddItem( Label, "label" );
422  context.AddItem( Accel, "accel" );
423  if( !Name.IsEmpty() )
424  context.AddItem( Name, "id" );// It is called Scripting ID outside Audacity.
425  context.EndStruct();
426 
427  if (item->IsSubMenu()) {
428  pMenu = item->GetSubMenu();
429  ExploreMenu( context, pMenu, item->GetId(), depth+1 );
430  }
431  }
432 }
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:347
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 461 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().

463 {
464  AudacityProject * pProj = context.GetProject();
465  TrackPanel * pTP = pProj->GetTrackPanel();
466 
467  wxRect trackRect = pWin->GetRect();
468 
469  for (auto t : pProj->GetTracks()->Any() + IsVisibleTrack{ pProj }) {
470  trackRect.y = t->GetY() - pTP->mViewInfo->vpos;
471  trackRect.height = t->GetHeight();
472 
473 #if 0
474  // Work in progress on getting the TCP button positions and sizes.
475  wxRect rect = trackRect;
476  Track *l = t->GetLink();
477 
478  if (t->GetLinked()) {
479  rect.height += l->GetHeight();
480  }
481 
482  switch (t->GetKind()) {
483  case Track::Wave:
484  {
485  break;
486  }
487 #ifdef USE_MIDI
488  case Track::Note:
489  {
490  break;
491  }
492 #endif // USE_MIDI
493  case Track::Label:
494  break;
495  case Track::Time:
496  break;
497  }
498  {
499  // Start with whole track rect
500  wxRect R = trackRect;
501 
502  // Now exclude left, right, and top insets
503  R.x += kLeftInset;
504  R.y += kTopInset;
505  R.width -= kLeftInset * 2;
506  R.height -= kTopInset;
507 
508  int labelw = pTP->GetLabelWidth();
509  int vrul = pTP->GetVRulerOffset();
510  bool bIsWave = true;
511  //mTrackInfo.DrawBackground(dc, R, t->GetSelected(), bIsWave, labelw, vrul);
512 
513 
514  for (Overlay * pOverlay : pTP->mOverlays) {
515  auto R2(pOverlay->GetRectangle(trackRect.GetSize()).first);
516  context.Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
517  depth, R2.GetLeft(), R2.GetTop(), R2.GetRight(), R2.GetBottom(), "Overthing" ));
518  }
519  }
520 #endif
521 
522  // The VRuler.
523  {
524  wxRect R = trackRect;
525  R.x += pTP->GetVRulerOffset();
526  R.y += kTopMargin;
527  R.width = pTP->GetVRulerWidth();
528  R.height -= (kTopMargin + kBottomMargin);
529  R.SetPosition( R.GetPosition() + P );
530 
531  context.StartStruct();
532  context.AddItem( depth, "depth" );
533  context.AddItem( "VRuler", "label" );
534  context.StartField("box");
535  context.StartArray();
536  context.AddItem( R.GetLeft() );
537  context.AddItem( R.GetTop() );
538  context.AddItem( R.GetRight() );
539  context.AddItem( R.GetBottom() );
540  context.EndArray();
541  context.EndField();
542  context.EndStruct();
543  }
544  }
545 }
int GetLabelWidth() const
Definition: TrackPanel.h:350
AudacityProject * GetProject() const
ViewInfo * mViewInfo
virtual void Status(const wxString &message, bool bFlush=false) const
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1195
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:175
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:237
void StartStruct() const
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:190
void EndArray() const
int vpos
Definition: ViewInfo.h:45
Track * GetLink() const
Definition: Track.cpp:259
TrackPanel * GetTrackPanel()
Definition: Project.h:309
TrackList * GetTracks()
Definition: Project.h:192
void StartArray() const
void EndStruct() const
int GetHeight() const
Definition: Track.cpp:170
void EndField() const
int GetVRulerOffset() const
Definition: TrackPanel.h:347
void GetInfoCommand::ExploreWindows ( const CommandContext context,
wxPoint  P,
wxWindow *  pWin,
int  Id,
int  depth 
)
private

Definition at line 548 of file GetInfoCommand.cpp.

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

Referenced by SendBoxes().

550 {
551  static_cast<void>(Id);//Compiler food.
552 
553  if( pWin->GetName() == "Track Panel" )
554  {
555  wxRect R = pWin->GetScreenRect();
556  ExploreTrackPanel( context, R.GetPosition()-P, pWin, Id, depth );
557  return;
558  }
559  wxWindowList list = pWin->GetChildren();
560  size_t lcnt = list.GetCount();
561 
562  for (size_t lndx = 0; lndx < lcnt; lndx++) {
563  wxWindow * item = list[lndx];
564  if( !item->IsShown() )
565  continue;
566  wxRect R = item->GetScreenRect();
567  R.SetPosition( R.GetPosition() - P );
568  wxString Name = item->GetName();
569  // Ignore staticLine and StaticBitmap.
570  if( Name.StartsWith( "static" ) )
571  continue;
572  // Ignore anonymous panels.
573  if( Name == "panel" )
574  continue;
575  if( Name.IsEmpty() )
576  Name = wxString("*") + item->GetToolTipText();
577 
578  context.StartStruct();
579  context.AddItem( depth, "depth" );
580  context.AddItem( Name, "label" );
581  context.AddItem( item->GetId(), "id" );
582  context.StartField( "box" );
583  context.StartArray();
584  context.AddItem( R.GetLeft() );
585  context.AddItem( R.GetTop() );
586  context.AddItem( R.GetRight() );
587  context.AddItem( R.GetBottom() );
588  context.EndArray();
589  context.EndField();
590  context.EndStruct();
591 
592  ExploreWindows( context, P, item, item->GetId(), depth+1 );
593  }
594 }
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
IdentInterfaceSymbol 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)
wxArrayString LocalizedStrings(const IdentInterfaceSymbol strings[], size_t nStrings)
Definition: Internat.cpp:303
static const IdentInterfaceSymbol kFormats[nFormats]
void EndMultiColumn()
kTypes
Definition: Noise.cpp:30
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
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 280 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().

281 {
282  TrackList *tracks = context.GetProject()->GetTracks();
283  int i=0;
284  context.StartArray();
285  for (auto waveTrack : tracks->Leaders<WaveTrack>()) {
286  WaveClipPointers ptrs( waveTrack->SortedClipArray());
287  for(WaveClip * pClip : ptrs ) {
288  context.StartStruct();
289  context.AddItem( (double)i, "track" );
290  context.AddItem( pClip->GetStartTime(), "start" );
291  context.AddItem( pClip->GetEndTime(), "end" );
292  context.AddItem( pClip->GetColourIndex(), "color" );
293  context.EndStruct();
294  }
295  i++;
296  }
297  context.EndArray();
298 
299  return true;
300 }
AudacityProject * GetProject() const
A list of TrackListNode items.
Definition: Track.h:1115
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1229
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:192
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 302 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().

303 {
304  TrackList *tracks = context.GetProject()->GetTracks();
305  int i=0;
306  int j=0;
307  context.StartArray();
308  for (auto waveTrack : tracks->Leaders<WaveTrack>()) {
309  WaveClipPointers ptrs( waveTrack->SortedClipArray());
310  for(WaveClip * pClip : ptrs ) {
311  context.StartStruct();
312  context.AddItem( (double)i, "track" );
313  context.AddItem( (double)j, "clip" );
314  context.AddItem( pClip->GetStartTime(), "start" );
315  Envelope * pEnv = pClip->GetEnvelope();
316  context.StartField( "points" );
317  context.StartArray();
318  double offset = pEnv->mOffset;
319  for( size_t k=0;k<pEnv->mEnv.size(); k++)
320  {
321  context.StartStruct( );
322  context.AddItem( pEnv->mEnv[k].GetT()+offset, "t" );
323  context.AddItem( pEnv->mEnv[k].GetVal(), "y" );
324  context.EndStruct();
325  }
326  context.EndArray();
327  context.EndField();
328  context.AddItem( pClip->GetEndTime(), "end" );
329  context.EndStruct();
330  j++;
331  }
332  }
333  context.EndArray();
334 
335  return true;
336 }
AudacityProject * GetProject() const
A list of TrackListNode items.
Definition: Track.h:1115
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1229
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:192
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 339 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().

340 {
341  TrackList *tracks = context.GetProject()->GetTracks();
342  int i=0;
343  context.StartArray();
344  for (auto t : tracks->Leaders()) {
345  t->TypeSwitch( [&](LabelTrack *labelTrack) {
346 #ifdef VERBOSE_LABELS_FORMATTING
347  for (int nn = 0; nn< (int)labelTrack->mLabels.size(); nn++) {
348  const auto &label = labelTrack->mLabels[nn];
349  context.StartStruct();
350  context.AddItem( (double)i, "track" );
351  context.AddItem( label.getT0(), "start" );
352  context.AddItem( label.getT1(), "end" );
353  context.AddItem( label.title, "text" );
354  context.EndStruct();
355  }
356 #else
357  context.StartArray();
358  context.AddItem( (double)i ); // Track number.
359  context.StartArray();
360  for (int nn = 0; nn< (int)labelTrack->mLabels.size(); nn++) {
361  const auto &label = labelTrack->mLabels[nn];
362  context.StartArray();
363  context.AddItem( label.getT0() ); // start
364  context.AddItem( label.getT1() ); // end
365  context.AddItem( label.title ); //text.
366  context.EndArray();
367  }
368  context.EndArray();
369  context.EndArray();
370 #endif
371  } );
372  // Per track numbering counts all tracks
373  i++;
374  }
375  context.EndArray();
376 
377 
378 
379  return true;
380 }
AudacityProject * GetProject() const
A list of TrackListNode items.
Definition: Track.h:1115
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1229
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:282
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
void StartStruct() const
void EndArray() const
TrackList * GetTracks()
Definition: Project.h:192
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::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 
255  TrackPanel *panel = context.GetProject()->GetTrackPanel();
256  Track * fTrack = panel->GetFocusedTrack();
257 
258  context.StartStruct();
259  context.AddItem( trk->GetName(), "name" );
260  context.AddBool( (trk == fTrack), "focused");
261  context.AddBool( trk->GetSelected(), "selected" );
262  //JKC: Possibly add these two later...
263  //context.AddItem( trk->GetKind(), "kind" );
264  //context.AddItem( trk->GetHeight(), "height" );
265  trk->TypeSwitch( [&] (const WaveTrack* t ) {
266  context.AddItem( t->GetStartTime(), "start" );
267  context.AddItem( t->GetEndTime(), "end" );
268  context.AddItem( t->GetPan() , "pan");
269  context.AddItem( t->GetGain() , "gain");
270  context.AddItem( TrackList::Channels(t).size(), "channels");
271  context.AddBool( t->GetSolo(), "solo" );
272  context.AddBool( t->GetMute(), "mute");
273  } );
274  context.EndStruct();
275  }
276  context.EndArray();
277  return true;
278 }
bool GetSolo() const
Definition: Track.h:765
AudacityProject * GetProject() const
A list of TrackListNode items.
Definition: Track.h:1115
float GetPan() const
Definition: WaveTrack.cpp:428
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1229
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:1888
double GetStartTime() const override
Get the time at which the first clip in the track starts.
Definition: WaveTrack.cpp:1868
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:237
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:190
void EndArray() const
Track * GetFocusedTrack()
TrackPanel * GetTrackPanel()
Definition: Project.h:309
bool GetMute() const
Definition: Track.h:764
float GetGain() const
Definition: WaveTrack.cpp:418
TrackList * GetTracks()
Definition: Project.h:192
void StartArray() const
void EndStruct() const
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1305
void AddBool(const bool value, const wxString &name="") const

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: