Audacity 3.2.0
|
#include <SelectHandle.h>
Classes | |
class | TimerHandler |
Public Member Functions | |
SelectHandle (const std::shared_ptr< ChannelView > &pChannelView, bool useSnap, const TrackList &trackList, const TrackPanelMouseState &st, const ViewInfo &viewInfo) | |
SelectHandle & | operator= (const SelectHandle &)=default |
virtual | ~SelectHandle () |
std::shared_ptr< const Track > | FindTrack () const override |
bool | IsDragging () const override |
void | SetUseSnap (bool use, AudacityProject *pProject) |
void | Enter (bool forward, AudacityProject *pProject) override |
bool | HasSnap () const |
bool | HasEscape (AudacityProject *pProject) const override |
bool | Escape (AudacityProject *pProject) override |
Result | Click (const TrackPanelMouseEvent &event, AudacityProject *pProject) override |
Result | Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) override |
HitTestPreview | Preview (const TrackPanelMouseState &state, AudacityProject *pProject) override |
Result | Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override |
Result | Cancel (AudacityProject *) override |
Public Member Functions inherited from UIHandle | |
virtual | ~UIHandle ()=0 |
virtual void | Enter (bool forward, AudacityProject *pProject) |
virtual bool | HasRotation () const |
virtual bool | Rotate (bool forward) |
virtual bool | HasEscape (AudacityProject *pProject) const |
virtual bool | Escape (AudacityProject *pProject) |
virtual bool | HandlesRightClick () |
Whether the handle has any special right-button handling. More... | |
virtual Result | Click (const TrackPanelMouseEvent &event, AudacityProject *pProject)=0 |
virtual Result | Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject)=0 |
virtual HitTestPreview | Preview (const TrackPanelMouseState &state, AudacityProject *pProject)=0 |
virtual Result | Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0 |
virtual Result | Cancel (AudacityProject *pProject)=0 |
virtual bool | StopsOnKeystroke () |
virtual void | OnProjectChange (AudacityProject *pProject) |
virtual std::shared_ptr< const Track > | FindTrack () const =0 |
virtual bool | IsDragging () const |
Result | GetChangeHighlight () const |
void | SetChangeHighlight (Result val) |
Public Member Functions inherited from TrackPanelDrawable | |
virtual | ~TrackPanelDrawable ()=0 |
virtual void | Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) |
virtual wxRect | DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass) |
Static Public Member Functions | |
static UIHandlePtr | HitTest (std::weak_ptr< SelectHandle > &holder, const TrackPanelMouseState &state, const AudacityProject *pProject, const std::shared_ptr< ChannelView > &pChannelView) |
static UIHandle::Result | NeedChangeHighlight (const SelectHandle &oldState, const SelectHandle &newState) |
static void | SnapCenterOnce (SpectrumAnalyst &analyst, ViewInfo &viewInfo, const WaveChannel &wc, bool up) |
Static Public Member Functions inherited from UIHandle | |
static UIHandle::Result | NeedChangeHighlight (const UIHandle &, const UIHandle &) |
static std::shared_ptr< const Track > | TrackFromChannel (const std::shared_ptr< const Channel > &pChannel) |
A frequent convenience in the definition of UIHandles. More... | |
Static Public Member Functions inherited from TrackPanelDrawable | |
static wxRect | MaximizeWidth (const wxRect &rect, const wxRect &panelRect) |
static wxRect | MaximizeHeight (const wxRect &rect, const wxRect &panelRect) |
Private Types | |
enum | eFreqSelMode { FREQ_SEL_INVALID , FREQ_SEL_SNAPPING_CENTER , FREQ_SEL_PINNED_CENTER , FREQ_SEL_DRAG_CENTER , FREQ_SEL_FREE , FREQ_SEL_TOP_FREE , FREQ_SEL_BOTTOM_FREE } |
Private Member Functions | |
SelectHandle (const SelectHandle &) | |
std::shared_ptr< Channel > | FindChannel () |
Track * | FindTrack () |
void | Connect (AudacityProject *pProject) |
void | StartSelection (AudacityProject *pProject) |
Reset our selection markers. More... | |
void | AdjustSelection (AudacityProject *pProject, ViewInfo &viewInfo, int mouseXCoordinate, int trackLeftEdge, Track *pTrack) |
Extend or contract the existing selection. More... | |
void | AssignSelection (ViewInfo &viewInfo, double selend) |
void | StartFreqSelection (ViewInfo &viewInfo, int mouseYCoordinate, int trackTopEdge, int trackHeight, ChannelView &channelView) |
void | AdjustFreqSelection (const WaveChannel &wc, ViewInfo &viewInfo, int mouseYCoordinate, int trackTopEdge, int trackHeight) |
void | HandleCenterFrequencyClick (const ViewInfo &viewInfo, bool shiftDown, const std::shared_ptr< const WaveChannel > &pWc, double value) |
void | MoveSnappingFreqSelection (AudacityProject *pProject, ViewInfo &viewInfo, int mouseYCoordinate, int trackTopEdge, int trackHeight, ChannelView &channelView, Track *pTrack) |
void | Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override |
wxRect | DrawingArea (TrackPanelDrawingContext &, const wxRect &rect, const wxRect &panelRect, unsigned iPass) override |
Static Private Member Functions | |
static Track * | FindTrack (Channel *) |
static void | StartSnappingFreqSelection (SpectrumAnalyst &analyst, const ViewInfo &viewInfo, const WaveChannel &wc) |
Private Attributes | |
std::weak_ptr< ChannelView > | mpView |
wxRect | mRect {} |
SelectedRegion | mInitialSelection {} |
std::shared_ptr< SnapManager > | mSnapManager |
SnapResults | mSnapStart |
SnapResults | mSnapEnd |
bool | mUseSnap { true } |
bool | mSelStartValid {} |
double | mSelStart { 0.0 } |
int | mSelectionBoundary { 0 } |
enum SelectHandle::eFreqSelMode | FREQ_SEL_INVALID |
std::weak_ptr< const WaveChannel > | mFreqSelTrack |
double | mFreqSelPin { -1.0 } |
std::shared_ptr< SpectrumAnalyst > | mFrequencySnapper |
int | mMostRecentX { -1 } |
int | mMostRecentY { -1 } |
bool | mAutoScrolling {} |
std::shared_ptr< SelectionStateChanger > | mSelectionStateChanger |
friend | TimerHandler |
std::shared_ptr< TimerHandler > | mTimerHandler |
Additional Inherited Members | |
Public Types inherited from UIHandle | |
using | Result = unsigned |
using | Cell = TrackPanelCell |
Protected Attributes inherited from UIHandle | |
Result | mChangeHighlight { 0 } |
Definition at line 32 of file SelectHandle.h.
|
private |
Enumerator | |
---|---|
FREQ_SEL_INVALID | |
FREQ_SEL_SNAPPING_CENTER | |
FREQ_SEL_PINNED_CENTER | |
FREQ_SEL_DRAG_CENTER | |
FREQ_SEL_FREE | |
FREQ_SEL_TOP_FREE | |
FREQ_SEL_BOTTOM_FREE |
Definition at line 147 of file SelectHandle.h.
|
private |
SelectHandle::SelectHandle | ( | const std::shared_ptr< ChannelView > & | pChannelView, |
bool | useSnap, | ||
const TrackList & | trackList, | ||
const TrackPanelMouseState & | st, | ||
const ViewInfo & | viewInfo | ||
) |
Definition at line 423 of file SelectHandle.cpp.
References FindTrack(), mRect, mSnapManager, mSnapStart, mUseSnap, SnapResults::outCoord, ZoomInfo::PositionToTime(), TrackPanelMouseState::rect, SnapResults::snappedPoint, and TrackPanelMouseState::state.
|
virtual |
Definition at line 449 of file SelectHandle.cpp.
|
private |
Definition at line 1257 of file SelectHandle.cpp.
References anonymous_namespace{SelectHandle.cpp}::findMaxRatio(), FREQ_SEL_BOTTOM_FREE, FREQ_SEL_DRAG_CENTER, FREQ_SEL_INVALID, FREQ_SEL_PINNED_CENTER, FREQ_SEL_SNAPPING_CENTER, FREQ_SEL_TOP_FREE, WaveChannel::GetRate(), mFreqSelPin, min(), anonymous_namespace{SelectHandle.cpp}::PositionToFrequency(), ViewInfo::selectedRegion, NotifyingSelectedRegion::setF0(), NotifyingSelectedRegion::setF1(), NotifyingSelectedRegion::setFrequencies(), and SelectedRegion::UndefinedFrequency.
Referenced by Click(), and Drag().
|
private |
Extend or contract the existing selection.
Definition at line 1178 of file SelectHandle.cpp.
References AssignSelection(), FindChannel(), mSelStart, mSelStartValid, mSnapEnd, mSnapManager, mSnapStart, mUseSnap, SnapResults::outCoord, SnapResults::outTime, ZoomInfo::PositionToTime(), SnapResults::Snapped(), SnapResults::snappedPoint, and SnapResults::snappedTime.
Referenced by Click(), and Drag().
|
private |
Definition at line 1222 of file SelectHandle.cpp.
References mSelStart, ViewInfo::selectedRegion, and NotifyingSelectedRegion::setTimes().
Referenced by AdjustSelection(), and SetUseSnap().
|
overridevirtual |
Implements UIHandle.
Definition at line 1032 of file SelectHandle.cpp.
References ViewInfo::Get(), mInitialSelection, mSelectionStateChanger, RefreshCode::RefreshAll, and ViewInfo::selectedRegion.
|
overridevirtual |
This method gets called when we're handling selection and the mouse was just clicked.
Implements UIHandle.
Definition at line 540 of file SelectHandle.cpp.
References AdjustFreqSelection(), AdjustSelection(), Cancelled, anonymous_namespace{SelectHandle.cpp}::ChooseBoundary(), Connect(), SelectUtilities::DoListSelection(), TrackPanelMouseEvent::event, FindTrack(), FREQ_SEL_BOTTOM_FREE, FREQ_SEL_INVALID, FREQ_SEL_PINNED_CENTER, FREQ_SEL_SNAPPING_CENTER, FREQ_SEL_TOP_FREE, TrackFocus::Get(), ProjectAudioIO::Get(), ProjectHistory::Get(), ViewInfo::Get(), SelectionState::Get(), SyncLockState::Get(), TrackList::Get(), TrackPanel::Get(), WaveChannelUtilities::GetIntervalAtTime(), HandleCenterFrequencyClick(), ProjectAudioIO::IsAudioActive(), anonymous_namespace{SelectHandle.cpp}::isSpectralSelectionView(), SyncLockState::IsSyncLocked(), mFreqSelPin, mFreqSelTrack, mInitialSelection, mMostRecentX, mMostRecentY, ProjectHistory::ModifyState(), mpView, mRect, mSelectionBoundary, mSelectionStateChanger, mSelStart, mSelStartValid, mSnapStart, mUseSnap, SnapResults::outTime, RefreshCode::RefreshAll, RefreshCode::RefreshNone, anonymous_namespace{SelectHandle.cpp}::SBBottom, anonymous_namespace{SelectHandle.cpp}::SBCenter, anonymous_namespace{SelectHandle.cpp}::SBLeft, anonymous_namespace{SelectHandle.cpp}::SBNone, anonymous_namespace{SelectHandle.cpp}::SBRight, anonymous_namespace{SelectHandle.cpp}::SBTop, anonymous_namespace{SelectHandle.cpp}::SBWidth, SelectionState::SelectTrackLength(), StartFreqSelection(), StartSelection(), and SnapResults::timeSnappedTime.
|
private |
Definition at line 1065 of file SelectHandle.cpp.
References mTimerHandler.
Referenced by Click().
|
overridevirtual |
AS: If we're dragging to adjust a selection (or actually, if the screen is scrolling while you're selecting), we handle it here.
Implements UIHandle.
Definition at line 809 of file SelectHandle.cpp.
References AdjustFreqSelection(), AdjustSelection(), Cancelled, TrackPanelMouseEvent::event, CommonTrackPanelCell::FindTrack(), FindTrack(), FREQ_SEL_SNAPPING_CENTER, ViewInfo::Get(), SelectionState::Get(), TrackList::Get(), mAutoScrolling, mFreqSelTrack, mMostRecentX, mMostRecentY, MoveSnappingFreqSelection(), mpView, mRect, mSelStart, mSelStartValid, TrackPanelMouseEvent::pCell, and RefreshCode::RefreshNone.
Referenced by SelectHandle::TimerHandler::OnTimer().
|
overrideprivatevirtual |
Reimplemented from TrackPanelDrawable.
Definition at line 1040 of file SelectHandle.cpp.
References TrackPanelDrawingContext::dc, TrackArt::DrawSnapLines(), IsDragging(), mSnapEnd, mSnapManager, mSnapStart, mUseSnap, SnapResults::outCoord, and TrackArtist::PassSnapping.
|
overrideprivatevirtual |
Reimplemented from TrackPanelDrawable.
Definition at line 1055 of file SelectHandle.cpp.
References TrackPanelDrawable::MaximizeHeight(), and TrackArtist::PassSnapping.
|
overridevirtual |
Reimplemented from UIHandle.
Definition at line 498 of file SelectHandle.cpp.
References project, and SetUseSnap().
|
overridevirtual |
Reimplemented from UIHandle.
Definition at line 531 of file SelectHandle.cpp.
References HasEscape(), project, and SetUseSnap().
|
private |
Definition at line 453 of file SelectHandle.cpp.
References mpView.
Referenced by AdjustSelection(), FindTrack(), and SelectHandle::TimerHandler::OnTimer().
|
private |
Definition at line 473 of file SelectHandle.cpp.
References FindChannel(), and FindTrack().
|
overridevirtual |
Implements UIHandle.
Definition at line 461 of file SelectHandle.cpp.
References FindChannel(), and UIHandle::TrackFromChannel().
Referenced by Click(), Drag(), FindTrack(), HitTest(), Preview(), and SelectHandle().
Definition at line 466 of file SelectHandle.cpp.
References Channel::GetChannelGroup().
|
private |
Definition at line 1340 of file SelectHandle.cpp.
References FREQ_SEL_DRAG_CENTER, FREQ_SEL_SNAPPING_CENTER, mFreqSelPin, mFreqSelTrack, mFrequencySnapper, mSelStartValid, and StartSnappingFreqSelection().
Referenced by Click().
|
overridevirtual |
bool SelectHandle::HasSnap | ( | ) | const |
Definition at line 520 of file SelectHandle.cpp.
References IsDragging(), mSnapEnd, and mSnapStart.
Referenced by HasEscape(), Preview(), and SetUseSnap().
|
static |
Definition at line 358 of file SelectHandle.cpp.
References AssignUIHandlePtr(), FindTrack(), ViewInfo::Get(), TrackList::Get(), and TrackPanelMouseState::rect.
Referenced by CommonChannelView::HitTest(), NoteTrackAffordanceControls::HitTest(), and WaveTrackAffordanceControls::HitTest().
|
overridevirtual |
Whether the handle is dragging, affecting other panel painting; default returns false
Reimplemented from UIHandle.
Definition at line 61 of file SelectHandle.cpp.
References mSelectionStateChanger.
Referenced by Draw(), HasSnap(), Preview(), and SetUseSnap().
|
private |
Definition at line 1405 of file SelectHandle.cpp.
References NotifyingSelectedRegion::f0(), NotifyingSelectedRegion::f1(), CommonChannelCell::FindChannel(), anonymous_namespace{SelectHandle.cpp}::findMaxRatio(), TrackFocus::Get(), Track::GetSelected(), anonymous_namespace{SelectHandle.cpp}::isSpectralSelectionView(), mFreqSelPin, mFreqSelTrack, mFrequencySnapper, min(), anonymous_namespace{SelectHandle.cpp}::PositionToFrequency(), ViewInfo::selectedRegion, NotifyingSelectedRegion::setFrequencies(), and staffpad::audio::simd::sqrt().
Referenced by Drag().
|
static |
Definition at line 404 of file SelectHandle.cpp.
References mSnapStart, mUseSnap, and RefreshCode::RefreshAll.
|
default |
|
overridevirtual |
Implements UIHandle.
Definition at line 903 of file SelectHandle.cpp.
References _, anonymous_namespace{SelectHandle.cpp}::ChooseBoundary(), NormalizedKeyString::Display(), TranslatableString::empty(), FindTrack(), FREQ_SEL_SNAPPING_CENTER, CommandManager::Get(), ViewInfo::Get(), ProjectSettings::Get(), CommandManager::GetKeyFromName(), ProjectSettings::GetTool(), HasEscape(), HasSnap(), IsDragging(), anonymous_namespace{SelectHandle.cpp}::isSpectralSelectionView(), TranslatableString::Join(), mpView, mRect, mSelectionBoundary, mSnapStart, ToolCodes::multiTool, mUseSnap, SnapResults::outTime, TrackPanelMouseState::rect, anonymous_namespace{SelectHandle.cpp}::SelectCursor(), anonymous_namespace{SelectHandle.cpp}::SetTipAndCursorForBoundary(), TrackPanelMouseState::state, SnapResults::timeSnappedTime, wxT(), and XO().
|
overridevirtual |
Implements UIHandle.
Definition at line 1013 of file SelectHandle.cpp.
References ProjectHistory::Get(), PitchAndSpeedDialog::Get(), mFrequencySnapper, ProjectHistory::ModifyState(), mSelectionStateChanger, mSnapEnd, mSnapManager, mSnapStart, mUseSnap, SnapResults::outCoord, RefreshCode::RefreshAll, RefreshCode::RefreshNone, and PitchAndSpeedDialog::TryRetarget().
void SelectHandle::SetUseSnap | ( | bool | use, |
AudacityProject * | pProject | ||
) |
Definition at line 503 of file SelectHandle.cpp.
References AssignSelection(), ViewInfo::Get(), HasSnap(), IsDragging(), UIHandle::mChangeHighlight, mSnapEnd, mUseSnap, SnapResults::outTime, project, RefreshCode::RefreshAll, and SnapResults::timeSnappedTime.
Referenced by Enter(), and Escape().
|
static |
Definition at line 1456 of file SelectHandle.cpp.
References NotifyingSelectedRegion::f1(), NotifyingSelectedRegion::fc(), anonymous_namespace{SelectHandle.cpp}::findMaxRatio(), SpectrumAnalyst::FindPeak(), SpectrogramSettings::Get(), WaveChannel::GetRate(), min(), ViewInfo::selectedRegion, NotifyingSelectedRegion::setFrequencies(), settings(), staffpad::audio::simd::sqrt(), and StartSnappingFreqSelection().
|
private |
Definition at line 1237 of file SelectHandle.cpp.
References CommonChannelCell::FindChannel(), FREQ_SEL_FREE, FREQ_SEL_INVALID, anonymous_namespace{SelectHandle.cpp}::isSpectralSelectionView(), mFreqSelPin, mFreqSelTrack, anonymous_namespace{SelectHandle.cpp}::PositionToFrequency(), ViewInfo::selectedRegion, NotifyingSelectedRegion::setFrequencies(), and SelectedRegion::UndefinedFrequency.
Referenced by Click().
|
private |
Reset our selection markers.
Definition at line 1163 of file SelectHandle.cpp.
References ProjectHistory::Get(), ViewInfo::Get(), ProjectHistory::ModifyState(), mSelStart, and mSelStartValid.
Referenced by Click().
|
staticprivate |
Definition at line 1363 of file SelectHandle.cpp.
References SpectrumAnalyst::Calculate(), details::end(), fillZero, SpectrogramSettings::Get(), WaveChannel::GetFloats(), WaveChannel::GetRate(), limitSampleBufferSize(), min(), ViewInfo::selectedRegion, settings(), SpectrumAnalyst::Spectrum, NotifyingSelectedRegion::t0(), NotifyingSelectedRegion::t1(), and WideSampleSequence::TimeToLongSamples().
Referenced by HandleCenterFrequencyClick(), and SnapCenterOnce().
|
private |
Referenced by AdjustFreqSelection(), Click(), and StartFreqSelection().
|
private |
Definition at line 170 of file SelectHandle.h.
Referenced by Drag(), and SelectHandle::TimerHandler::OnTimer().
|
private |
Definition at line 165 of file SelectHandle.h.
Referenced by AdjustFreqSelection(), Click(), HandleCenterFrequencyClick(), MoveSnappingFreqSelection(), and StartFreqSelection().
|
private |
Definition at line 158 of file SelectHandle.h.
Referenced by Click(), Drag(), HandleCenterFrequencyClick(), MoveSnappingFreqSelection(), and StartFreqSelection().
|
private |
Definition at line 166 of file SelectHandle.h.
Referenced by HandleCenterFrequencyClick(), MoveSnappingFreqSelection(), and Release().
|
private |
Definition at line 136 of file SelectHandle.h.
|
private |
Definition at line 168 of file SelectHandle.h.
Referenced by Click(), Drag(), and SelectHandle::TimerHandler::OnTimer().
|
private |
Definition at line 168 of file SelectHandle.h.
|
private |
Definition at line 134 of file SelectHandle.h.
Referenced by Click(), Drag(), FindChannel(), and Preview().
|
private |
Definition at line 135 of file SelectHandle.h.
Referenced by Click(), Drag(), SelectHandle::TimerHandler::OnTimer(), Preview(), and SelectHandle().
|
private |
Definition at line 145 of file SelectHandle.h.
|
private |
Definition at line 172 of file SelectHandle.h.
Referenced by Cancel(), Click(), IsDragging(), and Release().
|
private |
Definition at line 143 of file SelectHandle.h.
Referenced by AdjustSelection(), AssignSelection(), Click(), Drag(), and StartSelection().
|
private |
Definition at line 142 of file SelectHandle.h.
Referenced by AdjustSelection(), Click(), Drag(), HandleCenterFrequencyClick(), and StartSelection().
|
private |
Definition at line 139 of file SelectHandle.h.
Referenced by AdjustSelection(), Draw(), HasSnap(), Release(), and SetUseSnap().
|
private |
Definition at line 138 of file SelectHandle.h.
Referenced by AdjustSelection(), Draw(), Release(), and SelectHandle().
|
private |
Definition at line 139 of file SelectHandle.h.
Referenced by AdjustSelection(), Click(), Draw(), HasSnap(), NeedChangeHighlight(), Preview(), Release(), and SelectHandle().
|
private |
Definition at line 176 of file SelectHandle.h.
Referenced by Connect().
|
private |
Definition at line 140 of file SelectHandle.h.
Referenced by AdjustSelection(), Click(), Draw(), HasEscape(), NeedChangeHighlight(), Preview(), Release(), SelectHandle(), and SetUseSnap().
|
private |
Definition at line 175 of file SelectHandle.h.