Audacity  3.0.3
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 () override
 
TranslatableString GetDescription () override
 
bool DefineParams (ShuttleParams &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
ManualPageID ManualPage () override
 
bool ApplyInner (const CommandContext &context, Track *t) override
 
- Public Member Functions inherited from SetTrackBase
 SetTrackBase ()
 
bool Apply (const CommandContext &context) override
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
PluginPath GetPath () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
virtual void SetHostUI (EffectUIHostInterface *WXUNUSED(host))
 
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 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 ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 

Public Attributes

double mContainsTime
 
int mColour
 
double mT0
 
wxString mName
 
bool bHasContainsTime
 
bool bHasColour
 
bool bHasT0
 
bool bHasName
 
- Public Attributes inherited from SetTrackBase
int mTrackIndex
 
int mChannelIndex
 
bool bHasTrackIndex
 
bool bHasChannelIndex
 
bool bIsSecondChannel
 
bool mbPromptForTracks
 

Static Public Attributes

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

Additional Inherited Members

- Public Types inherited from AudacityCommand
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
using VetoDialogHook = bool(*)(wxDialog *)
 
- Static Public Member Functions inherited from AudacityCommand
static VetoDialogHook SetVetoDialogHook (VetoDialogHook hook)
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 

Detailed Description

Command that sets clip information.

Definition at line 21 of file SetClipCommand.h.

Constructor & Destructor Documentation

◆ SetClipCommand()

SetClipCommand::SetClipCommand ( )

Definition at line 33 of file SetClipCommand.cpp.

34 {
35 }

Member Function Documentation

◆ ApplyInner()

bool SetClipCommand::ApplyInner ( const CommandContext context,
Track t 
)
overridevirtual

Reimplemented from SetTrackBase.

Definition at line 79 of file SetClipCommand.cpp.

80 {
81  // if no 'At' is specified, then any clip in any selected track will be set.
82  t->TypeSwitch([&](WaveTrack *waveTrack) {
83  WaveClipPointers ptrs( waveTrack->SortedClipArray());
84  for(auto it = ptrs.begin(); (it != ptrs.end()); it++ ){
85  WaveClip * pClip = *it;
86  bool bFound =
87  !bHasContainsTime || (
88  ( pClip->GetStartTime() <= mContainsTime ) &&
89  ( pClip->GetEndTime() >= mContainsTime )
90  );
91  if( bFound )
92  {
93  // Inside this IF is where we actually apply the command
94 
95  if( bHasColour )
96  pClip->SetColourIndex(mColour);
97  // No validation of overlap yet. We assume the user is sensible!
98  if( bHasT0 )
99  pClip->SetOffset(mT0);
100  // \todo Use SetClip to move a clip between tracks too.
101  if( bHasName )
102  pClip->SetName(mName);
103 
104  }
105  }
106  } );
107  return true;
108 }

References bHasColour, bHasContainsTime, bHasName, bHasT0, WaveClip::GetEndTime(), WaveClip::GetStartTime(), mColour, mContainsTime, mName, mT0, WaveClip::SetColourIndex(), WaveClip::SetName(), WaveClip::SetOffset(), WaveTrack::SortedClipArray(), and Track::TypeSwitch().

Here is the call graph for this function:

◆ DefineParams()

bool SetClipCommand::DefineParams ( ShuttleParams S)
overridevirtual

Reimplemented from SetTrackBase.

Definition at line 55 of file SetClipCommand.cpp.

55  {
56  S.OptionalY( bHasContainsTime ).Define( mContainsTime, wxT("At"), 0.0, 0.0, 100000.0 );
58  // Allowing a negative start time is not a mistake.
59  // It will be used in demonstrating time before zero.
60  S.OptionalN( bHasT0 ).Define( mT0, wxT("Start"), 0.0, -5.0, 1000000.0);
61  return true;
62 };

References bHasColour, bHasContainsTime, bHasT0, ShuttleParams::Define(), ShuttleParams::DefineEnum(), kColour0, kColourStrings, mColour, mContainsTime, mT0, nColours, ShuttleParams::OptionalN(), and ShuttleParams::OptionalY().

Here is the call graph for this function:

◆ GetDescription()

TranslatableString SetClipCommand::GetDescription ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 29 of file SetClipCommand.h.

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

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol SetClipCommand::GetSymbol ( )
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 28 of file SetClipCommand.h.

28 {return Symbol;};

References Symbol.

◆ ManualPage()

ManualPageID SetClipCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 34 of file SetClipCommand.h.

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

◆ PopulateOrExchange()

void SetClipCommand::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from SetTrackBase.

Definition at line 64 of file SetClipCommand.cpp.

65 {
66  S.AddSpace(0, 5);
67 
68  S.StartMultiColumn(3, wxALIGN_CENTER);
69  {
71  S.Optional( bHasColour ).TieChoice( XXO("Color:"), mColour,
73  S.Optional( bHasT0 ).TieNumericTextBox( XXO("Start:"), mT0 );
74  S.Optional( bHasName ).TieTextBox( XXO("Name:"), mName );
75  }
76  S.EndMultiColumn();
77 }

References ShuttleGui::AddSpace(), bHasColour, bHasContainsTime, bHasName, bHasT0, ShuttleGuiBase::EndMultiColumn(), kColourStrings, mColour, mContainsTime, mName, Msgids(), mT0, nColours, ShuttleGui::Optional(), ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::TieChoice(), ShuttleGuiBase::TieNumericTextBox(), ShuttleGuiBase::TieTextBox(), and XXO.

Here is the call graph for this function:

Member Data Documentation

◆ bHasColour

bool SetClipCommand::bHasColour

Definition at line 45 of file SetClipCommand.h.

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

◆ bHasContainsTime

bool SetClipCommand::bHasContainsTime

Definition at line 44 of file SetClipCommand.h.

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

◆ bHasName

bool SetClipCommand::bHasName

Definition at line 47 of file SetClipCommand.h.

Referenced by ApplyInner(), and PopulateOrExchange().

◆ bHasT0

bool SetClipCommand::bHasT0

Definition at line 46 of file SetClipCommand.h.

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

◆ mColour

int SetClipCommand::mColour

Definition at line 39 of file SetClipCommand.h.

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

◆ mContainsTime

double SetClipCommand::mContainsTime

Definition at line 38 of file SetClipCommand.h.

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

◆ mName

wxString SetClipCommand::mName

Definition at line 41 of file SetClipCommand.h.

Referenced by ApplyInner(), and PopulateOrExchange().

◆ mT0

double SetClipCommand::mT0

Definition at line 40 of file SetClipCommand.h.

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

◆ 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:
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
kColour0
@ kColour0
Definition: SetClipCommand.cpp:39
WaveClip::SetOffset
void SetOffset(double offset)
Definition: WaveClip.cpp:216
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2459
WaveClip::GetEndTime
double GetEndTime() const
Definition: WaveClip.cpp:255
XO
#define XO(s)
Definition: Internat.h:31
SetClipCommand::mT0
double mT0
Definition: SetClipCommand.h:40
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1238
WaveClipPointers
std::vector< WaveClip * > WaveClipPointers
Definition: WaveTrack.h:41
ShuttleParams::OptionalN
virtual ShuttleParams & OptionalN(bool &var)
Definition: Shuttle.h:72
ShuttleGuiBase::TieTextBox
wxTextCtrl * TieTextBox(const TranslatableString &Caption, wxString &Value, const int nChars=0)
Definition: ShuttleGui.cpp:1652
WaveTrack::SortedClipArray
WaveClipPointers SortedClipArray()
Definition: WaveTrack.cpp:2606
WaveClip::GetStartTime
double GetStartTime() const
Definition: WaveClip.cpp:249
SetClipCommand::mName
wxString mName
Definition: SetClipCommand.h:41
WaveClip
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:173
XXO
#define XXO(s)
Definition: Internat.h:44
SetClipCommand::mColour
int mColour
Definition: SetClipCommand.h:39
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1229
SetClipCommand::bHasName
bool bHasName
Definition: SetClipCommand.h:47
ShuttleParams::DefineEnum
virtual void DefineEnum(int &var, const wxChar *key, const int vdefault, const EnumValueSymbol strings[], size_t nStrings)
Definition: Shuttle.cpp:339
WaveClip::SetName
void SetName(const wxString &name)
Definition: WaveClip.cpp:1783
ShuttleParams::OptionalY
virtual ShuttleParams & OptionalY(bool &var)
Definition: Shuttle.h:71
WaveClip::SetColourIndex
void SetColourIndex(int index)
Definition: WaveClip.h:217
ShuttleGuiBase::TieNumericTextBox
wxTextCtrl * TieNumericTextBox(const TranslatableString &Prompt, int &Value, const int nChars=0)
Definition: ShuttleGui.cpp:1673
Msgids
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
Definition: ShuttleGui.cpp:2522
SetClipCommand::bHasContainsTime
bool bHasContainsTime
Definition: SetClipCommand.h:44
SetClipCommand::mContainsTime
double mContainsTime
Definition: SetClipCommand.h:38
Track::TypeSwitch
R TypeSwitch(const Functions &...functions)
Use this function rather than testing track type explicitly and making down-casts.
Definition: Track.h:709
SetClipCommand::bHasT0
bool bHasT0
Definition: SetClipCommand.h:46
nColours
@ nColours
Definition: SetClipCommand.cpp:43
SetClipCommand::bHasColour
bool bHasColour
Definition: SetClipCommand.h:45
SetClipCommand::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: SetClipCommand.h:24
ShuttleParams::Define
virtual void Define(bool &var, const wxChar *key, const bool vdefault, const bool vmin=false, const bool vmax=false, const bool vscl=false)
Definition: Shuttle.cpp:332
ShuttleGui::Optional
ShuttleGui & Optional(bool &bVar)
Definition: ShuttleGui.cpp:2280
kColourStrings
static const EnumValueSymbol kColourStrings[nColours]
Definition: SetClipCommand.cpp:46
ShuttleGuiBase::TieChoice
wxChoice * TieChoice(const TranslatableString &Prompt, TranslatableString &Selected, const TranslatableStrings &choices)
Definition: ShuttleGui.cpp:1727