Audacity  2.2.2
Public Member Functions | Static Public Member Functions | 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:
PrefsPanel wxPanelWrapper wxTabTraversalWrapper< wxPanel >

Public Member Functions

 TracksPrefs (wxWindow *parent, wxWindowID winid)
 
 ~TracksPrefs ()
 
bool Commit () override
 
wxString HelpPageName () override
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const wxString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
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 wxString &name=_("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
- 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 wxString GetDefaultAudioTrackNamePreference ()
 
static WaveTrack::WaveTrackDisplay ViewModeChoice ()
 
static WaveTrack::SampleDisplay SampleViewChoice ()
 
static WaveTrack::ZoomPresets Zoom1Choice ()
 
static WaveTrack::ZoomPresets Zoom2Choice ()
 

Private Member Functions

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

Static Private Attributes

static int iPreferencePinned = -1
 

Detailed Description

A PrefsPanel for track display and behavior properties.

Definition at line 27 of file TracksPrefs.h.

Constructor & Destructor Documentation

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

Definition at line 218 of file TracksPrefs.cpp.

References Populate().

222 : PrefsPanel(parent, winid, _("Tracks"))
223 {
224  Populate();
225 }
void Populate()
PrefsPanel(wxWindow *parent, wxWindowID winid, const wxString &title)
Definition: PrefsPanel.h:48
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
TracksPrefs::~TracksPrefs ( )

Definition at line 227 of file TracksPrefs.cpp.

228 {
229 }

Member Function Documentation

bool TracksPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 341 of file TracksPrefs.cpp.

References _(), eIsSavingToPrefs, GetDefaultAudioTrackNamePreference(), gPrefs, iPreferencePinned, and PopulateOrExchange().

342 {
343  // Bug 1583: Clear the caching of the preference pinned state.
344  iPreferencePinned = -1;
345  ShuttleGui S(this, eIsSavingToPrefs);
347 
348  // Bug 1661: Don't store the name for new tracks if the name is the
349  // default in that language.
350  if (GetDefaultAudioTrackNamePreference() == _("Audio Track")) {
351  gPrefs->DeleteEntry(wxT("/GUI/TrackNames/DefaultTrackName"));
352  gPrefs->Flush();
353  }
354 
355  return true;
356 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
static wxString GetDefaultAudioTrackNamePreference()
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void PopulateOrExchange(ShuttleGui &S) override
static int iPreferencePinned
Definition: TracksPrefs.h:49
wxString TracksPrefs::GetDefaultAudioTrackNamePreference ( )
static

Definition at line 327 of file TracksPrefs.cpp.

References _(), gPrefs, and name.

Referenced by Commit(), ControlToolBar::DoRecord(), and WaveTrack::WaveTrack().

328 {
329  const auto name =
330  gPrefs->Read(wxT("/GUI/TrackNames/DefaultTrackName"), wxT(""));
331 
332  if (name.empty() || ( name == "Audio Track" ))
333  // When nothing was specified,
334  // the default-default is whatever translation of...
335  /* i18n-hint: The default name for an audio track. */
336  return _("Audio Track");
337  else
338  return name;
339 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
const wxChar * name
Definition: Distortion.cpp:94
bool TracksPrefs::GetPinnedHeadPreference ( )
static

Definition at line 308 of file TracksPrefs.cpp.

References gPrefs, and iPreferencePinned.

Referenced by AdornedRulerPanel::DoDrawIndicator(), Scrubber::DoScrub(), AudacityProject::ModifyToolbarMenus(), AdornedRulerPanel::OnMouseEvents(), AudacityProject::OnTogglePinnedHead(), ControlToolBar::StartScrollingIfPreferred(), and AdornedRulerPanel::UpdateButtonStates().

309 {
310  // JKC: Cache this setting as it is read many times during drawing, and otherwise causes screen flicker.
311  // Correct solution would be to re-write wxFileConfig to be efficient.
312  if( iPreferencePinned >= 0 )
313  return iPreferencePinned == 1;
314  bool bResult = gPrefs->ReadBool(PinnedHeadPreferenceKey(), PinnedHeadPreferenceDefault());
315  iPreferencePinned = bResult ? 1: 0;
316  return bResult;
317 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
static int iPreferencePinned
Definition: TracksPrefs.h:49
wxString TracksPrefs::HelpPageName ( )
overridevirtual

Reimplemented from PrefsPanel.

Definition at line 358 of file TracksPrefs.cpp.

359 {
360  return "Tracks_Preferences";
361 }
void TracksPrefs::Populate ( )
private

Definition at line 231 of file TracksPrefs.cpp.

References eIsCreatingFromPrefs, and PopulateOrExchange().

Referenced by TracksPrefs().

232 {
233  // Keep view choices and codes in proper correspondence --
234  // we don't display them by increasing integer values.
235 
236 
237  // How samples are displayed when zoomed in:
238 
239 
240  //------------------------- Main section --------------------
241  // Now construct the GUI itself.
242  // Use 'eIsCreatingFromPrefs' so that the GUI is
243  // initialised with values from gPrefs.
246  // ----------------------- End of main section --------------
247 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void PopulateOrExchange(ShuttleGui &S) override
void TracksPrefs::PopulateOrExchange ( ShuttleGui S)
overrideprivate

Definition at line 249 of file TracksPrefs.cpp.

References _(), ShuttleGui::AddSpace(), ShuttleGuiBase::EndMultiColumn(), ShuttleGuiBase::EndScroller(), ShuttleGuiBase::EndStatic(), sampleDisplaySetting, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::StartScroller(), ShuttleGuiBase::StartStatic(), ShuttleGuiBase::TieCheckBox(), ShuttleGuiBase::TieChoice(), ShuttleGuiBase::TieTextBox(), viewModeSetting, zoom1Setting, and zoom2Setting.

Referenced by Commit(), and Populate().

250 {
251  S.SetBorder(2);
252  S.StartScroller();
253 
254  S.StartStatic(_("Display"));
255  {
256  S.TieCheckBox(_("&Pinned Recording/Playback head"),
257  PinnedHeadPreferenceKey(),
258  PinnedHeadPreferenceDefault());
259  S.TieCheckBox(_("A&uto-scroll if head unpinned"),
260  wxT("/GUI/AutoScroll"),
261  true);
262  S.TieCheckBox(_("Auto-&fit track height"),
263  wxT("/GUI/TracksFitVerticallyZoomed"),
264  false);
265  S.TieCheckBox(_("Sho&w audio track name as overlay"),
266  wxT("/GUI/ShowTrackNameInWaveform"),
267  false);
268 #ifdef EXPERIMENTAL_HALF_WAVE
269  S.TieCheckBox(_("Use &half-wave display when collapsed"),
270  wxT("/GUI/CollapseToHalfWave"),
271  false);
272 #endif
273 
274  S.AddSpace(10);
275 
276  S.StartMultiColumn(2);
277  {
278  S.TieChoice(_("Default &view mode:"),
279  viewModeSetting );
280 
281  S.TieChoice(_("Display &samples:"),
283 
284  S.TieTextBox(_("Default audio track &name:"),
285  wxT("/GUI/TrackNames/DefaultTrackName"),
286  _("Audio Track"),
287  30);
288  }
289  S.EndMultiColumn();
290  }
291  S.EndStatic();
292 
293  S.StartStatic(_("Zoom Toggle"));
294  {
295  S.StartMultiColumn(4);
296  {
297  S.TieChoice(_("Preset 1:"),
298  zoom1Setting );
299 
300  S.TieChoice(_("Preset 2:"),
301  zoom2Setting );
302  }
303  }
304  S.EndStatic();
305  S.EndScroller();
306 }
wxChoice * TieChoice(const wxString &Prompt, WrappedType &WrappedRef, const wxArrayString *pChoices)
void EndMultiColumn()
static TracksViewModeSetting viewModeSetting
void EndScroller()
Definition: ShuttleGui.cpp:828
static EncodedEnumSetting zoom1Setting
wxScrolledWindow * StartScroller(int iStyle=0)
Definition: ShuttleGui.cpp:795
static EncodedEnumSetting zoom2Setting
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxCheckBox * TieCheckBox(const wxString &Prompt, WrappedType &WrappedRef)
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:763
wxSizerItem * AddSpace(int width, int height)
void SetBorder(int Border)
Definition: ShuttleGui.h:286
static EncodedEnumSetting sampleDisplaySetting
wxTextCtrl * TieTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)
WaveTrack::SampleDisplay TracksPrefs::SampleViewChoice ( )
static

Definition at line 144 of file TracksPrefs.cpp.

References EncodedEnumSetting::ReadInt(), and sampleDisplaySetting.

Referenced by TrackArtist::UpdatePrefs().

145 {
147 }
virtual int ReadInt() const
Definition: Prefs.cpp:419
static EncodedEnumSetting sampleDisplaySetting
void TracksPrefs::SetPinnedHeadPreference ( bool  value,
bool  flush = false 
)
static

Definition at line 319 of file TracksPrefs.cpp.

References gPrefs, and iPreferencePinned.

Referenced by AudacityProject::OnTogglePinnedHead().

320 {
321  iPreferencePinned = value ? 1 :0;
322  gPrefs->Write(PinnedHeadPreferenceKey(), value);
323  if(flush)
324  gPrefs->Flush();
325 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
static int iPreferencePinned
Definition: TracksPrefs.h:49
WaveTrack::WaveTrackDisplay TracksPrefs::ViewModeChoice ( )
static

Definition at line 116 of file TracksPrefs.cpp.

References EncodedEnumSetting::ReadInt(), and viewModeSetting.

Referenced by WaveTrack::WaveTrack().

117 {
119 }
virtual int ReadInt() const
Definition: Prefs.cpp:419
static TracksViewModeSetting viewModeSetting
int WaveTrackDisplay
Definition: WaveTrack.h:531
WaveTrack::ZoomPresets TracksPrefs::Zoom1Choice ( )
static

Definition at line 207 of file TracksPrefs.cpp.

References EncodedEnumSetting::ReadInt(), and zoom1Setting.

Referenced by AudacityProject::OnZoomToggle().

208 {
210 }
virtual int ReadInt() const
Definition: Prefs.cpp:419
static EncodedEnumSetting zoom1Setting
WaveTrack::ZoomPresets TracksPrefs::Zoom2Choice ( )
static

Definition at line 212 of file TracksPrefs.cpp.

References EncodedEnumSetting::ReadInt(), and zoom2Setting.

Referenced by AudacityProject::OnZoomToggle().

213 {
215 }
virtual int ReadInt() const
Definition: Prefs.cpp:419
static EncodedEnumSetting zoom2Setting

Member Data Documentation

int TracksPrefs::iPreferencePinned = -1
staticprivate

Definition at line 49 of file TracksPrefs.h.

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


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