1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

CalcItemY and DefaultTrackHeight into the TrackInfo namespace

This commit is contained in:
Paul Licameli 2019-06-18 12:46:28 -04:00
parent eccc62f99f
commit 63bf49adad
2 changed files with 14 additions and 5 deletions

View File

@ -53,7 +53,7 @@ inline bool HasSoloButton()
#define RANGE(array) (array), (array) + sizeof(array)/sizeof(*(array))
using TCPLine = TrackInfo::TCPLine;
using TCPLines = std::vector< TCPLine >;
using TCPLines = TrackInfo::TCPLines;
}
@ -162,9 +162,11 @@ const TCPLines &getTCPLines( const Track &track )
return commonTrackTCPLines;
}
}
// return y value and height
std::pair< int, int > CalcItemY( const TCPLines &lines, unsigned iItem )
std::pair< int, int >
TrackInfo::CalcItemY( const TCPLines &lines, unsigned iItem )
{
int y = 0;
auto pLines = lines.begin();
@ -179,6 +181,8 @@ std::pair< int, int > CalcItemY( const TCPLines &lines, unsigned iItem )
return { y, height };
}
namespace {
// Items for the bottom of the panel, listed bottom-upwards
// As also with the top items, the extra space is below the item
const TrackInfo::TCPLine defaultCommonTrackTCPBottomLines[] = {
@ -1060,8 +1064,7 @@ void TrackInfo::DrawBackground(
#endif
}
namespace {
unsigned DefaultTrackHeight( const TCPLines &topLines )
unsigned TrackInfo::DefaultTrackHeight( const TCPLines &topLines )
{
int needed =
kTopMargin + kBottomMargin +
@ -1069,7 +1072,6 @@ unsigned DefaultTrackHeight( const TCPLines &topLines )
totalTCPLines( commonTrackTCPBottomLines, false ) + 1;
return (unsigned) std::max( needed, (int) TrackView::DefaultHeight );
}
}
unsigned TrackInfo::DefaultNoteTrackHeight()
{

View File

@ -64,6 +64,13 @@ namespace TrackInfo
DrawFunction drawFunction;
};
using TCPLines = std::vector< TCPLine >;
// return y value and height
std::pair< int, int > CalcItemY( const TCPLines &lines, unsigned iItem );
unsigned DefaultTrackHeight( const TCPLines &topLines );
void DrawItems
( TrackPanelDrawingContext &context,
const wxRect &rect, const Track &track );