mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-04 17:49:45 +02:00
Highlighting of resizers
This commit is contained in:
parent
b11c3c8ccf
commit
3e7f82cf5e
@ -1648,12 +1648,14 @@ void TrackPanel::RefreshTrack(Track *trk, bool refreshbacking)
|
||||
link = trk->GetLink();
|
||||
}
|
||||
|
||||
// subtract insets and shadows from the rectangle, but not border
|
||||
// This matters because some separators do paint over the border
|
||||
wxRect rect(kLeftInset,
|
||||
// So that the highlighting of the resizer refreshes,
|
||||
// include left and right inset areas,
|
||||
// exclude the inset above,
|
||||
// but include the inset below.
|
||||
wxRect rect(0,
|
||||
-mViewInfo->vpos + trk->GetY() + kTopInset,
|
||||
GetRect().GetWidth() - kLeftInset - kRightInset - kShadowThickness,
|
||||
trk->GetHeight() - kTopInset - kShadowThickness);
|
||||
GetRect().GetWidth(),
|
||||
trk->GetHeight() );
|
||||
|
||||
if (link) {
|
||||
rect.height += link->GetHeight();
|
||||
@ -1749,7 +1751,8 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
|
||||
trackRect.height = 0; // for drawing background in no tracks case.
|
||||
|
||||
VisibleTrackIterator iter(GetProject());
|
||||
for (Track *t = iter.First(); t; t = iter.Next()) {
|
||||
Track *prev{};
|
||||
for (Track *t = iter.First(); t; prev = t, t = iter.Next()) {
|
||||
trackRect.y = t->GetY() - mViewInfo->vpos;
|
||||
trackRect.height = t->GetHeight();
|
||||
|
||||
@ -1793,7 +1796,7 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
|
||||
if (mAx->IsFocused(t)) {
|
||||
focusRect = borderRect;
|
||||
}
|
||||
DrawOutside(context, borderTrack, borderRect);
|
||||
DrawOutside(context, borderTrack, prev, borderRect);
|
||||
}
|
||||
|
||||
// Believe it or not, we can speed up redrawing if we don't
|
||||
@ -1835,7 +1838,7 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
|
||||
mUIHandle->DrawExtras(UIHandle::Cells, dc, region, clip);
|
||||
|
||||
// Paint over the part below the tracks
|
||||
trackRect.y += trackRect.height;
|
||||
trackRect.y += trackRect.height + kTopInset;
|
||||
if (trackRect.y < clip.GetBottom()) {
|
||||
AColor::TrackPanelBackground(dc, false);
|
||||
dc->DrawRectangle(trackRect.x,
|
||||
@ -2291,7 +2294,7 @@ void TrackInfo::Status2DrawFunction
|
||||
|
||||
void TrackPanel::DrawOutside
|
||||
(TrackPanelDrawingContext &context,
|
||||
Track * t, const wxRect & rec)
|
||||
Track * t, Track *prev, const wxRect & rec)
|
||||
{
|
||||
auto dc = &context.dc;
|
||||
bool bIsWave = (t->GetKind() == Track::Wave);
|
||||
@ -2300,7 +2303,7 @@ void TrackPanel::DrawOutside
|
||||
{
|
||||
// Start with whole track rect
|
||||
wxRect rect = rec;
|
||||
DrawOutsideOfTrack(context, t, rect);
|
||||
DrawOutsideOfTrack(context, t, prev, rect);
|
||||
|
||||
// Now exclude left, right, and top insets
|
||||
rect.x += kLeftInset;
|
||||
@ -2342,7 +2345,7 @@ void TrackPanel::DrawOutside
|
||||
// If linked to a following channel, also paint the separator area, which
|
||||
// overlaps the next track rectangle's top
|
||||
void TrackPanel::DrawOutsideOfTrack
|
||||
(TrackPanelDrawingContext &context, Track * t, const wxRect & rect)
|
||||
(TrackPanelDrawingContext &context, Track * t, Track *prev, const wxRect & rect)
|
||||
{
|
||||
auto dc = &context.dc;
|
||||
|
||||
@ -2355,10 +2358,13 @@ void TrackPanel::DrawOutsideOfTrack
|
||||
side.width = kLeftInset;
|
||||
dc->DrawRectangle(side);
|
||||
|
||||
// Area between panel border and top track border
|
||||
side = rect;
|
||||
side.height = kTopInset;
|
||||
dc->DrawRectangle(side);
|
||||
if (!prev)
|
||||
{
|
||||
// Area above the first track
|
||||
side = rect;
|
||||
side.height = kTopInset;
|
||||
dc->DrawRectangle(side);
|
||||
}
|
||||
|
||||
// Area between panel border and right track border
|
||||
side = rect;
|
||||
@ -2366,17 +2372,32 @@ void TrackPanel::DrawOutsideOfTrack
|
||||
side.width = kTopInset;
|
||||
dc->DrawRectangle(side);
|
||||
|
||||
// Area between tracks of stereo group
|
||||
if (t->GetLinked()
|
||||
auto target = dynamic_cast<TrackPanelResizeHandle*>(context.target.get());
|
||||
auto highlight = target && target->GetTrack().get() == t;
|
||||
|
||||
side = rect;
|
||||
side.y += t->GetHeight();
|
||||
|
||||
// Area below the track
|
||||
if (highlight ||
|
||||
t->GetLinked()
|
||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||
|| MONO_WAVE_PAN(t)
|
||||
#endif
|
||||
) {
|
||||
// Paint the channel separator over (what would be) the shadow of the top
|
||||
// channel, and the top inset of the bottom channel
|
||||
side = rect;
|
||||
side.y += t->GetHeight() - kShadowThickness;
|
||||
|
||||
// (Or, highlight the resizer area below the track)
|
||||
side.y -= kShadowThickness;
|
||||
side.height = kTopInset + kShadowThickness;
|
||||
if (highlight)
|
||||
dc->SetBrush( AColor::uglyBrush );
|
||||
dc->DrawRectangle(side);
|
||||
}
|
||||
else
|
||||
{
|
||||
side.height = kTopInset;
|
||||
dc->DrawRectangle(side);
|
||||
}
|
||||
}
|
||||
|
@ -417,14 +417,14 @@ protected:
|
||||
const wxRect & clip);
|
||||
void DrawOutside
|
||||
(TrackPanelDrawingContext &context,
|
||||
Track *t, const wxRect & rec);
|
||||
Track *t, Track *prev, const wxRect & rec);
|
||||
|
||||
void HighlightFocusedTrack (wxDC* dc, const wxRect &rect);
|
||||
void DrawShadow (Track *t, wxDC* dc, const wxRect & rect);
|
||||
void DrawBordersAroundTrack(Track *t, wxDC* dc, const wxRect & rect, const int labelw, const int vrul);
|
||||
void DrawOutsideOfTrack
|
||||
(TrackPanelDrawingContext &context,
|
||||
Track *t, const wxRect & rect);
|
||||
Track *t, Track *prev, const wxRect & rect);
|
||||
|
||||
public:
|
||||
// Set the object that performs catch-all event handling when the pointer
|
||||
|
@ -67,6 +67,8 @@ TrackPanelResizeHandle::TrackPanelResizeHandle
|
||||
: mpTrack{ track }
|
||||
, mMouseClickY( y )
|
||||
{
|
||||
mChangeHighlight = RefreshCode::RefreshCell;
|
||||
|
||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||
if (MONO_WAVE_PAN(track)){
|
||||
//STM: Determine whether we should rescale one or two tracks
|
||||
|
Loading…
x
Reference in New Issue
Block a user