mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 23:00:06 +02:00
Define and use CommonTrackCell
This commit is contained in:
parent
2bb823e1b6
commit
bebd709e98
@ -17,8 +17,9 @@ Paul Licameli split from TrackPanel.cpp
|
||||
|
||||
#include <wx/mousestate.h>
|
||||
|
||||
TrackPanelResizerCell::TrackPanelResizerCell( std::shared_ptr<Track> pTrack )
|
||||
: mpTrack{ pTrack }
|
||||
TrackPanelResizerCell::TrackPanelResizerCell(
|
||||
const std::shared_ptr<Track> &pTrack )
|
||||
: CommonTrackCell{ pTrack }
|
||||
{}
|
||||
|
||||
std::vector<UIHandlePtr> TrackPanelResizerCell::HitTest
|
||||
|
@ -15,14 +15,14 @@
|
||||
|
||||
class TrackPanelResizeHandle;
|
||||
|
||||
class TrackPanelResizerCell : public CommonTrackPanelCell
|
||||
class TrackPanelResizerCell : public CommonTrackCell
|
||||
{
|
||||
TrackPanelResizerCell(const TrackPanelResizerCell&) = delete;
|
||||
TrackPanelResizerCell &operator= (const TrackPanelResizerCell&) = delete;
|
||||
public:
|
||||
|
||||
explicit
|
||||
TrackPanelResizerCell( std::shared_ptr<Track> pTrack );
|
||||
TrackPanelResizerCell( const std::shared_ptr<Track> &pTrack );
|
||||
|
||||
std::vector<UIHandlePtr> HitTest
|
||||
(const TrackPanelMouseState &, const AudacityProject *) override;
|
||||
|
@ -50,3 +50,19 @@ unsigned CommonTrackPanelCell::HandleWheelRotation
|
||||
auto hook = GetHook();
|
||||
return hook ? hook( evt, pProject ) : RefreshCode::Cancelled;
|
||||
}
|
||||
|
||||
CommonTrackCell::CommonTrackCell( const std::shared_ptr< Track > &parent )
|
||||
: mwTrack { parent }
|
||||
{}
|
||||
|
||||
CommonTrackCell::~CommonTrackCell() = default;
|
||||
|
||||
void CommonTrackCell::Reparent( const std::shared_ptr<Track> &parent )
|
||||
{
|
||||
mwTrack = parent;
|
||||
}
|
||||
|
||||
std::shared_ptr<Track> CommonTrackCell::DoFindTrack()
|
||||
{
|
||||
return mwTrack.lock();
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ Paul Licameli split from TrackPanel.cpp
|
||||
#include "../../TrackPanelCell.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
class Track;
|
||||
@ -51,4 +52,20 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
class AUDACITY_DLL_API CommonTrackCell /* not final */
|
||||
: public CommonTrackPanelCell
|
||||
{
|
||||
public:
|
||||
explicit CommonTrackCell( const std::shared_ptr<Track> &pTrack );
|
||||
|
||||
~CommonTrackCell();
|
||||
|
||||
std::shared_ptr<Track> DoFindTrack() override;
|
||||
|
||||
void Reparent( const std::shared_ptr<Track> &parent );
|
||||
|
||||
private:
|
||||
std::weak_ptr< Track > mwTrack;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -29,7 +29,7 @@ Paul Licameli split from TrackPanel.cpp
|
||||
#include <wx/frame.h>
|
||||
|
||||
TrackControls::TrackControls( std::shared_ptr<Track> pTrack )
|
||||
: mwTrack{ pTrack }
|
||||
: CommonTrackCell{ pTrack }
|
||||
{
|
||||
}
|
||||
|
||||
@ -37,11 +37,6 @@ TrackControls::~TrackControls()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<Track> TrackControls::DoFindTrack()
|
||||
{
|
||||
return mwTrack.lock();
|
||||
}
|
||||
|
||||
std::vector<UIHandlePtr> CommonTrackControls::HitTest
|
||||
(const TrackPanelMouseState &st,
|
||||
const AudacityProject *WXUNUSED(project))
|
||||
|
@ -22,18 +22,13 @@ class MinimizeButtonHandle;
|
||||
class SelectButtonHandle;
|
||||
class TrackSelectHandle;
|
||||
|
||||
class TrackControls /* not final */ : public CommonTrackPanelCell
|
||||
class TrackControls /* not final */ : public CommonTrackCell
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
TrackControls( std::shared_ptr<Track> pTrack );
|
||||
|
||||
virtual ~TrackControls() = 0;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<Track> DoFindTrack() override;
|
||||
|
||||
std::weak_ptr<Track> mwTrack;
|
||||
};
|
||||
|
||||
class CommonTrackControls /* not final */ : public TrackControls
|
||||
|
Loading…
x
Reference in New Issue
Block a user