1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

Move code into CommonTrackView.cpp

This commit is contained in:
Paul Licameli 2019-06-18 13:29:21 -04:00
parent e77799d62c
commit e90943cfe1
8 changed files with 61 additions and 32 deletions

View File

@ -11,7 +11,7 @@ Paul Licameli split from class LabelTrack
#ifndef __AUDACITY_LABEL_TRACK_VIEW__
#define __AUDACITY_LABEL_TRACK_VIEW__
#include "../../ui/TrackView.h"
#include "../../ui/CommonTrackView.h"
class LabelTrackView final : public CommonTrackView
{

View File

@ -11,7 +11,7 @@ Paul Licameli split from class NoteTrack
#ifndef __AUDACITY_NOTE_TRACK_VIEW__
#define __AUDACITY_NOTE_TRACK_VIEW__
#include "../../../ui/TrackView.h"
#include "../../../ui/CommonTrackView.h"
class NoteTrackView final : public CommonTrackView
{

View File

@ -11,7 +11,7 @@ Paul Licameli split from class WaveTrack
#ifndef __AUDACITY_WAVE_TRACK_VIEW__
#define __AUDACITY_WAVE_TRACK_VIEW__
#include "../../../ui/TrackView.h"
#include "../../../ui/CommonTrackView.h"
class WaveTrackView final : public CommonTrackView
{

View File

@ -11,7 +11,7 @@ Paul Licameli split from class TimeTrack
#ifndef __AUDACITY_TIME_TRACK_VIEW__
#define __AUDACITY_TIME_TRACK_VIEW__
#include "../../ui/TrackView.h"
#include "../../ui/CommonTrackView.h"
class TimeTrackView final : public CommonTrackView
{

View File

@ -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();
}

View File

@ -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

View File

@ -34,13 +34,6 @@ const TrackView &TrackView::Get( const Track &track )
return *track.GetTrackView();
}
std::vector<UIHandlePtr> CommonTrackView::HitTest
(const TrackPanelMouseState &st,
const AudacityProject *pProject)
{
return {};
}
std::vector<UIHandlePtr> Track::HitTest
(const TrackPanelMouseState &st,
const AudacityProject *pProject)
@ -100,11 +93,6 @@ std::shared_ptr<TrackPanelCell> Track::ContextMenuDelegate()
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()
{
if (!mpView)

View File

@ -31,20 +31,4 @@ public:
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