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

256: PrefsPanel(parent, winid, XO("Tracks"))
257{
258 Populate();
259}
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 261 of file TracksPrefs.cpp.

262{
263}

Member Function Documentation

◆ Commit()

bool TracksPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 401 of file TracksPrefs.cpp.

402{
403 // Bug 1583: Clear the caching of the preference pinned state.
407
408 // Bug 1661: Don't store the name for new tracks if the name is the
409 // default in that language.
413 gPrefs->Flush();
414 }
415
418 return true;
419}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
#define S(N)
Definition: ToChars.cpp:64
StringSetting AudioTrackNameSetting
Definition: WaveTrack.cpp:3398
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:55
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 270 of file TracksPrefs.cpp.

271{
272 return XO("Preferences for Tracks");
273}

References XO().

Here is the call graph for this function:

◆ GetPinnedHeadPositionPreference()

double TracksPrefs::GetPinnedHeadPositionPreference ( )
static

Definition at line 385 of file TracksPrefs.cpp.

386{
387 auto value = gPrefs->ReadDouble(
390 return std::max(0.0, std::min(1.0, value));
391}
int min(int a, int b)
double ReadDouble(const wxString &key, double defaultValue) const
const wxChar * PinnedHeadPositionPreferenceKey()
Definition: TracksPrefs.cpp:51

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

367{
368 // JKC: Cache this setting as it is read many times during drawing, and otherwise causes screen flicker.
369 // Correct solution would be to re-write wxFileConfig to be efficient.
370 if( iPreferencePinned >= 0 )
371 return iPreferencePinned == 1;
373 iPreferencePinned = bResult ? 1: 0;
374 return bResult;
375}
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 265 of file TracksPrefs.cpp.

266{
268}
#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 275 of file TracksPrefs.cpp.

276{
277 return "Tracks_Preferences";
278}

◆ Populate()

void TracksPrefs::Populate ( )
private

Definition at line 280 of file TracksPrefs.cpp.

281{
282 // Keep view choices and codes in proper correspondence --
283 // we don't display them by increasing integer values.
284
285
286 // How samples are displayed when zoomed in:
287
288
289 //------------------------- Main section --------------------
290 // Now construct the GUI itself.
291 // Use 'eIsCreatingFromPrefs' so that the GUI is
292 // initialised with values from gPrefs.
295 // ----------------------- End of main section --------------
296}
@ 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 298 of file TracksPrefs.cpp.

299{
300 auto viewModeSetting = ViewModeSetting();
301
302 S.SetBorder(2);
303 S.StartScroller();
304
305 S.StartStatic(XO("Display"));
306 {
307 S.TieCheckBox(XXO("Auto-&fit track height"), TracksFitVerticallyZoomed);
308 S.TieCheckBox(XXO("Use &half-wave display when collapsed"),
309 {wxT("/GUI/CollapseToHalfWave"),
310 false});
311#ifdef SHOW_PINNED_UNPINNED_IN_PREFS
312 S.TieCheckBox(XXO("&Pinned Recording/Playback head"),
315#endif
316 S.TieCheckBox(XXO("A&uto-scroll if head unpinned"),
317 {wxT("/GUI/AutoScroll"),
318 true});
319
320 S.AddSpace(10);
321
322 S.StartMultiColumn(2);
323 {
324#ifdef SHOW_PINNED_POSITION_IN_PREFS
325 S.TieNumericTextBox(
326 XXO("Pinned &head position"),
329 30
330 );
331#endif
332
333 S.TieChoice(XXO("Default &view mode:"),
334 viewModeSetting );
335
336 S.TieChoice(
337 XXO("Default Waveform scale:"),
339
340 S.TieChoice(XXO("Display &samples:"),
342
343 S.TieTextBox(XXO("Default audio track &name:"),
345 30);
346 }
347 S.EndMultiColumn();
348 }
349 S.EndStatic();
350
351 S.StartStatic(XO("Zoom Toggle"));
352 {
353 S.StartMultiColumn(4);
354 {
355 S.TieChoice(XXO("Preset 1:"),
356 zoom1Setting );
357
358 S.TieChoice(XXO("Preset 2:"),
359 zoom2Setting );
360 }
361 }
362 S.EndStatic();
363 S.EndScroller();
364}
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< ScaleTypeValues > waveformScaleSetting

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(), WaveformSettings::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 180 of file TracksPrefs.cpp.

181{
182 return sampleDisplaySetting.ReadEnum();
183}

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

394{
395 value = std::max(0.0, std::min(1.0, value));
397 if(flush)
398 gPrefs->Flush();
399}
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 377 of file TracksPrefs.cpp.

378{
379 iPreferencePinned = value ? 1 :0;
381 if(flush)
382 gPrefs->Flush();
383}

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

158{
159 return ViewModeSetting().ReadEnum();
160}
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:

◆ Zoom1Choice()

WaveChannelViewConstants::ZoomPresets TracksPrefs::Zoom1Choice ( )
static

Definition at line 241 of file TracksPrefs.cpp.

242{
243 return zoom1Setting.ReadEnum();
244}

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

247{
248 return zoom2Setting.ReadEnum();
249}

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 55 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: