2010-01-23 19:44:49 +00:00
/**********************************************************************
Audacity : A Digital Audio Editor
TrackPanel . h
Dominic Mazzoni
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# ifndef __AUDACITY_TRACK_PANEL__
# define __AUDACITY_TRACK_PANEL__
2014-10-18 14:19:38 +00:00
# include <memory>
2015-04-12 16:39:11 +00:00
# include <vector>
2014-10-18 14:19:38 +00:00
2010-04-21 05:03:24 +00:00
# include <wx/dcmemory.h>
2010-01-23 19:44:49 +00:00
# include <wx/dynarray.h>
2010-04-21 05:03:24 +00:00
# include <wx/panel.h>
2010-01-23 19:44:49 +00:00
# include <wx/timer.h>
# include <wx/window.h>
2014-10-18 14:19:38 +00:00
# include "Experimental.h"
2011-04-26 21:19:59 +00:00
# include "Sequence.h" //Stm: included for the sampleCount declaration
2010-01-23 19:44:49 +00:00
# include "WaveClip.h"
# include "WaveTrack.h"
2011-05-22 16:23:11 +00:00
# include "UndoManager.h" //JKC: Included for PUSH_XXX definitions.
2014-11-08 15:18:43 +00:00
# include "widgets/NumericTextCtrl.h"
2010-01-23 19:44:49 +00:00
class wxMenu ;
class wxRect ;
2014-10-05 17:10:09 +00:00
class LabelTrack ;
2014-10-18 14:19:38 +00:00
class SpectrumAnalyst ;
2010-01-23 19:44:49 +00:00
class TrackPanel ;
class TrackArtist ;
class Ruler ;
class SnapManager ;
class AdornedRulerPanel ;
class LWSlider ;
class ControlToolBar ; //Needed because state of controls can affect what gets drawn.
class ToolsToolBar ; //Needed because state of controls can affect what gets drawn.
2010-07-21 04:53:38 +00:00
class MixerBoard ;
2010-01-23 19:44:49 +00:00
class AudacityProject ;
class TrackPanelAx ;
2015-04-19 16:21:31 +00:00
class ViewInfo ;
2010-01-23 19:44:49 +00:00
WX_DEFINE_ARRAY ( LWSlider * , LWSliderArray ) ;
2011-11-25 20:40:26 +00:00
class AUDACITY_DLL_API TrackClip
2010-01-23 19:44:49 +00:00
{
public :
TrackClip ( Track * t , WaveClip * c ) { track = t ; clip = c ; }
Track * track ;
WaveClip * clip ;
} ;
WX_DECLARE_OBJARRAY ( TrackClip , TrackClipArray ) ;
2014-10-18 14:19:38 +00:00
// Declared elsewhere, to reduce compilation dependencies
class TrackPanelListener ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
// JKC Nov 2011: Disabled warning C4251 which is to do with DLL linkage
// and only a worry when there are DLLs using the structures.
// LWSliderArray and TrackClipArray are private in TrackInfo, so we will not
// access them directly from the DLL.
2014-06-03 20:30:19 +00:00
// TrackClipArray in TrackPanel needs to be handled with care in the derived
2011-11-25 20:40:26 +00:00
// class, but the C4251 warning is no worry in core Audacity.
2014-06-03 20:30:19 +00:00
// wxWidgets doesn't cater to the exact details we need in
2011-11-25 20:40:26 +00:00
// WX_DECLARE_EXPORTED_OBJARRAY to be able to use that for these two arrays.
# ifdef _MSC_VER
# pragma warning( push )
# pragma warning( disable: 4251 )
# endif
class AUDACITY_DLL_API TrackInfo
2010-01-23 19:44:49 +00:00
{
public :
Fix for bug #949
This removes the TrackInfo's slider "cache".
Originally, the cache would build to the maximum number of tracks you
had created in an Audacity session. So, if you created 128 tracks
and then reduced that to 1, you'd still have 256 sliders, 1 gain and
1 pan per track.
But, the only real thing the cache did was prevent continuous allocations
of sliders since the allocated sliders position and values wer still
being updated nearly with ever interaction since they were redrawn each
time.
In April 2010, the slider cache was changed to reduce its size by
creating a sort of ring buffer based on how many tracks were displayed
and how many tracks were in the project (I guess). Unfortunately, it
didn't really handle large number of tracks and this bug was born.
While trying to find the proper fix for this, I realized that the
cache really wasn't saving anything. Maybe a little when dragging
the thumb, but during normal track redraws and interaction, it really
didn't serve a purpose, other than use additional memory.
So, I've removed the cache and have allocated a single gain and a
single pan slider. As before, their position and value are changed
as needed when drawn and manipulated.
2015-05-25 03:54:10 +00:00
TrackInfo ( TrackPanel * pParentIn ) ;
2010-01-23 19:44:49 +00:00
~ TrackInfo ( ) ;
private :
Fix for bug #949
This removes the TrackInfo's slider "cache".
Originally, the cache would build to the maximum number of tracks you
had created in an Audacity session. So, if you created 128 tracks
and then reduced that to 1, you'd still have 256 sliders, 1 gain and
1 pan per track.
But, the only real thing the cache did was prevent continuous allocations
of sliders since the allocated sliders position and values wer still
being updated nearly with ever interaction since they were redrawn each
time.
In April 2010, the slider cache was changed to reduce its size by
creating a sort of ring buffer based on how many tracks were displayed
and how many tracks were in the project (I guess). Unfortunately, it
didn't really handle large number of tracks and this bug was born.
While trying to find the proper fix for this, I realized that the
cache really wasn't saving anything. Maybe a little when dragging
the thumb, but during normal track redraws and interaction, it really
didn't serve a purpose, other than use additional memory.
So, I've removed the cache and have allocated a single gain and a
single pan slider. As before, their position and value are changed
as needed when drawn and manipulated.
2015-05-25 03:54:10 +00:00
int GetTrackInfoWidth ( ) const ;
void SetTrackInfoFont ( wxDC * dc ) const ;
void DrawBackground ( wxDC * dc , const wxRect & r , bool bSelected , bool bHasMuteSolo , const int labelw , const int vrul ) const ;
void DrawBordersWithin ( wxDC * dc , const wxRect & r , bool bHasMuteSolo ) const ;
void DrawCloseBox ( wxDC * dc , const wxRect & r , bool down ) const ;
void DrawTitleBar ( wxDC * dc , const wxRect & r , Track * t , bool down ) const ;
void DrawMuteSolo ( wxDC * dc , const wxRect & r , Track * t , bool down , bool solo , bool bHasSoloButton ) const ;
void DrawVRuler ( wxDC * dc , const wxRect & r , Track * t ) const ;
2010-09-18 21:02:36 +00:00
# ifdef EXPERIMENTAL_MIDI_OUT
Fix for bug #949
This removes the TrackInfo's slider "cache".
Originally, the cache would build to the maximum number of tracks you
had created in an Audacity session. So, if you created 128 tracks
and then reduced that to 1, you'd still have 256 sliders, 1 gain and
1 pan per track.
But, the only real thing the cache did was prevent continuous allocations
of sliders since the allocated sliders position and values wer still
being updated nearly with ever interaction since they were redrawn each
time.
In April 2010, the slider cache was changed to reduce its size by
creating a sort of ring buffer based on how many tracks were displayed
and how many tracks were in the project (I guess). Unfortunately, it
didn't really handle large number of tracks and this bug was born.
While trying to find the proper fix for this, I realized that the
cache really wasn't saving anything. Maybe a little when dragging
the thumb, but during normal track redraws and interaction, it really
didn't serve a purpose, other than use additional memory.
So, I've removed the cache and have allocated a single gain and a
single pan slider. As before, their position and value are changed
as needed when drawn and manipulated.
2015-05-25 03:54:10 +00:00
void DrawVelocitySlider ( wxDC * dc , NoteTrack * t , wxRect r ) const ;
2010-09-18 21:02:36 +00:00
# endif
Fix for bug #949
This removes the TrackInfo's slider "cache".
Originally, the cache would build to the maximum number of tracks you
had created in an Audacity session. So, if you created 128 tracks
and then reduced that to 1, you'd still have 256 sliders, 1 gain and
1 pan per track.
But, the only real thing the cache did was prevent continuous allocations
of sliders since the allocated sliders position and values wer still
being updated nearly with ever interaction since they were redrawn each
time.
In April 2010, the slider cache was changed to reduce its size by
creating a sort of ring buffer based on how many tracks were displayed
and how many tracks were in the project (I guess). Unfortunately, it
didn't really handle large number of tracks and this bug was born.
While trying to find the proper fix for this, I realized that the
cache really wasn't saving anything. Maybe a little when dragging
the thumb, but during normal track redraws and interaction, it really
didn't serve a purpose, other than use additional memory.
So, I've removed the cache and have allocated a single gain and a
single pan slider. As before, their position and value are changed
as needed when drawn and manipulated.
2015-05-25 03:54:10 +00:00
void DrawSliders ( wxDC * dc , WaveTrack * t , wxRect r ) const ;
(Sync-Lock)
Commented out the one call to TrackInfo::DrawBordersWithin(). This eliminates all the dark lines within the TrackInfo, in an effort to make the sync-lock icon not look like a button. It leaves some lighter borders, and I think that's an aesthetic improvement, though it make be worse in terms of accessibility. I can also remove the light border above the sync-lock icon, but I think this looks best overall.
In Track::IsSyncLockSelected(), for the "// Not in a sync-locked group." conditional, it returned true if the track was selected. I made it do so only if track kind is Wave or Label. Among other things, this means Time and Note tracks will never show the sync-lock icon. I think this is correct by definition, but Al, please let me know if this will have negative repercussions elsewhere. There are *lots* of calls to that method and I can move the track-type check to the code that draws the sync-lock icon..
Fixed the bug Gale pointed out where, if a WaveTrack is shrunk such that the sync-lock icon is over a TrackInfo control, such as pan slider, it didn't intercept the mouse event, and passed it on to the control. Now, clicking on the sync-lock icon does nothing.
Fixed a bug where the sync-lock icon was redrawn dark when the minimize button is down. Now not redrawn at all in that case.
Added some clarifying comments, especially about the term "Label" as used in TrackPanel.*.
2010-09-09 00:46:40 +00:00
// Draw the minimize button *and* the sync-lock track icon, if necessary.
Fix for bug #949
This removes the TrackInfo's slider "cache".
Originally, the cache would build to the maximum number of tracks you
had created in an Audacity session. So, if you created 128 tracks
and then reduced that to 1, you'd still have 256 sliders, 1 gain and
1 pan per track.
But, the only real thing the cache did was prevent continuous allocations
of sliders since the allocated sliders position and values wer still
being updated nearly with ever interaction since they were redrawn each
time.
In April 2010, the slider cache was changed to reduce its size by
creating a sort of ring buffer based on how many tracks were displayed
and how many tracks were in the project (I guess). Unfortunately, it
didn't really handle large number of tracks and this bug was born.
While trying to find the proper fix for this, I realized that the
cache really wasn't saving anything. Maybe a little when dragging
the thumb, but during normal track redraws and interaction, it really
didn't serve a purpose, other than use additional memory.
So, I've removed the cache and have allocated a single gain and a
single pan slider. As before, their position and value are changed
as needed when drawn and manipulated.
2015-05-25 03:54:10 +00:00
void DrawMinimize ( wxDC * dc , const wxRect & r , Track * t , bool down ) const ;
2010-01-23 19:44:49 +00:00
2015-04-23 14:07:25 +00:00
void GetTrackControlsRect ( const wxRect & r , wxRect & dest ) const ;
void GetCloseBoxRect ( const wxRect & r , wxRect & dest ) const ;
void GetTitleBarRect ( const wxRect & r , wxRect & dest ) const ;
void GetMuteSoloRect ( const wxRect & r , wxRect & dest , bool solo , bool bHasSoloButton ) const ;
void GetGainRect ( const wxRect & r , wxRect & dest ) const ;
void GetPanRect ( const wxRect & r , wxRect & dest ) const ;
void GetMinimizeRect ( const wxRect & r , wxRect & dest ) const ;
void GetSyncLockIconRect ( const wxRect & r , wxRect & dest ) const ;
2010-01-23 19:44:49 +00:00
Fix for bug #949
This removes the TrackInfo's slider "cache".
Originally, the cache would build to the maximum number of tracks you
had created in an Audacity session. So, if you created 128 tracks
and then reduced that to 1, you'd still have 256 sliders, 1 gain and
1 pan per track.
But, the only real thing the cache did was prevent continuous allocations
of sliders since the allocated sliders position and values wer still
being updated nearly with ever interaction since they were redrawn each
time.
In April 2010, the slider cache was changed to reduce its size by
creating a sort of ring buffer based on how many tracks were displayed
and how many tracks were in the project (I guess). Unfortunately, it
didn't really handle large number of tracks and this bug was born.
While trying to find the proper fix for this, I realized that the
cache really wasn't saving anything. Maybe a little when dragging
the thumb, but during normal track redraws and interaction, it really
didn't serve a purpose, other than use additional memory.
So, I've removed the cache and have allocated a single gain and a
single pan slider. As before, their position and value are changed
as needed when drawn and manipulated.
2015-05-25 03:54:10 +00:00
LWSlider * GainSlider ( WaveTrack * t ) const ;
LWSlider * PanSlider ( WaveTrack * t ) const ;
2010-04-21 05:03:24 +00:00
Fix for bug #949
This removes the TrackInfo's slider "cache".
Originally, the cache would build to the maximum number of tracks you
had created in an Audacity session. So, if you created 128 tracks
and then reduced that to 1, you'd still have 256 sliders, 1 gain and
1 pan per track.
But, the only real thing the cache did was prevent continuous allocations
of sliders since the allocated sliders position and values wer still
being updated nearly with ever interaction since they were redrawn each
time.
In April 2010, the slider cache was changed to reduce its size by
creating a sort of ring buffer based on how many tracks were displayed
and how many tracks were in the project (I guess). Unfortunately, it
didn't really handle large number of tracks and this bug was born.
While trying to find the proper fix for this, I realized that the
cache really wasn't saving anything. Maybe a little when dragging
the thumb, but during normal track redraws and interaction, it really
didn't serve a purpose, other than use additional memory.
So, I've removed the cache and have allocated a single gain and a
single pan slider. As before, their position and value are changed
as needed when drawn and manipulated.
2015-05-25 03:54:10 +00:00
private :
TrackPanel * pParent ;
2010-01-23 19:44:49 +00:00
wxFont mFont ;
Fix for bug #949
This removes the TrackInfo's slider "cache".
Originally, the cache would build to the maximum number of tracks you
had created in an Audacity session. So, if you created 128 tracks
and then reduced that to 1, you'd still have 256 sliders, 1 gain and
1 pan per track.
But, the only real thing the cache did was prevent continuous allocations
of sliders since the allocated sliders position and values wer still
being updated nearly with ever interaction since they were redrawn each
time.
In April 2010, the slider cache was changed to reduce its size by
creating a sort of ring buffer based on how many tracks were displayed
and how many tracks were in the project (I guess). Unfortunately, it
didn't really handle large number of tracks and this bug was born.
While trying to find the proper fix for this, I realized that the
cache really wasn't saving anything. Maybe a little when dragging
the thumb, but during normal track redraws and interaction, it really
didn't serve a purpose, other than use additional memory.
So, I've removed the cache and have allocated a single gain and a
single pan slider. As before, their position and value are changed
as needed when drawn and manipulated.
2015-05-25 03:54:10 +00:00
LWSlider * mGain ;
LWSlider * mPan ;
2010-01-23 19:44:49 +00:00
friend class TrackPanel ;
} ;
const int DragThreshold = 3 ; // Anything over 3 pixels is a drag, else a click.
2011-11-25 20:40:26 +00:00
class AUDACITY_DLL_API TrackPanel : public wxPanel {
2010-01-23 19:44:49 +00:00
public :
TrackPanel ( wxWindow * parent ,
wxWindowID id ,
const wxPoint & pos ,
const wxSize & size ,
TrackList * tracks ,
ViewInfo * viewInfo ,
TrackPanelListener * listener ,
AdornedRulerPanel * ruler ) ;
virtual ~ TrackPanel ( ) ;
2011-11-25 20:40:26 +00:00
virtual void BuildMenus ( void ) ;
2013-10-30 22:07:06 +00:00
2011-11-25 20:40:26 +00:00
virtual void DeleteMenus ( void ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void UpdatePrefs ( ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void OnSize ( wxSizeEvent & event ) ;
virtual void OnErase ( wxEraseEvent & event ) ;
virtual void OnPaint ( wxPaintEvent & event ) ;
virtual void OnMouseEvent ( wxMouseEvent & event ) ;
virtual void OnCaptureLost ( wxMouseCaptureLostEvent & event ) ;
virtual void OnCaptureKey ( wxCommandEvent & event ) ;
virtual void OnKeyDown ( wxKeyEvent & event ) ;
virtual void OnChar ( wxKeyEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void OnSetFocus ( wxFocusEvent & event ) ;
virtual void OnKillFocus ( wxFocusEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void OnContextMenu ( wxContextMenuEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void OnTrackListResized ( wxCommandEvent & event ) ;
virtual void OnTrackListUpdated ( wxCommandEvent & event ) ;
2012-08-16 23:41:09 +00:00
virtual void UpdateViewIfNoTracks ( ) ; // Call this to update mViewInfo, etc, after track(s) removal, before Refresh().
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual double GetMostRecentXPos ( ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void OnTimer ( ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual int GetLeftOffset ( ) const { return GetLabelWidth ( ) + 1 ; }
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void GetTracksUsableArea ( int * width , int * height ) const ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void SelectNone ( ) ;
2010-01-23 19:44:49 +00:00
virtual void Refresh ( bool eraseBackground = true ,
const wxRect * rect = ( const wxRect * ) NULL ) ;
2011-11-25 20:40:26 +00:00
virtual void RefreshTrack ( Track * trk , bool refreshbacking = true ) ;
virtual void DisplaySelection ( ) ;
// These two are neither used nor defined as of Nov-2011
//virtual void SetSelectionFormat(int iformat)
//virtual void SetSnapTo(int snapto)
2015-05-30 01:13:59 +00:00
virtual void HandleEscapeKey ( bool down ) ;
2013-08-09 01:03:34 +00:00
virtual void HandleAltKey ( bool down ) ;
2011-11-25 20:40:26 +00:00
virtual void HandleShiftKey ( bool down ) ;
virtual void HandleControlKey ( bool down ) ;
2012-02-14 00:18:29 +00:00
virtual void HandlePageUpKey ( ) ;
virtual void HandlePageDownKey ( ) ;
2011-11-25 20:40:26 +00:00
virtual AudacityProject * GetProject ( ) const ;
virtual void OnPrevTrack ( bool shift = false ) ;
virtual void OnNextTrack ( bool shift = false ) ;
2015-04-24 10:38:55 +00:00
virtual void OnFirstTrack ( ) ;
virtual void OnLastTrack ( ) ;
2011-11-25 20:40:26 +00:00
virtual void OnToggle ( ) ;
2013-10-23 18:01:14 +00:00
virtual void OnCursorLeft ( bool shift , bool ctrl , bool keyup = false ) ;
virtual void OnCursorRight ( bool shift , bool ctrl , bool keyup = false ) ;
2011-11-25 20:40:26 +00:00
virtual void OnCursorMove ( bool forward , bool jump , bool longjump ) ;
virtual void OnBoundaryMove ( bool left , bool boundaryContract ) ;
virtual void ScrollIntoView ( double pos ) ;
virtual void ScrollIntoView ( int x ) ;
virtual void OnTrackPan ( ) ;
virtual void OnTrackPanLeft ( ) ;
virtual void OnTrackPanRight ( ) ;
virtual void OnTrackGain ( ) ;
virtual void OnTrackGainDec ( ) ;
virtual void OnTrackGainInc ( ) ;
virtual void OnTrackMenu ( Track * t = NULL ) ;
virtual void OnTrackMute ( bool shiftdown , Track * t = NULL ) ;
virtual void OnTrackSolo ( bool shiftdown , Track * t = NULL ) ;
virtual void OnTrackClose ( ) ;
2015-04-17 12:53:15 +00:00
virtual void OnTrackMoveUp ( ) ;
virtual void OnTrackMoveDown ( ) ;
virtual void OnTrackMoveTop ( ) ;
virtual void OnTrackMoveBottom ( ) ;
2011-11-25 20:40:26 +00:00
virtual Track * GetFirstSelectedTrack ( ) ;
2012-12-04 16:41:43 +00:00
virtual bool IsMouseCaptured ( ) ;
2011-11-25 20:40:26 +00:00
virtual void EnsureVisible ( Track * t ) ;
virtual Track * GetFocusedTrack ( ) ;
virtual void SetFocusedTrack ( Track * t ) ;
virtual void HandleCursorForLastMouseEvent ( ) ;
virtual void UpdateVRulers ( ) ;
virtual void UpdateVRuler ( Track * t ) ;
virtual void UpdateTrackVRuler ( Track * t ) ;
virtual void UpdateVRulerSize ( ) ;
2015-04-17 16:52:13 +00:00
virtual void DrawQuickPlayIndicator ( wxDC & dc , double pos ) ;
2011-11-25 20:40:26 +00:00
protected :
virtual MixerBoard * GetMixerBoard ( ) ;
2013-10-30 22:07:06 +00:00
/** @brief Populates the track pop-down menu with the common set of
* initial items .
*
* Ensures that all pop - down menus start with Name , and the commands for moving
* the track around , via a single set of code .
* @ param menu the menu to add the commands to .
*/
virtual void BuildCommonDropMenuItems ( wxMenu * menu ) ;
2011-11-25 20:40:26 +00:00
virtual bool IsUnsafe ( ) ;
virtual bool HandleLabelTrackMouseEvent ( LabelTrack * lTrack , wxRect & r , wxMouseEvent & event ) ;
virtual bool HandleTrackLocationMouseEvent ( WaveTrack * track , wxRect & r , wxMouseEvent & event ) ;
virtual void HandleTrackSpecificMouseEvent ( wxMouseEvent & event ) ;
virtual void DrawIndicator ( ) ;
2011-06-04 02:41:16 +00:00
/// draws the green line on the tracks to show playback position
/// @param repairOld if true the playback position is not updated/erased, and simply redrawn
2015-04-17 18:09:35 +00:00
/// @param indicator if nonnegative, overrides the indicator value obtainable from AudioIO
virtual void DoDrawIndicator ( wxDC & dc , bool repairOld = false , double indicator = - 1 ) ;
2011-11-25 20:40:26 +00:00
virtual void DrawCursor ( ) ;
virtual void DoDrawCursor ( wxDC & dc ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void ScrollDuringDrag ( ) ;
2010-01-23 19:44:49 +00:00
// Working out where to dispatch the event to.
2011-11-25 20:40:26 +00:00
virtual int DetermineToolToUse ( ToolsToolBar * pTtb , wxMouseEvent & event ) ;
virtual bool HitTestEnvelope ( Track * track , wxRect & r , wxMouseEvent & event ) ;
virtual bool HitTestSamples ( Track * track , wxRect & r , wxMouseEvent & event ) ;
virtual bool HitTestSlide ( Track * track , wxRect & r , wxMouseEvent & event ) ;
2010-09-18 21:02:36 +00:00
# ifdef USE_MIDI
// data for NoteTrack interactive stretch operations:
// Stretching applies to a selected region after quantizing the
// region to beat boundaries (subbeat stretching is not supported,
// but maybe it should be enabled with shift or ctrl or something)
// Stretching can drag the left boundary (the right stays fixed),
// the right boundary (the left stays fixed), or the center (splits
// the selection into two parts: when left part grows, the right
2014-06-03 20:30:19 +00:00
// part shrinks, keeping the leftmost and rightmost boundaries
2010-09-18 21:02:36 +00:00
// fixed.
enum StretchEnum {
stretchLeft ,
stretchCenter ,
stretchRight
} ;
StretchEnum mStretchMode ; // remembers what to drag
bool mStretching ; // true between mouse down and mouse up
bool mStretched ; // true after drag has pushed state
double mStretchStart ; // time of initial mouse position, quantized
// to the nearest beat
double mStretchSel0 ; // initial sel0 (left) quantized to nearest beat
double mStretchSel1 ; // initial sel1 (left) quantized to nearest beat
double mStretchLeftBeats ; // how many beats from left to cursor
double mStretchRightBeats ; // how many beats from cursor to right
2011-11-25 20:40:26 +00:00
virtual bool HitTestStretch ( Track * track , wxRect & r , wxMouseEvent & event ) ;
virtual void Stretch ( int mouseXCoordinate , int trackLeftEdge , Track * pTrack ) ;
2010-09-18 21:02:36 +00:00
# endif
2010-01-23 19:44:49 +00:00
// AS: Selection handling
2011-11-25 20:40:26 +00:00
virtual void HandleSelect ( wxMouseEvent & event ) ;
virtual void SelectionHandleDrag ( wxMouseEvent & event , Track * pTrack ) ;
2015-05-19 16:30:02 +00:00
// Made obsolete by scrubbing:
# ifndef EXPERIMENTAL_SCRUBBING_BASIC
2014-11-29 22:09:57 +00:00
void StartOrJumpPlayback ( wxMouseEvent & event ) ;
2015-05-19 16:30:02 +00:00
# endif
2015-04-17 18:09:35 +00:00
# ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
double FindScrubSpeed ( double timeAtMouse ) const ;
2015-05-30 15:44:09 +00:00
double FindSeekSpeed ( double timeAtMouse ) const ;
2015-04-17 18:09:35 +00:00
# endif
# ifdef EXPERIMENTAL_SCRUBBING_BASIC
2015-05-30 15:44:09 +00:00
static bool PollIsSeeking ( ) ;
2015-05-19 16:30:02 +00:00
bool IsScrubbing ( ) ;
2015-05-30 00:13:42 +00:00
void MarkScrubStart (
2015-05-19 16:30:02 +00:00
wxCoord xx
# ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
, bool smoothScrolling
# endif
) ;
2015-04-17 18:09:35 +00:00
bool MaybeStartScrubbing ( wxMouseEvent & event ) ;
2015-05-30 15:44:09 +00:00
bool ContinueScrubbing ( wxCoord position , bool hasFocus , bool seek ) ;
2015-06-08 13:50:43 +00:00
public :
2015-04-17 18:09:35 +00:00
bool StopScrubbing ( ) ;
2015-06-08 13:50:43 +00:00
protected :
2015-04-17 18:09:35 +00:00
# endif
2013-02-20 23:42:58 +00:00
virtual void SelectionHandleClick ( wxMouseEvent & event ,
Track * pTrack , wxRect r ) ;
2011-11-25 20:40:26 +00:00
virtual void StartSelection ( int mouseXCoordinate , int trackLeftEdge ) ;
virtual void ExtendSelection ( int mouseXCoordinate , int trackLeftEdge ,
2010-01-23 19:44:49 +00:00
Track * pTrack ) ;
2014-10-18 14:19:38 +00:00
virtual void UpdateSelectionDisplay ( ) ;
2014-11-29 22:09:57 +00:00
// Handle small cursor and play head movements
void SeekLeftOrRight
( bool left , bool shift , bool ctrl , bool keyup ,
int snapToTime , bool mayAccelerateQuiet , bool mayAccelerateAudio ,
double quietSeekStepPositive , double audioSeekStepPositive ) ;
2014-10-18 14:19:38 +00:00
# ifdef EXPERIMENTAL_SPECTRAL_EDITING
2014-12-22 08:03:41 +00:00
public :
void SnapCenterOnce ( WaveTrack * pTrack , bool up ) ;
protected :
2014-10-25 22:05:45 +00:00
void StartSnappingFreqSelection ( WaveTrack * pTrack ) ;
void MoveSnappingFreqSelection ( int mouseYCoordinate ,
int trackTopEdge ,
int trackHeight , Track * pTrack ) ;
void StartFreqSelection ( int mouseYCoordinate , int trackTopEdge ,
int trackHeight , Track * pTrack ) ;
void ExtendFreqSelection ( int mouseYCoordinate , int trackTopEdge ,
int trackHeight ) ;
void ResetFreqSelectionPin ( double hintFrequency , bool logF ) ;
2014-10-18 14:19:38 +00:00
# endif
2011-11-25 20:40:26 +00:00
virtual void SelectTracksByLabel ( LabelTrack * t ) ;
virtual void SelectTrackLength ( Track * t ) ;
2010-01-23 19:44:49 +00:00
2010-02-02 19:43:52 +00:00
// Helper for moving by keyboard with snap-to-grid enabled
2011-11-25 20:40:26 +00:00
virtual double GridMove ( double t , int minPix ) ;
2010-01-23 19:44:49 +00:00
// AS: Cursor handling
2011-11-25 20:40:26 +00:00
virtual bool SetCursorByActivity ( ) ;
virtual void SetCursorAndTipWhenInLabel ( Track * t , wxMouseEvent & event , const wxChar * * ppTip ) ;
virtual void SetCursorAndTipWhenInVResizeArea ( Track * label , bool blinked , const wxChar * * ppTip ) ;
virtual void SetCursorAndTipWhenInLabelTrack ( LabelTrack * pLT , wxMouseEvent & event , const wxChar * * ppTip ) ;
2014-11-08 14:30:19 +00:00
virtual void SetCursorAndTipWhenSelectTool
( Track * t , wxMouseEvent & event , wxRect & r , bool bMultiToolMode , const wxChar * * ppTip , const wxCursor * * ppCursor ) ;
2011-11-25 20:40:26 +00:00
virtual void SetCursorAndTipByTool ( int tool , wxMouseEvent & event , const wxChar * * ppTip ) ;
virtual void HandleCursor ( wxMouseEvent & event ) ;
2014-10-26 10:11:35 +00:00
virtual void MaySetOnDemandTip ( Track * t , const wxChar * * ppTip ) ;
2010-01-23 19:44:49 +00:00
// AS: Envelope editing handlers
2011-11-25 20:40:26 +00:00
virtual void HandleEnvelope ( wxMouseEvent & event ) ;
virtual void ForwardEventToTimeTrackEnvelope ( wxMouseEvent & event ) ;
virtual void ForwardEventToWaveTrackEnvelope ( wxMouseEvent & event ) ;
virtual void ForwardEventToEnvelope ( wxMouseEvent & event ) ;
2010-01-23 19:44:49 +00:00
// AS: Track sliding handlers
2011-11-25 20:40:26 +00:00
virtual void HandleSlide ( wxMouseEvent & event ) ;
virtual void StartSlide ( wxMouseEvent & event ) ;
virtual void DoSlide ( wxMouseEvent & event ) ;
virtual void AddClipsToCaptured ( Track * t , bool withinSelection ) ;
virtual void AddClipsToCaptured ( Track * t , double t0 , double t1 ) ;
2010-01-23 19:44:49 +00:00
// AS: Handle zooming into tracks
2011-11-25 20:40:26 +00:00
virtual void HandleZoom ( wxMouseEvent & event ) ;
virtual void HandleZoomClick ( wxMouseEvent & event ) ;
virtual void HandleZoomDrag ( wxMouseEvent & event ) ;
virtual void HandleZoomButtonUp ( wxMouseEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual bool IsDragZooming ( ) ;
virtual void DragZoom ( wxMouseEvent & event , int x ) ;
virtual void DoZoomInOut ( wxMouseEvent & event , int x ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void HandleVZoom ( wxMouseEvent & event ) ;
virtual void HandleVZoomClick ( wxMouseEvent & event ) ;
virtual void HandleVZoomDrag ( wxMouseEvent & event ) ;
virtual void HandleVZoomButtonUp ( wxMouseEvent & event ) ;
2010-01-23 19:44:49 +00:00
// Handle sample editing using the 'draw' tool.
2011-11-25 20:40:26 +00:00
virtual bool IsSampleEditingPossible ( wxMouseEvent & event , Track * t ) ;
virtual void HandleSampleEditing ( wxMouseEvent & event ) ;
2015-06-03 05:43:06 +00:00
float FindSampleEditingLevel ( wxMouseEvent & event , double t0 ) ;
2011-11-25 20:40:26 +00:00
virtual void HandleSampleEditingClick ( wxMouseEvent & event ) ;
virtual void HandleSampleEditingDrag ( wxMouseEvent & event ) ;
virtual void HandleSampleEditingButtonUp ( wxMouseEvent & event ) ;
2010-01-23 19:44:49 +00:00
// MM: Handle mouse wheel rotation
2011-11-25 20:40:26 +00:00
virtual void HandleWheelRotation ( wxMouseEvent & event ) ;
2010-01-23 19:44:49 +00:00
// Handle resizing.
2011-11-25 20:40:26 +00:00
virtual void HandleResizeClick ( wxMouseEvent & event ) ;
virtual void HandleResizeDrag ( wxMouseEvent & event ) ;
virtual void HandleResizeButtonUp ( wxMouseEvent & event ) ;
virtual void HandleResize ( wxMouseEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void HandleLabelClick ( wxMouseEvent & event ) ;
virtual void HandleRearrange ( wxMouseEvent & event ) ;
virtual void CalculateRearrangingThresholds ( wxMouseEvent & event ) ;
virtual void HandleClosing ( wxMouseEvent & event ) ;
virtual void HandlePopping ( wxMouseEvent & event ) ;
virtual void HandleMutingSoloing ( wxMouseEvent & event , bool solo ) ;
virtual void HandleMinimizing ( wxMouseEvent & event ) ;
virtual void HandleSliders ( wxMouseEvent & event , bool pan ) ;
2010-09-12 05:11:43 +00:00
2014-06-03 20:30:19 +00:00
// These *Func methods are used in TrackPanel::HandleLabelClick to set up
// for actual handling in methods called by TrackPanel::OnMouseEvent, and
2010-09-12 05:11:43 +00:00
// to draw button-down states, etc.
2011-11-25 20:40:26 +00:00
virtual bool CloseFunc ( Track * t , wxRect r , int x , int y ) ;
virtual bool PopupFunc ( Track * t , wxRect r , int x , int y ) ;
2010-09-12 05:11:43 +00:00
2014-06-03 20:30:19 +00:00
// TrackSelFunc, unlike the other *Func methods, returns true if the click is not
// set up to be handled, but click is on the sync-lock icon or the blank area to
// the left of the minimize button, and we want to pass it forward to be a track select.
2011-11-25 20:40:26 +00:00
virtual bool TrackSelFunc ( Track * t , wxRect r , int x , int y ) ;
2010-09-12 05:11:43 +00:00
2011-11-25 20:40:26 +00:00
virtual bool MuteSoloFunc ( Track * t , wxRect r , int x , int f , bool solo ) ;
virtual bool MinimizeFunc ( Track * t , wxRect r , int x , int f ) ;
virtual bool GainFunc ( Track * t , wxRect r , wxMouseEvent & event ,
2010-01-23 19:44:49 +00:00
int x , int y ) ;
2011-11-25 20:40:26 +00:00
virtual bool PanFunc ( Track * t , wxRect r , wxMouseEvent & event ,
2010-01-23 19:44:49 +00:00
int x , int y ) ;
2010-09-12 05:11:43 +00:00
2011-11-25 20:40:26 +00:00
virtual void MakeParentRedrawScrollbars ( ) ;
2014-06-03 20:30:19 +00:00
2010-01-23 19:44:49 +00:00
// AS: Pushing the state preserves state for Undo operations.
2011-11-25 20:40:26 +00:00
virtual void MakeParentPushState ( wxString desc , wxString shortDesc ,
2015-04-07 11:20:50 +00:00
int flags = PUSH_AUTOSAVE ) ;
2013-12-30 00:41:18 +00:00
virtual void MakeParentModifyState ( bool bWantsAutoSave ) ; // if true, writes auto-save file. Should set only if you really want the state change restored after
// a crash, as it can take many seconds for large (eg. 10 track-hours) projects
2011-11-25 20:40:26 +00:00
virtual void MakeParentResize ( ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void OnSetName ( wxCommandEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void OnSetFont ( wxCommandEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void OnMoveTrack ( wxCommandEvent & event ) ;
2015-04-17 12:53:15 +00:00
virtual void MoveTrack ( Track * target , int eventId ) ;
2011-11-25 20:40:26 +00:00
virtual void OnChangeOctave ( wxCommandEvent & event ) ;
virtual void OnChannelChange ( wxCommandEvent & event ) ;
virtual void OnSetDisplay ( wxCommandEvent & event ) ;
virtual void OnSetTimeTrackRange ( wxCommandEvent & event ) ;
2012-12-19 21:49:25 +00:00
virtual void OnTimeTrackLin ( wxCommandEvent & event ) ;
virtual void OnTimeTrackLog ( wxCommandEvent & event ) ;
virtual void OnTimeTrackLogInt ( wxCommandEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void SetMenuCheck ( wxMenu & menu , int newId ) ;
virtual void SetRate ( Track * pTrack , double rate ) ;
virtual void OnRateChange ( wxCommandEvent & event ) ;
virtual void OnRateOther ( wxCommandEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void OnFormatChange ( wxCommandEvent & event ) ;
2010-01-23 19:44:49 +00:00
2013-11-03 01:17:58 +00:00
virtual void OnSwapChannels ( wxCommandEvent & event ) ;
2011-11-25 20:40:26 +00:00
virtual void OnSplitStereo ( wxCommandEvent & event ) ;
virtual void OnSplitStereoMono ( wxCommandEvent & event ) ;
virtual void SplitStereo ( bool stereo ) ;
virtual void OnMergeStereo ( wxCommandEvent & event ) ;
virtual void OnCutSelectedText ( wxCommandEvent & event ) ;
virtual void OnCopySelectedText ( wxCommandEvent & event ) ;
virtual void OnPasteSelectedText ( wxCommandEvent & event ) ;
2014-07-12 14:26:07 +00:00
virtual void OnDeleteSelectedLabel ( wxCommandEvent & event ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void SetTrackPan ( Track * t , LWSlider * s ) ;
virtual void SetTrackGain ( Track * t , LWSlider * s ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual void RemoveTrack ( Track * toRemove ) ;
2010-01-23 19:44:49 +00:00
// Find track info by coordinate
2011-11-25 20:40:26 +00:00
virtual Track * FindTrack ( int mouseX , int mouseY , bool label , bool link ,
2010-01-23 19:44:49 +00:00
wxRect * trackRect = NULL ) ;
2011-11-25 20:40:26 +00:00
virtual wxRect FindTrackRect ( Track * target , bool label ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual int GetVRulerWidth ( ) const ;
virtual int GetVRulerOffset ( ) const { return mTrackInfo . GetTrackInfoWidth ( ) ; } ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual int GetLabelWidth ( ) const { return mTrackInfo . GetTrackInfoWidth ( ) + GetVRulerWidth ( ) ; } ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
// JKC Nov-2011: These four functions only used from within a dll such as mod-track-panel
// They work around some messy problems with constructors.
public :
TrackList * GetTracks ( ) { return mTracks ; } ;
ViewInfo * GetViewInfo ( ) { return mViewInfo ; } ;
TrackPanelListener * GetListener ( ) { return mListener ; } ;
AdornedRulerPanel * GetRuler ( ) { return mRuler ; } ;
// JKC and here is a factory function which just does 'new' in standard Audacity.
static TrackPanel * ( * FactoryFunction ) ( wxWindow * parent ,
wxWindowID id ,
const wxPoint & pos ,
const wxSize & size ,
TrackList * tracks ,
ViewInfo * viewInfo ,
TrackPanelListener * listener ,
AdornedRulerPanel * ruler ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
protected :
virtual void DrawTracks ( wxDC * dc ) ;
2015-04-23 14:07:25 +00:00
virtual void DrawEverythingElse ( wxDC * dc , const wxRegion & region ,
2015-04-23 16:30:38 +00:00
const wxRect & clip ) ;
2015-04-23 14:07:25 +00:00
virtual void DrawOutside ( Track * t , wxDC * dc , const wxRect & rec ,
const wxRect & trackRect ) ;
2015-05-19 16:30:02 +00:00
# ifdef EXPERIMENTAL_SCRUBBING_BASIC
2015-04-17 18:09:35 +00:00
void DrawScrubSpeed ( wxDC & dc ) ;
2015-05-19 16:30:02 +00:00
# endif
2015-04-23 14:07:25 +00:00
virtual void DrawZooming ( wxDC * dc , const wxRect & clip ) ;
2010-01-23 19:44:49 +00:00
2015-04-23 14:07:25 +00:00
virtual void HighlightFocusedTrack ( wxDC * dc , const wxRect & r ) ;
virtual void DrawShadow ( Track * t , wxDC * dc , const wxRect & r ) ;
virtual void DrawBordersAroundTrack ( Track * t , wxDC * dc , const wxRect & r , const int labelw , const int vrul ) ;
virtual void DrawOutsideOfTrack ( Track * t , wxDC * dc , const wxRect & r ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual int IdOfRate ( int rate ) ;
virtual int IdOfFormat ( int format ) ;
2010-01-23 19:44:49 +00:00
2013-05-30 23:14:25 +00:00
# ifdef EXPERIMENTAL_OUTPUT_DISPLAY
void UpdateVirtualStereoOrder ( ) ;
# endif
2010-01-23 19:44:49 +00:00
// Accessors...
2011-11-25 20:40:26 +00:00
virtual bool HasSoloButton ( ) { return mSoloPref ! = wxT ( " None " ) ; } ;
2010-01-23 19:44:49 +00:00
//JKC: These two belong in the label track.
int mLabelTrackStartXPos ;
int mLabelTrackStartYPos ;
2014-06-03 20:30:19 +00:00
2011-11-25 20:40:26 +00:00
virtual wxString TrackSubText ( Track * t ) ;
2010-01-23 19:44:49 +00:00
2011-11-25 20:40:26 +00:00
virtual bool MoveClipToTrack ( WaveClip * clip , WaveTrack * dst ) ;
2010-01-23 19:44:49 +00:00
TrackInfo mTrackInfo ;
TrackPanelListener * mListener ;
TrackList * mTracks ;
ViewInfo * mViewInfo ;
AdornedRulerPanel * mRuler ;
double mSeekShort ;
double mSeekLong ;
TrackArtist * mTrackArtist ;
2011-11-25 20:40:26 +00:00
class AUDACITY_DLL_API AudacityTimer : public wxTimer {
2010-01-23 19:44:49 +00:00
public :
virtual void Notify ( ) { parent - > OnTimer ( ) ; }
TrackPanel * parent ;
} mTimer ;
2014-06-03 20:30:19 +00:00
2010-01-23 19:44:49 +00:00
// This stores the parts of the screen that get overwritten by the indicator
// and cursor
double mLastIndicator ;
double mLastCursor ;
2015-04-21 19:44:38 +00:00
// Quick-Play indicator postion
2015-04-17 16:52:13 +00:00
double mOldQPIndicatorPos ;
2010-01-23 19:44:49 +00:00
int mTimeCount ;
wxMemoryDC mBackingDC ;
wxBitmap * mBacking ;
bool mRefreshBacking ;
int mPrevWidth ;
int mPrevHeight ;
wxLongLong mLastSelectionAdjustment ;
2015-04-12 16:39:11 +00:00
SelectedRegion mInitialSelection ;
// Extra indirection to avoid the stupid MSW compiler warnings! Rrrr!
std : : vector < bool > * mInitialTrackSelection ;
2014-11-29 17:10:56 +00:00
bool mSelStartValid ;
2010-01-23 19:44:49 +00:00
double mSelStart ;
2014-10-18 14:19:38 +00:00
# ifdef EXPERIMENTAL_SPECTRAL_EDITING
2014-10-18 16:01:50 +00:00
enum eFreqSelMode {
2014-10-18 14:19:38 +00:00
FREQ_SEL_INVALID ,
2014-10-25 22:05:45 +00:00
2014-10-18 14:19:38 +00:00
FREQ_SEL_SNAPPING_CENTER ,
2014-10-25 22:05:45 +00:00
FREQ_SEL_PINNED_CENTER ,
FREQ_SEL_DRAG_CENTER ,
FREQ_SEL_FREE ,
2014-10-18 14:19:38 +00:00
FREQ_SEL_TOP_FREE ,
FREQ_SEL_BOTTOM_FREE ,
} mFreqSelMode ;
2014-10-25 22:05:45 +00:00
// Following holds:
// the center for FREQ_SEL_PINNED_CENTER,
// the ratio of top to center (== center to bottom) for FREQ_SEL_DRAG_CENTER,
// a frequency boundary for FREQ_SEL_FREE, FREQ_SEL_TOP_FREE, or
// FREQ_SEL_BOTTOM_FREE,
// and is ignored otherwise.
double mFreqSelPin ;
2014-10-18 14:19:38 +00:00
const WaveTrack * mFreqSelTrack ;
std : : auto_ptr < SpectrumAnalyst > mFrequencySnapper ;
2014-11-29 16:53:28 +00:00
// For toggling of spectral seletion
double mLastF0 ;
double mLastF1 ;
public :
void ToggleSpectralSelection ( ) ;
protected :
2014-10-18 14:19:38 +00:00
# endif
2010-01-23 19:44:49 +00:00
Track * mCapturedTrack ;
Envelope * mCapturedEnvelope ;
WaveClip * mCapturedClip ;
TrackClipArray mCapturedClipArray ;
bool mCapturedClipIsSelection ;
WaveTrack : : Location mCapturedTrackLocation ;
wxRect mCapturedTrackLocationRect ;
wxRect mCapturedRect ;
// When sliding horizontally, the moving clip may automatically
// snap to the beginning and ending of other clips, or to label
// starts and stops. When you start sliding, SlideSnapFromPoints
// gets populated with the start and stop times of selected clips,
// and SlideSnapToPoints gets populated with the start and stop times
// of other clips. In both cases, times that are within 3 pixels
// of another at the same zoom level are eliminated; you can't snap
// when there are two things arbitrarily close at that zoom level.
wxBaseArrayDouble mSlideSnapFromPoints ;
wxBaseArrayDouble mSlideSnapToPoints ;
wxArrayInt mSlideSnapLinePixels ;
// The amount that clips are sliding horizontally; this allows
// us to undo the slide and then slide it by another amount
double mHSlideAmount ;
bool mDidSlideVertically ;
bool mRedrawAfterStop ;
bool mIndicatorShowing ;
wxMouseEvent mLastMouseEvent ;
int mMouseClickX ;
int mMouseClickY ;
int mMouseMostRecentX ;
int mMouseMostRecentY ;
int mZoomStart ;
int mZoomEnd ;
// Handles snapping the selection boundaries or track boundaries to
// line up with existing tracks or labels. mSnapLeft and mSnapRight
// are the horizontal index of pixels to display user feedback
// guidelines so the user knows when such snapping is taking place.
SnapManager * mSnapManager ;
wxInt64 mSnapLeft ;
wxInt64 mSnapRight ;
bool mSnapPreferRightEdge ;
2014-11-08 15:18:43 +00:00
NumericConverter mConverter ;
2013-10-23 21:01:52 +00:00
2015-06-03 03:22:09 +00:00
WaveTrack * mDrawingTrack ; // Keeps track of which track you are drawing on between events cf. HandleDraw()
2010-01-23 19:44:49 +00:00
int mDrawingTrackTop ; // Keeps track of the top position of the drawing track.
sampleCount mDrawingStartSample ; // sample of last click-down
sampleCount mDrawingLastDragSample ; // sample of last drag-over
float mDrawingLastDragSampleValue ; // value of last drag-over
2014-06-03 20:30:19 +00:00
2014-11-08 14:30:19 +00:00
# ifdef EXPERIMENTAL_SPECTRAL_EDITING
void HandleCenterFrequencyCursor
( bool shiftDown , const wxChar * * ppTip , const wxCursor * * ppCursor ) ;
void HandleCenterFrequencyClick
( bool shiftDown , Track * pTrack , double value ) ;
# endif
2010-01-23 19:44:49 +00:00
double PositionToTime ( wxInt64 mouseXCoordinate ,
wxInt64 trackLeftEdge ) const ;
wxInt64 TimeToPosition ( double time ,
wxInt64 trackLeftEdge ) const ;
2014-10-18 14:19:38 +00:00
# ifdef EXPERIMENTAL_SPECTRAL_EDITING
double PositionToFrequency ( bool maySnap ,
wxInt64 mouseYCoordinate ,
wxInt64 trackTopEdge ,
int trackHeight ,
double rate ,
bool logF ) const ;
wxInt64 FrequencyToPosition ( double frequency ,
wxInt64 trackTopEdge ,
int trackHeight ,
double rate ,
bool logF ) const ;
# endif
2014-10-25 22:05:45 +00:00
enum SelectionBoundary {
SBNone ,
SBLeft , SBRight ,
# ifdef EXPERIMENTAL_SPECTRAL_EDITING
2014-11-11 15:24:22 +00:00
SBBottom , SBTop , SBCenter , SBWidth ,
2014-10-25 22:05:45 +00:00
# endif
} ;
2014-11-29 22:09:57 +00:00
SelectionBoundary ChooseTimeBoundary
( double selend , bool onlyWithinSnapDistance ,
wxInt64 * pPixelDist = NULL , double * pPinValue = NULL ) const ;
2014-10-25 22:05:45 +00:00
SelectionBoundary ChooseBoundary
( wxMouseEvent & event , const Track * pTrack ,
const wxRect & rect ,
2014-11-08 14:30:19 +00:00
bool mayDragWidth ,
2014-10-25 22:05:45 +00:00
bool onlyWithinSnapDistance ,
double * pPinValue = NULL ) const ;
2015-04-12 03:45:46 +00:00
bool mInitialMinimized ;
2010-01-23 19:44:49 +00:00
int mInitialTrackHeight ;
2015-04-12 03:45:46 +00:00
int mInitialActualHeight ;
2010-01-23 19:44:49 +00:00
int mInitialUpperTrackHeight ;
2015-04-12 03:45:46 +00:00
int mInitialUpperActualHeight ;
2010-01-23 19:44:49 +00:00
bool mAutoScrolling ;
enum MouseCaptureEnum
{
IsUncaptured = 0 , // This is the normal state for the mouse
IsVZooming ,
IsClosing ,
IsSelecting ,
IsAdjustingLabel ,
2015-04-24 08:55:03 +00:00
IsAdjustingSample ,
2010-01-23 19:44:49 +00:00
IsResizing ,
IsResizingBetweenLinkedTracks ,
IsResizingBelowLinkedTracks ,
IsRearranging ,
IsSliding ,
IsEnveloping ,
IsMuting ,
IsSoloing ,
IsGainSliding ,
IsPanSliding ,
IsMinimizing ,
IsOverCutLine ,
WasOverCutLine ,
IsPopping ,
2010-09-18 21:02:36 +00:00
# ifdef USE_MIDI
IsStretching ,
# endif
2015-04-17 18:09:35 +00:00
IsZooming ,
2015-05-19 16:30:02 +00:00
2010-01-23 19:44:49 +00:00
} ;
enum MouseCaptureEnum mMouseCapture ;
2011-11-25 20:40:26 +00:00
virtual void SetCapturedTrack ( Track * t , enum MouseCaptureEnum MouseCapture = IsUncaptured ) ;
2010-01-23 19:44:49 +00:00
2015-05-27 22:44:49 +00:00
bool mScrollBeyondZero ;
2010-01-23 19:44:49 +00:00
bool mAdjustSelectionEdges ;
bool mSlideUpDownOnly ;
bool mCircularTrackNavigation ;
float mdBr ;
// JH: if the user is dragging a track, at what y
// coordinate should the dragging track move up or down?
int mMoveUpThreshold ;
int mMoveDownThreshold ;
2015-04-17 18:09:35 +00:00
# ifdef EXPERIMENTAL_SCRUBBING_BASIC
int mScrubToken ;
wxLongLong mScrubStartClockTimeMillis ;
wxCoord mScrubStartPosition ;
double mMaxScrubSpeed ;
int mScrubSpeedDisplayCountdown ;
2015-05-29 23:45:43 +00:00
bool mScrubHasFocus ;
2015-05-30 00:13:42 +00:00
bool mScrubSeekPress ;
2015-04-17 18:09:35 +00:00
# endif
# ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
bool mSmoothScrollingScrub ;
# endif
# ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
int mLogMaxScrubSpeed ;
# endif
2010-01-23 19:44:49 +00:00
wxCursor * mArrowCursor ;
wxCursor * mPencilCursor ;
wxCursor * mSelectCursor ;
wxCursor * mResizeCursor ;
wxCursor * mSlideCursor ;
2014-11-08 14:30:19 +00:00
wxCursor * mEnvelopeCursor ; // doubles as the center frequency cursor
// for spectral selection
2010-01-23 19:44:49 +00:00
wxCursor * mSmoothCursor ;
wxCursor * mZoomInCursor ;
wxCursor * mZoomOutCursor ;
wxCursor * mLabelCursorLeft ;
wxCursor * mLabelCursorRight ;
wxCursor * mRearrangeCursor ;
wxCursor * mDisabledCursor ;
wxCursor * mAdjustLeftSelectionCursor ;
wxCursor * mAdjustRightSelectionCursor ;
2014-11-08 14:30:19 +00:00
# ifdef EXPERIMENTAL_SPECTRAL_EDITING
wxCursor * mBottomFrequencyCursor ;
wxCursor * mTopFrequencyCursor ;
wxCursor * mBandWidthCursor ;
# endif
2010-09-18 21:02:36 +00:00
# if USE_MIDI
wxCursor * mStretchCursor ;
wxCursor * mStretchLeftCursor ;
wxCursor * mStretchRightCursor ;
# endif
2010-01-23 19:44:49 +00:00
wxMenu * mWaveTrackMenu ;
wxMenu * mNoteTrackMenu ;
wxMenu * mTimeTrackMenu ;
wxMenu * mLabelTrackMenu ;
wxMenu * mRateMenu ;
wxMenu * mFormatMenu ;
wxMenu * mLabelTrackInfoMenu ;
Track * mPopupMenuTarget ;
friend class TrackPanelAx ;
TrackPanelAx * mAx ;
wxString mSoloPref ;
2010-01-25 22:44:48 +00:00
// Keeps track of extra fractional vertical scroll steps
double mVertScrollRemainder ;
2011-11-25 20:40:26 +00:00
protected :
2010-01-23 19:44:49 +00:00
// The screenshot class needs to access internals
friend class ScreenshotCommand ;
public :
wxSize vrulerSize ;
DECLARE_EVENT_TABLE ( )
} ;
2011-11-25 20:40:26 +00:00
# ifdef _MSC_VER
# pragma warning( pop )
# endif
2010-01-23 19:44:49 +00:00
//This constant determines the size of the vertical region (in pixels) around
//the bottom of a track that can be used for vertical track resizing.
# define TRACK_RESIZE_REGION 5
//This constant determines the size of the horizontal region (in pixels) around
//the right and left selection bounds that can be used for horizontal selection adjusting
2014-10-18 14:19:38 +00:00
//(or, vertical distance around top and bottom bounds in spectrograms,
// for vertical selection adjusting)
2010-01-23 19:44:49 +00:00
# define SELECTION_RESIZE_REGION 3
# define SMOOTHING_KERNEL_RADIUS 3
# define SMOOTHING_BRUSH_RADIUS 5
# define SMOOTHING_PROPORTION_MAX 0.7
# define SMOOTHING_PROPORTION_MIN 0.0
# endif