mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-25 08:58:06 +02:00
Revert "Bug 2275 - Crash when unchecking Multi-view with neither of the views checked"
This reverts commit 57ff92b20c01ce6da39475858775619a532e106b.
This commit is contained in:
parent
d50dae4dd2
commit
da2f5491ae
@ -559,50 +559,31 @@ void WaveTrackView::ToggleSubView(WaveTrackDisplay display)
|
|||||||
return false;
|
return false;
|
||||||
} ) ) {
|
} ) ) {
|
||||||
auto &foundPlacement = mPlacements[found];
|
auto &foundPlacement = mPlacements[found];
|
||||||
auto index = foundPlacement.index;
|
|
||||||
unsigned nn = 0;
|
|
||||||
|
|
||||||
// if found and active, deactivate it..
|
|
||||||
if ( foundPlacement.fraction > 0.0 ) {
|
if ( foundPlacement.fraction > 0.0 ) {
|
||||||
for (auto &placement : mPlacements) {
|
auto index = foundPlacement.index;
|
||||||
if (placement.fraction > 0.0 && placement.index >= 0) {
|
foundPlacement = { -1, 0.0 };
|
||||||
nn++;
|
if (index >= 0) {
|
||||||
}
|
for ( auto &placement : mPlacements ) {
|
||||||
}
|
if ( placement.index > index )
|
||||||
// if removing the last one, then don't!
|
--placement.index;
|
||||||
// Switch to radio-button view instead.
|
|
||||||
if (nn <= 1) {
|
|
||||||
DoSetDisplay(display);
|
|
||||||
SetMultiView(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foundPlacement = { -1, 0.0 };
|
|
||||||
if (index >= 0) {
|
|
||||||
for (auto &placement : mPlacements) {
|
|
||||||
if (placement.index > index)
|
|
||||||
--placement.index;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else found and zero size, so add it on the bottom.
|
|
||||||
else {
|
else {
|
||||||
float total = 0;
|
float total = 0;
|
||||||
int greatest = -1;
|
int greatest = -1;
|
||||||
|
unsigned nn = 0;
|
||||||
|
int removedIndex = foundPlacement.index;
|
||||||
for ( auto &placement : mPlacements ) {
|
for ( auto &placement : mPlacements ) {
|
||||||
if ( placement.fraction >= 0.0 && placement.index >= 0 ) {
|
if ( placement.fraction >= 0.0 && placement.index >= 0 ) {
|
||||||
// renumber in case there's an item removed.
|
// renumber in case there's an item removed.
|
||||||
if( (index >= 0) && (placement.index >= index))
|
if( (removedIndex >= 0) && (placement.index >= removedIndex))
|
||||||
--placement.index;
|
placement.index -= 1;
|
||||||
total += placement.fraction;
|
total += placement.fraction;
|
||||||
greatest = std::max( greatest, placement.index );
|
greatest = std::max( greatest, placement.index );
|
||||||
++nn;
|
++nn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
if ( index >= 0)
|
|
||||||
--nn;
|
|
||||||
// Turn on the sub-view, putting it lowest, and with average of the
|
// Turn on the sub-view, putting it lowest, and with average of the
|
||||||
// heights of the other sub-views
|
// heights of the other sub-views
|
||||||
foundPlacement = { greatest + 1, total / nn };
|
foundPlacement = { greatest + 1, total / nn };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user