... Unnecessary because transitively included.
But each .cpp file still includes its own .h file near the top to ensure
that it compiles indenendently, even if it is reincluded transitively later.
Following a lengthen discussion on the quality list, consensus is this option
should always have been off by default. The main argument for not changing
it now was that 'on' is what users have come to expect.
... except Audacity.h; and in no others.
Do so even if Experimental.h gets multiply included, as in both the .h and
.cpp files.
This makes it easier to do a text scan to be sure there are no unintended quiet
changes of meaning because of omission of Experimental.h when the flag is
an enabled one.
Also move inclusions of Experimental.h earlier.
Also don't require Experimental.h to be preceded by Audacity.h to define
EXPERIMENTAL_MIDI_OUT correctly.
... so that we can use Track::SharedPointer without undefined behavior even on
tracks that don't yet belong to any TrackList.
Also fix the return type of function template TrackList::Add and remove some
casts.
... Replacing:
Insert => insert
RemoveAt => erase
Remove => erase
IsSameAs => operator == or operator !=
(but only when second argument was true or default)
With the steps in bug 2028, FindFocus() could return a nullPtr - which is now safe.
No right context menu will appear though.
This looks like a bug in wxWidgets.
We could take more/different steps to find the parent for the LabelTrack, if we really want to do that. However, this change is enough to close the bug.
Problems fixed:
1. When adding a label at playback position, the position of the dialog was calculated using the position of the edit cursor
2. When adding a label at selection, the dialog could be to the left of the Audacity Window, and indeed offscreen.
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.
- Now when recording, the recording track has a number >=0 and so the modified
test will set the cursor for editing the label.
- Bug 305 is still fixed, because Nyquist will pass -2 for the restore track.
... and similar wx "variadics," which all treat wxString smartly enough that
you don't need this.
Don't need c_str either to convert wxString to const wxChar * because
wxString has a conversion operator that does the same.
- Dead code from experiments in SelectionBar removed.
- Many warnings about unused parameters fixed with WXUNUSED()
- Many warnings about signed / unsigned comparisons cleaned up.
- Several 'local variable declared but not used' warnings fixed.
Currently, when Audacity exports labels tracks numbers are formatted
with the "%f" specifier, which relies on the current user locale to pick
up the decimal separator.
This means that the numbers indicating the start and the end of the
labeled interval could end up using a comma as a decimal separator.
This makes the exported file less portable, especially in the case of
parsing the exported file with an external tool.
Audacity is already able to _import_ labels tracks independently of the
locale because it uses Internat::CompatibleToDouble(), so do something
symmetric at _export_ time, using Internat::ToString() to make the
exported data locale-independent (i.e. always using a dot as the decimal
separator).
Proposed in https://sourceforge.net/p/audacity/mailman/message/35534945/
NOTE:
When converting numbers to strings FLT_DIG is passed as the
digitsAfterDecimalPoint argument of Internat::ToString(), this is in
order to preserve the look and the alignment of the previous "%f" format
specifier; without that Internat::ToString() would strip trailing zeros.
Audacity requires C++11, this ensures that FLT_DIG is defined.
... Because all hit tests returned all fields blank, or else, returned a
UIHandle object whose Preview method gives the rest of the information; so
the other fields were redundant.