mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-05 22:59:29 +02:00
Redo calculation of default track heights
This commit is contained in:
parent
18b3bc0600
commit
98b24cd6b9
@ -5112,13 +5112,17 @@ const TCPLine noteTrackTCPLines[] = {
|
|||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
int totalTCPLines( const TCPLine *pLines )
|
int totalTCPLines( const TCPLine *pLines, bool omitLastExtra )
|
||||||
{
|
{
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
int lastExtra = 0;
|
||||||
while ( pLines->items ) {
|
while ( pLines->items ) {
|
||||||
total += pLines->height + pLines->extraSpace;
|
lastExtra = pLines->extraSpace;
|
||||||
|
total += pLines->height + lastExtra;
|
||||||
++pLines;
|
++pLines;
|
||||||
}
|
}
|
||||||
|
if (omitLastExtra)
|
||||||
|
total -= lastExtra;
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9378,25 +9382,25 @@ void TrackInfo::DrawVelocitySlider(wxDC *dc, NoteTrack *t, wxRect rect, bool cap
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned TrackInfo::DefaultNoteTrackHeight()
|
namespace {
|
||||||
|
unsigned DefaultTrackHeight( const TCPLine topLines[] )
|
||||||
{
|
{
|
||||||
// Just high enough that the velocity slider is just above the Minimize
|
|
||||||
// button, as for default sized Wave track
|
|
||||||
int needed =
|
int needed =
|
||||||
kTopMargin + kBottomMargin +
|
kTopMargin + kBottomMargin +
|
||||||
totalTCPLines( noteTrackTCPLines ) +
|
totalTCPLines( topLines, true ) +
|
||||||
totalTCPLines( commonTrackTCPBottomLines ) -
|
totalTCPLines( commonTrackTCPBottomLines, false ) + 1;
|
||||||
kTrackInfoSliderExtra;
|
|
||||||
return (unsigned) std::max( needed, (int) Track::DefaultHeight );
|
return (unsigned) std::max( needed, (int) Track::DefaultHeight );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned TrackInfo::DefaultNoteTrackHeight()
|
||||||
|
{
|
||||||
|
return DefaultTrackHeight( noteTrackTCPLines );
|
||||||
|
}
|
||||||
|
|
||||||
unsigned TrackInfo::DefaultWaveTrackHeight()
|
unsigned TrackInfo::DefaultWaveTrackHeight()
|
||||||
{
|
{
|
||||||
int needed =
|
return DefaultTrackHeight( waveTrackTCPLines );
|
||||||
kTopMargin + kBottomMargin +
|
|
||||||
totalTCPLines( waveTrackTCPLines ) +
|
|
||||||
totalTCPLines( commonTrackTCPBottomLines );
|
|
||||||
return (unsigned) std::max( needed, (int) Track::DefaultHeight );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<LWSlider>
|
std::unique_ptr<LWSlider>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user