Commit Graph

63 Commits

Author SHA1 Message Date
freddii
2593a84d56 Fix some spelling mistakes. 2021-01-12 09:55:31 +00:00
Yuri Chornoivan
d1ada5f08c Fix minor typos 2020-04-11 10:06:24 +01:00
Paul Licameli
8792e08bb9 MessageForScreenReader takes TranslatableString 2019-12-23 19:22:06 -05:00
Paul Licameli
acfd2b7010 TrackFocus is a new attached object...
... removing the need to use TrackPanel to get and set the focused track

ProjectAudioManager loses its direct dependency on TrackPanel
2019-07-03 19:10:21 -04:00
Paul Licameli
25f4d6cf8b TrackPanelAx does not depend on TrackPanel...
... TrackPanelAx now sends an event to the project when track focus changes,
and TrackPanel listens for it.

TrackPanel also initializes TrackPanelAx with a callback to do the details of
rectangle calculation.
2019-06-25 11:24:40 -04:00
Paul Licameli
2257fa642a Remove TrackPanel::EnsureVisible; TrackList sends an event instead 2019-06-25 10:54:55 -04:00
David Bailes
be55d891db Trackpanel accessibility: incorrect focus can be read
Problem: If the initial focus is a control in a toolbar, then after applying an effect such as amplify, then the focus is read as being a track, not the control in the toolbar.
TrackPanelAx::SetFocus() can be called when the TrackPanel is not the focus, and send a focus event.

Fix: In TrackPanelAx::SetFocus(), only send a focus event if the TrackPanel is the focus.
2019-05-17 09:56:01 +01:00
Paul Licameli
6c57948d8f Remove unnecessary #include-s from .cpp files...
... 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.
2019-05-16 17:21:00 -04:00
Paul Licameli
ab0c0d9cb1 Fix some comments 2019-04-23 13:40:17 -04:00
David Bailes
8e8dd459a4 Accessibility: make TrackPanel more accessible using Narrator
Problem:
Using the Narrator screen reader on Windows 10, there are a couple of issues:
1. After making a change to solo/mute/selectedness, the name and state of the track is not automatically read.
2. Text sent to TrackPanelAx::MessageForScreenReader() is not read.

Fixes:
After a focus event, if the focus has not changed, Narrator does not read the name, even if the name has changed. So:
1. In TrackPanelAx::Updated(), add a name change event. (The focus event has been retained to keep Window-Eyes happy until we stop supporting it.)
2. In TrackPanelAx::MessageForScreenReader(), change the focus event to a name change event. Note the Window-Eyes does not read these messages anyway, because when the role is set to wxROLE_NONE it does not read the name. So there's no point in including a focus event for the benefit of Window-Eyes.
2019-03-25 14:06:16 +00:00
Paul Licameli
a915a510bd include <wx/setup.h> in all files where wxUSE* macros are used...
... even if it's redundant; improving on what was done at b47e2f9
2019-03-23 14:56:02 -04:00
Paul Licameli
bb634614e6 static overloads of Track::SharedPointer when null check is needed...
... Some optimizing compilers don't let us get away with null check on this
in a nonstatic member function.
2019-03-23 13:23:46 -04:00
Paul Licameli
f45300f032 This is only comments, in files where USE_ macros are tested...
... following the comment convention used in the preceding commit.
2019-03-22 12:38:30 -04:00
Paul Licameli
15777834e0 Remove calls to TrackPanel::FindTrackRect for finding control area 2019-03-17 15:23:51 -04:00
Paul Licameli
43899da80d Remove some nested #include from TrackPanelAx.h 2019-03-17 15:05:24 -04:00
Paul Licameli
6f89c48873 Reimplement Track::Pointer using std::enable_shared_from_this...
... now the Track need not be owned yet by a TrackList
2019-03-16 13:11:32 -04:00
Paul Licameli
2db49dc1f0 Use standard library style members of wxArrayString (and wxString) ...
... which will make it easier to change the types of those containers to
std::vectors of other string-like classes

for wxString,

IsEmpty => empty
Clear => clear
Alloc => reserve

for wxArrayString,

Count => size
GetCount => size
IsEmpty => empty
Add => push_back
Clear => clear
Empty => clear
Sort => std::sort (only with default comparator)
SetCount => resize
Last => back
Item => operator []
Alloc => reserve
2019-03-10 14:43:57 -04:00
Paul Licameli
669054b4f4 Remove many uses of GetLink in TrackPanel 2018-10-01 13:42:24 -04:00
Paul Licameli
23a85893a1 Rewrite some iterations over tracks and channels in TrackPanel 2018-10-01 11:24:25 -04:00
Paul Licameli
fd10ed26cd Use TypeSwitch and track_cast in TrackPanel 2018-10-01 10:58:33 -04:00
Paul Licameli
89748cbe3c Remove "skiplinked" argument of old track iterators 2018-10-01 10:35:46 -04:00
Paul Licameli
a5c50a112a more const in drawing functions 2018-09-13 13:53:58 -04:00
David Bailes
5429148186 TrackPanel: improvements to the accessibility names of the tracks
Changes to the state of the track which are appended to the track name, as suggested by Robert.
Mute On becomes Muted.
Solo On becomes Soloed.
Select On becomes Selected
Sync Lock Selected becomes Sync Locked.
2018-07-06 10:29:22 +01:00
David Bailes
8b87e18c6d Accessibility: clean up track focus events after an effect is applied.
Problem. When an effect is applied, whatever track is the original focus, there is a focus event for track one. This causes NVDA to read out the track name of track 1, which is unnecessary noise.
The reason for this is that the execution of the Progress dialog destructor causes AudacityProject::OnActivate() to be called which causes a set focus on the TrackPanel. When this happens, the pointers to the selected tracks have changed, but the final focus has not been set (at the end of AudacityProject::DoEffect()). So TrackPanelAx::GetFocus returns the first track.

Fix: Modify TrackPanelAx::GetFocus so that if the existing pointer to the focused track is null, then use the track at the same position, if it exists.
2018-06-26 09:13:29 +01:00
David Bailes
f027708fe1 Fix an issue caused by the accessibility changes in wxWidgets 3.1.1
The main change in wx accessibility is this:
7dab555f71 (diff-04f5191d86f95b1c4d5d9c979da65878)

However wxWindowAccessible has not been updated to take into account of that change. In particular wxWindowAccessible::GetParent() was always wrong, but it was consistent with the rest of the framework. Now it's wrong and inconsistent. This function should return an object with role window, and which has the same name.

The fix is to introduce class WindowAccessible, which is effectively our own version of wxWindowAccessible. This class does not override GetParent(), and so just relies on a standard accessible object to to the right thing in wxIAccessible::get_accParent() (which is does). This class also allows us to have our own version of GetName(), which allows us to set the accessibility names of buttons.

These changes will break the accessibility of Audacity if it is built with wxWidgets 3.0.X. If this is a problem, then there could be some #if stuff in WindowAccessible.h to turn the WindowAccessible class into one which simply inherits from wxWindowAccessible, and doesn't override anything.
2018-04-03 14:57:59 +01:00
Paul Licameli
83c30620cb Fix Mac build, and avoid global variable ::GetActiveProject() 2018-03-14 09:37:08 -04:00
David Bailes
49eb7ddb61 Fix mac build
Changed the Windows constant CHILDID_SELF to the equivalent wx constant wxACC_SELF, which I should have used in the first place.
2018-03-12 15:57:32 +00:00
David Bailes
59d1ca46df TrackPanelAx: add Select function
Added an override for Select. This enables NVDA to move the focus to the current navigator object, and Jaws to move the focus to the current element when using the touch cursor.

For info on accSelect:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd318474(v=vs.85).aspx
2018-03-12 13:47:27 +00:00
David Bailes
0c2c956893 TrackPanelAx: add Navigate function for NVDA object navigation
accNavigate is deprecated, but NVDA uses it for object navigation. (Jaws and narrator do not).
So add Navigate function to TrackPanelAx.

Info on accNavigate:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd318473(v=vs.85).aspx
2018-03-12 08:55:30 +00:00
Paul Licameli
d08ae18ca4 Change details of focusing of tracks in presence of pending ones...
... Don't focus a pending changed track but remap it to the original.

You can focus a pending added track.
2018-02-21 19:20:58 -05:00
Paul Licameli
4ef8da8f16 Revert "Preliminaries to support better interaction of undo and recording"
This reverts commit 6e75ae58ac, reversing
changes made to 714d53e00f.
2018-01-14 21:36:33 -05:00
Paul Licameli
7d57a17ff4 Change details of focusing of tracks in presence of pending ones...
... Don't focus a pending changed track but remap it to the original.

You can focus a pending added track.
2018-01-14 19:04:01 -05:00
Paul Licameli
c6696f1b49 Move definition of _ and related into Internat.h 2018-01-06 21:03:32 -05:00
David Bailes
4de3264d60 Remove Track: improvement for screen readers.
After a focused track is removed by pressing shift+c, the new focus is often not correctly read by screen readers, especially nvda.
The fixes:
1. In AudacityProject::RemoveTrack, set the new focus after the track has been deleted, rather than before. (If it is set before, then the childId can be wrong after the track is deleted.

2. In TrackPanelAx::SetFocus, send an object focus event if there are no tracks. This is so the focus is correctly set when there are no tracks after a track has been deleted.

3. In TrackPanelAx::GetFocus, given the change in 2. , only call SetFocus if the focus has changed, to avoid sending unnecessary focus events. (Screen readers are normally tolerant of this, but Window Eyes became a bit too talkative.)
2017-07-04 14:41:00 +01:00
David Bailes
27f706bb2c TrackPanelAx::SetFocus - minor fix
Fix for bug introduced by commit fb18f6a: mFocusedTrack needs to be updated before the focus event is sent to ensure that when TrackPanelAx::GetState is called, mFocusedTrack is the focused track.
2017-06-28 11:48:09 +01:00
Paul Licameli
d6e09e142f more build fixes 2017-06-25 21:11:33 -04:00
Paul Licameli
321919301e Use weak_ptr to remember focused track, don't ask for trouble 2017-06-25 13:35:15 -04:00
Paul Licameli
4b4beceeec Slight change to screen reader rectangles about tracks on Windows 2017-06-05 15:46:13 -04:00
Paul Licameli
c38efc1fcd FindTrackRect omits all margins; better screen reader focus rects...
... Formerly it was outside of the yellow focus at the right side.  Now it
follows the yellow consistently on four sides.

The constant dx in TrackPanelAx::GetLocation might be adjusted.

No change of behavior is intended at other uses of FindTrackRect
2017-06-04 11:31:46 -04:00
Paul Licameli
6c4cf46c06 Move mute and solo state into PlayableTrack 2017-03-29 13:45:08 -04:00
Pokechu22
bdb0790150 Fix compiling when USE_MIDI not is defined
Compilation broke in TrackPanel in ed277ec and in TrackpanelAx in a96c719c.
2017-03-27 01:12:16 -04:00
David Bailes
ff9763f984 Add two commands to move the cursor/selection to next/prev label
The two commands are "selection to next label" and "selection to previous label".
They have default shortcuts alt+right and alt+left.

A label track does not have to be the focus. If there is a single label track in the project, that it used. If there is more than one label track, then the first label track, if any, starting at the focused track is used.

If the commands are used during playback of the project, playback continues from the new cursor/selection.

The commands provide feedback to screen readers: the name of the label, and position in the form of "i of n".
2016-10-24 14:24:20 +01:00
Paul Licameli
837173e9ad Mac screen reader speaks the tracks' types, as also on Windows 2016-09-15 09:45:33 -04:00
Paul Licameli
5761972dfa BHug1488: Don't crash exiting from command-line benchmark test...
Problem was that cfd7648fce fixed a memory leak
but created a dangling pointer bug, which does not happen during usual run
of Audacity because AudacityProject::OnCloseWindow is reached then before
destroying AudacityProject.

Fixed it by using a std::shared_pointer for the TrackList that both
AudacityProject and TrackPanel must use.
2016-08-20 13:58:56 -04:00
David Bailes
cf79f91da0 Fix bug 1418 - track focus problem.
To reproduce the bug: open audacity, press r, then spacebar to record some audio. The track is not the focus - the track panel is.

This was caused by commit 519a202. Most of the changes in this commit were latter reverted in commit 80e19f2, but not the changes to the file src/TrackPanelAx.cpp

The fix is to go back to the version of TrackPanelAx.cpp in commit db35301, the commit before 519a202.
2016-06-24 13:59:10 +01:00
Paul Licameli
519a2020ff Navigation to and from the ruler using up and down arrow keys...
... This affects those keys (and NUMPAD arrows), also (shift-)ctrl-f6,
ctrl-home, ctrl-end (which are command-left and right on mac)

Those should be tested to ensure correct restoration of the yellow rectangle,
appropriately in the tracks or the ruler.

This should also be tested with and without the Tracks preference for cyclic
movement of the focus.
2016-05-06 16:50:24 -04:00
Paul Licameli
7c4c45a0d5 "new"->"NEW" in comments, easier to find remaining naked operator new 2016-02-14 18:52:41 -05:00
Paul Licameli
d39eaa4e65 Remove WaveTrack.h from other headers 2015-07-28 10:02:05 -04:00
David Bailes
a96c719c54 Addition to the accessibility names of tracks, suggested by Robert Hanggi. If the track is a Label, Time or Note track, then this information is added after the track name. 2015-06-06 13:22:16 +01:00
David Bailes
df9481b3d9 Fix for accessibility names of tracks due to problems with translations. The strings for mute on, solo on, etc contained a leading space. Many of the translations of these strings did not include the leading space, resulting in merged words. Therefore a space has been added as a separate string. Because screen readers are not affected by multiple spaces, the leading spaces have been left in the original strings so that no new translations are needed. 2015-06-06 11:52:04 +01:00