mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-22 22:43:01 +02:00
Demote Copy to CommonTrackCell; Track points only to that base class
This commit is contained in:
@@ -263,8 +263,8 @@ class AUDACITY_DLL_API Track /* not final */
|
||||
|
||||
// Return another, associated TrackPanelCell object that implements
|
||||
// click and drag and keystrokes in the track contents.
|
||||
std::shared_ptr<TrackView> GetTrackView();
|
||||
std::shared_ptr<const TrackView> GetTrackView() const;
|
||||
std::shared_ptr<CommonTrackCell> GetTrackView();
|
||||
std::shared_ptr<const CommonTrackCell> GetTrackView() const;
|
||||
|
||||
// Return another, associated TrackPanelCell object that implements the
|
||||
// drop-down, close and minimize buttons, etc.
|
||||
@@ -704,7 +704,7 @@ public:
|
||||
bool HandleCommonXMLAttribute(const wxChar *attr, const wxChar *value);
|
||||
|
||||
protected:
|
||||
std::shared_ptr<TrackView> mpView;
|
||||
std::shared_ptr<CommonTrackCell> mpView;
|
||||
std::shared_ptr<CommonTrackCell> mpControls;
|
||||
};
|
||||
|
||||
|
@@ -97,7 +97,7 @@ void LabelTrackView::UnbindFrom( LabelTrack *pParent )
|
||||
EVT_LABELTRACK_PERMUTED, &LabelTrackView::OnLabelPermuted, this );
|
||||
}
|
||||
|
||||
void LabelTrackView::Copy( const TrackView &other )
|
||||
void LabelTrackView::Copy( const CommonTrackCell &other )
|
||||
{
|
||||
TrackView::Copy( other );
|
||||
|
||||
|
@@ -82,7 +82,7 @@ private:
|
||||
std::shared_ptr<TrackVRulerControls> DoGetVRulerControls() override;
|
||||
|
||||
// Preserve some view state too for undo/redo purposes
|
||||
void Copy( const TrackView &other ) override;
|
||||
void Copy( const CommonTrackCell &other ) override;
|
||||
|
||||
public:
|
||||
static void DoEditLabels(
|
||||
|
@@ -57,6 +57,10 @@ CommonTrackCell::CommonTrackCell( const std::shared_ptr< Track > &parent )
|
||||
|
||||
CommonTrackCell::~CommonTrackCell() = default;
|
||||
|
||||
void CommonTrackCell::Copy( const CommonTrackCell & )
|
||||
{
|
||||
}
|
||||
|
||||
void CommonTrackCell::Reparent( const std::shared_ptr<Track> &parent )
|
||||
{
|
||||
mwTrack = parent;
|
||||
|
@@ -62,6 +62,9 @@ public:
|
||||
|
||||
~CommonTrackCell();
|
||||
|
||||
// Copy state, for undo/redo purposes
|
||||
virtual void Copy( const CommonTrackCell &other );
|
||||
|
||||
std::shared_ptr<Track> DoFindTrack() override;
|
||||
|
||||
virtual void Reparent( const std::shared_ptr<Track> &parent );
|
||||
|
@@ -46,8 +46,13 @@ int TrackView::GetTotalHeight( const TrackList &list )
|
||||
return GetCumulativeHeight( *list.Any().rbegin() );
|
||||
}
|
||||
|
||||
void TrackView::Copy( const TrackView &other )
|
||||
void TrackView::Copy( const CommonTrackCell &otherCell )
|
||||
{
|
||||
auto pOther = dynamic_cast< const TrackView* >( &otherCell );
|
||||
if ( !pOther )
|
||||
return;
|
||||
auto &other = *pOther;
|
||||
|
||||
mMinimized = other.mMinimized;
|
||||
|
||||
// Let mY remain 0 -- TrackPositioner corrects it later
|
||||
@@ -57,12 +62,12 @@ void TrackView::Copy( const TrackView &other )
|
||||
|
||||
TrackView &TrackView::Get( Track &track )
|
||||
{
|
||||
return *track.GetTrackView();
|
||||
return static_cast<TrackView&>( *track.GetTrackView() );
|
||||
}
|
||||
|
||||
const TrackView &TrackView::Get( const Track &track )
|
||||
{
|
||||
return *track.GetTrackView();
|
||||
return static_cast<const TrackView&>( *track.GetTrackView() );
|
||||
}
|
||||
|
||||
void TrackView::SetMinimized(bool isMinimized)
|
||||
@@ -105,7 +110,7 @@ void TrackView::DoSetMinimized(bool isMinimized)
|
||||
mMinimized = isMinimized;
|
||||
}
|
||||
|
||||
std::shared_ptr<TrackView> Track::GetTrackView()
|
||||
std::shared_ptr<CommonTrackCell> Track::GetTrackView()
|
||||
{
|
||||
if (!mpView)
|
||||
// create on demand
|
||||
@@ -113,7 +118,7 @@ std::shared_ptr<TrackView> Track::GetTrackView()
|
||||
return mpView;
|
||||
}
|
||||
|
||||
std::shared_ptr<const TrackView> Track::GetTrackView() const
|
||||
std::shared_ptr<const CommonTrackCell> Track::GetTrackView() const
|
||||
{
|
||||
return const_cast<Track*>(this)->GetTrackView();
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
static int GetTotalHeight( const TrackList &list );
|
||||
|
||||
// Copy view state, for undo/redo purposes
|
||||
virtual void Copy( const TrackView &other );
|
||||
void Copy( const CommonTrackCell &other ) override;
|
||||
|
||||
static TrackView &Get( Track & );
|
||||
static const TrackView &Get( const Track & );
|
||||
|
Reference in New Issue
Block a user