Audacity  3.0.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
TimeShiftHandle Class Reference

#include <TimeShiftHandle.h>

Inheritance diagram for TimeShiftHandle:
[legend]
Collaboration diagram for TimeShiftHandle:
[legend]

Public Member Functions

 TimeShiftHandle (const std::shared_ptr< Track > &pTrack, bool gripHit)
 
TimeShiftHandleoperator= (TimeShiftHandle &&)=default
 
bool IsGripHit () const
 
virtual ~TimeShiftHandle ()
 
void Enter (bool forward, AudacityProject *) 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 *pProject) override
 
bool StopsOnKeystroke () override
 
bool Clicked () const
 
- Public Member Functions inherited from UIHandle
virtual ~UIHandle ()=0
 
virtual bool HasRotation () const
 
virtual bool Rotate (bool forward)
 
virtual bool HasEscape () const
 
virtual bool Escape (AudacityProject *pProject)
 
virtual bool HandlesRightClick ()
 Whether the handle has any special right-button handling. More...
 
virtual void OnProjectChange (AudacityProject *pProject)
 
Result GetChangeHighlight () const
 
void SetChangeHighlight (Result val)
 
- Public Member Functions inherited from TrackPanelDrawable
virtual ~TrackPanelDrawable ()=0
 

Static Public Member Functions

static bool DoSlideVertical (ViewInfo &viewInfo, wxCoord xx, ClipMoveState &state, TrackList &trackList, Track &dstTrack, double &desiredSlideAmount)
 
static UIHandlePtr HitAnywhere (std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
 
static UIHandlePtr HitTest (std::weak_ptr< TimeShiftHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< Track > &pTrack)
 
- Static Public Member Functions inherited from UIHandle
static UIHandle::Result NeedChangeHighlight (const UIHandle &, const UIHandle &)
 
- 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)
 

Protected Member Functions

std::shared_ptr< TrackGetTrack () const
 
bool WasMoved () const
 

Private Member Functions

 TimeShiftHandle (const TimeShiftHandle &)=delete
 
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 HitTestPreview HitPreview (const AudacityProject *pProject, bool unsafe)
 

Private Attributes

wxRect mRect {}
 
bool mDidSlideVertically {}
 
bool mSlideUpDownOnly {}
 
bool mSnapPreferRightEdge {}
 
std::shared_ptr< SnapManagermSnapManager {}
 
ClipMoveState mClipMoveState {}
 
bool mGripHit {}
 

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Detailed Description

Definition at line 261 of file TimeShiftHandle.h.

Constructor & Destructor Documentation

◆ TimeShiftHandle() [1/2]

TimeShiftHandle::TimeShiftHandle ( const TimeShiftHandle )
privatedelete

◆ TimeShiftHandle() [2/2]

TimeShiftHandle::TimeShiftHandle ( const std::shared_ptr< Track > &  pTrack,
bool  gripHit 
)
explicit

Definition at line 30 of file TimeShiftHandle.cpp.

32  : mGripHit{ gripHit }
33 {
35 }

◆ ~TimeShiftHandle()

TimeShiftHandle::~TimeShiftHandle ( )
virtual

Definition at line 113 of file TimeShiftHandle.cpp.

114 {
115 }

Member Function Documentation

◆ Cancel()

UIHandle::Result TimeShiftHandle::Cancel ( AudacityProject pProject)
overridevirtual

Implements UIHandle.

Definition at line 979 of file TimeShiftHandle.cpp.

980 {
981  ProjectHistory::Get( *pProject ).RollbackState();
983 }

References ProjectHistory::Get(), RefreshCode::RefreshAll, and ProjectHistory::RollbackState().

Referenced by Drag(), and Release().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Click()

UIHandle::Result TimeShiftHandle::Click ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
overridevirtual

Implements UIHandle.

Definition at line 473 of file TimeShiftHandle.cpp.

475 {
476  using namespace RefreshCode;
477  const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
478  if ( unsafe )
479  return Cancelled;
480 
481  const wxMouseEvent &event = evt.event;
482  const wxRect &rect = evt.rect;
483  auto &viewInfo = ViewInfo::Get( *pProject );
484 
485  const auto pView = std::static_pointer_cast<TrackView>(evt.pCell);
486  const auto pTrack = pView ? pView->FindTrack().get() : nullptr;
487  if (!pTrack)
488  return RefreshCode::Cancelled;
489 
490  auto &trackList = TrackList::Get( *pProject );
491 
493  mDidSlideVertically = false;
494 
495  const bool multiToolModeActive =
497 
498  const double clickTime =
499  viewInfo.PositionToTime(event.m_x, rect.x);
500 
501  auto pShifter = MakeTrackShifter::Call( *pTrack, *pProject );
502 
503  auto hitTestResult = TrackShifter::HitTestResult::Track;
504  if (!event.ShiftDown()) {
506  rect, event.m_x, event.m_y
507  };
508  hitTestResult = pShifter->HitTest( clickTime, viewInfo, &params );
509  switch( hitTestResult ) {
511  return Cancelled;
512  default:
513  break;
514  }
515  }
516  else {
517  // just do shifting of one whole track
518  }
519 
520  mClipMoveState.Init( *pProject, *pTrack,
521  hitTestResult,
522  std::move( pShifter ),
523  clickTime,
524 
525  viewInfo, trackList,
526  ProjectSettings::Get( *pProject ).IsSyncLocked() );
527 
528  mSlideUpDownOnly = event.CmdDown() && !multiToolModeActive;
529  mRect = rect;
530  mClipMoveState.mMouseClickX = event.m_x;
531  mSnapManager =
532  std::make_shared<SnapManager>(*trackList.GetOwner(),
533  FindCandidates( trackList, mClipMoveState.shifters ),
534  viewInfo,
535  true, // don't snap to time
539  auto pInterval = mClipMoveState.CapturedInterval();
540  mSnapPreferRightEdge = pInterval &&
541  (fabs(clickTime - pInterval->End()) <
542  fabs(clickTime - pInterval->Start()));
543 
544  return RefreshNone;
545 }

References AttachedVirtualFunction< Tag, Return, This, Arguments >::Call(), RefreshCode::Cancelled, ClipMoveState::CapturedInterval(), ClipMoveState::clear(), TrackPanelMouseEvent::event, anonymous_namespace{TimeShiftHandle.cpp}::FindCandidates(), ViewInfo::Get(), ProjectAudioIO::Get(), ProjectSettings::Get(), TrackList::Get(), ProjectSettings::GetTool(), ClipMoveState::Init(), ProjectAudioIO::IsAudioActive(), ProjectSettings::IsSyncLocked(), kPixelTolerance, mClipMoveState, mDidSlideVertically, TrackShifter::Miss, ClipMoveState::mMouseClickX, mRect, mSlideUpDownOnly, mSnapManager, mSnapPreferRightEdge, ToolCodes::multiTool, params, TrackPanelMouseEvent::pCell, TrackPanelMouseEvent::rect, RefreshCode::RefreshNone, ClipMoveState::shifters, ClipMoveState::snapLeft, ClipMoveState::snapRight, and TrackShifter::Track.

Referenced by AffordanceHandle::Click().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Clicked()

bool TimeShiftHandle::Clicked ( ) const

Definition at line 47 of file TimeShiftHandle.cpp.

48 {
50 }

References ClipMoveState::initialized, and mClipMoveState.

Referenced by AffordanceHandle::Preview().

Here is the caller graph for this function:

◆ DoSlideVertical()

bool TimeShiftHandle::DoSlideVertical ( ViewInfo viewInfo,
wxCoord  xx,
ClipMoveState state,
TrackList trackList,
Track dstTrack,
double &  desiredSlideAmount 
)
static

Definition at line 756 of file TimeShiftHandle.cpp.

760 {
761  Correspondence correspondence;
762 
763  // See if captured track corresponds to another
764  auto &capturedTrack = *state.mCapturedTrack;
765  if (!FindCorrespondence(
766  correspondence, trackList, capturedTrack, dstTrack, state ))
767  return false;
768 
769  // Try to extend the correpondence
770  auto tryExtend = [&](bool forward){
771  auto begin = trackList.begin(), end = trackList.end();
772  auto pCaptured = trackList.Find( &capturedTrack );
773  auto pDst = trackList.Find( &dstTrack );
774  // Scan for more correspondences
775  while ( true ) {
776  // Remember that TrackIter wraps circularly to the end iterator when
777  // decrementing it
778 
779  // First move to a track with moving intervals and
780  // without a correspondent
781  do
782  forward ? ++pCaptured : --pCaptured;
783  while ( pCaptured != end &&
784  ( correspondence.count(*pCaptured) || state.shifters[*pCaptured]->MovingIntervals().empty() ) );
785  if ( pCaptured == end )
786  break;
787 
788  // Change the choice of possible correspondent track too
789  do
790  forward ? ++pDst : --pDst;
791  while ( pDst != end && correspondence.count(*pDst) );
792  if ( pDst == end )
793  break;
794 
795  // Make correspondence if we can
796  if (!FindCorrespondence(
797  correspondence, trackList, **pCaptured, **pDst, state ))
798  break;
799  }
800  };
801  // Try extension, backward first, then forward
802  // (anticipating the case of dragging a label that is under a clip)
803  tryExtend(false);
804  tryExtend(true);
805 
806  // Having passed that test, remove clips temporarily from their
807  // tracks, so moving clips don't interfere with each other
808  // when we call CanInsertClip()
809  TemporaryClipRemover remover{ state };
810 
811  // Now check that the move is possible
812  double slide = desiredSlideAmount; // remember amount requested.
813  // The test for tolerance will need review with FishEye!
814  // The tolerance is supposed to be the time for one pixel,
815  // i.e. one pixel tolerance at current zoom.
816  double tolerance =
817  viewInfo.PositionToTime(xx + 1) - viewInfo.PositionToTime(xx);
818  bool ok = CheckFit( state, correspondence, remover.detached,
819  tolerance, desiredSlideAmount /*in,out*/ );
820 
821  if (!ok) {
822  // Failure, even with using tolerance.
823  remover.Reinsert( nullptr );
824  return false;
825  }
826 
827  // Make the offset permanent; start from a "clean slate"
828  state.mMouseClickX = xx;
829  remover.Reinsert( &correspondence );
830  return true;
831 }

References TrackList::begin(), anonymous_namespace{TimeShiftHandle.cpp}::CheckFit(), TrackList::end(), TrackList::Find(), anonymous_namespace{TimeShiftHandle.cpp}::FindCorrespondence(), ClipMoveState::mCapturedTrack, ClipMoveState::mMouseClickX, ZoomInfo::PositionToTime(), and ClipMoveState::shifters.

Referenced by Drag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Drag()

UIHandle::Result TimeShiftHandle::Drag ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
overridevirtual

Implements UIHandle.

Definition at line 833 of file TimeShiftHandle.cpp.

835 {
836  using namespace RefreshCode;
837  const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
838  if (unsafe) {
839  this->Cancel(pProject);
840  return RefreshAll | Cancelled;
841  }
842 
843  const wxMouseEvent &event = evt.event;
844  auto &viewInfo = ViewInfo::Get( *pProject );
845 
846  TrackView *trackView = dynamic_cast<TrackView*>(evt.pCell.get());
847  Track *track = trackView ? trackView->FindTrack().get() : nullptr;
848 
849  // Uncommenting this permits drag to continue to work even over the controls area
850  /*
851  track = static_cast<CommonTrackPanelCell*>(evt.pCell)->FindTrack().get();
852  */
853 
854  if (!track) {
855  // Allow sliding if the pointer is not over any track, but only if x is
856  // within the bounds of the tracks area.
857  if (event.m_x >= mRect.GetX() &&
858  event.m_x < mRect.GetX() + mRect.GetWidth())
859  track = mClipMoveState.mCapturedTrack.get();
860  }
861 
862  // May need a shared_ptr to reassign mCapturedTrack below
863  auto pTrack = Track::SharedPointer( track );
864  if (!pTrack)
866 
867 
868  auto &trackList = TrackList::Get( *pProject );
869 
870  // GM: slide now implementing snap-to
871  // samples functionality based on sample rate.
872 
873  // Start by undoing the current slide amount; everything
874  // happens relative to the original horizontal position of
875  // each clip...
877 
879  // Slide the selection, too
880  viewInfo.selectedRegion.move( -mClipMoveState.hSlideAmount );
881  }
883 
884  double desiredSlideAmount =
885  FindDesiredSlideAmount( viewInfo, mRect.x, event, mSnapManager.get(),
887  *pTrack );
888 
889  // Scroll during vertical drag.
890  // If the mouse is over a track that isn't the captured track,
891  // decide which tracks the captured clips should go to.
892  // EnsureVisible(pTrack); //vvv Gale says this has problems on Linux, per bug 393 thread. Revert for 2.0.2.
893  bool slidVertically = (
895  /* && !mCapturedClipIsSelection*/
896  && DoSlideVertical( viewInfo, event.m_x, mClipMoveState,
897  trackList, *pTrack, desiredSlideAmount ) );
898  if (slidVertically)
899  {
901  mDidSlideVertically = true;
902  }
903 
904  if (desiredSlideAmount == 0.0)
905  return RefreshAll;
906 
907  // Note that mouse dragging doesn't use TrackShifter::HintOffsetLarger()
908 
909  mClipMoveState.DoSlideHorizontal( desiredSlideAmount );
910 
912  // Slide the selection, too
913  viewInfo.selectedRegion.move( mClipMoveState.hSlideAmount );
914  }
915 
916  if (slidVertically) {
917  // NEW origin
919  }
920 
921  return RefreshAll;
922 }

References Cancel(), RefreshCode::Cancelled, ClipMoveState::DoHorizontalOffset(), ClipMoveState::DoSlideHorizontal(), DoSlideVertical(), TrackPanelMouseEvent::event, anonymous_namespace{TimeShiftHandle.cpp}::FindDesiredSlideAmount(), CommonTrackPanelCell::FindTrack(), ViewInfo::Get(), ProjectAudioIO::Get(), TrackList::Get(), ClipMoveState::hSlideAmount, ProjectAudioIO::IsAudioActive(), ClipMoveState::mCapturedTrack, mClipMoveState, mDidSlideVertically, ClipMoveState::movingSelection, mRect, mSlideUpDownOnly, mSnapManager, mSnapPreferRightEdge, TrackPanelMouseEvent::pCell, RefreshCode::RefreshAll, RefreshCode::RefreshNone, and Track::SharedPointer().

Here is the call graph for this function:

◆ Draw()

void TimeShiftHandle::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 
)
overrideprivatevirtual

Reimplemented from TrackPanelDrawable.

Definition at line 985 of file TimeShiftHandle.cpp.

988 {
989  if ( iPass == TrackArtist::PassSnapping ) {
990  auto &dc = context.dc;
991  // Draw snap guidelines if we have any
992  if ( mSnapManager ) {
993  mSnapManager->Draw(
995  }
996  }
997 }

References TrackPanelDrawingContext::dc, mClipMoveState, mSnapManager, TrackArtist::PassSnapping, ClipMoveState::snapLeft, and ClipMoveState::snapRight.

◆ DrawingArea()

wxRect TimeShiftHandle::DrawingArea ( TrackPanelDrawingContext ,
const wxRect &  rect,
const wxRect &  panelRect,
unsigned  iPass 
)
overrideprivatevirtual

Reimplemented from TrackPanelDrawable.

Definition at line 999 of file TimeShiftHandle.cpp.

1002 {
1003  if ( iPass == TrackArtist::PassSnapping )
1004  return MaximizeHeight( rect, panelRect );
1005  else
1006  return rect;
1007 }

References TrackPanelDrawable::MaximizeHeight(), and TrackArtist::PassSnapping.

Here is the call graph for this function:

◆ Enter()

void TimeShiftHandle::Enter ( bool  forward,
AudacityProject  
)
overridevirtual

Reimplemented from UIHandle.

Definition at line 52 of file TimeShiftHandle.cpp.

53 {
54 #ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
56 #endif
57 }

References UIHandle::mChangeHighlight, and RefreshCode::RefreshCell.

Referenced by AffordanceHandle::Enter().

Here is the caller graph for this function:

◆ GetTrack()

std::shared_ptr< Track > TimeShiftHandle::GetTrack ( ) const
protected

Definition at line 37 of file TimeShiftHandle.cpp.

38 {
40 }

References ClipMoveState::mCapturedTrack, and mClipMoveState.

Referenced by AffordanceHandle::Release(), and NoteTrackAffordanceHandle::SelectAt().

Here is the caller graph for this function:

◆ HitAnywhere()

UIHandlePtr TimeShiftHandle::HitAnywhere ( std::weak_ptr< TimeShiftHandle > &  holder,
const std::shared_ptr< Track > &  pTrack,
bool  gripHit 
)
static

Definition at line 79 of file TimeShiftHandle.cpp.

82 {
83  auto result = std::make_shared<TimeShiftHandle>( pTrack, gripHit );
84  result = AssignUIHandlePtr(holder, result);
85  return result;
86 }

References AssignUIHandlePtr().

Referenced by WaveTrackView::DoDetailedHitTest(), CommonTrackView::HitTest(), and HitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HitPreview()

HitTestPreview TimeShiftHandle::HitPreview ( const AudacityProject pProject,
bool  unsafe 
)
staticprivate

Definition at line 59 of file TimeShiftHandle.cpp.

61 {
62  static auto disabledCursor =
63  ::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
64  static auto slideCursor =
65  MakeCursor(wxCURSOR_SIZEWE, TimeCursorXpm, 16, 16);
66  // TODO: Should it say "track or clip" ? Non-wave tracks can move, or clips in a wave track.
67  // TODO: mention effects of shift (move all clips of selected wave track) and ctrl (move vertically only) ?
68  // -- but not all of that is available in multi tool.
69  auto message = XO("Click and drag to move a track in time");
70 
71  return {
72  message,
73  (unsafe
74  ? &*disabledCursor
75  : &*slideCursor)
76  };
77 }

References MakeCursor(), and XO.

Referenced by Preview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HitTest()

UIHandlePtr TimeShiftHandle::HitTest ( std::weak_ptr< TimeShiftHandle > &  holder,
const wxMouseState &  state,
const wxRect &  rect,
const std::shared_ptr< Track > &  pTrack 
)
static

method that tells us if the mouse event landed on a time-slider that allows us to time shift the sequence. (Those are the two "grips" drawn at left and right edges for multi tool mode.)

Definition at line 88 of file TimeShiftHandle.cpp.

92 {
96 
97  // Perhaps we should delegate this to TrackArtist as only TrackArtist
98  // knows what the real sizes are??
99 
100  // The drag Handle width includes border, width and a little extra margin.
101  const int adjustedDragHandleWidth = 14;
102  // The hotspot for the cursor isn't at its centre. Adjust for this.
103  const int hotspotOffset = 5;
104 
105  // We are doing an approximate test here - is the mouse in the right or left border?
106  if (!(state.m_x + hotspotOffset < rect.x + adjustedDragHandleWidth ||
107  state.m_x + hotspotOffset >= rect.x + rect.width - adjustedDragHandleWidth))
108  return {};
109 
110  return HitAnywhere( holder, pTrack, true );
111 }

References HitAnywhere().

Referenced by WaveformView::DetailedHitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsGripHit()

bool TimeShiftHandle::IsGripHit ( ) const
inline

Definition at line 273 of file TimeShiftHandle.h.

273 { return mGripHit; }

Referenced by WaveformView::DoDraw().

Here is the caller graph for this function:

◆ operator=()

TimeShiftHandle& TimeShiftHandle::operator= ( TimeShiftHandle &&  )
default

◆ Preview()

HitTestPreview TimeShiftHandle::Preview ( const TrackPanelMouseState state,
AudacityProject pProject 
)
overridevirtual

Implements UIHandle.

Definition at line 924 of file TimeShiftHandle.cpp.

926 {
927  // After all that, it still may be unsafe to drag.
928  // Even if so, make an informative cursor change from default to "banned."
929  const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
930  return HitPreview(pProject, unsafe);
931 }

References ProjectAudioIO::Get(), HitPreview(), and ProjectAudioIO::IsAudioActive().

Here is the call graph for this function:

◆ Release()

UIHandle::Result TimeShiftHandle::Release ( const TrackPanelMouseEvent event,
AudacityProject pProject,
wxWindow *  pParent 
)
overridevirtual

Implements UIHandle.

Definition at line 933 of file TimeShiftHandle.cpp.

936 {
937  using namespace RefreshCode;
938  const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
939  if (unsafe)
940  return this->Cancel(pProject);
941 
942  Result result = RefreshNone;
943 
944  // Do not draw yellow lines
945  if ( mClipMoveState.snapLeft != -1 || mClipMoveState.snapRight != -1) {
947  result |= RefreshAll;
948  }
949 
951  return result;
952 
953  for ( auto &pair : mClipMoveState.shifters )
954  if ( !pair.second->FinishMigration() )
956 
957  TranslatableString msg;
958  bool consolidate;
959  if (mDidSlideVertically) {
960  msg = XO("Moved clips to another track");
961  consolidate = false;
962  for (auto& pair : mClipMoveState.shifters)
963  pair.first->LinkConsistencyCheck();
964  }
965  else {
966  msg = ( mClipMoveState.hSlideAmount > 0
967  ? XO("Time shifted tracks/clips right %.02f seconds")
968  : XO("Time shifted tracks/clips left %.02f seconds")
969  )
970  .Format( fabs( mClipMoveState.hSlideAmount ) );
971  consolidate = true;
972  }
973  ProjectHistory::Get( *pProject ).PushState(msg, XO("Time-Shift"),
974  consolidate ? (UndoPush::CONSOLIDATE) : (UndoPush::NONE));
975 
976  return result | FixScrollbars;
977 }

References Cancel(), CONSOLIDATE, RefreshCode::FixScrollbars, ProjectAudioIO::Get(), ProjectHistory::Get(), ClipMoveState::hSlideAmount, ProjectAudioIO::IsAudioActive(), mClipMoveState, mDidSlideVertically, anonymous_namespace{TimeShiftHandle.cpp}::MigrationFailure(), NONE, ProjectHistory::PushState(), RefreshCode::RefreshAll, RefreshCode::RefreshNone, ClipMoveState::shifters, ClipMoveState::snapLeft, ClipMoveState::snapRight, and XO.

Referenced by AffordanceHandle::Release().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StopsOnKeystroke()

bool TimeShiftHandle::StopsOnKeystroke ( )
inlineoverridevirtual

Reimplemented from UIHandle.

Definition at line 311 of file TimeShiftHandle.h.

311 { return true; }

◆ WasMoved()

bool TimeShiftHandle::WasMoved ( ) const
protected

Definition at line 42 of file TimeShiftHandle.cpp.

References ClipMoveState::initialized, mClipMoveState, mDidSlideVertically, and ClipMoveState::wasMoved.

Referenced by AffordanceHandle::Release().

Here is the caller graph for this function:

Member Data Documentation

◆ mClipMoveState

ClipMoveState TimeShiftHandle::mClipMoveState {}
private

Definition at line 342 of file TimeShiftHandle.h.

Referenced by Click(), Clicked(), Drag(), Draw(), GetTrack(), Release(), and WasMoved().

◆ mDidSlideVertically

bool TimeShiftHandle::mDidSlideVertically {}
private

Definition at line 331 of file TimeShiftHandle.h.

Referenced by Click(), Drag(), Release(), and WasMoved().

◆ mGripHit

bool TimeShiftHandle::mGripHit {}
private

Definition at line 343 of file TimeShiftHandle.h.

◆ mRect

wxRect TimeShiftHandle::mRect {}
private

Definition at line 329 of file TimeShiftHandle.h.

Referenced by Click(), and Drag().

◆ mSlideUpDownOnly

bool TimeShiftHandle::mSlideUpDownOnly {}
private

Definition at line 332 of file TimeShiftHandle.h.

Referenced by Click(), and Drag().

◆ mSnapManager

std::shared_ptr<SnapManager> TimeShiftHandle::mSnapManager {}
private

Definition at line 340 of file TimeShiftHandle.h.

Referenced by Click(), Drag(), and Draw().

◆ mSnapPreferRightEdge

bool TimeShiftHandle::mSnapPreferRightEdge {}
private

Definition at line 334 of file TimeShiftHandle.h.

Referenced by Click(), and Drag().


The documentation for this class was generated from the following files:
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
RefreshCode::FixScrollbars
@ FixScrollbars
Definition: RefreshCode.h:27
ViewInfo::Get
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:241
RefreshCode::RefreshAll
@ RefreshAll
Definition: RefreshCode.h:26
RefreshCode::RefreshNone
@ RefreshNone
Definition: RefreshCode.h:21
AttachedVirtualFunction::Call
static Return Call(This &obj, Arguments &&...arguments)
Invoke the method – but only after static initialization time.
Definition: AttachedVirtualFunction.h:223
TrackShifter::HitTestResult::Track
@ Track
Shift selected track and sister channels only, as a whole.
ClipMoveState::snapLeft
wxInt64 snapLeft
Definition: TimeShiftHandle.h:245
ClipMoveState::DoHorizontalOffset
void DoHorizontalOffset(double offset)
Offset tracks or intervals horizontally, without adjusting the offset.
Definition: TimeShiftHandle.cpp:117
CommonTrackPanelCell::FindTrack
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:46
Format
Abstract base class used in importing a file.
TrackArtist::PassSnapping
@ PassSnapping
Definition: TrackArtist.h:88
MakeCursor
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
Definition: TrackPanel.cpp:182
ClipMoveState::snapRight
wxInt64 snapRight
Definition: TimeShiftHandle.h:245
Track::SharedPointer
std::shared_ptr< Subclass > SharedPointer()
Definition: Track.h:291
TimeShiftHandle::mSnapPreferRightEdge
bool mSnapPreferRightEdge
Definition: TimeShiftHandle.h:334
RefreshCode::Cancelled
@ Cancelled
Definition: RefreshCode.h:23
UndoPush::NONE
@ NONE
XO
#define XO(s)
Definition: Internat.h:31
ProjectSettings::Get
static ProjectSettings & Get(AudacityProject &project)
Definition: ProjectSettings.cpp:44
TrackList::Find
auto Find(Track *pTrack) -> TrackIter< TrackType >
Turn a pointer into a TrackIter (constant time); get end iterator if this does not own the track.
Definition: Track.h:1333
TrackPanelDrawingContext::dc
wxDC & dc
Definition: TrackPanelDrawingContext.h:23
TimeShiftHandle::mSlideUpDownOnly
bool mSlideUpDownOnly
Definition: TimeShiftHandle.h:332
TrackShifter::HitTestResult::Miss
@ Miss
Don't shift anything.
ProjectSettings::GetTool
int GetTool() const
Definition: ProjectSettings.h:94
ProjectAudioIO::Get
static ProjectAudioIO & Get(AudacityProject &project)
Definition: ProjectAudioIO.cpp:22
TimeShiftHandle::mSnapManager
std::shared_ptr< SnapManager > mSnapManager
Definition: TimeShiftHandle.h:340
ProjectAudioIO::IsAudioActive
bool IsAudioActive() const
Definition: ProjectAudioIO.cpp:51
TimeShiftHandle::mClipMoveState
ClipMoveState mClipMoveState
Definition: TimeShiftHandle.h:342
TrackList::end
iterator end()
Definition: Track.h:1325
ClipMoveState::mCapturedTrack
std::shared_ptr< Track > mCapturedTrack
Definition: TimeShiftHandle.h:238
ProjectSettings::IsSyncLocked
bool IsSyncLocked() const
Definition: ProjectSettings.cpp:179
UIHandle::mChangeHighlight
Result mChangeHighlight
Definition: UIHandle.h:139
ToolCodes::multiTool
@ multiTool
Definition: ProjectSettings.h:44
TimeShiftHandle::mDidSlideVertically
bool mDidSlideVertically
Definition: TimeShiftHandle.h:331
ClipMoveState::shifters
ShifterMap shifters
Definition: TimeShiftHandle.h:244
kPixelTolerance
const int kPixelTolerance
Definition: Snap.h:28
TrackList::begin
iterator begin()
Definition: Track.h:1324
ClipMoveState::hSlideAmount
double hSlideAmount
Definition: TimeShiftHandle.h:243
UIHandle::Result
unsigned Result
Definition: UIHandle.h:38
anonymous_namespace{TimeShiftHandle.cpp}::Correspondence
std::unordered_map< Track *, Track * > Correspondence
Definition: TimeShiftHandle.cpp:616
ClipMoveState::CapturedInterval
const TrackInterval * CapturedInterval() const
Return pointer to the first fixed interval of the captured track, if there is one.
Definition: TimeShiftHandle.cpp:394
TimeShiftHandle::HitPreview
static HitTestPreview HitPreview(const AudacityProject *pProject, bool unsafe)
Definition: TimeShiftHandle.cpp:60
anonymous_namespace{TimeShiftHandle.cpp}::FindDesiredSlideAmount
double FindDesiredSlideAmount(const ViewInfo &viewInfo, wxCoord xx, const wxMouseEvent &event, SnapManager *pSnapManager, bool slideUpDownOnly, bool snapPreferRightEdge, ClipMoveState &state, Track &track)
Definition: TimeShiftHandle.cpp:548
TrackPanelDrawable::MaximizeHeight
static wxRect MaximizeHeight(const wxRect &rect, const wxRect &panelRect)
Definition: TrackPanelDrawable.h:52
ClipMoveState::movingSelection
bool movingSelection
Definition: TimeShiftHandle.h:241
ClipMoveState::DoSlideHorizontal
double DoSlideHorizontal(double desiredSlideAmount)
Do sliding of tracks and intervals, maybe adjusting the offset.
Definition: TimeShiftHandle.cpp:411
TimeShiftHandle::DoSlideVertical
static bool DoSlideVertical(ViewInfo &viewInfo, wxCoord xx, ClipMoveState &state, TrackList &trackList, Track &dstTrack, double &desiredSlideAmount)
Definition: TimeShiftHandle.cpp:757
RefreshCode::RefreshCell
@ RefreshCell
Definition: RefreshCode.h:24
TimeShiftHandle::mRect
wxRect mRect
Definition: TimeShiftHandle.h:329
ClipMoveState::mMouseClickX
int mMouseClickX
Definition: TimeShiftHandle.h:247
ClipMoveState::Init
void Init(AudacityProject &project, Track &capturedTrack, TrackShifter::HitTestResult hitTestResult, std::unique_ptr< TrackShifter > pHit, double clickTime, const ViewInfo &viewInfo, TrackList &trackList, bool syncLocked)
Will associate a TrackShifter with each track in the list.
Definition: TimeShiftHandle.cpp:281
ProjectHistory::PushState
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
Definition: ProjectHistory.cpp:90
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:506
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
TrackView
Definition: TrackView.h:24
TimeShiftHandle::Cancel
Result Cancel(AudacityProject *pProject) override
Definition: TimeShiftHandle.cpp:979
ProjectHistory::RollbackState
void RollbackState()
Definition: ProjectHistory.cpp:117
anonymous_namespace{TimeShiftHandle.cpp}::MigrationFailure
void MigrationFailure()
Definition: TimeShiftHandle.cpp:722
anonymous_namespace{TimeShiftHandle.cpp}::FindCandidates
SnapPointArray FindCandidates(const TrackList &tracks, const ClipMoveState::ShifterMap &shifters)
Definition: TimeShiftHandle.cpp:453
anonymous_namespace{TimeShiftHandle.cpp}::FindCorrespondence
bool FindCorrespondence(Correspondence &correspondence, TrackList &trackList, Track &capturedTrack, Track &track, ClipMoveState &state)
Definition: TimeShiftHandle.cpp:618
UndoPush::CONSOLIDATE
@ CONSOLIDATE
TimeShiftHandle::mGripHit
bool mGripHit
Definition: TimeShiftHandle.h:343
ClipMoveState::initialized
bool initialized
Definition: TimeShiftHandle.h:240
anonymous_namespace{TimeShiftHandle.cpp}::CheckFit
bool CheckFit(ClipMoveState &state, const Correspondence &correspondence, const DetachedIntervals &intervals, double tolerance, double &desiredSlideAmount)
Definition: TimeShiftHandle.cpp:689
params
EffectDistortion::Params params
Definition: Distortion.cpp:99
AssignUIHandlePtr
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:151
RefreshCode
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16
ClipMoveState::clear
void clear()
Definition: TimeShiftHandle.h:249
TimeShiftHandle::HitAnywhere
static UIHandlePtr HitAnywhere(std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
Definition: TimeShiftHandle.cpp:80
ClipMoveState::wasMoved
bool wasMoved
Definition: TimeShiftHandle.h:242
ProjectHistory::Get
static ProjectHistory & Get(AudacityProject &project)
Definition: ProjectHistory.cpp:26
ZoomInfo::PositionToTime
double PositionToTime(wxInt64 position, wxInt64 origin=0, bool ignoreFisheye=false) const
Definition: ZoomInfo.cpp:39
TrackShifter::HitTestParams
Optional, more complete information for hit testing.
Definition: TimeShiftHandle.h:52