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.StartVerticalLay();
134  {
135  S.TieCheckBox(_("&Vari-Speed Play"), "/AudioIO/VariSpeedPlay", true);
136  S.TieCheckBox(_("&Micro-fades"), "/AudioIO/Microfades", false);
137  S.TieCheckBox(_("Always scrub un&pinned"),
138  UnpinnedScrubbingPreferenceKey(),
139  UnpinnedScrubbingPreferenceDefault());
140  }
141  S.EndVerticalLay();
142  }
143  S.EndStatic();
144 
145 
146  S.EndScroller();
147 
148 }
149 
151 {
152  if ( iPreferenceUnpinned >= 0 )
153  return iPreferenceUnpinned == 1;
154  bool bResult = gPrefs->ReadBool(
155  UnpinnedScrubbingPreferenceKey(),
156  UnpinnedScrubbingPreferenceDefault());
157  iPreferenceUnpinned = bResult ? 1: 0;
158  return bResult;
159 }
160 
162 {
163  iPreferenceUnpinned = -1;
164 
165  ShuttleGui S(this, eIsSavingToPrefs);
167 
168  return true;
169 }
170 
172 {
173  return "Playback_Preferences";
174 }
175 
176 PrefsPanel *PlaybackPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
177 {
178  wxASSERT(parent); // to justify safenew
179  return safenew PlaybackPrefs(parent, winid);
180 }
181 
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
void EndVerticalLay()
wxScrolledWindow * StartScroller(int iStyle=0)
Definition: ShuttleGui.cpp:803
wxTextCtrl * TieNumericTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)
void StartThreeColumn()
Definition: ShuttleGui.h:138
PlaybackPrefs(wxWindow *parent, wxWindowID winid)
virtual ~PlaybackPrefs()
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs...
Definition: PrefsPanel.h:50
_("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
static bool GetUnpinnedScrubbingPreference()
void StartVerticalLay(int iProp=1)