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 429 of file TracksPrefs.cpp.

430{
431 // Bug 1583: Clear the caching of the preference pinned state.
435
436 // Bug 1661: Don't store the name for new tracks if the name is the
437 // default in that language.
441 gPrefs->Flush();
442 }
443
446 return true;
447}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
#define S(N)
Definition: ToChars.cpp:64
StringSetting AudioTrackNameSetting
Definition: WaveTrack.cpp:3371
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:375
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 413 of file TracksPrefs.cpp.

414{
415 auto value = gPrefs->ReadDouble(
418 return std::max(0.0, std::min(1.0, value));
419}
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 394 of file TracksPrefs.cpp.

395{
396 // JKC: Cache this setting as it is read many times during drawing, and otherwise causes screen flicker.
397 // Correct solution would be to re-write wxFileConfig to be efficient.
398 if( iPreferencePinned >= 0 )
399 return iPreferencePinned == 1;
401 iPreferencePinned = bResult ? 1: 0;
402 return bResult;
403}
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("Sho&w track name as overlay"),
335 {wxT("/GUI/ShowTrackNameInWaveform"),
336 false});
337 S.TieCheckBox(XXO("Use &half-wave display when collapsed"),
338 {wxT("/GUI/CollapseToHalfWave"),
339 false});
340#ifdef SHOW_PINNED_UNPINNED_IN_PREFS
341 S.TieCheckBox(XXO("&Pinned Recording/Playback head"),
344#endif
345 S.TieCheckBox(XXO("A&uto-scroll if head unpinned"),
346 {wxT("/GUI/AutoScroll"),
347 true});
348
349 S.AddSpace(10);
350
351 S.StartMultiColumn(2);
352 {
353#ifdef SHOW_PINNED_POSITION_IN_PREFS
354 S.TieNumericTextBox(
355 XXO("Pinned &head position"),
358 30
359 );
360#endif
361
362 S.TieChoice(XXO("Default &view mode:"),
363 viewModeSetting );
364
365 S.TieChoice(XXO("Default Waveform scale:"),
367
368 S.TieChoice(XXO("Display &samples:"),
370
371 S.TieTextBox(XXO("Default audio track &name:"),
373 30);
374 }
375 S.EndMultiColumn();
376 }
377 S.EndStatic();
378
379 S.StartStatic(XO("Zoom Toggle"));
380 {
381 S.StartMultiColumn(4);
382 {
383 S.TieChoice(XXO("Preset 1:"),
384 zoom1Setting );
385
386 S.TieChoice(XXO("Preset 2:"),
387 zoom2Setting );
388 }
389 }
390 S.EndStatic();
391 S.EndScroller();
392}
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 421 of file TracksPrefs.cpp.

422{
423 value = std::max(0.0, std::min(1.0, value));
425 if(flush)
426 gPrefs->Flush();
427}
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 405 of file TracksPrefs.cpp.

406{
407 iPreferencePinned = value ? 1 :0;
409 if(flush)
410 gPrefs->Flush();
411}

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: