Commit Graph

81 Commits

Author SHA1 Message Date
Paul Licameli
a465ce0046 Naming of many menu sections, so they can be attachment sites 2020-01-31 21:12:36 -05:00
Paul Licameli
6b551d10c5 Fix indentations 2020-01-30 12:14:22 -05:00
Paul Licameli
a84da3dee1 Remove Separator items from menu descriptions; use Section(...) 2020-01-30 12:12:48 -05:00
Paul Licameli
9639ba84f4 Reimplement commit 512c27d, fixing menus & shortcut keys on Windows 2020-01-29 13:39:19 -05:00
Paul Licameli
ef41b8f2ee Fix static initialization order problem for more ReservedCommandFlags 2020-01-29 11:24:25 -05:00
Paul Licameli
9093364b8c Fix other problems since commit f6e5696...
... Problem with static initialization order of ReservedCommandFlags, caused
wrong enablement of menu items (at least on Mac), such as Plot Spectrum or
Contrast enabled when there was no selection
2020-01-28 17:49:07 -05:00
Paul Licameli
393a098b69 Store a string identifier in each menu item...
... which is not yet used for anything.

It could be used to describe textual paths for attaching plug-in menu items.

Strings are only path local, not necessarily globally unique, and may be
left empty for separators and for groups that should be transparent to
path identification.

It may also be empty for certain sub-menus, such as those that group effects
according to the changeable criteria in Preferences.
2020-01-24 18:05:56 -05:00
Paul Licameli
f6e5696146 Most functions defining menus compute once and cache the result...
... Except a few where project or plugin manager state or preferences are
needed to compute the items, so evaluation is delayed, often inside lambdas

Comment "Delayed evaluation" wherever there are exceptions
2020-01-24 18:05:56 -05:00
Paul Licameli
512c27d422 Simplify the FN macros in src/menus/*.cpp...
... Eliminate repetitious passing of the finder function into each of the
calls to Command and CommandGroup.
2020-01-24 18:05:56 -05:00
Paul Licameli
1f283a8981 Fewer includes of WaveformSettings.h, SpectrogramSettings.h...
... See ultimate origin of some of the deleted lines at 4724c6a

Whatever change it is that needs loading by LoadPrefs -- do it instead right
after any possibility of changes to the relevant preferences, in the Commit()
functions of SpectrumPrefs and WaveforPrefs
2020-01-19 19:11:14 -05:00
Paul Licameli
2570b56176 Rename Maybe and its members more like std::optional of C++17 2020-01-19 11:38:12 -05:00
Paul Licameli
a93c4472f5 TrackList has back-pointer to project...
... and Track::GetOwner() is publicized, so that now you can find the
the AudacityProject, if any, that owns a given Track; this will help eliminate
some uses of GetActiveProject
2020-01-06 14:14:21 -05:00
Paul Licameli
390d833229 Remove one more GetActiveProject in a menu command handler 2020-01-04 14:00:32 -05:00
Paul Licameli
c9a9c06bd0 Pass AudacityProject * into preference panel factories 2020-01-04 12:37:57 -05:00
Paul Licameli
353a235708 Bug2224: Should have error message trying to cut without selection...
... I got bitten by problems of static variable initialization order
2019-12-31 12:08:07 -05:00
Paul Licameli
259359a283 Update some calls expecting TranslatableString in disabled code 2019-12-28 23:49:14 -05:00
Paul Licameli
dc39f22442 AudacityMessageBox takes TranslatableString message and caption 2019-12-20 21:32:50 -05:00
Paul Licameli
4eb220e7b9 TranslatableString for undo history short and long descriptions 2019-12-16 14:19:23 -05:00
Paul Licameli
503ccabdd8 TranslatableString caption & message in MessageBoxException 2019-12-16 10:58:05 -05:00
Paul Licameli
53ee9c9800 TranslatableString for titles, names, labels of wxDialogWrappers...
... Found one missed translation in CommandTargets.cpp
2019-12-16 10:58:05 -05:00
Paul Licameli
a8de4d9e50 Construct MenuItem with untranslated label, so it can be static...
... and other storage of TranslatableString instead of naked wxString, for
management of menu items, in CommandManager
2019-12-12 15:49:00 -05:00
Paul Licameli
70ec69fa3d Pass untranslated command labels to CommandManager...
... and deduce whether to exclude from macros inside NewIdentifier, simplifying
argument lists further

Also fix the localization of "..." added to names by PluginMenus.cpp
2019-12-12 15:15:59 -05:00
David Bailes
14b53e6736 Bug 2251 - Windows: NVDA sometimes reads the name of the track twice
Problem:
Currently calling Track::EnsureVisible() also sets the track as focus.
In Audacity 2.3.3 the timing of the code to set the focus was changed. Rather than a direct call, an event is queued, and then the focus is set. This has changed the timing of the focus event which is sent with respect to other focus and name change events. In particular in the case of toggling the selectness of the focused track, this moved the focus event to be after the name change event.
These changes only had an effect on NVDA - Jaws and Narrator were unaffected.

The introduction of this bug has highlighted an existing problem.
1. There are a small number of existing cases where a track needs to be visible, but where it is already the focus, and so setting the focus is unnecessary. For example, pressing Enter to toggle whether a track is selected.
2. Some of the Audacity code which calls EnsureVisible() is written with the assumption that EnsureVisible() doesn't set the focus, and so there are unnecessary focus events. Whilst other code which calls EnsureVisible() assumes that it also sets the focus. Confusion.

The Fix:
Remove the setting of focus from within Track::EnsureVisible(), and so remove the unnecessary focus events.
Calls to set the focus were added before calls to EnsureVisible where the code was relying on EnsureVisible to set the focus. In TrackPanel::ProcessUIHandleResult, and TrackPanel::OnMouseEvent, I wasn't sure if the focus needed to be set, so called it anyway to ensure that the behaviour did not change.

So I would like to remove the setting of focus from within Track::EnsureVisible(), and add explicit calls to set the focus where necessary.
I think this would make the code clearer, remove unnecessary calls to set the focus, and make it easier to keep NVDA happy.
2019-11-26 14:43:25 +00:00
David Bailes
cff0011ee4 Bug 2225 - No error message when trying to delete with no selection
The problem only applies to the delete on the edit menu (ctrl+k), pressing delete or backspace work.

Fix: add a couple of missing flags.
2019-10-05 10:17:58 +01:00
David Bailes
9e51dba3db Bug 2215 - Cut does not work when in Pause mode
In bool MenuManager::TryToMakeActionAllowed(), there's the condition:
(MissingFlags & enabler.possibleFlags()) == MissingFlags

that is, the missing flags has to be a subset of the possible flags.
For cut in pause mode, this condition is not met for the enabler stopIfPaused, because MissingFlags also includes the CutCopyAvailableFlag, which is not one of the enabler's possible flags.
It is not sensible for the missing flags to have to be a subset of the possible flags, because for this to work, for each enabler the possible flags would have to include other flags that could need fixing by other enablers.

Fix:
1. Change the condition to the intersection of the missing flags and possible flags is non-empty.
2. In CutCopyAvailableFlag, remove the condition !AudioIOBusyPred(). If this is present, then due to the first change, paused audio could cause all audio to be selected even when there was a selection. The commands for which this flag is used are cut and copy, and they already have AudioIONotBusy flags, so this change should not affect previous behaviour.
2019-10-02 10:39:15 +01:00
James Crook
c65eb8fea5 Bug 2193 - Remove Tracks in Tracks menu is grayed-out if there is no selection 2019-08-17 18:52:46 +01:00
Paul Licameli
51f2578e0a Bug2184: should not grey Effect menu when selection is point 2019-08-03 12:03:46 -04:00
James Crook
0bd1beae9a Bug 2049 - ENH: Noise Reduction error message for no selection is unhelpful 2019-07-29 08:29:48 +01:00
Paul Licameli
02075d5b43 Remove some fetches of TrackPanel 2019-07-03 18:42:33 -04:00
Paul Licameli
52ff705b0d ScrollIntoView out of TrackPanel, into ProjectWindow 2019-07-03 13:32:32 -04:00
Paul Licameli
a5364119eb Eliminate many calls to RedrawProject & TrackPanel::Refresh()...
... Let the window respond to an undo manager event instead, whenever there
is a push or modify

Maybe this makes a few unnecessary redraws that did not happen before.  If
that is important, then we should figure out how to put the logic for eliding
the redraw into ProjectWindow, and the extra information needed for the
decision into the events, but not make intrusions in other code all over the
place.
2019-07-02 08:17:01 -04:00
Paul Licameli
f77ddc43d9 Smuggle AudacityProject into LabelTrackView::GetSelectedIndex() ...
... and eliminate some more calls to GetActiveProject
2019-06-28 18:09:29 -04:00
Paul Licameli
97f48c4326 Bug2133: Trim and Silence commands should not affect Note tracks 2019-06-28 10:51:41 -04:00
Paul Licameli
2257fa642a Remove TrackPanel::EnsureVisible; TrackList sends an event instead 2019-06-25 10:54:55 -04:00
Paul Licameli
b6077fd3cd Lower DoReloadPreferences into PrefsDialog.cpp 2019-06-25 00:14:53 -04:00
Paul Licameli
8db51416bc Lower DoEditMetadata into Exporter 2019-06-25 00:14:53 -04:00
Paul Licameli
684a948fd2 Don't reuse EditActions::DoUndo...
... instead, when timer recording is cancelled, don't push state and pop it
at once, but just roll it back.
2019-06-25 00:14:52 -04:00
Paul Licameli
02e620d35f Move functions into new file SelectUtilities.cpp ...
... so that other files do not have link dependency on SelectMenus.cpp

The new file enlarges the big s.c.c. to 24
2019-06-24 23:06:44 -04:00
Paul Licameli
5240c42cb6 No more LabelTrack::HasSelection...
... eliminating the last dependency of LabelTrack.cpp on LabelTrackView.h
2019-06-20 11:47:55 -04:00
Paul Licameli
e3efd52026 Move many declarations into LabelTrackView & define its Copy() 2019-06-20 10:47:25 -04:00
Paul Licameli
c0adb35839 Command flag functions out of Menus.cpp, reducing its dependencies...
... Mostly into CommonCommandFlags.cpp, but some elsewhere, to avoid giving
that new file problematic dependencies on LabelTrack, ControlToolBar, and
EffectManager.

Note that CutCopyAvailableFlag is critically ordered, for message purposes,
only with AudioIONotAvailableFlag, the only flag with a message that it combines
with in menu item definitions.

The dependency on LabelTrack.cpp might not be a bad one later, if the track and
its view can be separated, and that would allow CutCopyAvailableFlag to be
put with the others.  But much other work on LabelTrack must happen first.
2019-06-16 01:21:05 -04:00
Paul Licameli
0f2278d394 Eliminate the confusing mask from CommandManager entries...
... In fact it was only ever different from flags when flags had the special
NoAutoSelect and mask did not.  Now put that bit in the mask too, and make
the special NoAutoSelect always true in MenuManager::GetUpdateFlags().  This
still preserves the intended effects of NoAutoSelect.
2019-06-14 10:12:45 -04:00
Paul Licameli
a34f1cbba5 Reimplement the rejection of select-all-on-none for certain commands...
... Specify it in the menu descriptions.  Don't put special ad hoc logic
in Menus.cpp.
2019-06-14 10:12:44 -04:00
Paul Licameli
36e3a03c7f Redo CommandFlags as std::bitset, allow registration of values 2019-06-14 00:31:15 -04:00
Paul Licameli
291bd7258f Track.cpp does not depend directly on its subclasses 2019-06-12 11:14:19 -04:00
Paul Licameli
e2c6720436 MenuManager listens for undo events, intrudes less in other code 2019-06-12 11:08:50 -04:00
Paul Licameli
5eaf0a649b ProjectWindow listens for undo events, intrudes less in other code 2019-06-12 11:08:50 -04:00
Paul Licameli
f03684db4f New class ProjectHistory split from ProjectManager for undo, etc...
... And yet fewer inclusions of Projectmanager.h, though it's still not yet
free of cycles
2019-06-09 12:10:48 -04:00
Paul Licameli
4f940c855d New files for ProjectWindow 2019-06-03 01:43:26 -04:00
Paul Licameli
fee5582826 New files for ProjectManager 2019-06-03 01:21:12 -04:00