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 (const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
virtual bool Init ()
 
virtual bool PromptUser (AudacityProject &)
 
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 37 of file SetClipCommand.cpp.

38{
39}

Member Function Documentation

◆ Apply()

bool SetClipCommand::Apply ( const CommandContext context)
override

Definition at line 89 of file SetClipCommand.cpp.

90{
91 for(const auto track : TrackList::Get(context.project))
92 {
93 if(!track->GetSelected())
94 continue;
95
96 // if no 'At' is specified, then any clip in any selected track will be set.
97 track->TypeSwitch([&](WaveTrack &waveTrack) {
98 for (const auto &interval : waveTrack.Intervals()) {
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 for (const auto channel : interval->Channels())
106 WaveColorAttachment::Get(*channel).SetColorIndex(mColour);
107 }
108 // No validation of overlap yet. We assume the user is sensible!
109 if( bHasT0 )
110 interval->SetPlayStartTime(mT0);
111 // \todo Use SetClip to move a clip between tracks too.
112 if( bHasName )
113 interval->SetName(mName);
114 }
115 }
116 } );
117 }
118 return true;
119}
AudacityProject & project
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
auto Intervals()
Definition: WaveTrack.h:671

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 74 of file SetClipCommand.cpp.

75{
76 S.AddSpace(0, 5);
77
78 S.StartMultiColumn(3, wxALIGN_CENTER);
79 {
80 S.Optional( bHasContainsTime).TieNumericTextBox( XXO("At:"), mContainsTime );
81 S.Optional( bHasColour ).TieChoice( XXO("Color:"), mColour,
83 S.Optional( bHasT0 ).TieNumericTextBox( XXO("Start:"), mT0 );
84 S.Optional( bHasName ).TieTextBox( XXO("Name:"), mName );
85 }
86 S.EndMultiColumn();
87}
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 71 of file SetClipCommand.cpp.

72 { 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 68 of file SetClipCommand.cpp.

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

References S.

◆ VisitSettings() [3/3]

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

Definition at line 60 of file SetClipCommand.cpp.

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