1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-26 01:18:06 +02:00
audacity/src/prefs/TracksBehaviorsPrefs.cpp
David Bailes a13e7191c4 Add an option to use a dialog to enter the name of a new label
Motivation:
1. The text boxes in the label track are not fully accessible for users of screen readers, and I don't think that they can be made to be fully accessible using the accessibility API used by wxWidgets. When such an edit box becomes the focus, this is not announced, and for NVDA users typed characters are not echoed.

2. Provides a work around for bugs 1778 (cannot type diacritics into text label), and 1804 (Windows: Labels do not accept IME (Chinese/Japanese) input).

Fix: Provide an option for a dialog for entering the name. The text box in the dialog is accessible for screen readers. On windows the text box receives wm_keydown and wm_char messages and so is a work around for bug 1804. Being a standard text box, it will presumably be a work around for bug 1778.

1. There is a new option in track behaviors: "Use dialog for the name of new label", which is off by default.

2. When using the commands "Add label at selection" and "Add label at playback position", when the dialog closes, focus is returned to the track which was the focus before the dialog opened. I think this is more convenient for users of screen readers.
2018-05-11 10:23:48 +01:00

135 lines
3.6 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
TracksBehaviorsPrefs.cpp
Steve Daulton
*******************************************************************//**
\class TracksBehaviorsPrefs
\brief A PrefsPanel for Tracks Behaviors settings.
*//*******************************************************************/
#include "../Audacity.h"
#include "TracksBehaviorsPrefs.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../Experimental.h"
#include "../Internat.h"
TracksBehaviorsPrefs::TracksBehaviorsPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: two nouns */
: PrefsPanel(parent, winid, _("Tracks Behaviors"))
{
Populate();
}
TracksBehaviorsPrefs::~TracksBehaviorsPrefs()
{
}
const wxChar *TracksBehaviorsPrefs::ScrollingPreferenceKey()
{
static auto string = wxT("/GUI/ScrollBeyondZero");
return string;
}
void TracksBehaviorsPrefs::Populate()
{
mSoloCodes.Add(wxT("Simple"));
mSoloCodes.Add(wxT("Multi"));
mSoloCodes.Add(wxT("None"));
mSoloChoices.Add(_("Simple"));
mSoloChoices.Add(_("Multi-track"));
mSoloChoices.Add(_("None"));
//------------------------- Main section --------------------
// Now construct the GUI itself.
ShuttleGui S(this, eIsCreatingFromPrefs);
PopulateOrExchange(S);
// ----------------------- End of main section --------------
}
void TracksBehaviorsPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetBorder(2);
S.StartScroller();
S.StartStatic(_("Behaviors"));
{
S.TieCheckBox(_("A&uto-select, if selection required"),
wxT("/GUI/SelectAllOnNone"),
false);
/* i18n-hint: Cut-lines are lines that can expand to show the cut audio.*/
S.TieCheckBox(_("Enable cut &lines"),
wxT("/GUI/EnableCutLines"),
false);
S.TieCheckBox(_("Enable &dragging selection edges"),
wxT("/GUI/AdjustSelectionEdges"),
true);
S.TieCheckBox(_("Editing a clip can &move other clips"),
wxT("/GUI/EditClipCanMove"),
true);
S.TieCheckBox(_("\"Move track focus\" c&ycles repeatedly through tracks"),
wxT("/GUI/CircularTrackNavigation"),
false);
S.TieCheckBox(_("&Type to create a label"),
wxT("/GUI/TypeToCreateLabel"),
true);
S.TieCheckBox(_("Use dialog for the &name of a new label"),
wxT("/GUI/DialogForNameNewLabel"),
false);
#ifdef EXPERIMENTAL_SCROLLING_LIMITS
S.TieCheckBox(_("Enable scrolling left of &zero"),
ScrollingPreferenceKey(),
ScrollingPreferenceDefault());
#endif
S.TieCheckBox(_("Advanced &vertical zooming"),
wxT("/GUI/VerticalZooming"),
false);
S.AddSpace(10);
S.StartMultiColumn(2);
{
S.TieChoice(_("Solo &Button:"),
wxT("/GUI/Solo"),
wxT("Standard"),
mSoloChoices,
mSoloCodes);
}
S.EndMultiColumn();
}
S.EndStatic();
S.EndScroller();
}
bool TracksBehaviorsPrefs::Commit()
{
ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S);
return true;
}
wxString TracksBehaviorsPrefs::HelpPageName()
{
return "Tracks_Behaviors_Preferences";
}
TracksBehaviorsPrefsFactory::TracksBehaviorsPrefsFactory()
{
}
PrefsPanel *TracksBehaviorsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
{
wxASSERT(parent); // to justify safenew
return safenew TracksBehaviorsPrefs(parent, winid);
}