1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-02 17:09:26 +02:00

Temporary hack lets us defer encapsulation of track control panel drawing...

... while we can work on encapsulating the click-drag actions.
This commit is contained in:
Paul Licameli 2015-07-14 13:17:08 -04:00 committed by Paul Licameli
parent 43968c4ac9
commit f89cbefc7b
4 changed files with 19 additions and 2 deletions

View File

@ -5823,6 +5823,9 @@ void TrackPanel::DrawZooming(wxDC * dc, const wxRect & clip)
dc->DrawRectangle(rect); dc->DrawRectangle(rect);
} }
// Make this #include go away!
#include "tracks/ui/TrackControls.h"
void TrackInfo::DrawItems void TrackInfo::DrawItems
( wxDC *dc, const wxRect &rect, const Track &track, ( wxDC *dc, const wxRect &rect, const Track &track,
int mouseCapture, bool captured ) int mouseCapture, bool captured )
@ -6219,9 +6222,16 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect & rec)
rect.y += kTopMargin; rect.y += kTopMargin;
rect.height -= (kBottomMargin + 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 ); //mTrackInfo.DrawBordersWithin( dc, rect, *t );
} }

View File

@ -793,6 +793,8 @@ protected:
bool mAutoScrolling; bool mAutoScrolling;
public: public:
// Old enumeration of click-and-drag states, which will shrink and disappear
// as UIHandle subclasses take over the repsonsibilities.
enum MouseCaptureEnum enum MouseCaptureEnum
{ {
IsUncaptured=0, // This is the normal state for the mouse IsUncaptured=0, // This is the normal state for the mouse

View File

@ -12,6 +12,8 @@ Paul Licameli split from TrackPanel.cpp
#include "TrackControls.h" #include "TrackControls.h"
#include "../../HitTestResult.h" #include "../../HitTestResult.h"
int TrackControls::gCaptureState;
TrackControls::~TrackControls() TrackControls::~TrackControls()
{ {
} }

View File

@ -24,6 +24,9 @@ public:
Track *GetTrack() const { return mpTrack; } Track *GetTrack() const { return mpTrack; }
// Make this hack go away! See TrackPanel::DrawOutside
static int gCaptureState;
protected: protected:
// An override is supplied for derived classes to call through but it is // An override is supplied for derived classes to call through but it is
// still marked pure virtual // still marked pure virtual