Audacity  2.3.1
PlaybackPrefs.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  PlaybackPrefs.cpp
6 
7  Joshua Haberman
8  Dominic Mazzoni
9  James Crook
10 
11 *******************************************************************//********************************************************************/
20 
21 #include "../Audacity.h"
22 #include "PlaybackPrefs.h"
23 
24 #include <wx/defs.h>
25 #include <wx/textctrl.h>
26 
27 #include "../ShuttleGui.h"
28 #include "../Prefs.h"
29 #include "../Internat.h"
30 
31 PlaybackPrefs::PlaybackPrefs(wxWindow * parent, wxWindowID winid)
32 : PrefsPanel(parent, winid, _("Playback"))
33 {
34  Populate();
35 }
36 
38 {
39 }
40 
42 {
43  //------------------------- Main section --------------------
44  // Now construct the GUI itself.
45  // Use 'eIsCreatingFromPrefs' so that the GUI is
46  // initialised with values from gPrefs.
49  // ----------------------- End of main section --------------
50 }
51 
52 namespace {
53  const char *UnpinnedScrubbingPreferenceKey()
54  {
55  return "/AudioIO/UnpinnedScrubbing";
56  }
57  bool UnpinnedScrubbingPreferenceDefault()
58  {
59  return true;
60  }
61  int iPreferenceUnpinned = -1;
62 }
63 
65 {
66  wxTextCtrl *w;
67 
68  S.StartScroller();
69  S.SetBorder(2);
70 
71  S.StartStatic(_("Effects Preview"));
72  {
73  S.StartThreeColumn();
74  {
75  w = S.TieNumericTextBox(_("&Length:"),
76  wxT("/AudioIO/EffectsPreviewLen"),
77  6.0,
78  9);
79  S.AddUnits(_("seconds"));
80  if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
81  }
82  S.EndThreeColumn();
83  }
84  S.EndStatic();
85 
86  /* i18n-hint: (noun) this is a preview of the cut */
87  S.StartStatic(_("Cut Preview"));
88  {
89  S.StartThreeColumn();
90  {
91  w = S.TieNumericTextBox(_("&Before cut region:"),
92  wxT("/AudioIO/CutPreviewBeforeLen"),
93  2.0,
94  9);
95  S.AddUnits(_("seconds"));
96  if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
97 
98  w = S.TieNumericTextBox(_("&After cut region:"),
99  wxT("/AudioIO/CutPreviewAfterLen"),
100  1.0,
101  9);
102  S.AddUnits(_("seconds"));
103  if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
104  }
105  S.EndThreeColumn();
106  }
107  S.EndStatic();
108 
109  S.StartStatic(_("Seek Time when playing"));
110  {
111  S.StartThreeColumn();
112  {
113  w = S.TieNumericTextBox(_("&Short period:"),
114  wxT("/AudioIO/SeekShortPeriod"),
115  1.0,
116  9);
117  S.AddUnits(_("seconds"));
118  if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
119 
120  w = S.TieNumericTextBox(_("Lo&ng period:"),
121  wxT("/AudioIO/SeekLongPeriod"),
122  15.0,
123  9);
124  S.AddUnits(_("seconds"));
125  if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
126  }
127  S.EndThreeColumn();
128  }
129  S.EndStatic();
130 
131  S.StartStatic(_("Options"));
132  {
133  S.StartTwoColumn();
134  {
135  S.TieCheckBox(_("&Vari-Speed Play"), "/AudioIO/VariSpeedPlay", true);
136  }
137  S.EndTwoColumn();
138 
139  S.StartTwoColumn();
140  {
141  S.TieCheckBox(_("Always scrub un&pinned"),
142  UnpinnedScrubbingPreferenceKey(),
143  UnpinnedScrubbingPreferenceDefault());
144  }
145  S.EndTwoColumn();
146  }
147  S.EndStatic();
148 
149 
150  S.EndScroller();
151 
152 }
153 
155 {
156  if ( iPreferenceUnpinned >= 0 )
157  return iPreferenceUnpinned == 1;
158  bool bResult = gPrefs->ReadBool(
159  UnpinnedScrubbingPreferenceKey(),
160  UnpinnedScrubbingPreferenceDefault());
161  iPreferenceUnpinned = bResult ? 1: 0;
162  return bResult;
163 }
164 
166 {
167  iPreferenceUnpinned = -1;
168 
169  ShuttleGui S(this, eIsSavingToPrefs);
171 
172  return true;
173 }
174 
176 {
177  return "Playback_Preferences";
178 }
179 
180 PrefsPanel *PlaybackPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
181 {
182  wxASSERT(parent); // to justify safenew
183  return safenew PlaybackPrefs(parent, winid);
184 }
185 
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void EndThreeColumn()
Definition: ShuttleGui.h:139
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void PopulateOrExchange(ShuttleGui &S) override
void EndScroller()
Definition: ShuttleGui.cpp:836
A PrefsPanel used to select playback options.
Definition: PlaybackPrefs.h:23
#define safenew
Definition: Audacity.h:230
void AddUnits(const wxString &Prompt)
Left aligned text string.
Definition: ShuttleGui.cpp:260
wxScrolledWindow * StartScroller(int iStyle=0)
Definition: ShuttleGui.cpp:803
void StartTwoColumn()
Definition: ShuttleGui.h:136
wxTextCtrl * TieNumericTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)
void StartThreeColumn()
Definition: ShuttleGui.h:138
PlaybackPrefs(wxWindow *parent, wxWindowID winid)
virtual ~PlaybackPrefs()
Used within the PrefsDialog, classes derived from this class include AudioIOPrefs, BatchPrefs, DirectoriesPrefs, FileFormatPrefs, GUIPrefs, KeyConfigPrefs, MousePrefs, QualityPrefs, SpectrumPrefs and ThemePrefs.
Definition: PrefsPanel.h:45
_("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)
bool Commit() override
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:771
PrefsPanel * operator()(wxWindow *parent, wxWindowID winid) override
wxString HelpPageName() override
void SetBorder(int Border)
Definition: ShuttleGui.h:286
void EndTwoColumn()
Definition: ShuttleGui.h:137
static bool GetUnpinnedScrubbingPreference()