1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-07 07:57:43 +02:00

Free TrackControls and TrackSelectHandle from cycles, to high levels

This commit is contained in:
Paul Licameli 2019-06-05 09:50:45 -04:00
parent d4b44d16f1
commit e969315c90
9 changed files with 7 additions and 14 deletions

View File

@ -287,8 +287,8 @@ class AUDACITY_DLL_API Track /* not final */
// Return another, associated TrackPanelCell object that implements the // Return another, associated TrackPanelCell object that implements the
// drop-down, close and minimize buttons, etc. // drop-down, close and minimize buttons, etc.
std::shared_ptr<TrackControls> GetTrackControl(); std::shared_ptr<TrackPanelCell> GetTrackControl();
std::shared_ptr<const TrackControls> GetTrackControl() const; std::shared_ptr<const TrackPanelCell> GetTrackControl() const;
// Return another, associated TrackPanelCell object that implements the // Return another, associated TrackPanelCell object that implements the
// mouse actions for the vertical ruler // mouse actions for the vertical ruler

View File

@ -99,7 +99,6 @@ is time to refresh some aspect of the screen.
#include "toolbars/ControlToolBar.h" #include "toolbars/ControlToolBar.h"
#include "toolbars/ToolsToolBar.h" #include "toolbars/ToolsToolBar.h"
#include "tracks/ui/TrackControls.h" // for inheritance relation
#include "tracks/ui/TrackVRulerControls.h" // for inheritance relation #include "tracks/ui/TrackVRulerControls.h" // for inheritance relation
//This loads the appropriate set of cursors, depending on platform. //This loads the appropriate set of cursors, depending on platform.
@ -1283,9 +1282,6 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
target->DrawExtras(UIHandle::Panel, dc, region, clip); target->DrawExtras(UIHandle::Panel, dc, region, clip);
} }
// Make this #include go away!
#include "tracks/ui/TrackControls.h"
void TrackInfo::DrawItems void TrackInfo::DrawItems
( TrackPanelDrawingContext &context, ( TrackPanelDrawingContext &context,
const wxRect &rect, const Track &track ) const wxRect &rect, const Track &track )

View File

@ -19,7 +19,6 @@ Paul Licameli split from TrackPanel.cpp
#include "RefreshCode.h" #include "RefreshCode.h"
#include "Track.h" #include "Track.h"
#include "TrackPanelMouseEvent.h" #include "TrackPanelMouseEvent.h"
#include "tracks/ui/TrackControls.h"
HitTestPreview TrackPanelResizeHandle::HitPreview(bool bLinked) HitTestPreview TrackPanelResizeHandle::HitPreview(bool bLinked)
{ {

View File

@ -15,7 +15,6 @@ Paul Licameli
#include "../../RefreshCode.h" #include "../../RefreshCode.h"
#include "../../Track.h" #include "../../Track.h"
#include "../../TrackPanelMouseEvent.h" #include "../../TrackPanelMouseEvent.h"
#include "../ui/TrackControls.h"
ButtonHandle::ButtonHandle ButtonHandle::ButtonHandle
( const std::shared_ptr<Track> &pTrack, const wxRect &rect ) ( const std::shared_ptr<Track> &pTrack, const wxRect &rect )

View File

@ -14,7 +14,6 @@ Paul Licameli split from TrackPanel.cpp
#include "../../Experimental.h" #include "../../Experimental.h"
#include "Scrubbing.h" #include "Scrubbing.h"
#include "TrackControls.h"
#include "../../AColor.h" #include "../../AColor.h"
#include "../../FreqWindow.h" #include "../../FreqWindow.h"

View File

@ -13,7 +13,6 @@ Paul Licameli split from TrackPanel.cpp
#include "../../Experimental.h" #include "../../Experimental.h"
#include "TrackControls.h"
#include "../../AColor.h" #include "../../AColor.h"
#include "../../HitTestResult.h" #include "../../HitTestResult.h"
#include "../../NoteTrack.h" #include "../../NoteTrack.h"

View File

@ -55,7 +55,9 @@ std::vector<UIHandlePtr> TrackControls::HitTest
auto pTrack = FindTrack(); auto pTrack = FindTrack();
// shared pointer to this: // shared pointer to this:
auto sThis = pTrack->GetTrackControl(); auto sThis =
std::static_pointer_cast<TrackControls>( pTrack->GetTrackControl() );
wxASSERT( this == sThis.get() );
if (NULL != (result = CloseButtonHandle::HitTest( if (NULL != (result = CloseButtonHandle::HitTest(
mCloseHandle, state, rect, this))) mCloseHandle, state, rect, this)))

View File

@ -11,7 +11,6 @@ Paul Licameli split from TrackPanel.cpp
#include "../../Audacity.h" #include "../../Audacity.h"
#include "TrackSelectHandle.h" #include "TrackSelectHandle.h"
#include "TrackControls.h"
#include "../../Menus.h" #include "../../Menus.h"
#include "../../Project.h" #include "../../Project.h"
#include "../../ProjectAudioIO.h" #include "../../ProjectAudioIO.h"

View File

@ -83,7 +83,7 @@ std::shared_ptr<TrackPanelCell> Track::ContextMenuDelegate()
return FindTrack()->GetTrackControl(); return FindTrack()->GetTrackControl();
} }
std::shared_ptr<TrackControls> Track::GetTrackControl() std::shared_ptr<TrackPanelCell> Track::GetTrackControl()
{ {
if (!mpControls) if (!mpControls)
// create on demand // create on demand
@ -91,7 +91,7 @@ std::shared_ptr<TrackControls> Track::GetTrackControl()
return mpControls; return mpControls;
} }
std::shared_ptr<const TrackControls> Track::GetTrackControl() const std::shared_ptr<const TrackPanelCell> Track::GetTrackControl() const
{ {
return const_cast< Track* >( this )->GetTrackControl(); return const_cast< Track* >( this )->GetTrackControl();
} }