mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-22 15:20:15 +02:00
New preference for pinned play head, also in Transport menu
This commit is contained in:
parent
fecc6f53e4
commit
e39da0c42b
@ -69,6 +69,7 @@ simplifies construction of menu items.
|
|||||||
#include "export/Export.h"
|
#include "export/Export.h"
|
||||||
#include "export/ExportMultiple.h"
|
#include "export/ExportMultiple.h"
|
||||||
#include "prefs/PrefsDialog.h"
|
#include "prefs/PrefsDialog.h"
|
||||||
|
#include "prefs/PlaybackPrefs.h"
|
||||||
#include "ShuttleGui.h"
|
#include "ShuttleGui.h"
|
||||||
#include "HistoryWindow.h"
|
#include "HistoryWindow.h"
|
||||||
#include "LyricsWindow.h"
|
#include "LyricsWindow.h"
|
||||||
@ -772,6 +773,11 @@ void AudacityProject::CreateMenusAndCommands()
|
|||||||
|
|
||||||
c->AddSeparator();
|
c->AddSeparator();
|
||||||
|
|
||||||
|
c->AddCheck(wxT("PinnedHead"), _("Pinned Recording/Playback Head"),
|
||||||
|
FN(OnTogglePinnedHead), 0,
|
||||||
|
// Switching of scrolling on and off is permitted even during transport
|
||||||
|
AlwaysEnabledFlag, AlwaysEnabledFlag);
|
||||||
|
|
||||||
c->AddCheck(wxT("Duplex"), _("&Overdub (on/off)"), FN(OnTogglePlayRecording), 0);
|
c->AddCheck(wxT("Duplex"), _("&Overdub (on/off)"), FN(OnTogglePlayRecording), 0);
|
||||||
c->AddCheck(wxT("SWPlaythrough"), _("So&ftware Playthrough (on/off)"), FN(OnToggleSWPlaythrough), 0);
|
c->AddCheck(wxT("SWPlaythrough"), _("So&ftware Playthrough (on/off)"), FN(OnToggleSWPlaythrough), 0);
|
||||||
|
|
||||||
@ -1840,6 +1846,10 @@ void AudacityProject::ModifyToolbarMenus()
|
|||||||
gPrefs->Read(wxT("/AudioIO/AutomatedInputLevelAdjustment"),&active, false);
|
gPrefs->Read(wxT("/AudioIO/AutomatedInputLevelAdjustment"),&active, false);
|
||||||
mCommandManager.Check(wxT("AutomatedInputLevelAdjustmentOnOff"), active);
|
mCommandManager.Check(wxT("AutomatedInputLevelAdjustmentOnOff"), active);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
active = PlaybackPrefs::GetPinnedHeadPreference();
|
||||||
|
mCommandManager.Check(wxT("PinnedHead"), active);
|
||||||
|
|
||||||
gPrefs->Read(wxT("/AudioIO/Duplex"),&active, true);
|
gPrefs->Read(wxT("/AudioIO/Duplex"),&active, true);
|
||||||
mCommandManager.Check(wxT("Duplex"), active);
|
mCommandManager.Check(wxT("Duplex"), active);
|
||||||
gPrefs->Read(wxT("/AudioIO/SWPlaythrough"),&active, false);
|
gPrefs->Read(wxT("/AudioIO/SWPlaythrough"),&active, false);
|
||||||
@ -2360,6 +2370,18 @@ void AudacityProject::OnToggleSoundActivated()
|
|||||||
ModifyAllProjectToolbarMenus();
|
ModifyAllProjectToolbarMenus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudacityProject::OnTogglePinnedHead()
|
||||||
|
{
|
||||||
|
PlaybackPrefs::SetPinnedHeadPreference(
|
||||||
|
!PlaybackPrefs::GetPinnedHeadPreference(), true);
|
||||||
|
ModifyAllProjectToolbarMenus();
|
||||||
|
|
||||||
|
// Change what happens in case transport is in progress right now
|
||||||
|
auto ctb = GetActiveProject()->GetControlToolBar();
|
||||||
|
if (ctb)
|
||||||
|
ctb->StartScrollingIfPreferred();
|
||||||
|
}
|
||||||
|
|
||||||
void AudacityProject::OnTogglePlayRecording()
|
void AudacityProject::OnTogglePlayRecording()
|
||||||
{
|
{
|
||||||
bool Duplex;
|
bool Duplex;
|
||||||
|
@ -313,6 +313,7 @@ void OnResetToolBars();
|
|||||||
|
|
||||||
void OnSoundActivated();
|
void OnSoundActivated();
|
||||||
void OnToggleSoundActivated();
|
void OnToggleSoundActivated();
|
||||||
|
void OnTogglePinnedHead();
|
||||||
void OnTogglePlayRecording();
|
void OnTogglePlayRecording();
|
||||||
void OnToggleSWPlaythrough();
|
void OnToggleSWPlaythrough();
|
||||||
#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
|
#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
|
||||||
|
@ -19,13 +19,25 @@
|
|||||||
*//********************************************************************/
|
*//********************************************************************/
|
||||||
|
|
||||||
#include "../Audacity.h"
|
#include "../Audacity.h"
|
||||||
|
#include "PlaybackPrefs.h"
|
||||||
|
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
|
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
|
#include "../Prefs.h"
|
||||||
|
|
||||||
#include "PlaybackPrefs.h"
|
namespace {
|
||||||
|
const wxChar *PinnedHeadPreferenceKey()
|
||||||
|
{
|
||||||
|
return wxT("/AudioIO/PinnedHead");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PinnedHeadPreferenceDefault()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PlaybackPrefs::PlaybackPrefs(wxWindow * parent)
|
PlaybackPrefs::PlaybackPrefs(wxWindow * parent)
|
||||||
: PrefsPanel(parent, _("Playback"))
|
: PrefsPanel(parent, _("Playback"))
|
||||||
@ -113,6 +125,11 @@ void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
S.EndThreeColumn();
|
S.EndThreeColumn();
|
||||||
}
|
}
|
||||||
S.EndStatic();
|
S.EndStatic();
|
||||||
|
|
||||||
|
// This affects recording too, though it is in playback preferences.
|
||||||
|
S.TieCheckBox(_("Pinned playback/recording head"),
|
||||||
|
PinnedHeadPreferenceKey(),
|
||||||
|
PinnedHeadPreferenceDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlaybackPrefs::Apply()
|
bool PlaybackPrefs::Apply()
|
||||||
@ -123,8 +140,21 @@ bool PlaybackPrefs::Apply()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PlaybackPrefs::GetPinnedHeadPreference()
|
||||||
|
{
|
||||||
|
return gPrefs->ReadBool(PinnedHeadPreferenceKey(), PinnedHeadPreferenceDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlaybackPrefs::SetPinnedHeadPreference(bool value, bool flush)
|
||||||
|
{
|
||||||
|
gPrefs->Write(PinnedHeadPreferenceKey(), value);
|
||||||
|
if(flush)
|
||||||
|
gPrefs->Flush();
|
||||||
|
}
|
||||||
|
|
||||||
PrefsPanel *PlaybackPrefsFactory::Create(wxWindow *parent)
|
PrefsPanel *PlaybackPrefsFactory::Create(wxWindow *parent)
|
||||||
{
|
{
|
||||||
wxASSERT(parent); // to justify safenew
|
wxASSERT(parent); // to justify safenew
|
||||||
return safenew PlaybackPrefs(parent);
|
return safenew PlaybackPrefs(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@ class PlaybackPrefs final : public PrefsPanel
|
|||||||
virtual ~PlaybackPrefs();
|
virtual ~PlaybackPrefs();
|
||||||
bool Apply() override;
|
bool Apply() override;
|
||||||
|
|
||||||
|
static bool GetPinnedHeadPreference();
|
||||||
|
static void SetPinnedHeadPreference(bool value, bool flush = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Populate();
|
void Populate();
|
||||||
void PopulateOrExchange(ShuttleGui & S);
|
void PopulateOrExchange(ShuttleGui & S);
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
#include "../widgets/Meter.h"
|
#include "../widgets/Meter.h"
|
||||||
|
|
||||||
#include "../tracks/ui/Scrubbing.h"
|
#include "../tracks/ui/Scrubbing.h"
|
||||||
|
#include "../prefs/PlaybackPrefs.h"
|
||||||
|
|
||||||
IMPLEMENT_CLASS(ControlToolBar, ToolBar);
|
IMPLEMENT_CLASS(ControlToolBar, ToolBar);
|
||||||
|
|
||||||
@ -635,15 +636,16 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
|||||||
NoteTrackArray(),
|
NoteTrackArray(),
|
||||||
#endif
|
#endif
|
||||||
tcp0, tcp1, myOptions);
|
tcp0, tcp1, myOptions);
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
// Cannot create cut preview tracks, clean up and exit
|
// Cannot create cut preview tracks, clean up and exit
|
||||||
SetPlay(false);
|
SetPlay(false);
|
||||||
SetStop(false);
|
SetStop(false);
|
||||||
SetRecord(false);
|
SetRecord(false);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Lifted the following into AudacityProject::GetDefaultPlayOptions()
|
// Lifted the following into AudacityProject::GetDefaultPlayOptions()
|
||||||
/*
|
/*
|
||||||
if (!timetrack) {
|
if (!timetrack) {
|
||||||
@ -682,6 +684,8 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StartScrollingIfPreferred();
|
||||||
|
|
||||||
// Let other UI update appearance
|
// Let other UI update appearance
|
||||||
if (p)
|
if (p)
|
||||||
p->GetRulerPanel()->HideQuickPlayIndicator();
|
p->GetRulerPanel()->HideQuickPlayIndicator();
|
||||||
@ -1076,6 +1080,8 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||||||
if (success) {
|
if (success) {
|
||||||
p->SetAudioIOToken(token);
|
p->SetAudioIOToken(token);
|
||||||
mBusyProject = p;
|
mBusyProject = p;
|
||||||
|
|
||||||
|
StartScrollingIfPreferred();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (shifted) {
|
if (shifted) {
|
||||||
@ -1263,6 +1269,14 @@ void ControlToolBar::UpdateStatusBar(AudacityProject *pProject)
|
|||||||
pProject->GetStatusBar()->SetStatusText(StateForStatusBar(), stateStatusBarField);
|
pProject->GetStatusBar()->SetStatusText(StateForStatusBar(), stateStatusBarField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ControlToolBar::StartScrollingIfPreferred()
|
||||||
|
{
|
||||||
|
if (PlaybackPrefs::GetPinnedHeadPreference())
|
||||||
|
StartScrolling();
|
||||||
|
else
|
||||||
|
StopScrolling();
|
||||||
|
}
|
||||||
|
|
||||||
void ControlToolBar::StartScrolling()
|
void ControlToolBar::StartScrolling()
|
||||||
{
|
{
|
||||||
using Mode = AudacityProject::PlaybackScroller::Mode;
|
using Mode = AudacityProject::PlaybackScroller::Mode;
|
||||||
|
@ -107,6 +107,7 @@ class ControlToolBar final : public ToolBar {
|
|||||||
void UpdateStatusBar(AudacityProject *pProject);
|
void UpdateStatusBar(AudacityProject *pProject);
|
||||||
|
|
||||||
// Starting and stopping of scrolling display
|
// Starting and stopping of scrolling display
|
||||||
|
void StartScrollingIfPreferred();
|
||||||
void StartScrolling();
|
void StartScrolling();
|
||||||
void StopScrolling();
|
void StopScrolling();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user