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

A SetTrackBase that sets appearance of a track. More...

#include <SetTrackInfoCommand.h>

Inheritance diagram for SetTrackVisualsCommand:
[legend]
Collaboration diagram for SetTrackVisualsCommand:
[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
 
ManualPageID ManualPage () override
 
bool ApplyInner (const CommandContext &context, Track *t) override
 
- Public Member Functions inherited from SetTrackBase
 SetTrackBase ()
 
bool Apply (const CommandContext &context) override
 
virtual bool ApplyInner (const CommandContext &context, Track *t)
 
template<bool Const>
bool VisitSettings (SettingsVisitorBase< Const > &S)
 
bool VisitSettings (SettingsVisitor &S) override
 
bool VisitSettings (ConstSettingsVisitor &S) override
 
virtual void PopulateOrExchange (ShuttleGui &S) 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

int mColour
 
int mHeight
 
int mDisplayType
 
int mScaleType
 
int mVZoom
 
double mVZoomTop
 
double mVZoomBottom
 
bool bUseSpecPrefs
 
bool bSpectralSelect
 
int mSpecColorScheme
 
bool bHasColour
 
bool bHasHeight
 
bool bHasDisplayType
 
bool bHasScaleType
 
bool bHasVZoom
 
bool bHasVZoomTop
 
bool bHasVZoomBottom
 
bool bHasUseSpecPrefs
 
bool bHasSpectralSelect
 
bool bHasSpecColorScheme
 
- 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 Track Visuals") }
 

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

A SetTrackBase that sets appearance of a track.

Definition at line 106 of file SetTrackInfoCommand.h.

Member Function Documentation

◆ ApplyInner()

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

Reimplemented from SetTrackBase.

Definition at line 400 of file SetTrackInfoCommand.cpp.

401{
402 static_cast<void>(context);
403 auto wt = dynamic_cast<WaveTrack *>(t);
404 //auto pt = dynamic_cast<PlayableTrack *>(t);
405 static const double ZOOMLIMIT = 0.001f;
406
407 // You can get some intriguing effects by setting R and L channels to
408 // different values.
409 if( wt && bHasColour )
411
412 if( t && bHasHeight )
414
415 if( wt && bHasDisplayType ) {
416 auto &view = WaveTrackView::Get( *wt );
417 auto &all = WaveTrackSubViewType::All();
418 if (mDisplayType < all.size())
419 view.SetDisplay( all[ mDisplayType ].id );
420 else {
421 view.SetMultiView( true );
422 view.SetDisplay( WaveTrackSubViewType::Default(), false );
423 }
424 }
425 if( wt && bHasScaleType )
426 wt->GetWaveformSettings().scaleType =
427 (mScaleType==kLinear) ?
430
431 if( wt && bHasVZoom ){
432 switch( mVZoom ){
433 default:
434 case kReset: wt->SetDisplayBounds(-1,1); break;
435 case kTimes2: wt->SetDisplayBounds(-2,2); break;
436 case kHalfWave: wt->SetDisplayBounds(0,1); break;
437 }
438 }
439
440 if ( wt && (bHasVZoomTop || bHasVZoomBottom) && !bHasVZoom){
441 float vzmin, vzmax;
442 wt->GetDisplayBounds(&vzmin, &vzmax);
443
444 if ( !bHasVZoomTop ){
445 mVZoomTop = vzmax;
446 }
447 if ( !bHasVZoomBottom ){
448 mVZoomBottom = vzmin;
449 }
450
451 // Can't use std::clamp until C++17
452 mVZoomTop = std::max(-2.0, std::min(mVZoomTop, 2.0));
453 mVZoomBottom = std::max(-2.0, std::min(mVZoomBottom, 2.0));
454
455 if (mVZoomBottom > mVZoomTop){
457 }
458 if ( mVZoomTop - mVZoomBottom < ZOOMLIMIT ){
459 double c = (mVZoomBottom + mVZoomTop) / 2;
460 mVZoomBottom = c - ZOOMLIMIT / 2.0;
461 mVZoomTop = c + ZOOMLIMIT / 2.0;
462 }
463 wt->SetDisplayBounds(mVZoomBottom, mVZoomTop);
464 auto &tp = TrackPanel::Get( context.project );
465 tp.UpdateVRulers();
466 }
467
468 if( wt && bHasUseSpecPrefs ){
469 wt->UseSpectralPrefs( bUseSpecPrefs );
470 }
471 if( wt && bHasSpectralSelect ){
472 wt->GetSpectrogramSettings().spectralSelection = bSpectralSelect;
473 }
474 if (wt && bHasSpecColorScheme) {
475 wt->GetSpectrogramSettings().colorScheme = (SpectrogramSettings::ColorScheme)mSpecColorScheme;
476 }
477
478 return true;
479}
int min(int a, int b)
AudacityProject & project
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:230
void SetExpandedHeight(int height)
Definition: TrackView.cpp:172
static TrackView & Get(Track &)
Definition: TrackView.cpp:69
A Track that contains audio waveform data.
Definition: WaveTrack.h:57
void SetWaveColorIndex(int colorIndex)
Definition: WaveTrack.cpp:568
static WaveTrackView & Get(WaveTrack &track)
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:753
static const std::vector< WaveTrackSubViewType > & All()
Discover all registered types.
static Display Default()
Return a preferred type.

References WaveTrackSubViewType::All(), bHasColour, bHasDisplayType, bHasHeight, bHasScaleType, bHasSpecColorScheme, bHasSpectralSelect, bHasUseSpecPrefs, bHasVZoom, bHasVZoomBottom, bHasVZoomTop, bSpectralSelect, bUseSpecPrefs, WaveTrackSubViewType::Default(), TrackPanel::Get(), TrackView::Get(), WaveTrackView::Get(), kHalfWave, kLinear, kReset, kTimes2, mColour, mDisplayType, mHeight, min(), mScaleType, mSpecColorScheme, mVZoom, mVZoomBottom, mVZoomTop, CommandContext::project, TrackView::SetExpandedHeight(), WaveTrack::SetWaveColorIndex(), WaveformSettings::stLinear, WaveformSettings::stLogarithmic, and anonymous_namespace{NoteTrack.cpp}::swap().

Referenced by SetTrackCommand::ApplyInner().

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

◆ GetDescription()

TranslatableString SetTrackVisualsCommand::GetDescription ( ) const
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 114 of file SetTrackInfoCommand.h.

114{return XO("Sets various values for a track.");};
#define XO(s)
Definition: Internat.h:31

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol SetTrackVisualsCommand::GetSymbol ( ) const
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 113 of file SetTrackInfoCommand.h.

113{return Symbol;};
static const ComponentInterfaceSymbol Symbol

References Symbol.

◆ ManualPage()

ManualPageID SetTrackVisualsCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 121 of file SetTrackInfoCommand.h.

121{return L"Extra_Menu:_Scriptables_I#set_track_visuals";}

◆ PopulateOrExchange()

void SetTrackVisualsCommand::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from SetTrackBase.

Definition at line 357 of file SetTrackInfoCommand.cpp.

358{
360 S.StartMultiColumn(3, wxEXPAND);
361 {
362 S.SetStretchyCol( 2 );
363 S.Optional( bHasHeight ).TieNumericTextBox( XXO("Height:"), mHeight );
364 S.Optional( bHasColour ).TieChoice( XXO("Color:"), mColour,
366
367 {
368 auto symbols = DiscoverSubViewTypes();
369 auto typeNames = transform_container<TranslatableStrings>(
370 symbols, std::mem_fn( &EnumValueSymbol::Stripped ) );
371 S.Optional( bHasDisplayType ).TieChoice( XXO("Display:"), mDisplayType,
372 typeNames );
373 }
374
375 S.Optional( bHasScaleType ).TieChoice( XXO("Scale:"), mScaleType,
377 S.Optional( bHasVZoom ).TieChoice( XXO("VZoom:"), mVZoom,
379 S.Optional( bHasVZoomTop ).TieTextBox( XXO("VZoom Top:"), mVZoomTop );
380 S.Optional( bHasVZoomBottom ).TieTextBox( XXO("VZoom Bottom:"), mVZoomBottom );
381 }
382 S.EndMultiColumn();
383 S.StartMultiColumn(2, wxEXPAND);
384 {
385 S.SetStretchyCol( 1 );
386 S.Optional( bHasUseSpecPrefs ).TieCheckBox( XXO("Use Spectral Prefs"), bUseSpecPrefs );
387 S.Optional( bHasSpectralSelect ).TieCheckBox( XXO("Spectral Select"), bSpectralSelect);
388 }
389 S.EndMultiColumn();
390 S.StartMultiColumn(3, wxEXPAND);
391 {
392 S.SetStretchyCol( 2 );
394 S.Optional( bHasSpecColorScheme).TieChoice( XC("Sche&me", "spectrum prefs"), mSpecColorScheme,
395 Msgids( schemes.data(), schemes.size() ) );
396 }
397 S.EndMultiColumn();
398}
#define XXO(s)
Definition: Internat.h:44
#define XC(s, c)
Definition: Internat.h:37
static const EnumValueSymbol kScaleTypeStrings[nScaleTypes]
static const EnumValueSymbol kZoomTypeStrings[nZoomTypes]
static EnumValueSymbols DiscoverSubViewTypes()
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
const TranslatableString Stripped() const
virtual void PopulateOrExchange(ShuttleGui &S) override
static const EnumValueSymbols & GetColorSchemeNames()

References bHasColour, bHasDisplayType, bHasHeight, bHasScaleType, bHasSpecColorScheme, bHasSpectralSelect, bHasUseSpecPrefs, bHasVZoom, bHasVZoomBottom, bHasVZoomTop, bSpectralSelect, bUseSpecPrefs, DiscoverSubViewTypes(), SpectrogramSettings::GetColorSchemeNames(), kColourStrings, kScaleTypeStrings, kZoomTypeStrings, mColour, mDisplayType, mHeight, mScaleType, Msgids(), mSpecColorScheme, mVZoom, mVZoomBottom, mVZoomTop, nColours, nScaleTypes, nZoomTypes, SetTrackBase::PopulateOrExchange(), S, ComponentInterfaceSymbol::Stripped(), XC, and XXO.

Referenced by SetTrackCommand::PopulateOrExchange().

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

◆ VisitSettings() [1/3]

bool SetTrackVisualsCommand::VisitSettings ( ConstSettingsVisitor )
overridevirtual

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

Reimplemented from SetTrackBase.

Definition at line 354 of file SetTrackInfoCommand.cpp.

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

References S.

◆ VisitSettings() [2/3]

bool SetTrackVisualsCommand::VisitSettings ( SettingsVisitor )
overridevirtual

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

Reimplemented from SetTrackBase.

Definition at line 351 of file SetTrackInfoCommand.cpp.

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

References S.

◆ VisitSettings() [3/3]

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

Definition at line 327 of file SetTrackInfoCommand.cpp.

327 {
329 S.OptionalN( bHasHeight ).Define( mHeight, wxT("Height"), 120, 44, 2000 );
330
331 {
332 auto symbols = DiscoverSubViewTypes();
333 S.OptionalN( bHasDisplayType ).DefineEnum( mDisplayType, wxT("Display"), 0, symbols.data(), symbols.size() );
334 }
335
336 S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, kScaleTypeStrings, nScaleTypes );
337 S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, kColourStrings, nColours );
338 S.OptionalN( bHasVZoom ).DefineEnum( mVZoom, wxT("VZoom"), kReset, kZoomTypeStrings, nZoomTypes );
339 S.OptionalN( bHasVZoomTop ).Define( mVZoomTop, wxT("VZoomHigh"), 1.0, -2.0, 2.0 );
340 S.OptionalN( bHasVZoomBottom ).Define( mVZoomBottom, wxT("VZoomLow"), -1.0, -2.0, 2.0 );
341
342 S.OptionalN( bHasUseSpecPrefs ).Define( bUseSpecPrefs, wxT("SpecPrefs"), false );
343 S.OptionalN( bHasSpectralSelect ).Define( bSpectralSelect, wxT("SpectralSel"),true );
344
346 S.OptionalN( bHasSpecColorScheme).DefineEnum( mSpecColorScheme,wxT("SpecColor"), SpectrogramSettings::csColorNew, schemes.data(), schemes.size());
347
348 return true;
349};
bool VisitSettings(SettingsVisitorBase< Const > &S)

References bHasColour, bHasDisplayType, bHasHeight, bHasScaleType, bHasSpecColorScheme, bHasSpectralSelect, bHasUseSpecPrefs, bHasVZoom, bHasVZoomBottom, bHasVZoomTop, bSpectralSelect, bUseSpecPrefs, SpectrogramSettings::csColorNew, DiscoverSubViewTypes(), SpectrogramSettings::GetColorSchemeNames(), kColour0, kColourStrings, kLinear, kReset, kScaleTypeStrings, kZoomTypeStrings, mColour, mDisplayType, mHeight, mScaleType, mSpecColorScheme, mVZoom, mVZoomBottom, mVZoomTop, nColours, nScaleTypes, nZoomTypes, S, and SetTrackBase::VisitSettings().

Referenced by SetTrackCommand::VisitSettings().

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

Member Data Documentation

◆ bHasColour

bool SetTrackVisualsCommand::bHasColour

Definition at line 138 of file SetTrackInfoCommand.h.

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

◆ bHasDisplayType

bool SetTrackVisualsCommand::bHasDisplayType

Definition at line 140 of file SetTrackInfoCommand.h.

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

◆ bHasHeight

bool SetTrackVisualsCommand::bHasHeight

Definition at line 139 of file SetTrackInfoCommand.h.

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

◆ bHasScaleType

bool SetTrackVisualsCommand::bHasScaleType

Definition at line 141 of file SetTrackInfoCommand.h.

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

◆ bHasSpecColorScheme

bool SetTrackVisualsCommand::bHasSpecColorScheme

Definition at line 148 of file SetTrackInfoCommand.h.

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

◆ bHasSpectralSelect

bool SetTrackVisualsCommand::bHasSpectralSelect

Definition at line 147 of file SetTrackInfoCommand.h.

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

◆ bHasUseSpecPrefs

bool SetTrackVisualsCommand::bHasUseSpecPrefs

Definition at line 146 of file SetTrackInfoCommand.h.

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

◆ bHasVZoom

bool SetTrackVisualsCommand::bHasVZoom

Definition at line 142 of file SetTrackInfoCommand.h.

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

◆ bHasVZoomBottom

bool SetTrackVisualsCommand::bHasVZoomBottom

Definition at line 144 of file SetTrackInfoCommand.h.

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

◆ bHasVZoomTop

bool SetTrackVisualsCommand::bHasVZoomTop

Definition at line 143 of file SetTrackInfoCommand.h.

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

◆ bSpectralSelect

bool SetTrackVisualsCommand::bSpectralSelect

Definition at line 134 of file SetTrackInfoCommand.h.

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

◆ bUseSpecPrefs

bool SetTrackVisualsCommand::bUseSpecPrefs

Definition at line 133 of file SetTrackInfoCommand.h.

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

◆ mColour

int SetTrackVisualsCommand::mColour

Definition at line 125 of file SetTrackInfoCommand.h.

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

◆ mDisplayType

int SetTrackVisualsCommand::mDisplayType

Definition at line 127 of file SetTrackInfoCommand.h.

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

◆ mHeight

int SetTrackVisualsCommand::mHeight

Definition at line 126 of file SetTrackInfoCommand.h.

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

◆ mScaleType

int SetTrackVisualsCommand::mScaleType

Definition at line 128 of file SetTrackInfoCommand.h.

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

◆ mSpecColorScheme

int SetTrackVisualsCommand::mSpecColorScheme

Definition at line 135 of file SetTrackInfoCommand.h.

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

◆ mVZoom

int SetTrackVisualsCommand::mVZoom

Definition at line 129 of file SetTrackInfoCommand.h.

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

◆ mVZoomBottom

double SetTrackVisualsCommand::mVZoomBottom

Definition at line 131 of file SetTrackInfoCommand.h.

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

◆ mVZoomTop

double SetTrackVisualsCommand::mVZoomTop

Definition at line 130 of file SetTrackInfoCommand.h.

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

◆ Symbol

const ComponentInterfaceSymbol SetTrackVisualsCommand::Symbol { XO("Set Track Visuals") }
static

Definition at line 109 of file SetTrackInfoCommand.h.

Referenced by GetSymbol().


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