mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-03 01:19:24 +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/ui/TimeShiftHandle.h"
|
||||||
|
#include "tracks/playabletrack/wavetrack/ui/CutlineHandle.h"
|
||||||
void TrackArtist::DrawWaveform(TrackPanelDrawingContext &context,
|
void TrackArtist::DrawWaveform(TrackPanelDrawingContext &context,
|
||||||
const WaveTrack *track,
|
const WaveTrack *track,
|
||||||
const wxRect & rect,
|
const wxRect & rect,
|
||||||
@ -1523,27 +1524,36 @@ void TrackArtist::DrawWaveform(TrackPanelDrawingContext &context,
|
|||||||
// Update cache for locations, e.g. cutlines and merge points
|
// Update cache for locations, e.g. cutlines and merge points
|
||||||
track->UpdateLocationsCache();
|
track->UpdateLocationsCache();
|
||||||
|
|
||||||
|
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
||||||
|
auto target2 = dynamic_cast<CutlineHandle*>(context.target.get());
|
||||||
|
#endif
|
||||||
for (const auto loc : track->GetCachedLocations()) {
|
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);
|
const int xx = zoomInfo.TimeToPosition(loc.pos);
|
||||||
if (xx >= 0 && xx < rect.width) {
|
if (xx >= 0 && xx < rect.width) {
|
||||||
// delta is used to adjust the top and bottom edge of a split line.
|
// delta is used to adjust the top and bottom edge of a split line.
|
||||||
int delta =0;
|
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);
|
AColor::Line(dc, (int) (rect.x + xx - 1), rect.y, (int) (rect.x + xx - 1), rect.y + rect.height);
|
||||||
if (loc.typ == WaveTrackLocation::locationCutLine) {
|
if (loc.typ == WaveTrackLocation::locationCutLine) {
|
||||||
dc.SetPen(*wxRED_PEN);
|
dc.SetPen( highlight ? AColor::uglyPen : *wxRED_PEN );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
delta = rect.height/3;
|
delta = rect.height/3;
|
||||||
#ifdef EXPERIMENTAL_DA
|
#ifdef EXPERIMENTAL_DA
|
||||||
// JKC Black does not show up enough.
|
// JKC Black does not show up enough.
|
||||||
dc.SetPen(*wxWHITE_PEN);
|
dc.SetPen(highlight ? AColor::uglyPen : *wxWHITE_PEN);
|
||||||
#else
|
#else
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
dc.SetPen(highlight ? AColor::uglyPen : *wxBLACK_PEN);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
AColor::Line(dc, (int) (rect.x + xx), rect.y+delta, (int) (rect.x + xx), rect.y - delta + rect.height);
|
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);
|
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)
|
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
|
#endif
|
||||||
|
@ -10,6 +10,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
|
|
||||||
#include "../../../../Audacity.h"
|
#include "../../../../Audacity.h"
|
||||||
#include "CutlineHandle.h"
|
#include "CutlineHandle.h"
|
||||||
|
#include "../../../../Experimental.h"
|
||||||
|
|
||||||
#include "../../../../MemoryX.h"
|
#include "../../../../MemoryX.h"
|
||||||
|
|
||||||
@ -26,7 +27,11 @@ CutlineHandle::CutlineHandle
|
|||||||
( const std::shared_ptr<WaveTrack> &pTrack, WaveTrackLocation location )
|
( const std::shared_ptr<WaveTrack> &pTrack, WaveTrackLocation location )
|
||||||
: mpTrack{ pTrack }
|
: mpTrack{ pTrack }
|
||||||
, mLocation{ location }
|
, mLocation{ location }
|
||||||
{}
|
{
|
||||||
|
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
||||||
|
mChangeHighlight = RefreshCode::RefreshCell;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
HitTestPreview CutlineHandle::HitPreview(bool cutline, bool unsafe)
|
HitTestPreview CutlineHandle::HitPreview(bool cutline, bool unsafe)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user