Audacity 3.2.0
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
SetClipCommand Class Reference

Command that sets clip information. More...

#include <SetClipCommand.h>

Inheritance diagram for SetClipCommand:
[legend]
Collaboration diagram for SetClipCommand:
[legend]

Public Member Functions

 SetClipCommand ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
template<bool Const>
bool VisitSettings (SettingsVisitorBase< Const > &S)
 
bool VisitSettings (SettingsVisitor &S) override
 
bool VisitSettings (ConstSettingsVisitor &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
ManualPageID ManualPage () override
 
bool Apply (const CommandContext &context) override
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
PluginPath GetPath () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
ComponentInterfaceSymbol GetSymbol () const override=0
 
virtual TranslatableString GetDescription () const override
 
virtual ManualPageID ManualPage ()
 
virtual bool IsBatchProcessing () const
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
bool SaveSettingsAsString (wxString &parms)
 
bool LoadSettingsFromString (const wxString &parms)
 
bool DoAudacityCommand (wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
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 ()
 
virtual bool VisitSettings (SettingsVisitor &)
 
virtual bool VisitSettings (ConstSettingsVisitor &)
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Public Attributes

double mContainsTime
 
int mColour
 
double mT0
 
wxString mName
 
bool bHasContainsTime
 
bool bHasColour
 
bool bHasT0
 
bool bHasName
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Set Clip") }
 

Additional Inherited Members

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

Detailed Description

Command that sets clip information.

Definition at line 21 of file SetClipCommand.h.

Constructor & Destructor Documentation

◆ SetClipCommand()

SetClipCommand::SetClipCommand ( )

Definition at line 36 of file SetClipCommand.cpp.

37{
38}

Member Function Documentation

◆ Apply()

bool SetClipCommand::Apply ( const CommandContext context)
override

Definition at line 88 of file SetClipCommand.cpp.

89{
90 for(const auto track : TrackList::Get(context.project))
91 {
92 if(!track->GetSelected())
93 continue;
94
95 // if no 'At' is specified, then any clip in any selected track will be set.
96 track->TypeSwitch([&](WaveTrack &waveTrack) {
97 for(const auto& interval : waveTrack.Intervals())
98 {
99 if(!bHasContainsTime ||
100 (interval->Start() <= mContainsTime &&
101 interval->End() >= mContainsTime ))
102 {
103 // Inside this IF is where we actually apply the command
104 if( bHasColour )
105 interval->SetColorIndex(mColour);
106 // No validation of overlap yet. We assume the user is sensible!
107 if( bHasT0 )
108 interval->SetPlayStartTime(mT0);
109 // \todo Use SetClip to move a clip between tracks too.
110 if( bHasName )
111 interval->SetName(mName);
112 }
113 }
114 } );
115 }
116 return true;
117}
AudacityProject & project
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:347
A Track that contains audio waveform data.
Definition: WaveTrack.h:227
auto Intervals()
Definition: WaveTrack.h:1041

References TrackList::Get(), WaveTrack::Intervals(), and CommandContext::project.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString SetClipCommand::GetDescription ( ) const
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 29 of file SetClipCommand.h.

29{return XO("Sets various values for a clip.");};
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol SetClipCommand::GetSymbol ( ) const
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 28 of file SetClipCommand.h.

28{return Symbol;};
static const ComponentInterfaceSymbol Symbol

References Symbol.

◆ ManualPage()

ManualPageID SetClipCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 36 of file SetClipCommand.h.

36{return L"Extra_Menu:_Scriptables_I#set_clip";}

◆ PopulateOrExchange()

void SetClipCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 73 of file SetClipCommand.cpp.

74{
75 S.AddSpace(0, 5);
76
77 S.StartMultiColumn(3, wxALIGN_CENTER);
78 {
79 S.Optional( bHasContainsTime).TieNumericTextBox( XXO("At:"), mContainsTime );
80 S.Optional( bHasColour ).TieChoice( XXO("Color:"), mColour,
82 S.Optional( bHasT0 ).TieNumericTextBox( XXO("Start:"), mT0 );
83 S.Optional( bHasName ).TieTextBox( XXO("Name:"), mName );
84 }
85 S.EndMultiColumn();
86}
XXO("&Cut/Copy/Paste Toolbar")
@ nColours
static const EnumValueSymbol kColourStrings[nColours]
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
#define S(N)
Definition: ToChars.cpp:64
double mContainsTime

References bHasColour, bHasContainsTime, bHasName, bHasT0, kColourStrings, mColour, mContainsTime, mName, Msgids(), mT0, nColours, S, and XXO().

Here is the call graph for this function:

◆ VisitSettings() [1/3]

bool SetClipCommand::VisitSettings ( ConstSettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 70 of file SetClipCommand.cpp.

71 { return VisitSettings<true>(S); }

References S.

◆ VisitSettings() [2/3]

bool SetClipCommand::VisitSettings ( SettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 67 of file SetClipCommand.cpp.

68 { return VisitSettings<false>(S); }

References S.

◆ VisitSettings() [3/3]

template<bool Const>
bool SetClipCommand::VisitSettings ( SettingsVisitorBase< Const > &  S)

Definition at line 59 of file SetClipCommand.cpp.

59 {
60 S.OptionalY( bHasContainsTime ).Define( mContainsTime, wxT("At"), 0.0, 0.0, 100000.0 );
61 S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, kColourStrings, nColours );
62 // Allowing a negative start time is not a mistake.
63 // It will be used in demonstrating time before zero.
64 S.OptionalN( bHasT0 ).Define( mT0, wxT("Start"), 0.0, -5.0, 1000000.0);
65 return true;
66};
wxT("CloseDown"))
@ kColour0

References bHasColour, bHasContainsTime, bHasT0, kColour0, kColourStrings, mColour, mContainsTime, mT0, nColours, S, and wxT().

Here is the call graph for this function:

Member Data Documentation

◆ bHasColour

bool SetClipCommand::bHasColour

Definition at line 47 of file SetClipCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ bHasContainsTime

bool SetClipCommand::bHasContainsTime

Definition at line 46 of file SetClipCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ bHasName

bool SetClipCommand::bHasName

Definition at line 49 of file SetClipCommand.h.

Referenced by PopulateOrExchange().

◆ bHasT0

bool SetClipCommand::bHasT0

Definition at line 48 of file SetClipCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ mColour

int SetClipCommand::mColour

Definition at line 41 of file SetClipCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ mContainsTime

double SetClipCommand::mContainsTime

Definition at line 40 of file SetClipCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ mName

wxString SetClipCommand::mName

Definition at line 43 of file SetClipCommand.h.

Referenced by PopulateOrExchange().

◆ mT0

double SetClipCommand::mT0

Definition at line 42 of file SetClipCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ Symbol

const ComponentInterfaceSymbol SetClipCommand::Symbol { XO("Set Clip") }
static

Definition at line 24 of file SetClipCommand.h.

Referenced by GetSymbol().


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