mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-22 14:32:58 +02:00
Move code into CommonTrackView.cpp
This commit is contained in:
@@ -11,7 +11,7 @@ Paul Licameli split from class LabelTrack
|
|||||||
#ifndef __AUDACITY_LABEL_TRACK_VIEW__
|
#ifndef __AUDACITY_LABEL_TRACK_VIEW__
|
||||||
#define __AUDACITY_LABEL_TRACK_VIEW__
|
#define __AUDACITY_LABEL_TRACK_VIEW__
|
||||||
|
|
||||||
#include "../../ui/TrackView.h"
|
#include "../../ui/CommonTrackView.h"
|
||||||
|
|
||||||
class LabelTrackView final : public CommonTrackView
|
class LabelTrackView final : public CommonTrackView
|
||||||
{
|
{
|
||||||
|
@@ -11,7 +11,7 @@ Paul Licameli split from class NoteTrack
|
|||||||
#ifndef __AUDACITY_NOTE_TRACK_VIEW__
|
#ifndef __AUDACITY_NOTE_TRACK_VIEW__
|
||||||
#define __AUDACITY_NOTE_TRACK_VIEW__
|
#define __AUDACITY_NOTE_TRACK_VIEW__
|
||||||
|
|
||||||
#include "../../../ui/TrackView.h"
|
#include "../../../ui/CommonTrackView.h"
|
||||||
|
|
||||||
class NoteTrackView final : public CommonTrackView
|
class NoteTrackView final : public CommonTrackView
|
||||||
{
|
{
|
||||||
|
@@ -11,7 +11,7 @@ Paul Licameli split from class WaveTrack
|
|||||||
#ifndef __AUDACITY_WAVE_TRACK_VIEW__
|
#ifndef __AUDACITY_WAVE_TRACK_VIEW__
|
||||||
#define __AUDACITY_WAVE_TRACK_VIEW__
|
#define __AUDACITY_WAVE_TRACK_VIEW__
|
||||||
|
|
||||||
#include "../../../ui/TrackView.h"
|
#include "../../../ui/CommonTrackView.h"
|
||||||
|
|
||||||
class WaveTrackView final : public CommonTrackView
|
class WaveTrackView final : public CommonTrackView
|
||||||
{
|
{
|
||||||
|
@@ -11,7 +11,7 @@ Paul Licameli split from class TimeTrack
|
|||||||
#ifndef __AUDACITY_TIME_TRACK_VIEW__
|
#ifndef __AUDACITY_TIME_TRACK_VIEW__
|
||||||
#define __AUDACITY_TIME_TRACK_VIEW__
|
#define __AUDACITY_TIME_TRACK_VIEW__
|
||||||
|
|
||||||
#include "../../ui/TrackView.h"
|
#include "../../ui/CommonTrackView.h"
|
||||||
|
|
||||||
class TimeTrackView final : public CommonTrackView
|
class TimeTrackView final : public CommonTrackView
|
||||||
{
|
{
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Audacity: A Digital Audio Editor
|
||||||
|
|
||||||
|
CommonTrackView.cpp
|
||||||
|
|
||||||
|
Paul Licameli split from class TrackView
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#include "CommonTrackView.h"
|
||||||
|
|
||||||
|
#include "TrackControls.h"
|
||||||
|
|
||||||
|
std::vector<UIHandlePtr> CommonTrackView::HitTest
|
||||||
|
(const TrackPanelMouseState &st,
|
||||||
|
const AudacityProject *pProject)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<TrackPanelCell> CommonTrackView::ContextMenuDelegate()
|
||||||
|
{
|
||||||
|
return TrackControls::Get( *FindTrack() ).shared_from_this();
|
||||||
|
}
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Audacity: A Digital Audio Editor
|
||||||
|
|
||||||
|
CommonTrackView.h
|
||||||
|
|
||||||
|
Paul Licameli split from class TrackView
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_COMMON_TRACK_VIEW__
|
||||||
|
#define __AUDACITY_COMMON_TRACK_VIEW__
|
||||||
|
|
||||||
|
#include "TrackView.h" // to inherit
|
||||||
|
|
||||||
|
class CommonTrackView /* not final */ : public TrackView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using TrackView::TrackView;
|
||||||
|
|
||||||
|
std::vector<UIHandlePtr> HitTest
|
||||||
|
(const TrackPanelMouseState &, const AudacityProject *pProject)
|
||||||
|
final override;
|
||||||
|
|
||||||
|
// Delegates the handling to the related TCP cell
|
||||||
|
std::shared_ptr<TrackPanelCell> ContextMenuDelegate() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Track *GetTrack() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -34,13 +34,6 @@ const TrackView &TrackView::Get( const Track &track )
|
|||||||
return *track.GetTrackView();
|
return *track.GetTrackView();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<UIHandlePtr> CommonTrackView::HitTest
|
|
||||||
(const TrackPanelMouseState &st,
|
|
||||||
const AudacityProject *pProject)
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<UIHandlePtr> Track::HitTest
|
std::vector<UIHandlePtr> Track::HitTest
|
||||||
(const TrackPanelMouseState &st,
|
(const TrackPanelMouseState &st,
|
||||||
const AudacityProject *pProject)
|
const AudacityProject *pProject)
|
||||||
@@ -100,11 +93,6 @@ std::shared_ptr<TrackPanelCell> Track::ContextMenuDelegate()
|
|||||||
return TrackControls::Get( *this ).shared_from_this();
|
return TrackControls::Get( *this ).shared_from_this();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<TrackPanelCell> CommonTrackView::ContextMenuDelegate()
|
|
||||||
{
|
|
||||||
return TrackControls::Get( *FindTrack() ).shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<TrackView> Track::GetTrackView()
|
std::shared_ptr<TrackView> Track::GetTrackView()
|
||||||
{
|
{
|
||||||
if (!mpView)
|
if (!mpView)
|
||||||
|
@@ -31,20 +31,4 @@ public:
|
|||||||
static const TrackView &Get( const Track & );
|
static const TrackView &Get( const Track & );
|
||||||
};
|
};
|
||||||
|
|
||||||
class CommonTrackView /* not final */ : public TrackView
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using TrackView::TrackView;
|
|
||||||
|
|
||||||
std::vector<UIHandlePtr> HitTest
|
|
||||||
(const TrackPanelMouseState &, const AudacityProject *pProject)
|
|
||||||
final override;
|
|
||||||
|
|
||||||
// Delegates the handling to the related TCP cell
|
|
||||||
std::shared_ptr<TrackPanelCell> ContextMenuDelegate() override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Track *GetTrack() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user