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

Command for changing the selection of tracks. More...

#include <SelectCommand.h>

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

Public Member Functions

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
 
bool Apply (const CommandContext &context) override
 
ManualPageID ManualPage () 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

bool bHasFirstTrack
 
bool bHasNumTracks
 
bool bHasMode
 
double mFirstTrack
 
double mNumTracks
 
int mMode
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Select Tracks") }
 

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 for changing the selection of tracks.

Definition at line 80 of file SelectCommand.h.

Member Function Documentation

◆ Apply()

bool SelectTracksCommand::Apply ( const CommandContext context)
override

Definition at line 254 of file SelectCommand.cpp.

255{
256
257 // Count selection as a do-nothing effect.
258 // Used to invalidate cached selection and tracks.
260 int index = 0;
261 auto &tracks = TrackList::Get( context.project );
262
263 // Defaults if no value...
264 if( !bHasNumTracks )
265 mNumTracks = 1.0;
266 if( !bHasFirstTrack )
267 mFirstTrack = 0.0;
268
269 // Multiple channels count as fractions of a track.
270 double last = mFirstTrack + mNumTracks;
271 double first = mFirstTrack;
272
273 for (auto t : tracks) {
274 const bool sel = first <= index && index < last;
275 if (mMode == 0) // Set
276 t->SetSelected(sel);
277 else if(mMode == 1 && sel) // Add
278 t->SetSelected(sel);
279 else if(mMode == 2 && sel) // Remove
280 t->SetSelected(!sel);
281 ++index;
282 }
283 return true;
284}
const auto tracks
AudacityProject & project
static void IncEffectCounter()
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314

References bHasFirstTrack, bHasNumTracks, TrackList::Get(), EffectOutputTracks::IncEffectCounter(), mFirstTrack, mMode, mNumTracks, CommandContext::project, and tracks.

Referenced by SelectCommand::Apply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDescription()

TranslatableString SelectTracksCommand::GetDescription ( ) const
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 87 of file SelectCommand.h.

87{return XO("Selects a range of tracks.");};
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol SelectTracksCommand::GetSymbol ( ) const
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 86 of file SelectCommand.h.

86{return Symbol;};
static const ComponentInterfaceSymbol Symbol
Definition: SelectCommand.h:83

References Symbol.

◆ ManualPage()

ManualPageID SelectTracksCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 94 of file SelectCommand.h.

94{return L"Extra_Menu:_Scriptables_I#select_tracks";}

◆ PopulateOrExchange()

void SelectTracksCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 235 of file SelectCommand.cpp.

236{
237 S.AddSpace(0, 5);
238
239 S.StartMultiColumn(3, wxEXPAND);
240 {
241 S.SetStretchyCol( 2 );
242 S.Optional( bHasFirstTrack).TieTextBox(XXO("First Track:"),mFirstTrack);
243 S.Optional( bHasNumTracks).TieTextBox(XXO("Track Count:"),mNumTracks);
244 }
245 S.EndMultiColumn();
246 S.StartMultiColumn(2, wxALIGN_CENTER);
247 {
248 // Always used, so no check box.
249 S.TieChoice( XXO("Mode:"), mMode, Msgids( kModes, nModes ));
250 }
251 S.EndMultiColumn();
252}
XXO("&Cut/Copy/Paste Toolbar")
static const EnumValueSymbol kModes[nModes]
const int nModes
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
#define S(N)
Definition: ToChars.cpp:64

References bHasFirstTrack, bHasNumTracks, kModes, mFirstTrack, mMode, mNumTracks, Msgids(), nModes, S, and XXO().

Referenced by SelectCommand::PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VisitSettings() [1/3]

bool SelectTracksCommand::VisitSettings ( ConstSettingsVisitor )
overridevirtual

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

Reimplemented from AudacityCommand.

Definition at line 232 of file SelectCommand.cpp.

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

References S.

◆ VisitSettings() [2/3]

bool SelectTracksCommand::VisitSettings ( SettingsVisitor )
overridevirtual

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

Reimplemented from AudacityCommand.

Definition at line 229 of file SelectCommand.cpp.

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

References S.

◆ VisitSettings() [3/3]

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

Definition at line 221 of file SelectCommand.cpp.

221 {
222 S.OptionalN( bHasFirstTrack).Define( mFirstTrack, wxT("Track"), 0.0, 0.0, 100.0);
223 S.OptionalN( bHasNumTracks ).Define( mNumTracks, wxT("TrackCount"), 1.0, 0.0, 100.0);
224 S.OptionalY( bHasMode ).DefineEnum( mMode, wxT("Mode"), 0, kModes, nModes );
225
226 return true;
227}
wxT("CloseDown"))

References bHasFirstTrack, bHasMode, bHasNumTracks, kModes, mFirstTrack, mMode, mNumTracks, nModes, S, and wxT().

Referenced by SelectCommand::VisitSettings().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ bHasFirstTrack

bool SelectTracksCommand::bHasFirstTrack

Definition at line 96 of file SelectCommand.h.

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

◆ bHasMode

bool SelectTracksCommand::bHasMode

Definition at line 98 of file SelectCommand.h.

Referenced by VisitSettings().

◆ bHasNumTracks

bool SelectTracksCommand::bHasNumTracks

Definition at line 97 of file SelectCommand.h.

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

◆ mFirstTrack

double SelectTracksCommand::mFirstTrack

Definition at line 100 of file SelectCommand.h.

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

◆ mMode

int SelectTracksCommand::mMode

Definition at line 102 of file SelectCommand.h.

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

◆ mNumTracks

double SelectTracksCommand::mNumTracks

Definition at line 101 of file SelectCommand.h.

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

◆ Symbol

const ComponentInterfaceSymbol SelectTracksCommand::Symbol { XO("Select Tracks") }
static

Definition at line 83 of file SelectCommand.h.

Referenced by GetSymbol().


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