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__
2016-02-14 18:23:08 +00:00
# include "MemoryX.h"
2015-04-12 16:39:11 +00:00
# include <vector>
2014-10-18 14:19:38 +00:00
2010-01-23 19:44:49 +00:00
# include <wx/timer.h>
2014-10-18 14:19:38 +00:00
# include "Experimental.h"
2015-07-05 15:22:03 +00:00
# include "audacity/Types.h"
2014-11-08 15:18:43 +00:00
# include "widgets/NumericTextCtrl.h"
2010-01-23 19:44:49 +00:00
2016-02-24 16:41:26 +00:00
# include "SelectedRegion.h"
2015-07-03 04:20:21 +00:00
# include "WaveTrackLocation.h"
2015-07-09 04:38:42 +00:00
# include "Snap.h"
2015-08-24 01:25:01 +00:00
# include "Track.h"
2016-05-07 17:00:48 +00:00
# include "widgets/OverlayPanel.h"
2015-07-09 04:38:42 +00:00
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
2015-07-03 04:20:21 +00:00
class WaveTrack ;
2015-07-04 22:12:25 +00:00
class WaveClip ;
class Envelope ;
2015-07-03 04:20:21 +00:00
2014-10-18 14:19:38 +00:00
// Declared elsewhere, to reduce compilation dependencies
class TrackPanelListener ;
2010-01-23 19:44:49 +00:00
2016-02-25 01:45:49 +00:00
enum class UndoPush : unsigned char ;
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.
2015-07-09 04:38:42 +00:00
// Array classes are private in TrackInfo, so we will not
2011-11-25 20:40:26 +00:00
// 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
2015-07-12 12:47:56 +00:00
DECLARE_EXPORTED_EVENT_TYPE ( AUDACITY_DLL_API , EVT_TRACK_PANEL_TIMER , - 1 ) ;
2015-08-27 05:13:46 +00:00
enum {
kTimerInterval = 50 , // milliseconds
} ;
2011-11-25 20:40:26 +00:00
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 ;
2015-08-03 17:49:53 +00:00
void DrawBackground ( wxDC * dc , const wxRect & rect , bool bSelected , bool bHasMuteSolo , const int labelw , const int vrul ) const ;
void DrawBordersWithin ( wxDC * dc , const wxRect & rect , bool bHasMuteSolo ) const ;
void DrawCloseBox ( wxDC * dc , const wxRect & rect , bool down ) const ;
void DrawTitleBar ( wxDC * dc , const wxRect & rect , Track * t , bool down ) const ;
void DrawMuteSolo ( wxDC * dc , const wxRect & rect , Track * t , bool down , bool solo , bool bHasSoloButton ) const ;
void DrawVRuler ( wxDC * dc , const wxRect & rect , Track * t ) const ;
2010-09-18 21:02:36 +00:00
# ifdef EXPERIMENTAL_MIDI_OUT
2015-08-03 17:49:53 +00:00
void DrawVelocitySlider ( wxDC * dc , NoteTrack * t , wxRect rect ) const ;
2010-09-18 21:02:36 +00:00
# endif
2015-09-08 16:24:59 +00:00
void DrawSliders ( wxDC * dc , WaveTrack * t , wxRect rect , bool captured ) 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.
2015-08-03 17:49:53 +00:00
void DrawMinimize ( wxDC * dc , const wxRect & rect , Track * t , bool down ) const ;
2010-01-23 19:44:49 +00:00
2015-08-03 17:49:53 +00:00
void GetTrackControlsRect ( const wxRect & rect , wxRect & dest ) const ;
void GetCloseBoxRect ( const wxRect & rect , wxRect & dest ) const ;
void GetTitleBarRect ( const wxRect & rect , wxRect & dest ) const ;
void GetMuteSoloRect ( const wxRect & rect , wxRect & dest , bool solo , bool bHasSoloButton ) const ;
void GetGainRect ( const wxRect & rect , wxRect & dest ) const ;
void GetPanRect ( const wxRect & rect , wxRect & dest ) const ;
void GetMinimizeRect ( const wxRect & rect , wxRect & dest ) const ;
void GetSyncLockIconRect ( const wxRect & rect , wxRect & dest ) const ;
2010-01-23 19:44:49 +00:00
2015-08-28 19:53:11 +00:00
public :
2015-09-08 16:24:59 +00:00
LWSlider * GainSlider ( WaveTrack * t , bool captured = false ) const ;
LWSlider * PanSlider ( WaveTrack * t , bool captured = false ) const ;
2010-04-21 05:03:24 +00:00
2016-04-09 19:10:05 +00:00
# ifdef EXPERIMENTAL_MIDI_OUT
LWSlider * GainSlider ( int index ) const ;
# 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
private :
2016-05-01 21:55:48 +00:00
void UpdatePrefs ( ) ;
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
TrackPanel * pParent ;
2010-01-23 19:44:49 +00:00
wxFont mFont ;
2016-08-03 01:25:05 +00:00
std : : unique_ptr < LWSlider >
mGainCaptured , mPanCaptured , mGain , 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.
2016-05-07 17:00:48 +00:00
class AUDACITY_DLL_API TrackPanel final : public OverlayPanel {
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 ( ) ;
2016-06-11 23:46:42 +00:00
virtual void BuildMenusIfNeeded ( void ) ;
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 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 ) ;
2015-08-09 23:26:29 +00:00
virtual void OnKeyUp ( 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
2015-08-26 03:50:23 +00:00
virtual void OnTimer ( wxTimerEvent & event ) ;
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
2015-08-21 15:49:49 +00:00
// Width and height, relative to upper left corner at (GetLeftOffset(), 0)
2015-08-21 16:02:48 +00:00
// Either argument may be NULL
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)
2016-05-22 03:19:09 +00:00
virtual void HandleInterruptedDrag ( ) ;
2016-04-20 19:34:49 +00:00
virtual bool 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 ( ) ;
virtual void ScrollIntoView ( double pos ) ;
virtual void ScrollIntoView ( int x ) ;
virtual void OnTrackMenu ( Track * t = NULL ) ;
2015-06-23 03:56:36 +00:00
virtual void OnVRulerMenu ( Track * t , wxMouseEvent * pEvent = NULL ) ;
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-08-21 17:22:44 +00:00
// Returns the time corresponding to the pixel column one past the track area
// (ignoring any fisheye)
virtual double GetScreenEndTime ( ) const ;
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
2015-08-13 14:59:42 +00:00
* the track around , via a single set of c ode .
2013-10-30 22:07:06 +00:00
* @ param menu the menu to add the commands to .
*/
2015-08-04 16:23:50 +00:00
virtual void BuildCommonDropMenuItems ( wxMenu * menu ) ;
2016-05-27 09:45:01 +00:00
// left over from PRL's vertical ruler context menu experiment in 2.1.2
// static void BuildVRulerMenuItems(wxMenu * menu, int firstId, const wxArrayString &names);
2015-07-06 20:55:04 +00:00
virtual bool IsAudioActive ( ) ;
2011-11-25 20:40:26 +00:00
virtual bool IsUnsafe ( ) ;
2015-08-11 00:02:24 +00:00
virtual bool HandleLabelTrackClick ( LabelTrack * lTrack , wxRect & rect , wxMouseEvent & event ) ;
virtual void HandleGlyphDragRelease ( LabelTrack * lTrack , wxMouseEvent & event ) ;
virtual void HandleTextDragRelease ( LabelTrack * lTrack , wxMouseEvent & event ) ;
2015-07-13 17:03:19 +00:00
virtual bool HandleTrackLocationMouseEvent ( WaveTrack * track , wxRect & rect , wxMouseEvent & event ) ;
2016-04-19 01:49:27 +00:00
virtual bool IsOverCutline ( WaveTrack * track , wxRect & rect , const wxMouseEvent & event ) ;
2011-11-25 20:40:26 +00:00
virtual void HandleTrackSpecificMouseEvent ( wxMouseEvent & event ) ;
2015-08-13 14:59:42 +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.
2016-04-19 01:49:27 +00:00
virtual int DetermineToolToUse ( ToolsToolBar * pTtb , const wxMouseEvent & event ) ;
virtual bool HitTestEnvelope ( Track * track , wxRect & rect , const wxMouseEvent & event ) ;
virtual bool HitTestSamples ( Track * track , wxRect & rect , const wxMouseEvent & event ) ;
virtual bool HitTestSlide ( Track * track , wxRect & rect , const 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
2016-04-19 01:49:27 +00:00
virtual bool HitTestStretch ( Track * track , wxRect & rect , const wxMouseEvent & event ) ;
2011-11-25 20:40:26 +00:00
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
2016-06-26 15:24:11 +00:00
void SelectTrack ( Track * track , bool selected , bool updateLastPicked = true ) ;
2016-06-26 14:39:29 +00:00
void SelectRangeOfTracks ( Track * sTrack , Track * eTrack ) ;
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
2015-06-08 13:50:43 +00:00
protected :
2015-04-17 18:09:35 +00:00
2013-02-20 23:42:58 +00:00
virtual void SelectionHandleClick ( wxMouseEvent & event ,
2015-08-03 17:49:53 +00:00
Track * pTrack , wxRect rect ) ;
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 ( ) ;
2015-08-28 14:40:19 +00:00
public :
virtual void UpdateAccessibility ( ) ;
2014-10-18 14:19:38 +00:00
# ifdef EXPERIMENTAL_SPECTRAL_EDITING
2014-12-22 08:03:41 +00:00
public :
2015-06-13 16:13:55 +00:00
void SnapCenterOnce ( const WaveTrack * pTrack , bool up ) ;
2014-12-22 08:03:41 +00:00
protected :
2015-06-13 16:13:55 +00:00
void StartSnappingFreqSelection ( const WaveTrack * pTrack ) ;
2014-10-25 22:05:45 +00:00
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
// AS: Cursor handling
2011-11-25 20:40:26 +00:00
virtual bool SetCursorByActivity ( ) ;
2016-04-19 01:49:27 +00:00
virtual bool SetCursorForCutline ( WaveTrack * track , wxRect & rect , const wxMouseEvent & event ) ;
virtual void SetCursorAndTipWhenInLabel ( Track * t , const wxMouseEvent & event , wxString & tip ) ;
2015-07-13 11:59:46 +00:00
virtual void SetCursorAndTipWhenInVResizeArea ( bool blinked , wxString & tip ) ;
2016-04-19 01:49:27 +00:00
virtual void SetCursorAndTipWhenInLabelTrack ( LabelTrack * pLT , const wxMouseEvent & event , wxString & tip ) ;
2014-11-08 14:30:19 +00:00
virtual void SetCursorAndTipWhenSelectTool
2016-04-19 01:49:27 +00:00
( Track * t , const wxMouseEvent & event , wxRect & rect , bool bMultiToolMode , wxString & tip , const wxCursor * * ppCursor ) ;
virtual void SetCursorAndTipByTool ( int tool , const wxMouseEvent & event , wxString & tip ) ;
public :
virtual void HandleCursor ( const wxMouseEvent & event ) ;
protected :
2015-07-06 21:20:48 +00:00
virtual void MaySetOnDemandTip ( Track * t , wxString & tip ) ;
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
2015-08-15 00:30:26 +00:00
static bool IsDragZooming ( int zoomStart , int zoomEnd ) ;
virtual bool IsDragZooming ( ) { return IsDragZooming ( mZoomStart , mZoomEnd ) ; }
2011-11-25 20:40:26 +00:00
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 ) ;
2015-07-01 18:22:25 +00:00
virtual void HandleWaveTrackVZoom ( WaveTrack * track , bool shiftDown , bool rightUp ) ;
2015-08-15 00:30:26 +00:00
static void HandleWaveTrackVZoom
( TrackList * tracks , const wxRect & rect ,
int zoomStart , int zoomEnd ,
WaveTrack * track , bool shiftDown , bool rightUp ,
bool fixedMousePoint ) ;
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-08-15 22:07:29 +00:00
float FindSampleEditingLevel ( wxMouseEvent & event , double dBRange , 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 ) ;
2015-08-27 15:51:30 +00:00
virtual void HandleWheelRotationInVRuler
2016-07-03 16:14:08 +00:00
( wxMouseEvent & event , double steps , Track * pTrack , const wxRect & rect ) ;
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 ) ;
2016-06-26 16:03:45 +00:00
public :
2016-06-26 17:31:00 +00:00
virtual void HandleListSelection ( Track * t , bool shift , bool ctrl ,
bool modifyState = true ) ;
2016-06-26 16:03:45 +00:00
protected :
2011-11-25 20:40:26 +00:00
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.
2015-08-03 17:49:53 +00:00
virtual bool CloseFunc ( Track * t , wxRect rect , int x , int y ) ;
virtual bool PopupFunc ( Track * t , wxRect rect , 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.
2015-08-03 17:49:53 +00:00
virtual bool TrackSelFunc ( Track * t , wxRect rect , int x , int y ) ;
2010-09-12 05:11:43 +00:00
2015-08-03 17:49:53 +00:00
virtual bool MuteSoloFunc ( Track * t , wxRect rect , int x , int f , bool solo ) ;
virtual bool MinimizeFunc ( Track * t , wxRect rect , int x , int f ) ;
virtual bool GainFunc ( Track * t , wxRect rect , wxMouseEvent & event ,
2010-01-23 19:44:49 +00:00
int x , int y ) ;
2015-08-03 17:49:53 +00:00
virtual bool PanFunc ( Track * t , wxRect rect , 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.
2016-02-24 17:06:29 +00:00
virtual void MakeParentPushState ( const wxString & desc , const wxString & shortDesc ) ; // use UndoPush::AUTOSAVE
2016-02-23 02:18:11 +00:00
virtual void MakeParentPushState ( const wxString & desc , const wxString & shortDesc ,
2016-02-24 17:06:29 +00:00
UndoPush flags ) ;
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
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 ) ;
virtual void OnChangeOctave ( wxCommandEvent & event ) ;
virtual void OnChannelChange ( wxCommandEvent & event ) ;
2015-08-19 04:13:56 +00:00
virtual void OnSpectrogramSettings ( wxCommandEvent & event ) ;
2011-11-25 20:40:26 +00:00
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
2015-06-23 03:56:36 +00:00
virtual void OnWaveformScaleType ( wxCommandEvent & event ) ;
virtual void OnSpectrumScaleType ( wxCommandEvent & event ) ;
2015-07-01 18:22:25 +00:00
virtual void OnZoomInVertical ( wxCommandEvent & event ) ;
virtual void OnZoomOutVertical ( wxCommandEvent & event ) ;
virtual void OnZoomFitVertical ( wxCommandEvent & event ) ;
2015-06-23 03:56:36 +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 ) ;
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 ;
2015-06-13 16:13:55 +00:00
virtual int GetVRulerOffset ( ) const { return mTrackInfo . GetTrackInfoWidth ( ) ; }
2010-01-23 19:44:49 +00:00
2015-06-13 16:13:55 +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 :
2015-04-19 21:12:06 +00:00
TrackList * GetTracks ( ) { return mTracks ; }
ViewInfo * GetViewInfo ( ) { return mViewInfo ; }
TrackPanelListener * GetListener ( ) { return mListener ; }
AdornedRulerPanel * GetRuler ( ) { return mRuler ; }
2016-02-13 15:43:16 +00:00
// JKC and here is a factory function which just does 'NEW' in standard Audacity.
2016-02-14 07:54:25 +00:00
// Precondition: parent != NULL
2011-11-25 20:40:26 +00:00
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 ) ;
virtual void DrawZooming ( wxDC * dc , const wxRect & clip ) ;
2010-01-23 19:44:49 +00:00
2015-08-03 17:49:53 +00:00
virtual void HighlightFocusedTrack ( wxDC * dc , const wxRect & rect ) ;
virtual void DrawShadow ( Track * t , wxDC * dc , const wxRect & rect ) ;
virtual void DrawBordersAroundTrack ( Track * t , wxDC * dc , const wxRect & rect , const int labelw , const int vrul ) ;
virtual void DrawOutsideOfTrack ( Track * t , wxDC * dc , const wxRect & rect ) ;
2010-01-23 19:44:49 +00:00
2015-08-27 23:26:00 +00:00
protected :
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...
2015-04-19 21:12:06 +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
TrackInfo mTrackInfo ;
2015-08-28 19:53:11 +00:00
public :
TrackInfo * GetTrackInfo ( ) { return & mTrackInfo ; }
2010-01-23 19:44:49 +00:00
2015-08-28 19:53:11 +00:00
protected :
2010-01-23 19:44:49 +00:00
TrackPanelListener * mListener ;
TrackList * mTracks ;
ViewInfo * mViewInfo ;
AdornedRulerPanel * mRuler ;
2016-08-03 01:25:05 +00:00
std : : unique_ptr < TrackArtist > mTrackArtist ;
2010-01-23 19:44:49 +00:00
2016-02-24 06:06:39 +00:00
class AUDACITY_DLL_API AudacityTimer final : public wxTimer {
2010-01-23 19:44:49 +00:00
public :
2016-02-24 06:06:47 +00:00
void Notify ( ) override {
2015-08-26 03:50:23 +00:00
// (From Debian)
//
// Don't call parent->OnTimer(..) directly here, but instead post
// an event. This ensures that this is a pure wxWidgets event
// (no GDK event behind it) and that it therefore isn't processed
// within the YieldFor(..) of the clipboard operations (workaround
// for Debian bug #765341).
2016-08-08 13:54:53 +00:00
// QueueEvent() will take ownership of the event
parent - > GetEventHandler ( ) - > QueueEvent ( safenew wxTimerEvent ( * this ) ) ;
2015-08-26 03:50:23 +00:00
}
2010-01-23 19:44:49 +00:00
TrackPanel * parent ;
} mTimer ;
2014-06-03 20:30:19 +00:00
2010-01-23 19:44:49 +00:00
int mTimeCount ;
bool mRefreshBacking ;
int mPrevWidth ;
int mPrevHeight ;
2015-04-12 16:39:11 +00:00
SelectedRegion mInitialSelection ;
2016-06-26 14:45:57 +00:00
std : : vector < bool > mInitialTrackSelection ;
2016-06-26 14:39:29 +00:00
Track * mInitialLastPickedTrack { } ;
2015-04-12 16:39:11 +00:00
2014-11-29 17:10:56 +00:00
bool mSelStartValid ;
2010-01-23 19:44:49 +00:00
double mSelStart ;
2016-06-26 14:39:29 +00:00
Track * mLastPickedTrack { } ;
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 ;
2016-02-06 01:27:09 +00:00
std : : unique_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 ;
2015-08-24 01:25:01 +00:00
TrackArray mTrackExclusions ;
2010-01-23 19:44:49 +00:00
bool mCapturedClipIsSelection ;
2015-07-03 04:20:21 +00:00
WaveTrackLocation mCapturedTrackLocation ;
2010-01-23 19:44:49 +00:00
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 ;
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.
2016-08-03 01:25:05 +00:00
std : : unique_ptr < SnapManager > mSnapManager ;
2010-01-23 19:44:49 +00:00
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
2015-07-06 21:20:48 +00:00
( bool shiftDown , wxString & tip , const wxCursor * * ppCursor ) ;
2014-11-08 14:30:19 +00:00
void HandleCenterFrequencyClick
( bool shiftDown , Track * pTrack , double value ) ;
2010-01-23 19:44:49 +00:00
2015-06-13 16:13:55 +00:00
double PositionToFrequency ( const WaveTrack * wt ,
bool maySnap ,
2014-10-18 14:19:38 +00:00
wxInt64 mouseYCoordinate ,
wxInt64 trackTopEdge ,
2015-06-16 16:46:55 +00:00
int trackHeight ) const ;
2015-06-13 16:13:55 +00:00
wxInt64 FrequencyToPosition ( const WaveTrack * wt ,
double frequency ,
2014-10-18 14:19:38 +00:00
wxInt64 trackTopEdge ,
2015-06-16 16:46:55 +00:00
int trackHeight ) const ;
2014-10-18 14:19:38 +00:00
# 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
2016-04-19 01:49:27 +00:00
( const wxMouseEvent & event , const Track * pTrack ,
2014-10-25 22:05:45 +00:00
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-08-11 00:02:24 +00:00
IsSelectingLabelText ,
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 ,
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
bool mAdjustSelectionEdges ;
bool mSlideUpDownOnly ;
bool mCircularTrackNavigation ;
// 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-08-08 22:55:31 +00:00
int mRearrangeCount ;
2010-01-23 19:44:49 +00:00
2016-04-10 03:06:10 +00:00
std : : unique_ptr < wxCursor >
mArrowCursor , mPencilCursor , mSelectCursor ,
mResizeCursor , mSlideCursor , mEnvelopeCursor , // doubles as the center frequency cursor
2014-11-08 14:30:19 +00:00
// for spectral selection
2016-04-10 03:06:10 +00:00
mSmoothCursor , mZoomInCursor , mZoomOutCursor ,
mLabelCursorLeft , mLabelCursorRight , mRearrangeCursor ,
mDisabledCursor , mAdjustLeftSelectionCursor , mAdjustRightSelectionCursor ;
2014-11-08 14:30:19 +00:00
# ifdef EXPERIMENTAL_SPECTRAL_EDITING
2016-04-10 03:06:10 +00:00
std : : unique_ptr < wxCursor >
mBottomFrequencyCursor , mTopFrequencyCursor , mBandWidthCursor ;
2014-11-08 14:30:19 +00:00
# endif
2010-09-18 21:02:36 +00:00
# if USE_MIDI
2016-04-10 03:06:10 +00:00
std : : unique_ptr < wxCursor >
mStretchCursor , mStretchLeftCursor , mStretchRightCursor ;
2010-09-18 21:02:36 +00:00
# endif
2010-01-23 19:44:49 +00:00
2016-08-03 01:25:05 +00:00
std : : unique_ptr < wxMenu > mWaveTrackMenu ;
2016-06-13 14:06:20 +00:00
size_t mChannelItemsInsertionPoint { } ;
2015-08-04 17:00:46 +00:00
2016-08-03 01:25:05 +00:00
std : : unique_ptr < wxMenu >
mNoteTrackMenu , mTimeTrackMenu , mLabelTrackMenu ,
mRulerWaveformMenu , mRulerSpectrumMenu ;
2010-01-23 19:44:49 +00:00
2016-08-03 01:25:05 +00:00
// These sub-menus are owned by parent menus,
// so not unique_ptrs
wxMenu * mRateMenu { } , * mFormatMenu { } ;
2015-06-23 03:56:36 +00:00
2016-06-13 14:06:20 +00:00
Track * mPopupMenuTarget { } ;
2010-01-23 19:44:49 +00:00
friend class TrackPanelAx ;
2016-08-03 01:24:53 +00:00
# if wxUSE_ACCESSIBILITY
TrackPanelAx * mAx { } ;
# else
std : : unique_ptr < TrackPanelAx > mAx ;
# endif
2010-01-23 19:44:49 +00:00
2015-08-25 17:35:32 +00:00
public :
TrackPanelAx & GetAx ( ) { return * mAx ; }
protected :
2010-01-23 19:44:49 +00:00
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 ;
2016-05-23 21:56:06 +00:00
SelectedRegion mLastDrawnSelectedRegion { } ;
2010-01-23 19:44:49 +00:00
public :
wxSize vrulerSize ;
2015-08-25 17:35:32 +00:00
public :
2010-01-23 19:44:49 +00:00
DECLARE_EVENT_TABLE ( )
} ;
2016-04-27 22:39:47 +00:00
// See big pictorial comment in TrackPanel for explanation of these numbers
enum : int {
kLeftInset = 4 ,
kRightInset = kLeftInset ,
kTopInset = 4 ,
kShadowThickness = 1 ,
kBorderThickness = 1 ,
kTopMargin = kTopInset + kBorderThickness ,
kBottomMargin = kShadowThickness + kBorderThickness ,
kLeftMargin = kLeftInset + kBorderThickness ,
kRightMargin = kRightInset + kShadowThickness + kBorderThickness ,
} ;
enum : int {
kTrackInfoWidth = 100 ,
kTrackInfoBtnSize = 16 // widely used dimension, usually height
} ;
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