... 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
... It must be empty, or else one extension not including the leading dot;
then correct the string passed to FileSelector in lib-src, which should be
a filename pattern
- There are two new commands: Scrub Backwards and Scrub Forwards.
- These commands appear on the Transport sub menu of the Extra menu.
- The commands have default shortcuts U and I, and are in the standard default set.
- After pressing one of the two keys, playback continues until the key is released. (Note that this means that the command on the Extra > Transport menu can't actually be used for scrubbing as it executes a KeyDown immediately followed by a KeyUp, but the menu items are needed so that the current keystrokes can be seen and changed.)
- Playback starts from the cursor position, or the start of a time selection if there is one.
- The speed of playback is determined by the zoom level. If the zoom level is normal, then the playback speed is one quarter of the normal playback speed. Zooming in (Ctrl + 1), halves the playback speed, and zooming out (Ctrl + 3) doubles the playback speed. There are minimum and maximum playback speeds of one sixteenth, and four respectively.
- You can scrub to the end of the audio, even if there is an initial selection. In other words, scrubbing forwards does not automatically stop at the end of the selection.
- Normally, when one of the keys is released, the position of the cursor is set to the time when the key was released.
- If during the time one of the keys is pressed the left bracket and or right bracket keys are pressed to set the start and/or end of the selection, then when the scrubbing key is released, the change to the selection made by pressing the bracket keys is preserved - the position of the cursor is not set to the time when the key was released.
This implementation is affected by two existing bugs:
1. Bug 1954 - Clicks may occur starting/pausing play-at-speed or Scrub. (See comment 19 and attached image).
2. Bug 1956 - Windows: MME and WDS playback cursor is buffer length ahead of actual audio playing. This means that on Windows, WASAPI is preferable if scrubbing is being used for the accurate positioning of the cursor.
... in cases of "TranslatableString" that are not really translated.
This makes it easier to scan the code for such unusual constructions of
TranslatableString, distinct from mere mentions of the TranslatableString type.
... and deduce whether to exclude from macros inside NewIdentifier, simplifying
argument lists further
Also fix the localization of "..." added to names by PluginMenus.cpp
... The purpose of the boolean field in command entries was to exclude certain
menu commands from being steps in macros, because they require user interaction.
Effects are never meant to be excluded, even though they normally have dialogs,
but in the context of macro execution, the parameters are supplied by other
means.
... include it in the msgid intead, to get appropriate translations. For
instance some locales use the same character but prefer to insert a space
before it.
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.
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.
... Do not include CommonCommandFlags in Menus.cpp, but PluginMenus is
high-level enough to do the special case changing of flags.
see commit 0bd1beae9a
... which was redundant with what happens in the yield to idle events in
ProjectAudioManager::Stop.
This removes direct dependency of ProjectAudioManager on ControlToolBar.
And remove another #include we don't need
... 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.
... This also causes a momentary push-down of the stop button, which happens
in ControlToolBar::StopPlaying, really to be visible, as was apparently the
intent.
For instance, when playing, then clicking in the quick-play ruler to restart
the play elsewhere.
... so most calls to ControlToolBar::SetPlay are removed. One remains in
TransportMenus, which will not be problematic for untangling dependencies,
and one remains where the toolbar remakes its own buttons.
But the routines that start and stop the streams, importantly, don't use it.
Fix:
Call TrackPanel::OnTrackMenu(Track *t) with a track pointer.
Query:
Is there any reason why this function's parameter has a default value of NULL?
... not the best thing for the long term, but hidden dependencies on
TransportMenus.cpp are eliminated
Tying CommonCommandFlags again into the big component, which is now 26
... though in a small cycle with each other, by moving RealtimeEffectManager to
new files, which remain in the big component.
Net loss of 1, the big component now has 27 files
... and updating of them is accomplished privately in implementation files,
reducing intrusions into TrackPanel and ProjectWindow
This removes #include-s from TrackInfo.cpp, leaving dependency cycles better
than previously
... and eliminate some unnecessary calls to SubstitutePendingChangedTrack,
because the track and the substitute store Y and height in their shared
TrackView object.
Also make GetMinimizedHeight() virtual to avoid inclusion of TrackPanel.h in
TrackView.cpp.
... 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.
... 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.
... New files, but (almost) empty; don't use the global variable gAudioIO,
but use one of two accessor function names (which are the same function for
now).
AudioIOBase will have fewer dependencies than AudioIO -- in particular, no
dependency on tracks.
It won't include StartStream. It will contain functions to query the
present state of streams, and device capabilities.
... The former will handle File menu items, and the choosing of file paths to
write; the latter will handle the XML contents and do auto-save. Auto-save is
a lower-level thing that must be done in many places whenever undo history
is pushed or modified.
... handling the callbacks from the selection toolbars.
Next ProjectFileManager will be split out of ProjectManager, and
ProjectSelectionManager will be used by it during file opening, so separating
files for it avoids a cycle.
... that is, a factory function, open, close, import, undo/redo/rollback.
Also the callbacks from AudioIO, which need to invoke undo history push when
recording stops.
It is meant as a high-level class using several of the other things attached
to the project, while AudacityProject will be a low level class acting mostly
as just the container of the attached structures.
... as a preparation for splitting up class AudacityProject.
Use ProjectWindow as an alias for AudacityProject, and fetch it from the
project with a static member function, where certain of its services are used;
pretending they are not the same class.
Use global accessor functions to get wxFrame from the project where only
wxFrame's member functions are needed, so there will be less dependency on
ProjectWindow when it becomes a distinct class.
... Rename it as SetStatus; make it part of AudacityProject not
TrackPanelListener; and use a roundabout event signalling to cause the timer
restart.
Because SetStatus will be one of very few things left in AudacityProject, but
the timer handling will be part of another class decoupled from it.
And TrackPanelListener won't really be needed: TrackPanel will not need to
pretend it doesn't know what an AudacityProject is.
... Just one low-level function to simply set the variable, and one
high-level function that also pushes notifications. The danger of infinite
recursion in the toolbar code, as in the previous commit, doesn't exist here.
... use registered factories instead, so class AudacityProject needn't know
the other classes.
This frees 9 .cpp files, related to various non-modal dialogs, to higher
levels out of the big strongly connected component, as determined by
scripts/graph.pl!
But in reality there is still link dependency on them that the script does not
detect. The remaining dependency is via the declarations of ViewMenu,
EffectMenu, etc. in Menus.cpp.
That could be broken with a registration system for menus.
... Generalizing what was first done at 280e8d9 for certain menu command
handlers.
Allow core data structures to host data attached by other code, on which it
need have no compilation or link dependencies.
... There was no reason to store the help location preferences as per-project
state. Also move the dialog for quick fixes near its only use in
HelpMenus.cpp.
This takes 22 files out of the big strongly connected component, notably
the much used lower level utilities, ErrorDialog and AudacityException.
HelpSystem itself is still in a small cycle with LinkingHtmlWindow.
... 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 Experimental.h, but see preceding commit.
This is especially important in the header files.
Be sure there are no quiet changes of meaning when a header file is included
in a different context, not having seen Audacity.h. Rather include Audacity.h
even if redundantly.
Also, in some header files, move more inside the include-guard #ifdef-#endif
pair.
... so that USE_* macros will be seen first, and so
EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT, for one, is correctly defined.
I hesitated actually to include Audacity.h in Experimental.h. Maybe no
need for that hesitancy. But instead I use #error if Audacity.h has not been
seen yet.
... 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.
... for wxString and wxArrayStringEx, holding file paths (absolute or relative,
directory or plain file); to be replaced later with different types
(not yet using std::vector, becase of some uses of wxArrayString::Index with
two arguments)
... Replacing:
Insert => insert
RemoveAt => erase
Remove => erase
IsSameAs => operator == or operator !=
(but only when second argument was true or default)
... 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
It combines the old IdentInterface with the ParamsInterface, providing an identifier and parameters (if needed).
The main purpose of the change is to make the class hierarchy (as viewed via doxygen) much easier to follow.