From ce2bc7f60e882da41ed41ca07a5b62cac7b232a6 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 8 Aug 2021 10:32:25 -0400 Subject: [PATCH] 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 --- src/TrackInfo.cpp | 4 ++-- src/ViewInfo.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/TrackInfo.cpp b/src/TrackInfo.cpp index 4d770504e..bb65fa1ec 100644 --- a/src/TrackInfo.cpp +++ b/src/TrackInfo.cpp @@ -202,7 +202,7 @@ unsigned TrackInfo::MinimumTrackHeight() 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; + return height + kVerticalPadding + 1; } bool TrackInfo::HideTopItem( const wxRect &rect, const wxRect &subRect, @@ -566,7 +566,7 @@ void TrackInfo::SetTrackInfoFont(wxDC * dc) unsigned TrackInfo::DefaultTrackHeight( const TCPLines &topLines ) { int needed = - kTopMargin + kBottomMargin + + kVerticalPadding + totalTCPLines( topLines, true ) + totalTCPLines( commonTrackTCPBottomLines, false ) + 1; return (unsigned) std::max( needed, (int) TrackView::DefaultHeight ); diff --git a/src/ViewInfo.h b/src/ViewInfo.h index 27ce66c25..ce0561c06 100644 --- a/src/ViewInfo.h +++ b/src/ViewInfo.h @@ -99,8 +99,9 @@ private: }; // See big pictorial comment in TrackPanel.cpp for explanation of these numbers +//! constants related to y coordinates in the track panel enum : int { - // constants related to y coordinates in the track panel + kVerticalPadding = 7, /*!< Width of padding below each channel group */ kAffordancesAreaHeight = 20, kTopInset = 4, kTopMargin = kTopInset + kBorderThickness, @@ -108,6 +109,8 @@ enum : int { kSeparatorThickness = kBottomMargin + kTopMargin, }; +static_assert( kVerticalPadding == kTopMargin + kBottomMargin ); + enum : int { kTrackInfoBtnSize = 18, // widely used dimension, usually height kTrackInfoSliderHeight = 25,