Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Attributes | List of all members
TracksPrefs Class Referencefinal

A PrefsPanel for track display and behavior properties. More...

#include <TracksPrefs.h>

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

Public Member Functions

 TracksPrefs (wxWindow *parent, wxWindowID winid)
 
 ~TracksPrefs ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
bool Commit () override
 
ManualPageID HelpPageName () override
 If not empty string, the Help button is added below the panel. More...
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const TranslatableString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool Commit ()=0
 
virtual PluginPath GetPath () const override
 
virtual VendorSymbol GetVendor () const override
 
virtual wxString GetVersion () const override
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual ManualPageID HelpPageName ()
 If not empty string, the Help button is added below the panel. More...
 
virtual void Cancel ()
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Static Public Member Functions

static bool GetPinnedHeadPreference ()
 
static void SetPinnedHeadPreference (bool value, bool flush=false)
 
static double GetPinnedHeadPositionPreference ()
 
static void SetPinnedHeadPositionPreference (double value, bool flush=false)
 
static WaveChannelViewConstants::Display ViewModeChoice ()
 
static WaveformSettings::ScaleTypeValues WaveformScaleChoice ()
 
static WaveChannelViewConstants::SampleDisplay SampleViewChoice ()
 
static WaveChannelViewConstants::ZoomPresets Zoom1Choice ()
 
static WaveChannelViewConstants::ZoomPresets Zoom2Choice ()
 
- Static Public Member Functions inherited from PrefsPanel
static FactoriesDefaultFactories ()
 

Static Public Attributes

static BoolSetting TracksFitVerticallyZoomed
 

Private Member Functions

void Populate ()
 
void PopulateOrExchange (ShuttleGui &S) override
 

Static Private Attributes

static int iPreferencePinned = -1
 

Additional Inherited Members

- Public Types inherited from PrefsPanel
using Factories = std::vector< PrefsPanel::PrefsNode >
 
using Factory = std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) >
 

Detailed Description

A PrefsPanel for track display and behavior properties.

Definition at line 27 of file TracksPrefs.h.

Constructor & Destructor Documentation

◆ TracksPrefs()

TracksPrefs::TracksPrefs ( wxWindow *  parent,
wxWindowID  winid 
)

Definition at line 278 of file TracksPrefs.cpp.

282: PrefsPanel(parent, winid, XO("Tracks"))
283{
284 Populate();
285}
XO("Cut/Copy/Paste")
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:94
void Populate()

References Populate().

Here is the call graph for this function:

◆ ~TracksPrefs()

TracksPrefs::~TracksPrefs ( )

Definition at line 287 of file TracksPrefs.cpp.

288{
289}

Member Function Documentation

◆ Commit()

bool TracksPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 426 of file TracksPrefs.cpp.

427{
428 // Bug 1583: Clear the caching of the preference pinned state.
432
433 // Bug 1661: Don't store the name for new tracks if the name is the
434 // default in that language.
438 gPrefs->Flush();
439 }
440
443 return true;
444}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
#define S(N)
Definition: ToChars.cpp:64
StringSetting AudioTrackNameSetting
Definition: WaveTrack.cpp:3380
bool Delete()
Delete the key if present, and return true iff it was.
Definition: Prefs.cpp:549
void Invalidate() override
Definition: Prefs.h:289
const T & GetDefault() const
Definition: Prefs.h:199
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
void PopulateOrExchange(ShuttleGui &S) override
static BoolSetting TracksFitVerticallyZoomed
Definition: TracksPrefs.h:30
static int iPreferencePinned
Definition: TracksPrefs.h:56
static wxString GetDefaultAudioTrackNamePreference()
Definition: WaveTrack.cpp:373
virtual bool Flush() noexcept=0

References AudioTrackNameSetting, SettingBase::Delete(), eIsSavingToPrefs, audacity::BasicSettings::Flush(), Setting< T >::GetDefault(), WaveTrack::GetDefaultAudioTrackNamePreference(), gPrefs, Setting< T >::Invalidate(), iPreferencePinned, PopulateOrExchange(), S, and TracksFitVerticallyZoomed.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString TracksPrefs::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 296 of file TracksPrefs.cpp.

297{
298 return XO("Preferences for Tracks");
299}

References XO().

Here is the call graph for this function:

◆ GetPinnedHeadPositionPreference()

double TracksPrefs::GetPinnedHeadPositionPreference ( )
static

Definition at line 410 of file TracksPrefs.cpp.

411{
412 auto value = gPrefs->ReadDouble(
415 return std::max(0.0, std::min(1.0, value));
416}
int min(int a, int b)
double ReadDouble(const wxString &key, double defaultValue) const
const wxChar * PinnedHeadPositionPreferenceKey()
Definition: TracksPrefs.cpp:50

References gPrefs, min(), anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPositionPreferenceDefault(), anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPositionPreferenceKey(), and audacity::BasicSettings::ReadDouble().

Referenced by anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Click(), anonymous_namespace{Scrubbing.cpp}::FindScrubbingSpeed(), anonymous_namespace{Scrubbing.cpp}::FindSeekSpeed(), anonymous_namespace{AdornedRulerPanel.cpp}::GetPlayHeadX(), Scrubber::MaybeStartScrubbing(), and ProjectWindow::PlaybackScroller::OnTimer().

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

◆ GetPinnedHeadPreference()

bool TracksPrefs::GetPinnedHeadPreference ( )
static

Definition at line 391 of file TracksPrefs.cpp.

392{
393 // JKC: Cache this setting as it is read many times during drawing, and otherwise causes screen flicker.
394 // Correct solution would be to re-write wxFileConfig to be efficient.
395 if( iPreferencePinned >= 0 )
396 return iPreferencePinned == 1;
398 iPreferencePinned = bResult ? 1: 0;
399 return bResult;
400}
bool ReadBool(const wxString &key, bool defaultValue) const

References gPrefs, iPreferencePinned, anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPreferenceDefault(), anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPreferenceKey(), and audacity::BasicSettings::ReadBool().

Referenced by Scrubber::IsTransportingPinned(), Scrubber::ShouldScrubPinned(), AdornedRulerPanel::ShowMenu(), and AdornedRulerPanel::TogglePinnedHead().

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

◆ GetSymbol()

ComponentInterfaceSymbol TracksPrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 291 of file TracksPrefs.cpp.

292{
294}
#define TRACKS_PREFS_PLUGIN_SYMBOL
Definition: TracksPrefs.h:25

References TRACKS_PREFS_PLUGIN_SYMBOL.

◆ HelpPageName()

ManualPageID TracksPrefs::HelpPageName ( )
overridevirtual

If not empty string, the Help button is added below the panel.

Default returns empty string.

Reimplemented from PrefsPanel.

Definition at line 301 of file TracksPrefs.cpp.

302{
303 return "Tracks_Preferences";
304}

◆ Populate()

void TracksPrefs::Populate ( )
private

Definition at line 306 of file TracksPrefs.cpp.

307{
308 // Keep view choices and codes in proper correspondence --
309 // we don't display them by increasing integer values.
310
311
312 // How samples are displayed when zoomed in:
313
314
315 //------------------------- Main section --------------------
316 // Now construct the GUI itself.
317 // Use 'eIsCreatingFromPrefs' so that the GUI is
318 // initialised with values from gPrefs.
321 // ----------------------- End of main section --------------
322}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46

References eIsCreatingFromPrefs, PopulateOrExchange(), and S.

Referenced by TracksPrefs().

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

◆ PopulateOrExchange()

void TracksPrefs::PopulateOrExchange ( ShuttleGui S)
overrideprivate

Definition at line 324 of file TracksPrefs.cpp.

325{
326 auto viewModeSetting = ViewModeSetting();
327
328 S.SetBorder(2);
329 S.StartScroller();
330
331 S.StartStatic(XO("Display"));
332 {
333 S.TieCheckBox(XXO("Auto-&fit track height"), TracksFitVerticallyZoomed);
334 S.TieCheckBox(XXO("Use &half-wave display when collapsed"),
335 {wxT("/GUI/CollapseToHalfWave"),
336 false});
337#ifdef SHOW_PINNED_UNPINNED_IN_PREFS
338 S.TieCheckBox(XXO("&Pinned Recording/Playback head"),
341#endif
342 S.TieCheckBox(XXO("A&uto-scroll if head unpinned"),
343 {wxT("/GUI/AutoScroll"),
344 true});
345
346 S.AddSpace(10);
347
348 S.StartMultiColumn(2);
349 {
350#ifdef SHOW_PINNED_POSITION_IN_PREFS
351 S.TieNumericTextBox(
352 XXO("Pinned &head position"),
355 30
356 );
357#endif
358
359 S.TieChoice(XXO("Default &view mode:"),
360 viewModeSetting );
361
362 S.TieChoice(XXO("Default Waveform scale:"),
364
365 S.TieChoice(XXO("Display &samples:"),
367
368 S.TieTextBox(XXO("Default audio track &name:"),
370 30);
371 }
372 S.EndMultiColumn();
373 }
374 S.EndStatic();
375
376 S.StartStatic(XO("Zoom Toggle"));
377 {
378 S.StartMultiColumn(4);
379 {
380 S.TieChoice(XXO("Preset 1:"),
381 zoom1Setting );
382
383 S.TieChoice(XXO("Preset 2:"),
384 zoom2Setting );
385 }
386 }
387 S.EndStatic();
388 S.EndScroller();
389}
wxT("CloseDown"))
XXO("&Cut/Copy/Paste Toolbar")
static EnumSetting< WaveChannelViewConstants::ZoomPresets > zoom2Setting
static EnumSetting< WaveChannelViewConstants::ZoomPresets > zoom1Setting
static EnumSetting< WaveChannelViewConstants::SampleDisplay > sampleDisplaySetting
static TracksViewModeEnumSetting ViewModeSetting()
static EnumSetting< WaveformSettings::ScaleTypeValues > waveformScaleSetting
Definition: TracksPrefs.cpp:68

References AudioTrackNameSetting, anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPositionPreferenceDefault(), anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPositionPreferenceKey(), anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPreferenceDefault(), anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPreferenceKey(), S, sampleDisplaySetting, TracksFitVerticallyZoomed, ViewModeSetting(), waveformScaleSetting, wxT(), XO(), XXO(), zoom1Setting, and zoom2Setting.

Referenced by Commit(), and Populate().

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

◆ SampleViewChoice()

WaveChannelViewConstants::SampleDisplay TracksPrefs::SampleViewChoice ( )
static

Definition at line 206 of file TracksPrefs.cpp.

207{
208 return sampleDisplaySetting.ReadEnum();
209}

References sampleDisplaySetting.

Referenced by TrackArtist::UpdatePrefs().

Here is the caller graph for this function:

◆ SetPinnedHeadPositionPreference()

void TracksPrefs::SetPinnedHeadPositionPreference ( double  value,
bool  flush = false 
)
static

Definition at line 418 of file TracksPrefs.cpp.

419{
420 value = std::max(0.0, std::min(1.0, value));
422 if(flush)
423 gPrefs->Flush();
424}
virtual bool Write(const wxString &key, bool value)=0

References audacity::BasicSettings::Flush(), gPrefs, min(), anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPositionPreferenceKey(), and audacity::BasicSettings::Write().

Referenced by anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Cancel(), anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Click(), anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Drag(), and anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Release().

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

◆ SetPinnedHeadPreference()

void TracksPrefs::SetPinnedHeadPreference ( bool  value,
bool  flush = false 
)
static

Definition at line 402 of file TracksPrefs.cpp.

403{
404 iPreferencePinned = value ? 1 :0;
406 if(flush)
407 gPrefs->Flush();
408}

References audacity::BasicSettings::Flush(), gPrefs, iPreferencePinned, anonymous_namespace{TracksPrefs.cpp}::PinnedHeadPreferenceKey(), and audacity::BasicSettings::Write().

Referenced by AdornedRulerPanel::TogglePinnedHead().

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

◆ ViewModeChoice()

WaveChannelViewConstants::Display TracksPrefs::ViewModeChoice ( )
static

Definition at line 178 of file TracksPrefs.cpp.

179{
180 return ViewModeSetting().ReadEnum();
181}
Enum ReadEnum() const
Definition: Prefs.h:534

References EnumSetting< Enum >::ReadEnum(), and ViewModeSetting().

Referenced by WaveChannelView::BuildSubViews().

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

◆ WaveformScaleChoice()

WaveformSettings::ScaleTypeValues TracksPrefs::WaveformScaleChoice ( )
static

Definition at line 183 of file TracksPrefs.cpp.

184{
185 return waveformScaleSetting.ReadEnum();
186}

References waveformScaleSetting.

Referenced by WaveformSettings::LoadPrefs(), and WaveformSettings::UpdatePrefs().

Here is the caller graph for this function:

◆ Zoom1Choice()

WaveChannelViewConstants::ZoomPresets TracksPrefs::Zoom1Choice ( )
static

Definition at line 267 of file TracksPrefs.cpp.

268{
269 return zoom1Setting.ReadEnum();
270}

References zoom1Setting.

Referenced by anonymous_namespace{ViewMenus.cpp}::OnZoomToggle().

Here is the caller graph for this function:

◆ Zoom2Choice()

WaveChannelViewConstants::ZoomPresets TracksPrefs::Zoom2Choice ( )
static

Definition at line 272 of file TracksPrefs.cpp.

273{
274 return zoom2Setting.ReadEnum();
275}

References zoom2Setting.

Referenced by anonymous_namespace{ViewMenus.cpp}::OnZoomToggle().

Here is the caller graph for this function:

Member Data Documentation

◆ iPreferencePinned

int TracksPrefs::iPreferencePinned = -1
staticprivate

Definition at line 56 of file TracksPrefs.h.

Referenced by Commit(), GetPinnedHeadPreference(), and SetPinnedHeadPreference().

◆ TracksFitVerticallyZoomed

BoolSetting TracksPrefs::TracksFitVerticallyZoomed
static
Initial value:
{
"/GUI/TracksFitVerticallyZoomed", false }

Definition at line 30 of file TracksPrefs.h.

Referenced by Commit(), ProjectAudioManager::DoRecord(), anonymous_namespace{TracksPrefs.cpp}::Handler::Handler(), and PopulateOrExchange().


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