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"
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
2016-05-07 17:00:48 +00:00
# include "widgets/OverlayPanel.h"
2015-07-09 04:38:42 +00:00
2017-06-11 11:20:01 +00:00
# include "SelectionState.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 ;
2015-07-08 21:17:43 +00:00
class Track ;
class TrackList ;
2010-01-23 19:44:49 +00:00
class TrackPanel ;
2015-07-07 03:12:16 +00:00
class TrackPanelCell ;
2010-01-23 19:44:49 +00:00
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-08 21:17:43 +00:00
class NoteTrack ;
2015-07-03 04:20:21 +00:00
class WaveTrack ;
2015-07-04 22:12:25 +00:00
class WaveClip ;
2015-07-07 03:12:16 +00:00
class UIHandle ;
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
} ;
2017-06-12 16:28:20 +00:00
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 ( ) ;
2017-04-05 19:16:12 +00:00
void ReCreateSliders ( ) ;
2010-01-23 19:44:49 +00:00
2017-06-12 16:28:20 +00:00
struct TCPLine ;
static void DrawItems
( wxDC * dc , const wxRect & rect , const Track & track , int mouseCapture ,
bool captured ) ;
static void DrawItems
( wxDC * dc , const wxRect & rect , const Track * pTrack ,
2017-06-13 17:34:12 +00:00
const std : : vector < TCPLine > & topLines ,
const std : : vector < TCPLine > & bottomLines ,
2017-06-12 16:28:20 +00:00
int mouseCapture , bool captured ) ;
2017-06-12 17:23:00 +00:00
static void CloseTitleDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
2017-06-12 19:17:26 +00:00
static void MinimizeSyncLockDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
2017-06-12 19:51:06 +00:00
static void MidiControlsDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
2017-06-12 20:10:03 +00:00
template < typename TrackClass >
static void SliderDrawFunction
( LWSlider * ( * Selector )
( const wxRect & sliderRect , const TrackClass * t , bool captured ,
wxWindow * ) ,
wxDC * dc , const wxRect & rect , const Track * pTrack , bool captured ) ;
static void PanSliderDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
static void GainSliderDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
# ifdef EXPERIMENTAL_MIDI_OUT
static void VelocitySliderDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
# endif
2017-06-13 12:02:44 +00:00
static void MuteOrSoloDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured , bool solo ) ;
static void WideMuteDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
static void WideSoloDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
static void MuteAndSoloDrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
2017-06-13 13:14:58 +00:00
static void StatusDrawFunction
( const wxString & string , wxDC * dc , const wxRect & rect ) ;
static void Status1DrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
static void Status2DrawFunction
( wxDC * dc , const wxRect & rect , const Track * pTrack , int pressed ,
bool captured ) ;
2015-07-07 03:12:16 +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
int GetTrackInfoWidth ( ) const ;
2017-06-12 19:02:28 +00:00
static void SetTrackInfoFont ( wxDC * dc ) ;
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
2017-04-02 22:07:13 +00:00
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 ;
2017-06-05 16:47:29 +00:00
void DrawBordersWithin ( wxDC * dc , const wxRect & rect , const Track & track ) const ;
2015-08-03 17:49:53 +00:00
void DrawVRuler ( wxDC * dc , const wxRect & rect , Track * t ) 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
2017-06-12 17:39:23 +00:00
static void GetCloseBoxHorizontalBounds ( const wxRect & rect , wxRect & dest ) ;
2017-06-12 17:33:07 +00:00
static void GetCloseBoxRect ( const wxRect & rect , wxRect & dest ) ;
2017-06-12 17:39:23 +00:00
static void GetTitleBarHorizontalBounds ( const wxRect & rect , wxRect & dest ) ;
2017-06-12 17:33:07 +00:00
static void GetTitleBarRect ( const wxRect & rect , wxRect & dest ) ;
2017-06-12 17:39:23 +00:00
static void GetNarrowMuteHorizontalBounds
( const wxRect & rect , wxRect & dest ) ;
static void GetNarrowSoloHorizontalBounds
( const wxRect & rect , wxRect & dest ) ;
static void GetWideMuteSoloHorizontalBounds
( const wxRect & rect , wxRect & dest ) ;
static void GetMuteSoloRect
( const wxRect & rect , wxRect & dest , bool solo , bool bHasSoloButton ,
const Track * pTrack ) ;
static void GetSliderHorizontalBounds ( const wxPoint & topleft , wxRect & dest ) ;
2017-06-12 17:33:07 +00:00
static void GetGainRect ( const wxPoint & topLeft , wxRect & dest ) ;
2017-06-12 17:39:23 +00:00
2017-06-12 17:33:07 +00:00
static void GetPanRect ( const wxPoint & topLeft , wxRect & dest ) ;
2017-06-12 17:39:23 +00:00
2017-02-22 02:05:35 +00:00
# ifdef EXPERIMENTAL_MIDI_OUT
2017-06-12 17:33:07 +00:00
static void GetVelocityRect ( const wxPoint & topLeft , wxRect & dest ) ;
2017-02-22 02:05:35 +00:00
# endif
2017-06-12 17:39:23 +00:00
static void GetMinimizeHorizontalBounds ( const wxRect & rect , wxRect & dest ) ;
2017-06-12 17:33:07 +00:00
static void GetMinimizeRect ( const wxRect & rect , wxRect & dest ) ;
2017-06-12 17:39:23 +00:00
static void GetSyncLockHorizontalBounds ( const wxRect & rect , wxRect & dest ) ;
2017-06-12 17:33:07 +00:00
static void GetSyncLockIconRect ( const wxRect & rect , wxRect & dest ) ;
2017-06-12 17:39:23 +00:00
2017-03-28 18:29:40 +00:00
# ifdef USE_MIDI
2017-06-12 17:39:23 +00:00
static void GetMidiControlsHorizontalBounds
( const wxRect & rect , wxRect & dest ) ;
2017-06-12 17:33:07 +00:00
static void GetMidiControlsRect ( const wxRect & rect , wxRect & dest ) ;
2017-03-28 18:29:40 +00:00
# endif
2010-01-23 19:44:49 +00:00
2017-06-07 14:39:47 +00:00
static bool HideTopItem ( const wxRect & rect , const wxRect & subRect ,
int allowance = 0 ) ;
2017-06-07 01:40:58 +00:00
static unsigned DefaultNoteTrackHeight ( ) ;
2017-06-07 02:37:24 +00:00
static unsigned DefaultWaveTrackHeight ( ) ;
2017-06-07 01:40:58 +00:00
2017-06-12 20:54:12 +00:00
static LWSlider * GainSlider
( const wxRect & sliderRect , const WaveTrack * t , bool captured ,
wxWindow * pParent ) ;
static LWSlider * PanSlider
( const wxRect & sliderRect , const WaveTrack * t , bool captured ,
wxWindow * pParent ) ;
2010-04-21 05:03:24 +00:00
2016-04-09 19:10:05 +00:00
# ifdef EXPERIMENTAL_MIDI_OUT
2017-06-12 20:54:12 +00:00
static LWSlider * VelocitySlider
( const wxRect & sliderRect , const NoteTrack * t , bool captured ,
wxWindow * pParent ) ;
2016-04-09 19:10:05 +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
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 ;
2017-06-12 19:02:28 +00:00
static wxFont gFont ;
2017-06-14 15:12:07 +00:00
// These are on separate lines to work around an MSVC 2013 compiler bug.
static std : : unique_ptr < LWSlider > gGainCaptured ;
static std : : unique_ptr < LWSlider > gPanCaptured ;
static std : : unique_ptr < LWSlider > gGain ;
static std : : unique_ptr < LWSlider > gPan ;
2017-02-22 02:05:35 +00:00
# ifdef EXPERIMENTAL_MIDI_OUT
2017-06-14 15:12:07 +00:00
static std : : unique_ptr < LWSlider > gVelocityCaptured ;
static std : : unique_ptr < LWSlider > gVelocity ;
2017-02-22 02:05:35 +00:00
# endif
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 ,
2016-08-20 17:58:56 +00:00
const std : : shared_ptr < TrackList > & tracks ,
2010-01-23 19:44:49 +00:00
ViewInfo * viewInfo ,
TrackPanelListener * listener ,
AdornedRulerPanel * ruler ) ;
virtual ~ TrackPanel ( ) ;
2011-11-25 20:40:26 +00:00
virtual void UpdatePrefs ( ) ;
2017-04-05 19:16:12 +00:00
virtual void ApplyUpdatedTheme ( ) ;
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
2017-02-25 21:16:42 +00:00
virtual void OnIdle ( wxIdleEvent & event ) ;
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
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 ( ) ;
2015-07-07 03:12:16 +00:00
virtual void CancelDragging ( ) ;
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 ScrollIntoView ( double pos ) ;
virtual void ScrollIntoView ( int x ) ;
virtual void OnTrackMenu ( Track * t = NULL ) ;
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 ) ;
2017-02-22 19:23:35 +00:00
virtual void UpdateTrackVRuler ( const Track * t ) ;
2011-11-25 20:40:26 +00:00
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 ( ) ;
2016-05-27 09:45:01 +00:00
2015-07-06 20:55:04 +00:00
virtual bool IsAudioActive ( ) ;
2011-11-25 20:40:26 +00:00
virtual bool IsUnsafe ( ) ;
2017-02-22 19:23:35 +00:00
virtual bool HandleLabelTrackClick ( LabelTrack * lTrack , const wxRect & rect , wxMouseEvent & event ) ;
2015-08-11 00:02:24 +00:00
virtual void HandleGlyphDragRelease ( LabelTrack * lTrack , wxMouseEvent & event ) ;
virtual void HandleTextDragRelease ( LabelTrack * lTrack , 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 ) ;
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 {
2017-05-11 18:53:03 +00:00
stretchNone = 0 , // false value!
2010-09-18 21:02:36 +00:00
stretchLeft ,
stretchCenter ,
stretchRight
} ;
2017-05-11 19:44:40 +00:00
struct StretchState {
StretchEnum mMode { stretchCenter } ; // remembers what to drag
2017-05-11 17:41:26 +00:00
using QuantizedTimeAndBeat = std : : pair < double , double > ;
2017-05-11 19:44:40 +00:00
bool mStretching { } ; // true between mouse down and mouse up
2017-05-12 21:41:57 +00:00
double mOrigT0 { } ;
double mOrigT1 { } ;
2017-05-11 17:41:26 +00:00
QuantizedTimeAndBeat mBeatCenter { 0 , 0 } ;
QuantizedTimeAndBeat mBeat0 { 0 , 0 } ;
QuantizedTimeAndBeat mBeat1 { 0 , 0 } ;
2017-05-11 19:44:40 +00:00
double mLeftBeats { } ; // how many beats from left to cursor
double mRightBeats { } ; // how many beats from cursor to right
} mStretchState ;
2017-05-11 18:53:03 +00:00
virtual StretchEnum HitTestStretch
( const Track * track , const wxRect & rect , const wxMouseEvent & event ,
StretchState * pState = nullptr ) ;
wxCursor * ChooseStretchCursor ( StretchEnum mode ) ;
static StretchEnum ChooseStretchMode
( const wxMouseEvent & event , const wxRect & rect , const ViewInfo & viewInfo ,
const NoteTrack * nt , StretchState * pState = nullptr ) ;
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-10-07 20:38:18 +00:00
size_t GetTrackCount ( ) ;
2016-10-03 12:28:25 +00:00
size_t GetSelectedTrackCount ( ) ;
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 ( ) ;
2016-10-18 14:50:42 +00:00
void MessageForScreenReader ( const wxString & message ) ;
2015-08-28 14:40:19 +00:00
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 ) ;
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 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
2017-02-22 19:23:35 +00:00
( Track * t , const wxMouseEvent & event , const wxRect & rect , bool bMultiToolMode , wxString & tip , const wxCursor * * ppCursor ) ;
2016-04-19 01:49:27 +00:00
virtual void SetCursorAndTipByTool ( int tool , const wxMouseEvent & event , wxString & tip ) ;
public :
2015-07-07 03:12:16 +00:00
virtual void HandleCursor ( wxMouseEvent & event ) ;
2016-04-19 01:49:27 +00:00
protected :
2015-07-06 21:20:48 +00:00
virtual void MaySetOnDemandTip ( Track * t , wxString & tip ) ;
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 ) ;
2016-06-26 16:03:45 +00:00
2011-11-25 20:40:26 +00:00
virtual void HandleRearrange ( wxMouseEvent & event ) ;
virtual void CalculateRearrangingThresholds ( wxMouseEvent & event ) ;
2010-09-12 05:11:43 +00:00
2015-07-07 03:12:16 +00:00
public :
2011-11-25 20:40:26 +00:00
virtual void MakeParentRedrawScrollbars ( ) ;
2014-06-03 20:30:19 +00:00
2015-07-07 03:12:16 +00:00
protected :
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
// Find track info by coordinate
2015-07-07 03:12:16 +00:00
enum class CellType { Label , Track , VRuler , Background } ;
2017-01-10 20:53:19 +00:00
struct FoundCell {
Track * pTrack ;
2015-07-07 03:12:16 +00:00
TrackPanelCell * pCell ;
2017-01-10 20:53:19 +00:00
CellType type ;
wxRect rect ;
} ;
virtual FoundCell FindCell ( int mouseX , int mouseY ) ;
2010-01-23 19:44:49 +00:00
2017-06-04 14:55:46 +00:00
// If label, rectangle includes track control panel only.
// If !label, rectangle includes all of that, and the vertical ruler, and
// the proper track area.
2017-06-12 20:54:12 +00:00
virtual wxRect FindTrackRect ( const 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 :
2016-08-20 17:58:56 +00:00
TrackList * GetTracks ( ) { return mTracks . get ( ) ; }
2015-04-19 21:12:06 +00:00
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 ,
2016-08-20 17:58:56 +00:00
const std : : shared_ptr < TrackList > & tracks ,
2011-11-25 20:40:26 +00:00
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 ) ;
2017-06-05 22:16:55 +00:00
virtual void DrawOutside ( Track * t , wxDC * dc , const wxRect & rec ) ;
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-07-07 03:12:16 +00:00
public :
// Set the object that performs catch-all event handling when the pointer
// is not in any track or ruler or control panel.
virtual void SetBackgroundCell
( const std : : shared_ptr < TrackPanelCell > & pCell ) ;
2013-05-30 23:14:25 +00:00
# ifdef EXPERIMENTAL_OUTPUT_DISPLAY
void UpdateVirtualStereoOrder ( ) ;
# endif
2017-06-13 12:05:17 +00:00
public :
2010-01-23 19:44:49 +00:00
// Accessors...
2017-06-13 12:05:17 +00:00
static bool HasSoloButton ( ) { return gSoloPref ! = wxT ( " None " ) ; }
2010-01-23 19:44:49 +00:00
2017-06-13 12:05:17 +00:00
protected :
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
2010-01-23 19:44:49 +00:00
TrackInfo mTrackInfo ;
2017-06-12 20:54:12 +00:00
public :
LWSlider * GainSlider ( const WaveTrack * wt ) ;
LWSlider * PanSlider ( const WaveTrack * wt ) ;
# ifdef EXPERIMENTAL_MIDI_OUT
LWSlider * VelocitySlider ( const NoteTrack * nt ) ;
# endif
TrackInfo * GetTrackInfo ( ) { return & mTrackInfo ; }
const TrackInfo * GetTrackInfo ( ) const { 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 ;
2016-08-20 17:58:56 +00:00
std : : shared_ptr < TrackList > mTracks ;
2010-01-23 19:44:49 +00:00
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 ;
2015-04-12 16:39:11 +00:00
SelectedRegion mInitialSelection ;
2017-06-11 14:37:58 +00:00
SelectionState & GetSelectionState ( ) ;
2017-06-11 13:59:23 +00:00
std : : unique_ptr < SelectionStateChanger > mSelectionStateChanger { } ;
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 ;
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 ;
2016-09-11 21:00:01 +00:00
const WaveTrack * mFreqSelTrack = NULL ;
2016-02-06 01:27:09 +00:00
std : : unique_ptr < SpectrumAnalyst > mFrequencySnapper ;
2014-11-29 16:53:28 +00:00
protected :
2014-10-18 14:19:38 +00:00
# endif
2010-01-23 19:44:49 +00:00
Track * mCapturedTrack ;
wxRect mCapturedRect ;
bool mRedrawAfterStop ;
wxMouseEvent mLastMouseEvent ;
int mMouseClickY ;
int mMouseMostRecentX ;
int mMouseMostRecentY ;
// 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 ;
2015-07-08 21:17:43 +00:00
2017-05-15 23:12:18 +00:00
wxInt64 mSnapLeft { - 1 } ;
wxInt64 mSnapRight { - 1 } ;
2010-01-23 19:44:49 +00:00
2017-05-15 23:12:18 +00:00
public :
2017-05-16 08:06:06 +00:00
wxInt64 GetSnapLeft ( ) const
{
return mSnapLeft ;
}
wxInt64 GetSnapRight ( ) const
{
return mSnapRight ;
}
2017-05-15 23:12:18 +00:00
protected :
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
2016-09-15 13:54:38 +00:00
( bool shiftDown , const WaveTrack * 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 ;
2017-06-12 17:23:00 +00:00
public :
2015-07-14 17:17:08 +00:00
// Old enumeration of click-and-drag states, which will shrink and disappear
// as UIHandle subclasses take over the repsonsibilities.
2010-01-23 19:44:49 +00:00
enum MouseCaptureEnum
{
IsUncaptured = 0 , // This is the normal state for the mouse
IsClosing ,
IsSelecting ,
IsAdjustingLabel ,
2015-08-11 00:02:24 +00:00
IsSelectingLabelText ,
2010-01-23 19:44:49 +00:00
IsResizing ,
IsResizingBetweenLinkedTracks ,
IsResizingBelowLinkedTracks ,
IsRearranging ,
IsMuting ,
IsSoloing ,
IsMinimizing ,
IsPopping ,
} ;
2017-06-12 17:23:00 +00:00
protected :
2010-01-23 19:44:49 +00:00
enum MouseCaptureEnum mMouseCapture ;
2015-07-18 20:07:46 +00:00
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
// 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 >
2015-07-08 06:48:21 +00:00
mArrowCursor , mSelectCursor ,
2015-07-08 21:17:43 +00:00
mResizeCursor , mEnvelopeCursor , // doubles as the center frequency cursor
2014-11-08 14:30:19 +00:00
// for spectral selection
2015-09-06 16:37:05 +00:00
mRearrangeCursor ,
2016-04-10 03:06:10 +00:00
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
2017-04-26 20:27:21 +00:00
# ifdef 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
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 :
2017-06-13 12:05:17 +00:00
static wxString gSoloPref ;
2010-01-23 19:44:49 +00:00
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-07-07 03:12:16 +00:00
protected :
Track * mpClickedTrack { } ;
// TrackPanel is not responsible for memory management:
UIHandle * mUIHandle { } ;
std : : shared_ptr < TrackPanelCell > mpBackground ;
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 ,
2017-06-05 00:13:48 +00:00
kTrackInfoBtnSize = 18 , // widely used dimension, usually height
kTrackInfoSliderHeight = 25 ,
2017-06-06 15:24:03 +00:00
kTrackInfoSliderWidth = 84 ,
2017-06-07 01:19:57 +00:00
kTrackInfoSliderAllowance = 5 ,
2017-06-07 01:40:58 +00:00
kTrackInfoSliderExtra = 5 ,
2016-04-27 22:39:47 +00:00
} ;
2017-03-28 18:29:40 +00:00
# ifdef USE_MIDI
enum : int {
kMidiCellWidth = ( kTrackInfoWidth / 4 ) - 2 ,
kMidiCellHeight = kTrackInfoBtnSize
} ;
# endif
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
# endif