2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
PlaybackPrefs.cpp
|
|
|
|
|
|
|
|
Joshua Haberman
|
|
|
|
Dominic Mazzoni
|
|
|
|
James Crook
|
|
|
|
|
|
|
|
*******************************************************************//**
|
|
|
|
|
|
|
|
\class PlaybackPrefs
|
|
|
|
\brief A PrefsPanel used to select playback options.
|
|
|
|
|
|
|
|
Presents interface for user to update the various playback options
|
|
|
|
like previewing and seeking.
|
|
|
|
|
|
|
|
*//********************************************************************/
|
|
|
|
|
2021-05-09 15:16:56 +00:00
|
|
|
|
2016-05-29 19:47:11 +00:00
|
|
|
#include "PlaybackPrefs.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
|
|
|
|
#include "../ShuttleGui.h"
|
2016-05-29 19:47:11 +00:00
|
|
|
#include "../Prefs.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2017-10-28 00:35:52 +00:00
|
|
|
PlaybackPrefs::PlaybackPrefs(wxWindow * parent, wxWindowID winid)
|
2019-12-08 02:00:39 +00:00
|
|
|
: PrefsPanel(parent, winid, XO("Playback"))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
Populate();
|
|
|
|
}
|
|
|
|
|
|
|
|
PlaybackPrefs::~PlaybackPrefs()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-04-15 12:01:24 +00:00
|
|
|
ComponentInterfaceSymbol PlaybackPrefs::GetSymbol()
|
|
|
|
{
|
|
|
|
return PLAYBACK_PREFS_PLUGIN_SYMBOL;
|
|
|
|
}
|
|
|
|
|
2019-12-08 18:53:48 +00:00
|
|
|
TranslatableString PlaybackPrefs::GetDescription()
|
2019-04-15 12:01:24 +00:00
|
|
|
{
|
2019-12-08 18:53:48 +00:00
|
|
|
return XO("Preferences for Playback");
|
2019-04-15 12:01:24 +00:00
|
|
|
}
|
|
|
|
|
2021-06-06 16:18:35 +00:00
|
|
|
ManualPageID PlaybackPrefs::HelpPageName()
|
2019-04-15 12:01:24 +00:00
|
|
|
{
|
|
|
|
return "Playback_Preferences";
|
|
|
|
}
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
void PlaybackPrefs::Populate()
|
|
|
|
{
|
|
|
|
//------------------------- Main section --------------------
|
|
|
|
// Now construct the GUI itself.
|
2014-06-03 20:30:19 +00:00
|
|
|
// Use 'eIsCreatingFromPrefs' so that the GUI is
|
2010-01-23 19:44:49 +00:00
|
|
|
// initialised with values from gPrefs.
|
|
|
|
ShuttleGui S(this, eIsCreatingFromPrefs);
|
|
|
|
PopulateOrExchange(S);
|
|
|
|
// ----------------------- End of main section --------------
|
|
|
|
}
|
|
|
|
|
2018-08-30 15:51:28 +00:00
|
|
|
namespace {
|
|
|
|
const char *UnpinnedScrubbingPreferenceKey()
|
|
|
|
{
|
|
|
|
return "/AudioIO/UnpinnedScrubbing";
|
|
|
|
}
|
|
|
|
bool UnpinnedScrubbingPreferenceDefault()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
int iPreferenceUnpinned = -1;
|
|
|
|
}
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
|
|
|
|
{
|
2017-10-29 14:27:23 +00:00
|
|
|
const auto suffix = XO("seconds");
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2018-01-17 20:41:40 +00:00
|
|
|
S.StartScroller();
|
2010-01-23 19:44:49 +00:00
|
|
|
S.SetBorder(2);
|
|
|
|
|
2019-12-22 19:58:36 +00:00
|
|
|
S.StartStatic(XO("Effects Preview"));
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
S.StartThreeColumn();
|
|
|
|
{
|
2017-10-29 14:27:23 +00:00
|
|
|
S.NameSuffix(suffix)
|
2020-05-11 15:28:14 +00:00
|
|
|
.TieNumericTextBox(XXO("&Length:"),
|
2019-04-03 14:57:59 +00:00
|
|
|
{wxT("/AudioIO/EffectsPreviewLen"),
|
|
|
|
6.0},
|
2011-06-16 23:29:56 +00:00
|
|
|
9);
|
2019-12-22 20:40:29 +00:00
|
|
|
S.AddUnits(XO("seconds"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndThreeColumn();
|
|
|
|
}
|
|
|
|
S.EndStatic();
|
|
|
|
|
2012-03-20 16:48:57 +00:00
|
|
|
/* i18n-hint: (noun) this is a preview of the cut */
|
2019-12-22 19:58:36 +00:00
|
|
|
S.StartStatic(XO("Cut Preview"));
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
S.StartThreeColumn();
|
|
|
|
{
|
2017-10-29 14:27:23 +00:00
|
|
|
S.NameSuffix(suffix)
|
2020-05-11 15:28:14 +00:00
|
|
|
.TieNumericTextBox(XXO("&Before cut region:"),
|
2019-04-03 14:57:59 +00:00
|
|
|
{wxT("/AudioIO/CutPreviewBeforeLen"),
|
|
|
|
2.0},
|
2011-06-16 23:29:56 +00:00
|
|
|
9);
|
2019-12-22 20:40:29 +00:00
|
|
|
S.AddUnits(XO("seconds"));
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2017-10-29 14:27:23 +00:00
|
|
|
S.NameSuffix(suffix)
|
2020-05-11 15:28:14 +00:00
|
|
|
.TieNumericTextBox(XXO("&After cut region:"),
|
2019-04-03 14:57:59 +00:00
|
|
|
{wxT("/AudioIO/CutPreviewAfterLen"),
|
|
|
|
1.0},
|
2011-06-16 23:29:56 +00:00
|
|
|
9);
|
2019-12-22 20:40:29 +00:00
|
|
|
S.AddUnits(XO("seconds"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndThreeColumn();
|
|
|
|
}
|
|
|
|
S.EndStatic();
|
|
|
|
|
2019-12-22 19:58:36 +00:00
|
|
|
S.StartStatic(XO("Seek Time when playing"));
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
S.StartThreeColumn();
|
|
|
|
{
|
2017-10-29 14:27:23 +00:00
|
|
|
S.NameSuffix(suffix)
|
2020-05-11 15:28:14 +00:00
|
|
|
.TieNumericTextBox(XXO("&Short period:"),
|
2019-04-03 14:57:59 +00:00
|
|
|
{wxT("/AudioIO/SeekShortPeriod"),
|
|
|
|
1.0},
|
2011-06-16 23:29:56 +00:00
|
|
|
9);
|
2019-12-22 20:40:29 +00:00
|
|
|
S.AddUnits(XO("seconds"));
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2017-10-29 14:27:23 +00:00
|
|
|
S.NameSuffix(suffix)
|
2020-05-11 15:28:14 +00:00
|
|
|
.TieNumericTextBox(XXO("Lo&ng period:"),
|
2019-04-03 14:57:59 +00:00
|
|
|
{wxT("/AudioIO/SeekLongPeriod"),
|
|
|
|
15.0},
|
2011-06-16 23:29:56 +00:00
|
|
|
9);
|
2019-12-22 20:40:29 +00:00
|
|
|
S.AddUnits(XO("seconds"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndThreeColumn();
|
|
|
|
}
|
|
|
|
S.EndStatic();
|
2018-07-20 20:43:07 +00:00
|
|
|
|
2019-12-22 19:58:36 +00:00
|
|
|
S.StartStatic(XO("Options"));
|
2018-07-20 20:43:07 +00:00
|
|
|
{
|
2018-11-02 21:36:05 +00:00
|
|
|
S.StartVerticalLay();
|
2018-07-20 20:43:07 +00:00
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.TieCheckBox(XXO("&Vari-Speed Play"), {"/AudioIO/VariSpeedPlay", true});
|
|
|
|
S.TieCheckBox(XXO("&Micro-fades"), {"/AudioIO/Microfades", false});
|
|
|
|
S.TieCheckBox(XXO("Always scrub un&pinned"),
|
2019-04-03 14:57:59 +00:00
|
|
|
{UnpinnedScrubbingPreferenceKey(),
|
|
|
|
UnpinnedScrubbingPreferenceDefault()});
|
2018-08-24 22:12:25 +00:00
|
|
|
}
|
2018-11-02 21:36:05 +00:00
|
|
|
S.EndVerticalLay();
|
2018-07-20 20:43:07 +00:00
|
|
|
}
|
|
|
|
S.EndStatic();
|
|
|
|
|
|
|
|
|
2018-01-17 20:41:40 +00:00
|
|
|
S.EndScroller();
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2018-08-30 15:51:28 +00:00
|
|
|
bool PlaybackPrefs::GetUnpinnedScrubbingPreference()
|
|
|
|
{
|
|
|
|
if ( iPreferenceUnpinned >= 0 )
|
|
|
|
return iPreferenceUnpinned == 1;
|
|
|
|
bool bResult = gPrefs->ReadBool(
|
|
|
|
UnpinnedScrubbingPreferenceKey(),
|
|
|
|
UnpinnedScrubbingPreferenceDefault());
|
|
|
|
iPreferenceUnpinned = bResult ? 1: 0;
|
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
|
2017-06-25 14:57:26 +00:00
|
|
|
bool PlaybackPrefs::Commit()
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2018-08-30 15:51:28 +00:00
|
|
|
iPreferenceUnpinned = -1;
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
ShuttleGui S(this, eIsSavingToPrefs);
|
|
|
|
PopulateOrExchange(S);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-06-13 21:59:47 +00:00
|
|
|
|
2020-01-20 01:53:03 +00:00
|
|
|
namespace{
|
2019-01-16 17:18:40 +00:00
|
|
|
PrefsPanel::Registration sAttachment{ "Playback",
|
2020-01-20 01:53:03 +00:00
|
|
|
[](wxWindow *parent, wxWindowID winid, AudacityProject *)
|
|
|
|
{
|
|
|
|
wxASSERT(parent); // to justify safenew
|
|
|
|
return safenew PlaybackPrefs(parent, winid);
|
|
|
|
}
|
2019-01-14 01:55:52 +00:00
|
|
|
};
|
2020-01-20 01:53:03 +00:00
|
|
|
}
|