mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Highlighting of cutlines and clip boundaries
This commit is contained in:
parent
a4d53b43da
commit
ed4057ae1b
@ -1490,6 +1490,7 @@ void TrackArtist::DrawEnvLine(wxDC &dc, const wxRect &rect, int x0, int y0, int
|
||||
}
|
||||
|
||||
#include "tracks/ui/TimeShiftHandle.h"
|
||||
#include "tracks/playabletrack/wavetrack/ui/CutlineHandle.h"
|
||||
void TrackArtist::DrawWaveform(TrackPanelDrawingContext &context,
|
||||
const WaveTrack *track,
|
||||
const wxRect & rect,
|
||||
@ -1523,27 +1524,36 @@ void TrackArtist::DrawWaveform(TrackPanelDrawingContext &context,
|
||||
// Update cache for locations, e.g. cutlines and merge points
|
||||
track->UpdateLocationsCache();
|
||||
|
||||
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
||||
auto target2 = dynamic_cast<CutlineHandle*>(context.target.get());
|
||||
#endif
|
||||
for (const auto loc : track->GetCachedLocations()) {
|
||||
bool highlight = false;
|
||||
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
||||
highlight =
|
||||
target2 && target2->GetTrack().get() == track &&
|
||||
target2->GetLocation() == loc;
|
||||
#endif
|
||||
const int xx = zoomInfo.TimeToPosition(loc.pos);
|
||||
if (xx >= 0 && xx < rect.width) {
|
||||
// delta is used to adjust the top and bottom edge of a split line.
|
||||
int delta =0;
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
dc.SetPen( highlight ? AColor::uglyPen : *wxGREY_PEN );
|
||||
AColor::Line(dc, (int) (rect.x + xx - 1), rect.y, (int) (rect.x + xx - 1), rect.y + rect.height);
|
||||
if (loc.typ == WaveTrackLocation::locationCutLine) {
|
||||
dc.SetPen(*wxRED_PEN);
|
||||
dc.SetPen( highlight ? AColor::uglyPen : *wxRED_PEN );
|
||||
}
|
||||
else {
|
||||
delta = rect.height/3;
|
||||
#ifdef EXPERIMENTAL_DA
|
||||
// JKC Black does not show up enough.
|
||||
dc.SetPen(*wxWHITE_PEN);
|
||||
dc.SetPen(highlight ? AColor::uglyPen : *wxWHITE_PEN);
|
||||
#else
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
dc.SetPen(highlight ? AColor::uglyPen : *wxBLACK_PEN);
|
||||
#endif
|
||||
}
|
||||
AColor::Line(dc, (int) (rect.x + xx), rect.y+delta, (int) (rect.x + xx), rect.y - delta + rect.height);
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
dc.SetPen( highlight ? AColor::uglyPen : *wxGREY_PEN );
|
||||
AColor::Line(dc, (int) (rect.x + xx + 1), rect.y+delta, (int) (rect.x + xx + 1), rect.y - delta + rect.height);
|
||||
}
|
||||
}
|
||||
|
@ -36,4 +36,19 @@ struct WaveTrackLocation {
|
||||
int clipidx2; // second clip (right one)
|
||||
};
|
||||
|
||||
inline
|
||||
bool operator == (const WaveTrackLocation &a, const WaveTrackLocation &b)
|
||||
{
|
||||
return a.pos == b.pos &&
|
||||
a.typ == b.typ &&
|
||||
a.clipidx1 == b.clipidx1 &&
|
||||
a.clipidx2 == b.clipidx2;
|
||||
}
|
||||
|
||||
inline
|
||||
bool operator != (const WaveTrackLocation &a, const WaveTrackLocation &b)
|
||||
{
|
||||
return !( a == b );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -10,6 +10,7 @@ Paul Licameli split from TrackPanel.cpp
|
||||
|
||||
#include "../../../../Audacity.h"
|
||||
#include "CutlineHandle.h"
|
||||
#include "../../../../Experimental.h"
|
||||
|
||||
#include "../../../../MemoryX.h"
|
||||
|
||||
@ -26,7 +27,11 @@ CutlineHandle::CutlineHandle
|
||||
( const std::shared_ptr<WaveTrack> &pTrack, WaveTrackLocation location )
|
||||
: mpTrack{ pTrack }
|
||||
, mLocation{ location }
|
||||
{}
|
||||
{
|
||||
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
||||
mChangeHighlight = RefreshCode::RefreshCell;
|
||||
#endif
|
||||
}
|
||||
|
||||
HitTestPreview CutlineHandle::HitPreview(bool cutline, bool unsafe)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user