From f89cbefc7ba2a7b5605e5cc6ee76ea32bdd7bc2c Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 14 Jul 2015 13:17:08 -0400 Subject: [PATCH] Temporary hack lets us defer encapsulation of track control panel drawing... ... while we can work on encapsulating the click-drag actions. --- src/TrackPanel.cpp | 14 ++++++++++++-- src/TrackPanel.h | 2 ++ src/tracks/ui/TrackControls.cpp | 2 ++ src/tracks/ui/TrackControls.h | 3 +++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index f1e6610b6..2363a10e5 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -5823,6 +5823,9 @@ void TrackPanel::DrawZooming(wxDC * dc, const wxRect & clip) dc->DrawRectangle(rect); } +// Make this #include go away! +#include "tracks/ui/TrackControls.h" + void TrackInfo::DrawItems ( wxDC *dc, const wxRect &rect, const Track &track, int mouseCapture, bool captured ) @@ -6219,9 +6222,16 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect & rec) rect.y += kTopMargin; rect.height -= (kBottomMargin + kTopMargin); - bool captured = (t == mCapturedTrack); + // Need to know which button, if any, to draw as pressed. + const MouseCaptureEnum mouseCapture = + mMouseCapture ? mMouseCapture + // This public global variable is a hack for now, which should go away + // when TrackPanelCell gets a virtual function into which we move this + // drawing code. + : MouseCaptureEnum(TrackControls::gCaptureState); + const bool captured = (t == mCapturedTrack || t == mpClickedTrack); - TrackInfo::DrawItems( dc, rect, *t, mMouseCapture, captured ); + TrackInfo::DrawItems( dc, rect, *t, mouseCapture, captured ); //mTrackInfo.DrawBordersWithin( dc, rect, *t ); } diff --git a/src/TrackPanel.h b/src/TrackPanel.h index 2b3a33d91..551e67f7c 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -793,6 +793,8 @@ protected: bool mAutoScrolling; public: + // Old enumeration of click-and-drag states, which will shrink and disappear + // as UIHandle subclasses take over the repsonsibilities. enum MouseCaptureEnum { IsUncaptured=0, // This is the normal state for the mouse diff --git a/src/tracks/ui/TrackControls.cpp b/src/tracks/ui/TrackControls.cpp index df34aca49..f4963f008 100644 --- a/src/tracks/ui/TrackControls.cpp +++ b/src/tracks/ui/TrackControls.cpp @@ -12,6 +12,8 @@ Paul Licameli split from TrackPanel.cpp #include "TrackControls.h" #include "../../HitTestResult.h" +int TrackControls::gCaptureState; + TrackControls::~TrackControls() { } diff --git a/src/tracks/ui/TrackControls.h b/src/tracks/ui/TrackControls.h index 783d28834..398ffe11d 100644 --- a/src/tracks/ui/TrackControls.h +++ b/src/tracks/ui/TrackControls.h @@ -24,6 +24,9 @@ public: Track *GetTrack() const { return mpTrack; } + // Make this hack go away! See TrackPanel::DrawOutside + static int gCaptureState; + protected: // An override is supplied for derived classes to call through but it is // still marked pure virtual