1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-28 14:18:41 +02:00

Add a setting for whether labels can be created by typing

Added a setting for whether labels can be created by typing in a label track.
The setting can be changed in either the Tracks menu, or the Tracks category in Preferences.
By default the setting is set to on.
This commit is contained in:
David Bailes 2016-10-26 13:11:07 +01:00
parent cf547077d5
commit a79596fb4e
4 changed files with 22 additions and 2 deletions

View File

@ -1687,7 +1687,9 @@ bool LabelTrack::CaptureKey(wxKeyEvent & event)
} }
} }
else { else {
if (IsGoodLabelFirstKey(event)) { bool typeToCreateLabel;
gPrefs->Read(wxT("/GUI/TypeToCreateLabel"), &typeToCreateLabel, true);
if (IsGoodLabelFirstKey(event) && typeToCreateLabel) {
AudacityProject * pProj = GetActiveProject(); AudacityProject * pProj = GetActiveProject();
// If we're playing, don't capture if the selection is the same as the // If we're playing, don't capture if the selection is the same as the

View File

@ -920,6 +920,9 @@ void AudacityProject::CreateMenusAndCommands()
AudioIOBusyFlag); AudioIOBusyFlag);
c->AddItem(wxT("EditLabels"), _("&Edit Labels..."), FN(OnEditLabels)); c->AddItem(wxT("EditLabels"), _("&Edit Labels..."), FN(OnEditLabels));
c->AddCheck(wxT("TypeToCreateLabel"), _("&Type to Create a Label (on/off)"),
FN(OnToggleTypeToCreateLabel), 0, AlwaysEnabledFlag, AlwaysEnabledFlag);
c->AddSeparator(); c->AddSeparator();
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -1911,6 +1914,8 @@ void AudacityProject::ModifyToolbarMenus()
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &active, false); gPrefs->Read(wxT("/GUI/SyncLockTracks"), &active, false);
SetSyncLock(active); SetSyncLock(active);
mCommandManager.Check(wxT("SyncLock"), active); mCommandManager.Check(wxT("SyncLock"), active);
gPrefs->Read(wxT("/GUI/TypeToCreateLabel"),&active, true);
mCommandManager.Check(wxT("TypeToCreateLabel"), active);
} }
// checkActive is a temporary hack that should be removed as soon as we // checkActive is a temporary hack that should be removed as soon as we
@ -6694,6 +6699,15 @@ void AudacityProject::OnEditLabels()
DoEditLabels(); DoEditLabels();
} }
void AudacityProject::OnToggleTypeToCreateLabel()
{
bool typeToCreateLabel;
gPrefs->Read(wxT("/GUI/TypeToCreateLabel"), &typeToCreateLabel, true);
gPrefs->Write(wxT("/GUI/TypeToCreateLabel"), !typeToCreateLabel);
gPrefs->Flush();
ModifyAllProjectToolbarMenus();
}
void AudacityProject::OnApplyChain() void AudacityProject::OnApplyChain()
{ {
BatchProcessDialog dlg(this); BatchProcessDialog dlg(this);

View File

@ -377,6 +377,7 @@ void OnAddLabel();
void OnAddLabelPlaying(); void OnAddLabelPlaying();
void DoEditLabels(LabelTrack *lt = nullptr, int index = -1); void DoEditLabels(LabelTrack *lt = nullptr, int index = -1);
void OnEditLabels(); void OnEditLabels();
void OnToggleTypeToCreateLabel();
// Effect Menu // Effect Menu

View File

@ -144,7 +144,7 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
wxT("/GUI/SelectAllOnNone"), wxT("/GUI/SelectAllOnNone"),
true); true);
/* i18n-hint: cut-lines are a lines indicating where to cut.*/ /* i18n-hint: cut-lines are a lines indicating where to cut.*/
S.TieCheckBox(_("Enable cu&t lines"), S.TieCheckBox(_("Enable c&ut lines"),
wxT("/GUI/EnableCutLines"), wxT("/GUI/EnableCutLines"),
false); false);
S.TieCheckBox(_("Enable &dragging of left and right selection edges"), S.TieCheckBox(_("Enable &dragging of left and right selection edges"),
@ -156,6 +156,9 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
S.TieCheckBox(_("Editing a clip can &move other clips"), S.TieCheckBox(_("Editing a clip can &move other clips"),
wxT("/GUI/EditClipCanMove"), wxT("/GUI/EditClipCanMove"),
true); true);
S.TieCheckBox(_("&Type to create a label"),
wxT("/GUI/TypeToCreateLabel"),
true);
#ifdef EXPERIMENTAL_SCROLLING_LIMITS #ifdef EXPERIMENTAL_SCROLLING_LIMITS
S.TieCheckBox(_("Enable scrolling left of &zero"), S.TieCheckBox(_("Enable scrolling left of &zero"),
ScrollingPreferenceKey(), ScrollingPreferenceKey(),