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

#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
 
std::shared_ptr< TrackGetTrack () const =delete
 
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
 
- 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 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)
 

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 254 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 98 of file TimeShiftHandle.cpp.

99 {
100 }

Member Function Documentation

◆ Cancel()

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

Implements UIHandle.

Definition at line 954 of file TimeShiftHandle.cpp.

955 {
956  ProjectHistory::Get( *pProject ).RollbackState();
958 }

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 454 of file TimeShiftHandle.cpp.

456 {
457  using namespace RefreshCode;
458  const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
459  if ( unsafe )
460  return Cancelled;
461 
462  const wxMouseEvent &event = evt.event;
463  const wxRect &rect = evt.rect;
464  auto &viewInfo = ViewInfo::Get( *pProject );
465 
466  const auto pView = std::static_pointer_cast<TrackView>(evt.pCell);
467  const auto pTrack = pView ? pView->FindTrack().get() : nullptr;
468  if (!pTrack)
469  return RefreshCode::Cancelled;
470 
471  auto &trackList = TrackList::Get( *pProject );
472 
474  mDidSlideVertically = false;
475 
476  const bool multiToolModeActive =
478 
479  const double clickTime =
480  viewInfo.PositionToTime(event.m_x, rect.x);
481 
482  auto pShifter = MakeTrackShifter::Call( *pTrack, *pProject );
483 
484  auto hitTestResult = TrackShifter::HitTestResult::Track;
485  if (!event.ShiftDown()) {
487  rect, event.m_x, event.m_y
488  };
489  hitTestResult = pShifter->HitTest( clickTime, viewInfo, &params );
490  switch( hitTestResult ) {
492  return Cancelled;
493  default:
494  break;
495  }
496  }
497  else {
498  // just do shifting of one whole track
499  }
500 
501  mClipMoveState.Init( *pProject, *pTrack,
502  hitTestResult,
503  std::move( pShifter ),
504  clickTime,
505 
506  viewInfo, trackList,
507  ProjectSettings::Get( *pProject ).IsSyncLocked() );
508 
509  mSlideUpDownOnly = event.CmdDown() && !multiToolModeActive;
510  mRect = rect;
511  mClipMoveState.mMouseClickX = event.m_x;
512  mSnapManager =
513  std::make_shared<SnapManager>(*trackList.GetOwner(),
514  FindCandidates( trackList, mClipMoveState.shifters ),
515  viewInfo,
516  true, // don't snap to time
520  auto pInterval = mClipMoveState.CapturedInterval();
521  mSnapPreferRightEdge = pInterval &&
522  (fabs(clickTime - pInterval->End()) <
523  fabs(clickTime - pInterval->Start()));
524 
525  return RefreshNone;
526 }

References AttachedVirtualFunction< Tag, Return, This, Arguments >::Call(), RefreshCode::Cancelled, Cancelled, ClipMoveState::CapturedInterval(), ClipMoveState::clear(), TrackPanelMouseEvent::event, anonymous_namespace{TimeShiftHandle.cpp}::FindCandidates(), ProjectAudioIO::Get(), ProjectSettings::Get(), TrackList::Get(), ViewInfo::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.

Here is the call graph for this function:

◆ DoSlideVertical()

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

Definition at line 733 of file TimeShiftHandle.cpp.

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

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 810 of file TimeShiftHandle.cpp.

812 {
813  using namespace RefreshCode;
814  const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
815  if (unsafe) {
816  this->Cancel(pProject);
817  return RefreshAll | Cancelled;
818  }
819 
820  const wxMouseEvent &event = evt.event;
821  auto &viewInfo = ViewInfo::Get( *pProject );
822 
823  TrackView *trackView = dynamic_cast<TrackView*>(evt.pCell.get());
824  Track *track = trackView ? trackView->FindTrack().get() : nullptr;
825 
826  // Uncommenting this permits drag to continue to work even over the controls area
827  /*
828  track = static_cast<CommonTrackPanelCell*>(evt.pCell)->FindTrack().get();
829  */
830 
831  if (!track) {
832  // Allow sliding if the pointer is not over any track, but only if x is
833  // within the bounds of the tracks area.
834  if (event.m_x >= mRect.GetX() &&
835  event.m_x < mRect.GetX() + mRect.GetWidth())
836  track = mClipMoveState.mCapturedTrack.get();
837  }
838 
839  // May need a shared_ptr to reassign mCapturedTrack below
840  auto pTrack = Track::SharedPointer( track );
841  if (!pTrack)
843 
844 
845  auto &trackList = TrackList::Get( *pProject );
846 
847  // GM: slide now implementing snap-to
848  // samples functionality based on sample rate.
849 
850  // Start by undoing the current slide amount; everything
851  // happens relative to the original horizontal position of
852  // each clip...
854 
856  // Slide the selection, too
857  viewInfo.selectedRegion.move( -mClipMoveState.hSlideAmount );
858  }
860 
861  double desiredSlideAmount =
862  FindDesiredSlideAmount( viewInfo, mRect.x, event, mSnapManager.get(),
864  *pTrack );
865 
866  // Scroll during vertical drag.
867  // If the mouse is over a track that isn't the captured track,
868  // decide which tracks the captured clips should go to.
869  // EnsureVisible(pTrack); //vvv Gale says this has problems on Linux, per bug 393 thread. Revert for 2.0.2.
870  bool slidVertically = (
872  /* && !mCapturedClipIsSelection*/
873  && DoSlideVertical( viewInfo, event.m_x, mClipMoveState,
874  trackList, *pTrack, desiredSlideAmount ) );
875  if (slidVertically)
876  {
878  mDidSlideVertically = true;
879  }
880 
881  if (desiredSlideAmount == 0.0)
882  return RefreshAll;
883 
884  // Note that mouse dragging doesn't use TrackShifter::HintOffsetLarger()
885 
886  mClipMoveState.DoSlideHorizontal( desiredSlideAmount );
887 
889  // Slide the selection, too
890  viewInfo.selectedRegion.move( mClipMoveState.hSlideAmount );
891  }
892 
893  if (slidVertically) {
894  // NEW origin
896  }
897 
898  return RefreshAll;
899 }

References Cancel(), Cancelled, ClipMoveState::DoHorizontalOffset(), ClipMoveState::DoSlideHorizontal(), DoSlideVertical(), TrackPanelMouseEvent::event, anonymous_namespace{TimeShiftHandle.cpp}::FindDesiredSlideAmount(), CommonTrackPanelCell::FindTrack(), ProjectAudioIO::Get(), TrackList::Get(), ViewInfo::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 960 of file TimeShiftHandle.cpp.

963 {
964  if ( iPass == TrackArtist::PassSnapping ) {
965  auto &dc = context.dc;
966  // Draw snap guidelines if we have any
967  if ( mSnapManager ) {
968  mSnapManager->Draw(
970  }
971  }
972 }

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 974 of file TimeShiftHandle.cpp.

977 {
978  if ( iPass == TrackArtist::PassSnapping )
979  return MaximizeHeight( rect, panelRect );
980  else
981  return rect;
982 }

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 37 of file TimeShiftHandle.cpp.

38 {
39 #ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
41 #endif
42 }

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

◆ GetTrack()

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

◆ HitAnywhere()

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

Definition at line 64 of file TimeShiftHandle.cpp.

67 {
68  auto result = std::make_shared<TimeShiftHandle>( pTrack, gripHit );
69  result = AssignUIHandlePtr(holder, result);
70  return result;
71 }

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 44 of file TimeShiftHandle.cpp.

46 {
47  static auto disabledCursor =
48  ::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
49  static auto slideCursor =
50  MakeCursor(wxCURSOR_SIZEWE, TimeCursorXpm, 16, 16);
51  // TODO: Should it say "track or clip" ? Non-wave tracks can move, or clips in a wave track.
52  // TODO: mention effects of shift (move all clips of selected wave track) and ctrl (move vertically only) ?
53  // -- but not all of that is available in multi tool.
54  auto message = XO("Click and drag to move a track in time");
55 
56  return {
57  message,
58  (unsafe
59  ? &*disabledCursor
60  : &*slideCursor)
61  };
62 }

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 73 of file TimeShiftHandle.cpp.

77 {
81 
82  // Perhaps we should delegate this to TrackArtist as only TrackArtist
83  // knows what the real sizes are??
84 
85  // The drag Handle width includes border, width and a little extra margin.
86  const int adjustedDragHandleWidth = 14;
87  // The hotspot for the cursor isn't at its centre. Adjust for this.
88  const int hotspotOffset = 5;
89 
90  // We are doing an approximate test here - is the mouse in the right or left border?
91  if (!(state.m_x + hotspotOffset < rect.x + adjustedDragHandleWidth ||
92  state.m_x + hotspotOffset >= rect.x + rect.width - adjustedDragHandleWidth))
93  return {};
94 
95  return HitAnywhere( holder, pTrack, true );
96 }

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 266 of file TimeShiftHandle.h.

266 { 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 901 of file TimeShiftHandle.cpp.

903 {
904  // After all that, it still may be unsafe to drag.
905  // Even if so, make an informative cursor change from default to "banned."
906  const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
907  return HitPreview(pProject, unsafe);
908 }

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 910 of file TimeShiftHandle.cpp.

913 {
914  using namespace RefreshCode;
915  const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
916  if (unsafe)
917  return this->Cancel(pProject);
918 
919  Result result = RefreshNone;
920 
921  // Do not draw yellow lines
922  if ( mClipMoveState.snapLeft != -1 || mClipMoveState.snapRight != -1) {
924  result |= RefreshAll;
925  }
926 
928  return result;
929 
930  for ( auto &pair : mClipMoveState.shifters )
931  if ( !pair.second->FinishMigration() )
933 
934  TranslatableString msg;
935  bool consolidate;
936  if (mDidSlideVertically) {
937  msg = XO("Moved clips to another track");
938  consolidate = false;
939  }
940  else {
941  msg = ( mClipMoveState.hSlideAmount > 0
942  ? XO("Time shifted tracks/clips right %.02f seconds")
943  : XO("Time shifted tracks/clips left %.02f seconds")
944  )
945  .Format( fabs( mClipMoveState.hSlideAmount ) );
946  consolidate = true;
947  }
948  ProjectHistory::Get( *pProject ).PushState(msg, XO("Time-Shift"),
949  consolidate ? (UndoPush::CONSOLIDATE) : (UndoPush::NONE));
950 
951  return result | FixScrollbars;
952 }

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.

Here is the call graph for this function:

◆ StopsOnKeystroke()

bool TimeShiftHandle::StopsOnKeystroke ( )
inlineoverridevirtual

Reimplemented from UIHandle.

Definition at line 305 of file TimeShiftHandle.h.

305 { return true; }

Member Data Documentation

◆ mClipMoveState

ClipMoveState TimeShiftHandle::mClipMoveState {}
private

Definition at line 330 of file TimeShiftHandle.h.

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

◆ mDidSlideVertically

bool TimeShiftHandle::mDidSlideVertically {}
private

Definition at line 319 of file TimeShiftHandle.h.

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

◆ mGripHit

bool TimeShiftHandle::mGripHit {}
private

Definition at line 331 of file TimeShiftHandle.h.

◆ mRect

wxRect TimeShiftHandle::mRect {}
private

Definition at line 317 of file TimeShiftHandle.h.

Referenced by Click(), and Drag().

◆ mSlideUpDownOnly

bool TimeShiftHandle::mSlideUpDownOnly {}
private

Definition at line 320 of file TimeShiftHandle.h.

Referenced by Click(), and Drag().

◆ mSnapManager

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

Definition at line 328 of file TimeShiftHandle.h.

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

◆ mSnapPreferRightEdge

bool TimeShiftHandle::mSnapPreferRightEdge {}
private

Definition at line 322 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:156
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:229
TrackShifter::HitTestResult::Track
@ Track
Shift selected track and sister channels only, as a whole.
ClipMoveState::snapLeft
wxInt64 snapLeft
Definition: TimeShiftHandle.h:240
ClipMoveState::DoHorizontalOffset
void DoHorizontalOffset(double offset)
Offset tracks or intervals horizontally, without adjusting the offset.
Definition: TimeShiftHandle.cpp:102
CommonTrackPanelCell::FindTrack
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:44
Format
Abstract base class used in importing a file.
TrackArtist::PassSnapping
@ PassSnapping
Definition: TrackArtist.h:70
MakeCursor
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
Definition: TrackPanel.cpp:177
ClipMoveState::snapRight
wxInt64 snapRight
Definition: TimeShiftHandle.h:240
Track::SharedPointer
std::shared_ptr< Subclass > SharedPointer()
Definition: Track.h:279
TimeShiftHandle::mSnapPreferRightEdge
bool mSnapPreferRightEdge
Definition: TimeShiftHandle.h:322
RefreshCode::Cancelled
@ Cancelled
Definition: RefreshCode.h:23
UndoPush::NONE
@ NONE
XO
#define XO(s)
Definition: Internat.h:31
ProgressResult::Cancelled
@ Cancelled
ProjectSettings::Get
static ProjectSettings & Get(AudacityProject &project)
Definition: ProjectSettings.cpp:40
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:1316
TrackPanelDrawingContext::dc
wxDC & dc
Definition: TrackPanelDrawingContext.h:23
TimeShiftHandle::mSlideUpDownOnly
bool mSlideUpDownOnly
Definition: TimeShiftHandle.h:320
TrackShifter::HitTestResult::Miss
@ Miss
Don't shift anything.
ProjectSettings::GetTool
int GetTool() const
Definition: ProjectSettings.h:91
ProjectAudioIO::Get
static ProjectAudioIO & Get(AudacityProject &project)
Definition: ProjectAudioIO.cpp:23
TimeShiftHandle::mSnapManager
std::shared_ptr< SnapManager > mSnapManager
Definition: TimeShiftHandle.h:328
ProjectAudioIO::IsAudioActive
bool IsAudioActive() const
Definition: ProjectAudioIO.cpp:52
TimeShiftHandle::mClipMoveState
ClipMoveState mClipMoveState
Definition: TimeShiftHandle.h:330
TrackList::end
iterator end()
Definition: Track.h:1308
ClipMoveState::mCapturedTrack
std::shared_ptr< Track > mCapturedTrack
Definition: TimeShiftHandle.h:235
ProjectSettings::IsSyncLocked
bool IsSyncLocked() const
Definition: ProjectSettings.cpp:192
UIHandle::mChangeHighlight
Result mChangeHighlight
Definition: UIHandle.h:133
ToolCodes::multiTool
@ multiTool
Definition: ProjectSettings.h:40
TimeShiftHandle::mDidSlideVertically
bool mDidSlideVertically
Definition: TimeShiftHandle.h:319
ClipMoveState::shifters
ShifterMap shifters
Definition: TimeShiftHandle.h:239
kPixelTolerance
const int kPixelTolerance
Definition: Snap.h:28
TrackList::begin
iterator begin()
Definition: Track.h:1307
ClipMoveState::hSlideAmount
double hSlideAmount
Definition: TimeShiftHandle.h:238
UIHandle::Result
unsigned Result
Definition: UIHandle.h:37
anonymous_namespace{TimeShiftHandle.cpp}::Correspondence
std::unordered_map< Track *, Track * > Correspondence
Definition: TimeShiftHandle.cpp:597
ClipMoveState::CapturedInterval
const TrackInterval * CapturedInterval() const
Return pointer to the first fixed interval of the captured track, if there is one.
Definition: TimeShiftHandle.cpp:378
TimeShiftHandle::HitPreview
static HitTestPreview HitPreview(const AudacityProject *pProject, bool unsafe)
Definition: TimeShiftHandle.cpp:45
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:529
TrackPanelDrawable::MaximizeHeight
static wxRect MaximizeHeight(const wxRect &rect, const wxRect &panelRect)
Definition: TrackPanelDrawable.h:52
ClipMoveState::movingSelection
bool movingSelection
Definition: TimeShiftHandle.h:237
ClipMoveState::DoSlideHorizontal
double DoSlideHorizontal(double desiredSlideAmount)
Do sliding of tracks and intervals, maybe adjusting the offset.
Definition: TimeShiftHandle.cpp:395
TimeShiftHandle::DoSlideVertical
static bool DoSlideVertical(ViewInfo &viewInfo, wxCoord xx, ClipMoveState &state, TrackList &trackList, Track &dstTrack, double &desiredSlideAmount)
Definition: TimeShiftHandle.cpp:734
RefreshCode::RefreshCell
@ RefreshCell
Definition: RefreshCode.h:24
TimeShiftHandle::mRect
wxRect mRect
Definition: TimeShiftHandle.h:317
ClipMoveState::mMouseClickX
int mMouseClickX
Definition: TimeShiftHandle.h:242
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:267
ProjectHistory::PushState
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
Definition: ProjectHistory.cpp:90
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:495
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:238
TrackView
Definition: TrackView.h:24
TimeShiftHandle::Cancel
Result Cancel(AudacityProject *pProject) override
Definition: TimeShiftHandle.cpp:954
ProjectHistory::RollbackState
void RollbackState()
Definition: ProjectHistory.cpp:117
anonymous_namespace{TimeShiftHandle.cpp}::MigrationFailure
void MigrationFailure()
Definition: TimeShiftHandle.cpp:699
anonymous_namespace{TimeShiftHandle.cpp}::FindCandidates
SnapPointArray FindCandidates(const TrackList &tracks, const ClipMoveState::ShifterMap &shifters)
Definition: TimeShiftHandle.cpp:434
anonymous_namespace{TimeShiftHandle.cpp}::FindCorrespondence
bool FindCorrespondence(Correspondence &correspondence, TrackList &trackList, Track &capturedTrack, Track &track, ClipMoveState &state)
Definition: TimeShiftHandle.cpp:599
UndoPush::CONSOLIDATE
@ CONSOLIDATE
TimeShiftHandle::mGripHit
bool mGripHit
Definition: TimeShiftHandle.h:331
anonymous_namespace{TimeShiftHandle.cpp}::CheckFit
bool CheckFit(ClipMoveState &state, const Correspondence &correspondence, const DetachedIntervals &intervals, double tolerance, double &desiredSlideAmount)
Definition: TimeShiftHandle.cpp:666
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:145
RefreshCode
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16
ClipMoveState::clear
void clear()
Definition: TimeShiftHandle.h:244
TimeShiftHandle::HitAnywhere
static UIHandlePtr HitAnywhere(std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
Definition: TimeShiftHandle.cpp:65
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:43
TrackShifter::HitTestParams
Optional, more complete information for hit testing.
Definition: TimeShiftHandle.h:50