1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 07:39:42 +02:00

TrackInfo doesn't use the kTopMargin or kBottomMargin constants...

... It only needs their sum, which it will assume is the constant amount of
padding always between tracks (not channels of a track).

(cherry picked from audacity commit 058c729ea544e326938b9473e7b9a5cd5ecc6ab5)

Signed-off-by: akleja <storspov@gmail.com>
This commit is contained in:
Paul Licameli 2021-08-08 10:32:25 -04:00 committed by akleja
parent 88fe1ee084
commit ce2bc7f60e
2 changed files with 6 additions and 3 deletions

View File

@ -202,7 +202,7 @@ unsigned TrackInfo::MinimumTrackHeight()
height += commonTrackTCPBottomLines.front().height; height += commonTrackTCPBottomLines.front().height;
// + 1 prevents the top item from disappearing for want of enough space, // + 1 prevents the top item from disappearing for want of enough space,
// according to the rules in HideTopItem. // according to the rules in HideTopItem.
return height + kTopMargin + kBottomMargin + 1; return height + kVerticalPadding + 1;
} }
bool TrackInfo::HideTopItem( const wxRect &rect, const wxRect &subRect, bool TrackInfo::HideTopItem( const wxRect &rect, const wxRect &subRect,
@ -566,7 +566,7 @@ void TrackInfo::SetTrackInfoFont(wxDC * dc)
unsigned TrackInfo::DefaultTrackHeight( const TCPLines &topLines ) unsigned TrackInfo::DefaultTrackHeight( const TCPLines &topLines )
{ {
int needed = int needed =
kTopMargin + kBottomMargin + kVerticalPadding +
totalTCPLines( topLines, true ) + totalTCPLines( topLines, true ) +
totalTCPLines( commonTrackTCPBottomLines, false ) + 1; totalTCPLines( commonTrackTCPBottomLines, false ) + 1;
return (unsigned) std::max( needed, (int) TrackView::DefaultHeight ); return (unsigned) std::max( needed, (int) TrackView::DefaultHeight );

View File

@ -99,8 +99,9 @@ private:
}; };
// See big pictorial comment in TrackPanel.cpp for explanation of these numbers // See big pictorial comment in TrackPanel.cpp for explanation of these numbers
//! constants related to y coordinates in the track panel
enum : int { enum : int {
// constants related to y coordinates in the track panel kVerticalPadding = 7, /*!< Width of padding below each channel group */
kAffordancesAreaHeight = 20, kAffordancesAreaHeight = 20,
kTopInset = 4, kTopInset = 4,
kTopMargin = kTopInset + kBorderThickness, kTopMargin = kTopInset + kBorderThickness,
@ -108,6 +109,8 @@ enum : int {
kSeparatorThickness = kBottomMargin + kTopMargin, kSeparatorThickness = kBottomMargin + kTopMargin,
}; };
static_assert( kVerticalPadding == kTopMargin + kBottomMargin );
enum : int { enum : int {
kTrackInfoBtnSize = 18, // widely used dimension, usually height kTrackInfoBtnSize = 18, // widely used dimension, usually height
kTrackInfoSliderHeight = 25, kTrackInfoSliderHeight = 25,