Skip to content

Commit

Permalink
Keep EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING compilable
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Licameli committed Nov 9, 2023
1 parent f274c8b commit a773b12
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/EnvelopeEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "TrackArtist.h"
#include "TrackPanelDrawingContext.h"
#include "ViewInfo.h"
#include "tracks/ui/EnvelopeHandle.h"

namespace {
void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top)
Expand All @@ -45,7 +46,7 @@ void EnvelopeEditor::DrawPoints(const Envelope &env,
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<EnvelopeHandle*>(context.target.get());
highlight = target && target->GetEnvelope() == this;
highlight = target && target->GetEnvelope() == &env;
#endif
wxPen &pen = highlight ? AColor::uglyPen : AColor::envelopePen;
dc.SetPen( pen );
Expand Down
4 changes: 3 additions & 1 deletion src/tracks/labeltrack/ui/LabelTrackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,9 @@ void LabelTrackView::Draw
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
bool highlightTrack = false;
auto target = dynamic_cast<LabelTextHandle*>(context.target.get());
highlightTrack = target && target->GetTrack().get() == this;
highlightTrack = target &&
target->FindChannel().get() ==
static_cast<const LabelTrack*>(FindTrack().get());
#endif
int i = -1; for (const auto &labelStruct : mLabels) { ++i;
bool highlight = false;
Expand Down
6 changes: 3 additions & 3 deletions src/tracks/playabletrack/wavetrack/ui/WaveformView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ void DrawClipWaveform(TrackPanelDrawingContext &context,
bool highlightEnvelope = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<EnvelopeHandle*>(context.target.get());
highlightEnvelope = target && target->GetEnvelope() == clip.GetEnvelope();
highlightEnvelope = target && target->GetEnvelope() == &envelope;
#endif

//If clip is "too small" draw a placeholder instead of
Expand Down Expand Up @@ -850,7 +850,7 @@ void DrawClipWaveform(TrackPanelDrawingContext &context,
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<SampleHandle*>(context.target.get());
highlight = target && target->GetTrack().get() == track;
highlight = target && target->FindChannel().get() == &track;
#endif
DrawIndividualSamples(
context, leftOffset, rectPortion, zoomMin, zoomMax,
Expand Down Expand Up @@ -957,7 +957,7 @@ void WaveformView::DoDraw(TrackPanelDrawingContext &context, size_t channel,
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<TimeShiftHandle*>(context.target.get());
gripHit = target && target->IsGripHit();
highlight = target && target->GetTrack().get() == track;
highlight = target && target->GetTrack().get() == &track;
#endif

const bool dB = !WaveformSettings::Get(track).isLinear();
Expand Down
2 changes: 1 addition & 1 deletion src/tracks/timetrack/ui/TimeTrackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void DrawHorzRulerAndCurve
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<EnvelopeHandle*>(context.target.get());
highlight = target && target->GetEnvelope() == this->GetEnvelope();
highlight = target && target->GetEnvelope() == track.GetEnvelope();
#endif

double min = zoomInfo.PositionToTime(0);
Expand Down
4 changes: 3 additions & 1 deletion src/tracks/ui/TimeShiftHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,15 @@ class AUDACITY_DLL_API TimeShiftHandle : public UIHandle

bool Clicked() const;

protected:
/*!
@return will point only to a leader
*/
std::shared_ptr<Track> GetTrack() const;

protected:
//There were attempt to move clip/track horizontally, or to move it vertically
bool WasMoved() const;

private:

// Try to move clips from one track to another with offset, allowing 1px tolerance,
Expand Down

0 comments on commit a773b12

Please sign in to comment.