1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-04 17:49:45 +02:00

Bug1669: Close and Menu buttons should never disappear...

... As they did with Ctrl+Shift+F, with a certain minimimum number of wave
tracks that depends on screen resolution.  On my Macbook, that was 13 tracks.

This bug was a consequence of James' TCP layout changes making buttons a little
taller plus my changes to hide any top controls for which there is not
sufficient height.

The fix makes the height of tracks after Ctrl+Shift+F a bit more (44 pixels
not 40) than in 2.1.3.

This fix also replaces some more "magic numbers" with calculation from
tabled data about TCP layout.
This commit is contained in:
Paul Licameli 2017-07-14 11:53:17 -04:00
parent 2185b42d84
commit 903cebafe1
4 changed files with 25 additions and 5 deletions

View File

@ -6391,9 +6391,7 @@ void AudacityProject::DoZoomFitV()
return;
height = height / count;
if (height < 40)
height = 40;
height = std::max( (int)TrackInfo::MinimumTrackHeight(), height );
TrackListIterator iter2(GetTracks());
t = iter2.First();

View File

@ -33,6 +33,8 @@ and TimeTrack.
#include "Experimental.h"
#include "TrackPanel.h" // for TrackInfo
#ifdef _MSC_VER
//Disable truncation warnings
#pragma warning( disable : 4786 )
@ -130,11 +132,17 @@ void Track::SetOwner
int Track::GetMinimizedHeight() const
{
auto height = TrackInfo::MinimumTrackHeight();
if (GetLink()) {
return 22;
auto halfHeight = height / 2;
if (GetLinked())
return halfHeight;
else
return height - halfHeight;
}
return 44;
return height;
}
int Track::GetIndex() const

View File

@ -1313,6 +1313,18 @@ std::pair< int, int > CalcBottomItemY
}
unsigned TrackInfo::MinimumTrackHeight()
{
unsigned height = 0;
if (!commonTrackTCPLines.empty())
height += commonTrackTCPLines.front().height;
if (!commonTrackTCPBottomLines.empty())
height += commonTrackTCPBottomLines.front().height;
// + 1 prevents the top item from disappearing for want of enough space,
// according to the rules in HideTopItem.
return height + kTopMargin + kBottomMargin + 1;
}
bool TrackInfo::HideTopItem( const wxRect &rect, const wxRect &subRect,
int allowance ) {
auto limit = CalcBottomItemY

View File

@ -92,6 +92,8 @@ public:
~TrackInfo();
void ReCreateSliders();
static unsigned MinimumTrackHeight();
struct TCPLine;
static void DrawItems