... with run-time assertions.
I examined each place and reasoned that the narrowing was safe, and commented
why so.
Again, there are places where the sampleCount variable will later be changed
to have a different type, and they are not changed here.
... A non-narrowing conversion out to long long is a necessity, but the
conversions to float and double are simply conveniences.
Conversion from floating is explicit, to avoid unintended consequences with
arithmetic operators, when later sampleCount ceases to be an alias for an
integral type.
Some conversions are not made explicit, where I expect to change the type of
the variable later to have mere size_t width.
Thanks to Darrell Walisser for the outline of the problem, which was causing laggy dragging of stereo track sizes in spectrogram view.
This was caused by refreshing the horizontal ruler unnecessarily.
The Ctrl-Z was interrupting the enveloping, making it finish, but it then got asked to finish again on a mouse up. This change stops the second finish from happening.
Previously Ctrl Click on Wave behaved exactly as Ctrl Click on Track Control Panel. With this change on wave it
(a) No longer toggles. It only adds.
(b) It will extend and can be drag extended.
It is possible to change (a) to be toggle if that is desired.
This should ease the creation and extension of discontinuous track selections.
It turns out that having fixed the behaviour of Shift-Click on the Track Control Panel, I'd also fixed the behaviour of Shift-Click on the wave. But then I blew it by over riding the Shift-Click behaviour on wave to use the version that does NOT horizontally extend. This change comments out the 'bShift' and so gives us the original Shift-Click behaviour on wave, without undoing the other fixes.
I first of all added a warning message if trying to configure while playing.
Then decided that it is more in keeping with current style to grey out the Spectrogram Settings menu item.
So the new warning message should actually never be reached.
... This makes much code agnostic about how other things (functions and
arguments) are typed.
Many of these neeed to become size_t instead of sampleCount.
Problem was that cfd7648fce2388ec8ae35b38004f2ae111c484af 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.