mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-31 07:59:27 +02:00
Classes no more instantiated after previous commit become namespaces
This commit is contained in:
parent
c7b888b903
commit
8d29746af9
@ -49,8 +49,6 @@ private:
|
|||||||
|
|
||||||
static void DoUpdateVRuler( const wxRect &rect, const WaveTrack *wt );
|
static void DoUpdateVRuler( const wxRect &rect, const WaveTrack *wt );
|
||||||
|
|
||||||
friend class WaveTrackVRulerControls;
|
|
||||||
|
|
||||||
std::weak_ptr<SpectrumVZoomHandle> mVZoomHandle;
|
std::weak_ptr<SpectrumVZoomHandle> mVZoomHandle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,10 +11,6 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../../../Audacity.h"
|
#include "../../../../Audacity.h"
|
||||||
#include "WaveTrackVRulerControls.h"
|
#include "WaveTrackVRulerControls.h"
|
||||||
|
|
||||||
#include "SpectrumVRulerControls.h"
|
|
||||||
#include "WaveformVRulerControls.h"
|
|
||||||
#include "WaveformVZoomHandle.h"
|
|
||||||
|
|
||||||
#include "../../../../Experimental.h"
|
#include "../../../../Experimental.h"
|
||||||
|
|
||||||
#include "../../../../RefreshCode.h"
|
#include "../../../../RefreshCode.h"
|
||||||
@ -28,60 +24,12 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../../../widgets/Ruler.h"
|
#include "../../../../widgets/Ruler.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
WaveTrackVRulerControls::~WaveTrackVRulerControls()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<UIHandlePtr> WaveTrackVRulerControls::HitTest
|
|
||||||
(const TrackPanelMouseState &st,
|
|
||||||
const AudacityProject *pProject)
|
|
||||||
{
|
|
||||||
std::vector<UIHandlePtr> results;
|
|
||||||
|
|
||||||
if ( st.state.GetX() <= st.rect.GetRight() - kGuard ) {
|
|
||||||
auto pTrack = FindTrack()->SharedPointer<WaveTrack>( );
|
|
||||||
if (pTrack) {
|
|
||||||
auto result = std::make_shared<WaveTrackVZoomHandle>(
|
|
||||||
pTrack, st.rect, st.state.m_y );
|
|
||||||
result = AssignUIHandlePtr(mVZoomHandle, result);
|
|
||||||
results.push_back(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto more = TrackVRulerControls::HitTest(st, pProject);
|
|
||||||
std::copy(more.begin(), more.end(), std::back_inserter(results));
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned WaveTrackVRulerControls::HandleWheelRotation
|
|
||||||
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
|
|
||||||
{
|
|
||||||
using namespace RefreshCode;
|
|
||||||
const auto pTrack = FindTrack();
|
|
||||||
if (!pTrack)
|
|
||||||
return RefreshNone;
|
|
||||||
const auto wt = static_cast<WaveTrack*>(pTrack.get());
|
|
||||||
if (wt->GetDisplay() == WaveTrackViewConstants::Spectrum)
|
|
||||||
return SpectrumVRulerControls::DoHandleWheelRotation( evt, pProject, wt );
|
|
||||||
else
|
|
||||||
return WaveformVRulerControls::DoHandleWheelRotation( evt, pProject, wt );
|
|
||||||
}
|
|
||||||
|
|
||||||
Ruler &WaveTrackVRulerControls::ScratchRuler()
|
Ruler &WaveTrackVRulerControls::ScratchRuler()
|
||||||
{
|
{
|
||||||
static Ruler theRuler;
|
static Ruler theRuler;
|
||||||
return theRuler;
|
return theRuler;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveTrackVRulerControls::Draw(
|
|
||||||
TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect_, unsigned iPass )
|
|
||||||
{
|
|
||||||
TrackVRulerControls::Draw( context, rect_, iPass );
|
|
||||||
DoDraw( *this, context, rect_, iPass );
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaveTrackVRulerControls::DoDraw( TrackVRulerControls &controls,
|
void WaveTrackVRulerControls::DoDraw( TrackVRulerControls &controls,
|
||||||
TrackPanelDrawingContext &context,
|
TrackPanelDrawingContext &context,
|
||||||
const wxRect &rect_, unsigned iPass )
|
const wxRect &rect_, unsigned iPass )
|
||||||
@ -131,17 +79,3 @@ void WaveTrackVRulerControls::DoDraw( TrackVRulerControls &controls,
|
|||||||
vruler.Draw(*dc);
|
vruler.Draw(*dc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveTrackVRulerControls::UpdateRuler( const wxRect &rect )
|
|
||||||
{
|
|
||||||
const auto wt = std::static_pointer_cast< WaveTrack >( FindTrack() );
|
|
||||||
if (!wt)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const int display = wt->GetDisplay();
|
|
||||||
|
|
||||||
if (display == WaveTrackViewConstants::Waveform)
|
|
||||||
WaveformVRulerControls::DoUpdateVRuler( rect, wt.get() );
|
|
||||||
else
|
|
||||||
SpectrumVRulerControls::DoUpdateVRuler( rect, wt.get() );
|
|
||||||
}
|
|
||||||
|
@ -15,44 +15,14 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
|
|
||||||
class Ruler;
|
class Ruler;
|
||||||
class WaveTrack;
|
class WaveTrack;
|
||||||
class WaveTrackVZoomHandle;
|
|
||||||
|
|
||||||
class WaveTrackVRulerControls final : public TrackVRulerControls
|
namespace WaveTrackVRulerControls
|
||||||
{
|
{
|
||||||
static Ruler &ScratchRuler();
|
Ruler &ScratchRuler();
|
||||||
|
|
||||||
WaveTrackVRulerControls(const WaveTrackVRulerControls&) = delete;
|
void DoDraw( TrackVRulerControls &controls,
|
||||||
WaveTrackVRulerControls &operator=(const WaveTrackVRulerControls&) = delete;
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit
|
|
||||||
WaveTrackVRulerControls( const std::shared_ptr<TrackView> &pTrackView )
|
|
||||||
: TrackVRulerControls( pTrackView ) {}
|
|
||||||
~WaveTrackVRulerControls();
|
|
||||||
|
|
||||||
std::vector<UIHandlePtr> HitTest
|
|
||||||
(const TrackPanelMouseState &state,
|
|
||||||
const AudacityProject *) override;
|
|
||||||
|
|
||||||
unsigned HandleWheelRotation
|
|
||||||
(const TrackPanelMouseEvent &event,
|
|
||||||
AudacityProject *pProject) override;
|
|
||||||
private:
|
|
||||||
// TrackPanelDrawable implementation
|
|
||||||
void Draw(
|
|
||||||
TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, unsigned iPass ) override;
|
|
||||||
static void DoDraw( TrackVRulerControls &controls,
|
|
||||||
TrackPanelDrawingContext &context,
|
TrackPanelDrawingContext &context,
|
||||||
const wxRect &rect, unsigned iPass );
|
const wxRect &rect, unsigned iPass );
|
||||||
|
|
||||||
// TrackVRulerControls implementation
|
|
||||||
void UpdateRuler( const wxRect &rect ) override;
|
|
||||||
|
|
||||||
std::weak_ptr<WaveTrackVZoomHandle> mVZoomHandle;
|
|
||||||
|
|
||||||
friend class SpectrumVRulerControls;
|
|
||||||
friend class WaveformVRulerControls;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,9 +11,6 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../../../Audacity.h"
|
#include "../../../../Audacity.h"
|
||||||
#include "WaveTrackVZoomHandle.h"
|
#include "WaveTrackVZoomHandle.h"
|
||||||
|
|
||||||
#include "SpectrumVZoomHandle.h"
|
|
||||||
#include "WaveformVZoomHandle.h"
|
|
||||||
|
|
||||||
#include "../../../../Experimental.h"
|
#include "../../../../Experimental.h"
|
||||||
|
|
||||||
#include "../../../ui/TrackVRulerControls.h"
|
#include "../../../ui/TrackVRulerControls.h"
|
||||||
@ -34,19 +31,6 @@ bool WaveTrackVZoomHandle::IsDragZooming(int zoomStart, int zoomEnd)
|
|||||||
return bVZoom && (abs(zoomEnd - zoomStart) > DragThreshold);
|
return bVZoom && (abs(zoomEnd - zoomStart) > DragThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
WaveTrackVZoomHandle::WaveTrackVZoomHandle
|
|
||||||
(const std::shared_ptr<WaveTrack> &pTrack, const wxRect &rect, int y)
|
|
||||||
: mpTrack{ pTrack } , mZoomStart(y), mZoomEnd(y), mRect(rect)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaveTrackVZoomHandle::Enter(bool)
|
|
||||||
{
|
|
||||||
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
|
||||||
mChangeHighlight = RefreshCode::RefreshCell;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Table class
|
// Table class
|
||||||
|
|
||||||
@ -91,26 +75,6 @@ HitTestPreview WaveTrackVZoomHandle::HitPreview(const wxMouseState &state)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
WaveTrackVZoomHandle::~WaveTrackVZoomHandle()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
UIHandle::Result WaveTrackVZoomHandle::Click
|
|
||||||
(const TrackPanelMouseEvent &, AudacityProject *)
|
|
||||||
{
|
|
||||||
return RefreshCode::RefreshNone;
|
|
||||||
}
|
|
||||||
|
|
||||||
UIHandle::Result WaveTrackVZoomHandle::Drag
|
|
||||||
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
|
|
||||||
{
|
|
||||||
using namespace RefreshCode;
|
|
||||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
|
||||||
if (!pTrack)
|
|
||||||
return Cancelled;
|
|
||||||
return DoDrag( evt, pProject, mZoomStart, mZoomEnd );
|
|
||||||
}
|
|
||||||
|
|
||||||
UIHandle::Result WaveTrackVZoomHandle::DoDrag(
|
UIHandle::Result WaveTrackVZoomHandle::DoDrag(
|
||||||
const TrackPanelMouseEvent &evt, AudacityProject *pProject,
|
const TrackPanelMouseEvent &evt, AudacityProject *pProject,
|
||||||
const int zoomStart, int &zoomEnd)
|
const int zoomStart, int &zoomEnd)
|
||||||
@ -126,29 +90,6 @@ UIHandle::Result WaveTrackVZoomHandle::DoDrag(
|
|||||||
return RefreshNone;
|
return RefreshNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
HitTestPreview WaveTrackVZoomHandle::Preview
|
|
||||||
(const TrackPanelMouseState &st, const AudacityProject *)
|
|
||||||
{
|
|
||||||
return HitPreview(st.state);
|
|
||||||
}
|
|
||||||
|
|
||||||
UIHandle::Result WaveTrackVZoomHandle::Release
|
|
||||||
(const TrackPanelMouseEvent &evt, AudacityProject *pProject,
|
|
||||||
wxWindow *pParent)
|
|
||||||
{
|
|
||||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
|
||||||
auto doZoom = (pTrack->GetDisplay() == WaveTrackViewConstants::Spectrum)
|
|
||||||
? SpectrumVZoomHandle::DoZoom
|
|
||||||
: WaveformVZoomHandle::DoZoom;
|
|
||||||
return DoRelease(
|
|
||||||
evt, pProject, pParent, pTrack.get(), mRect,
|
|
||||||
doZoom,
|
|
||||||
(pTrack->GetDisplay() == WaveTrackViewConstants::Spectrum)
|
|
||||||
? SpectrumVRulerMenuTable::Instance()
|
|
||||||
: WaveformVRulerMenuTable::Instance(),
|
|
||||||
mZoomStart, mZoomEnd );
|
|
||||||
}
|
|
||||||
|
|
||||||
UIHandle::Result WaveTrackVZoomHandle::DoRelease(
|
UIHandle::Result WaveTrackVZoomHandle::DoRelease(
|
||||||
const TrackPanelMouseEvent &evt, AudacityProject *pProject,
|
const TrackPanelMouseEvent &evt, AudacityProject *pProject,
|
||||||
wxWindow *pParent, WaveTrack *pTrack, const wxRect &rect,
|
wxWindow *pParent, WaveTrack *pTrack, const wxRect &rect,
|
||||||
@ -219,22 +160,6 @@ UIHandle::Result WaveTrackVZoomHandle::DoRelease(
|
|||||||
return UpdateVRuler | RefreshAll;
|
return UpdateVRuler | RefreshAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
UIHandle::Result WaveTrackVZoomHandle::Cancel(AudacityProject*)
|
|
||||||
{
|
|
||||||
// Cancel is implemented! And there is no initial state to restore,
|
|
||||||
// so just return a code.
|
|
||||||
return RefreshCode::RefreshAll;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaveTrackVZoomHandle::Draw(
|
|
||||||
TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, unsigned iPass )
|
|
||||||
{
|
|
||||||
if (!mpTrack.lock()) //? TrackList::Lock()
|
|
||||||
return;
|
|
||||||
return DoDraw( context, rect, iPass, mZoomStart, mZoomEnd );
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaveTrackVZoomHandle::DoDraw(
|
void WaveTrackVZoomHandle::DoDraw(
|
||||||
TrackPanelDrawingContext &context,
|
TrackPanelDrawingContext &context,
|
||||||
const wxRect &rect, unsigned iPass, const int zoomStart, const int zoomEnd )
|
const wxRect &rect, unsigned iPass, const int zoomStart, const int zoomEnd )
|
||||||
@ -246,12 +171,6 @@ void WaveTrackVZoomHandle::DoDraw(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect WaveTrackVZoomHandle::DrawingArea(
|
|
||||||
const wxRect &rect, const wxRect &panelRect, unsigned iPass )
|
|
||||||
{
|
|
||||||
return DoDrawingArea( rect, panelRect, iPass );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRect WaveTrackVZoomHandle::DoDrawingArea(
|
wxRect WaveTrackVZoomHandle::DoDrawingArea(
|
||||||
const wxRect &rect, const wxRect &panelRect, unsigned iPass )
|
const wxRect &rect, const wxRect &panelRect, unsigned iPass )
|
||||||
{
|
{
|
||||||
|
@ -18,18 +18,14 @@ class WaveTrack;
|
|||||||
#include "../../../../UIHandle.h"
|
#include "../../../../UIHandle.h"
|
||||||
|
|
||||||
|
|
||||||
class WaveTrackVZoomHandle : public UIHandle
|
namespace WaveTrackVZoomHandle
|
||||||
{
|
{
|
||||||
WaveTrackVZoomHandle(const WaveTrackVZoomHandle&);
|
// See RefreshCode.h for bit flags:
|
||||||
static HitTestPreview HitPreview(const wxMouseState &state);
|
using Result = unsigned;
|
||||||
|
|
||||||
public:
|
HitTestPreview HitPreview(const wxMouseState &state);
|
||||||
explicit WaveTrackVZoomHandle
|
|
||||||
(const std::shared_ptr<WaveTrack> &pTrack, const wxRect &rect, int y);
|
|
||||||
|
|
||||||
WaveTrackVZoomHandle &operator=(const WaveTrackVZoomHandle&) = default;
|
bool IsDragZooming(int zoomStart, int zoomEnd);
|
||||||
|
|
||||||
static bool IsDragZooming(int zoomStart, int zoomEnd);
|
|
||||||
|
|
||||||
using DoZoomFunction = void (*)( AudacityProject *pProject,
|
using DoZoomFunction = void (*)( AudacityProject *pProject,
|
||||||
WaveTrack *pTrack,
|
WaveTrack *pTrack,
|
||||||
@ -37,58 +33,22 @@ public:
|
|||||||
const wxRect &rect, int zoomStart, int zoomEnd,
|
const wxRect &rect, int zoomStart, int zoomEnd,
|
||||||
bool fixedMousePoint);
|
bool fixedMousePoint);
|
||||||
|
|
||||||
virtual ~WaveTrackVZoomHandle();
|
Result DoDrag(
|
||||||
|
|
||||||
std::shared_ptr<WaveTrack> GetTrack() const { return mpTrack.lock(); }
|
|
||||||
|
|
||||||
void Enter(bool forward) override;
|
|
||||||
|
|
||||||
Result Click
|
|
||||||
(const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
|
|
||||||
|
|
||||||
Result Drag
|
|
||||||
(const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
|
|
||||||
static Result DoDrag(
|
|
||||||
const TrackPanelMouseEvent &event, AudacityProject *pProject,
|
const TrackPanelMouseEvent &event, AudacityProject *pProject,
|
||||||
int zoomStart, int &zoomEnd );
|
int zoomStart, int &zoomEnd );
|
||||||
|
|
||||||
HitTestPreview Preview
|
Result DoRelease(
|
||||||
(const TrackPanelMouseState &state, const AudacityProject *pProject)
|
|
||||||
override;
|
|
||||||
|
|
||||||
Result Release
|
|
||||||
(const TrackPanelMouseEvent &event, AudacityProject *pProject,
|
|
||||||
wxWindow *pParent) override;
|
|
||||||
static Result DoRelease(
|
|
||||||
const TrackPanelMouseEvent &event, AudacityProject *pProject,
|
const TrackPanelMouseEvent &event, AudacityProject *pProject,
|
||||||
wxWindow *pParent, WaveTrack *pTrack, const wxRect &mRect,
|
wxWindow *pParent, WaveTrack *pTrack, const wxRect &mRect,
|
||||||
DoZoomFunction doZoom, PopupMenuTable &table,
|
DoZoomFunction doZoom, PopupMenuTable &table,
|
||||||
int zoomStart, int zoomEnd );
|
int zoomStart, int zoomEnd );
|
||||||
|
|
||||||
Result Cancel(AudacityProject *pProject) override;
|
void DoDraw(
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// TrackPanelDrawable implementation
|
|
||||||
void Draw(
|
|
||||||
TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, unsigned iPass ) override;
|
|
||||||
static void DoDraw(
|
|
||||||
TrackPanelDrawingContext &context,
|
TrackPanelDrawingContext &context,
|
||||||
const wxRect &rect, unsigned iPass, int zoomStart, int zoomEnd );
|
const wxRect &rect, unsigned iPass, int zoomStart, int zoomEnd );
|
||||||
|
|
||||||
wxRect DrawingArea(
|
wxRect DoDrawingArea(
|
||||||
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
|
|
||||||
static wxRect DoDrawingArea(
|
|
||||||
const wxRect &rect, const wxRect &panelRect, unsigned iPass );
|
const wxRect &rect, const wxRect &panelRect, unsigned iPass );
|
||||||
|
|
||||||
std::weak_ptr<WaveTrack> mpTrack;
|
|
||||||
|
|
||||||
int mZoomStart{}, mZoomEnd{};
|
|
||||||
wxRect mRect{};
|
|
||||||
|
|
||||||
friend class SpectrumVZoomHandle;
|
|
||||||
friend class WaveformVZoomHandle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "../../../../widgets/PopupMenuTable.h" // to inherit
|
#include "../../../../widgets/PopupMenuTable.h" // to inherit
|
||||||
|
@ -145,8 +145,10 @@ static DoGetWaveTrackView registerDoGetWaveTrackView;
|
|||||||
|
|
||||||
std::shared_ptr<TrackVRulerControls> WaveTrackView::DoGetVRulerControls()
|
std::shared_ptr<TrackVRulerControls> WaveTrackView::DoGetVRulerControls()
|
||||||
{
|
{
|
||||||
return
|
// This should never be called because of delegation to the spectrum or
|
||||||
std::make_shared<WaveTrackVRulerControls>( shared_from_this() );
|
// waveform sub-view
|
||||||
|
wxASSERT( false );
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef PROFILE_WAVEFORM
|
#undef PROFILE_WAVEFORM
|
||||||
|
@ -49,8 +49,6 @@ private:
|
|||||||
|
|
||||||
static void DoUpdateVRuler( const wxRect &rect, const WaveTrack *wt );
|
static void DoUpdateVRuler( const wxRect &rect, const WaveTrack *wt );
|
||||||
|
|
||||||
friend class WaveTrackVRulerControls;
|
|
||||||
|
|
||||||
std::weak_ptr<WaveformVZoomHandle> mVZoomHandle;
|
std::weak_ptr<WaveformVZoomHandle> mVZoomHandle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user