mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-28 14:18:41 +02:00
Rewrite iteration over tracks in DrawEverythingElse
This commit is contained in:
parent
10bc061b00
commit
3589aacd7c
@ -1087,36 +1087,29 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
|
|||||||
};
|
};
|
||||||
wxRect focusRect{};
|
wxRect focusRect{};
|
||||||
|
|
||||||
for ( auto t :
|
for ( auto leaderTrack : GetTracks()->Leaders< const Track >()
|
||||||
GetTracks()->Any< const Track >() + IsVisibleTrack{ GetProject() } ) {
|
// Predicate is true iff any channel in the group is wholly or partly
|
||||||
auto visibleT = t->SubstitutePendingChangedTrack().get();
|
// visible:
|
||||||
trackRect.y = visibleT->GetY() - mViewInfo->vpos;
|
+ IsVisibleTrack{ GetProject() } ) {
|
||||||
trackRect.height = visibleT->GetHeight();
|
const auto channels = TrackList::Channels(leaderTrack);
|
||||||
|
bool focused = false;
|
||||||
auto leaderTrack = *GetTracks()->FindLeader( t );
|
wxRect teamRect = trackRect;
|
||||||
// If the previous track is linked to this one but isn't on the screen
|
teamRect.height = 0;
|
||||||
// (and thus would have been skipped) we need to draw that track's border
|
bool first = true;
|
||||||
// instead.
|
for (auto channel : channels) {
|
||||||
bool drawBorder = (t == leaderTrack || trackRect.y < 0);
|
focused = focused || mAx->IsFocused(channel);
|
||||||
|
channel = channel->SubstitutePendingChangedTrack().get();
|
||||||
if (drawBorder) {
|
if (first)
|
||||||
wxRect teamRect = trackRect;
|
first = false,
|
||||||
auto visibleLeaderTrack =
|
teamRect.y = channel->GetY() - mViewInfo->vpos;
|
||||||
leaderTrack->SubstitutePendingChangedTrack().get();
|
teamRect.height += channel->GetHeight();
|
||||||
teamRect.y = visibleLeaderTrack->GetY() - mViewInfo->vpos;
|
|
||||||
teamRect.height = TrackList::Channels(leaderTrack).sum(
|
|
||||||
[&] (const Track *channel) {
|
|
||||||
channel = channel->SubstitutePendingChangedTrack().get();
|
|
||||||
return channel->GetHeight();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (mAx->IsFocused(t)) {
|
|
||||||
focusRect = teamRect;
|
|
||||||
}
|
|
||||||
DrawOutside(context, leaderTrack, teamRect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (focused) {
|
||||||
|
focusRect = teamRect;
|
||||||
|
}
|
||||||
|
DrawOutside(context, leaderTrack, teamRect);
|
||||||
|
|
||||||
// Believe it or not, we can speed up redrawing if we don't
|
// Believe it or not, we can speed up redrawing if we don't
|
||||||
// redraw the vertical ruler when only the waveform data has
|
// redraw the vertical ruler when only the waveform data has
|
||||||
// changed. An example is during recording.
|
// changed. An example is during recording.
|
||||||
@ -1127,14 +1120,21 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
|
|||||||
// rbox.x, rbox.y, rbox.width, rbox.height);
|
// rbox.x, rbox.y, rbox.width, rbox.height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (region.Contains(0, trackRect.y, GetLeftOffset(), trackRect.height)) {
|
for (auto channel : channels) {
|
||||||
wxRect rect{
|
bool bSelected = channel->GetSelected();
|
||||||
GetVRulerOffset(),
|
channel = channel->SubstitutePendingChangedTrack().get();
|
||||||
trackRect.y + kTopMargin,
|
trackRect.y = channel->GetY() - mViewInfo->vpos;
|
||||||
GetVRulerWidth() + 1,
|
trackRect.height = channel->GetHeight();
|
||||||
trackRect.height - kSeparatorThickness
|
if (region.Contains(
|
||||||
};
|
0, trackRect.y, GetLeftOffset(), trackRect.height)) {
|
||||||
mTrackArtist->DrawVRuler( context, visibleT, rect, t->GetSelected() );
|
wxRect rect{
|
||||||
|
GetVRulerOffset(),
|
||||||
|
trackRect.y + kTopMargin,
|
||||||
|
GetVRulerWidth() + 1,
|
||||||
|
trackRect.height - kSeparatorThickness
|
||||||
|
};
|
||||||
|
mTrackArtist->DrawVRuler(context, channel, rect, bSelected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user