mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-18 17:10:55 +02:00
Bug2275 residual: don't get into state where you can't select audio...
... if you enter multi-view, then (try to) toggle both sub-views off. Now instead, the second toggling will have no effect.
This commit is contained in:
parent
4018546a96
commit
d28967b7ad
@ -805,7 +805,11 @@ void WaveTrackMenuTable::OnSetDisplay(wxCommandEvent & event)
|
||||
auto &view = WaveTrackView::Get( *pTrack );
|
||||
if ( view.GetMultiView() ) {
|
||||
for (auto channel : TrackList::Channels(pTrack)) {
|
||||
WaveTrackView::Get( *channel ).ToggleSubView( id );
|
||||
if ( !WaveTrackView::Get( *channel ).ToggleSubView( id ) ) {
|
||||
// Trying to toggle off the last sub-view. It was refused.
|
||||
// Decide what to do here. Turn off multi-view instead?
|
||||
// PRL: I don't agree that it makes sense
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -546,7 +546,7 @@ void WaveTrackView::SetDisplay(WaveTrackDisplay display, bool exclusive)
|
||||
DoSetDisplay( display, exclusive );
|
||||
}
|
||||
|
||||
void WaveTrackView::ToggleSubView(WaveTrackDisplay display)
|
||||
bool WaveTrackView::ToggleSubView(WaveTrackDisplay display)
|
||||
{
|
||||
size_t ii = 0;
|
||||
size_t found = 0;
|
||||
@ -560,6 +560,12 @@ void WaveTrackView::ToggleSubView(WaveTrackDisplay display)
|
||||
} ) ) {
|
||||
auto &foundPlacement = mPlacements[found];
|
||||
if ( foundPlacement.fraction > 0.0 ) {
|
||||
// Toggle off
|
||||
|
||||
if (GetDisplays().size() < 2)
|
||||
// refuse to do it
|
||||
return false;
|
||||
|
||||
auto index = foundPlacement.index;
|
||||
foundPlacement = { -1, 0.0 };
|
||||
if (index >= 0) {
|
||||
@ -568,8 +574,11 @@ void WaveTrackView::ToggleSubView(WaveTrackDisplay display)
|
||||
--placement.index;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// Toggle on
|
||||
float total = 0;
|
||||
int greatest = -1;
|
||||
unsigned nn = 0;
|
||||
@ -583,8 +592,13 @@ void WaveTrackView::ToggleSubView(WaveTrackDisplay display)
|
||||
// Turn on the sub-view, putting it lowest, and with average of the
|
||||
// heights of the other sub-views
|
||||
foundPlacement = { greatest + 1, total / nn };
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
// unknown sub-view
|
||||
return false;
|
||||
}
|
||||
|
||||
// If exclusive, make the chosen view take up all the height. Else,
|
||||
|
@ -91,7 +91,9 @@ public:
|
||||
void RestorePlacements( const WaveTrackSubViewPlacements &placements )
|
||||
{ mPlacements = placements; }
|
||||
|
||||
void ToggleSubView( WaveTrackDisplay id );
|
||||
// Return true if successful. Fails if you try to toggle off the only
|
||||
// sub-view.
|
||||
bool ToggleSubView( WaveTrackDisplay id );
|
||||
|
||||
// Get all the sub-views, in a sequence that is unspecified but in
|
||||
// correspondence with the result of SavePlacements
|
||||
|
Loading…
x
Reference in New Issue
Block a user