Move code to TrackInfo.cpp
This commit is contained in:
parent
015e3abfe5
commit
23b584b529
1191
src/TrackInfo.cpp
1191
src/TrackInfo.cpp
File diff suppressed because it is too large
Load Diff
104
src/TrackInfo.h
104
src/TrackInfo.h
|
@ -34,42 +34,7 @@ namespace TrackInfo
|
|||
|
||||
unsigned MinimumTrackHeight();
|
||||
|
||||
struct TCPLine {
|
||||
enum : unsigned {
|
||||
// The sequence is not significant, just keep bits distinct
|
||||
kItemBarButtons = 1 << 0,
|
||||
kItemStatusInfo1 = 1 << 1,
|
||||
kItemMute = 1 << 2,
|
||||
kItemSolo = 1 << 3,
|
||||
kItemGain = 1 << 4,
|
||||
kItemPan = 1 << 5,
|
||||
kItemVelocity = 1 << 6,
|
||||
kItemMidiControlsRect = 1 << 7,
|
||||
kItemMinimize = 1 << 8,
|
||||
kItemSyncLock = 1 << 9,
|
||||
kItemStatusInfo2 = 1 << 10,
|
||||
|
||||
kHighestBottomItem = kItemMinimize,
|
||||
};
|
||||
|
||||
using DrawFunction = void (*)(
|
||||
TrackPanelDrawingContext &context,
|
||||
const wxRect &rect,
|
||||
const Track *maybeNULL
|
||||
);
|
||||
|
||||
unsigned items; // a bitwise OR of values of the enum above
|
||||
int height;
|
||||
int extraSpace;
|
||||
DrawFunction drawFunction;
|
||||
};
|
||||
|
||||
using TCPLines = std::vector< TCPLine >;
|
||||
|
||||
// return y value and height
|
||||
std::pair< int, int > CalcItemY( const TCPLines &lines, unsigned iItem );
|
||||
|
||||
unsigned DefaultTrackHeight( const TCPLines &topLines );
|
||||
struct TCPLine;
|
||||
|
||||
void DrawItems
|
||||
( TrackPanelDrawingContext &context,
|
||||
|
@ -89,6 +54,32 @@ namespace TrackInfo
|
|||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void MidiControlsDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
template<typename TrackClass>
|
||||
void SliderDrawFunction
|
||||
( LWSlider *(*Selector)
|
||||
(const wxRect &sliderRect, const TrackClass *t, bool captured,
|
||||
wxWindow*),
|
||||
wxDC *dc, const wxRect &rect, const Track *pTrack,
|
||||
bool captured, bool highlight );
|
||||
|
||||
void PanSliderDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void GainSliderDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
void VelocitySliderDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
#endif
|
||||
|
||||
void MuteOrSoloDrawFunction
|
||||
( wxDC *dc, const wxRect &rect, const Track *pTrack, bool down,
|
||||
bool captured, bool solo, bool hit );
|
||||
|
@ -105,6 +96,17 @@ namespace TrackInfo
|
|||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void StatusDrawFunction
|
||||
( const wxString &string, wxDC *dc, const wxRect &rect );
|
||||
|
||||
void Status1DrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void Status2DrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void SetTrackInfoFont(wxDC *dc);
|
||||
|
||||
|
||||
|
@ -131,6 +133,14 @@ namespace TrackInfo
|
|||
|
||||
void GetSliderHorizontalBounds( const wxPoint &topleft, wxRect &dest );
|
||||
|
||||
void GetGainRect(const wxPoint & topLeft, wxRect &dest);
|
||||
|
||||
void GetPanRect(const wxPoint & topLeft, wxRect &dest);
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
void GetVelocityRect(const wxPoint & topLeft, wxRect &dest);
|
||||
#endif
|
||||
|
||||
void GetMinimizeHorizontalBounds( const wxRect &rect, wxRect &dest );
|
||||
void GetMinimizeRect(const wxRect & rect, wxRect &dest);
|
||||
|
||||
|
@ -140,9 +150,31 @@ namespace TrackInfo
|
|||
void GetSyncLockHorizontalBounds( const wxRect &rect, wxRect &dest );
|
||||
void GetSyncLockIconRect(const wxRect & rect, wxRect &dest);
|
||||
|
||||
#ifdef USE_MIDI
|
||||
void GetMidiControlsHorizontalBounds
|
||||
( const wxRect &rect, wxRect &dest );
|
||||
void GetMidiControlsRect(const wxRect & rect, wxRect &dest);
|
||||
#endif
|
||||
|
||||
bool HideTopItem( const wxRect &rect, const wxRect &subRect,
|
||||
int allowance = 0 );
|
||||
|
||||
unsigned DefaultNoteTrackHeight();
|
||||
unsigned DefaultWaveTrackHeight();
|
||||
|
||||
LWSlider * GainSlider
|
||||
(const wxRect &sliderRect, const WaveTrack *t, bool captured,
|
||||
wxWindow *pParent);
|
||||
LWSlider * PanSlider
|
||||
(const wxRect &sliderRect, const WaveTrack *t, bool captured,
|
||||
wxWindow *pParent);
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
LWSlider * VelocitySlider
|
||||
(const wxRect &sliderRect, const NoteTrack *t, bool captured,
|
||||
wxWindow *pParent);
|
||||
#endif
|
||||
|
||||
// Non-member, namespace function relying on TrackPanel to invoke it
|
||||
// when it handles preference update events
|
||||
void UpdatePrefs( wxWindow *pParent );
|
||||
|
|
1171
src/TrackPanel.cpp
1171
src/TrackPanel.cpp
File diff suppressed because it is too large
Load Diff
160
src/TrackPanel.h
160
src/TrackPanel.h
|
@ -60,160 +60,6 @@ enum {
|
|||
kTimerInterval = 50, // milliseconds
|
||||
};
|
||||
|
||||
|
||||
namespace TrackInfo
|
||||
{
|
||||
void ReCreateSliders();
|
||||
|
||||
unsigned MinimumTrackHeight();
|
||||
|
||||
struct TCPLine;
|
||||
|
||||
void DrawItems
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track &track );
|
||||
|
||||
void DrawItems
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack,
|
||||
const std::vector<TCPLine> &topLines,
|
||||
const std::vector<TCPLine> &bottomLines );
|
||||
|
||||
void CloseTitleDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void MinimizeSyncLockDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void MidiControlsDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
template<typename TrackClass>
|
||||
void SliderDrawFunction
|
||||
( LWSlider *(*Selector)
|
||||
(const wxRect &sliderRect, const TrackClass *t, bool captured,
|
||||
wxWindow*),
|
||||
wxDC *dc, const wxRect &rect, const Track *pTrack,
|
||||
bool captured, bool highlight );
|
||||
|
||||
void PanSliderDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void GainSliderDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
void VelocitySliderDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
#endif
|
||||
|
||||
void MuteOrSoloDrawFunction
|
||||
( wxDC *dc, const wxRect &rect, const Track *pTrack, bool down,
|
||||
bool captured, bool solo, bool hit );
|
||||
|
||||
void WideMuteDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void WideSoloDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void MuteAndSoloDrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void StatusDrawFunction
|
||||
( const wxString &string, wxDC *dc, const wxRect &rect );
|
||||
|
||||
void Status1DrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void Status2DrawFunction
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
void SetTrackInfoFont(wxDC *dc);
|
||||
|
||||
|
||||
void DrawBackground(
|
||||
wxDC * dc, const wxRect & rect, bool bSelected, const int vrul );
|
||||
// void DrawBordersWithin(
|
||||
// wxDC * dc, const wxRect & rect, const Track &track ) const;
|
||||
|
||||
void GetCloseBoxHorizontalBounds( const wxRect & rect, wxRect &dest );
|
||||
void GetCloseBoxRect(const wxRect & rect, wxRect &dest);
|
||||
|
||||
void GetTitleBarHorizontalBounds( const wxRect & rect, wxRect &dest );
|
||||
void GetTitleBarRect(const wxRect & rect, wxRect &dest);
|
||||
|
||||
void GetNarrowMuteHorizontalBounds
|
||||
( const wxRect & rect, wxRect &dest );
|
||||
void GetNarrowSoloHorizontalBounds
|
||||
( const wxRect & rect, wxRect &dest );
|
||||
void GetWideMuteSoloHorizontalBounds
|
||||
( const wxRect & rect, wxRect &dest );
|
||||
void GetMuteSoloRect
|
||||
(const wxRect & rect, wxRect &dest, bool solo, bool bHasSoloButton,
|
||||
const Track *pTrack);
|
||||
|
||||
void GetSliderHorizontalBounds( const wxPoint &topleft, wxRect &dest );
|
||||
|
||||
void GetGainRect(const wxPoint & topLeft, wxRect &dest);
|
||||
|
||||
void GetPanRect(const wxPoint & topLeft, wxRect &dest);
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
void GetVelocityRect(const wxPoint & topLeft, wxRect &dest);
|
||||
#endif
|
||||
|
||||
void GetMinimizeHorizontalBounds( const wxRect &rect, wxRect &dest );
|
||||
void GetMinimizeRect(const wxRect & rect, wxRect &dest);
|
||||
|
||||
void GetSelectButtonHorizontalBounds( const wxRect &rect, wxRect &dest );
|
||||
void GetSelectButtonRect(const wxRect & rect, wxRect &dest);
|
||||
|
||||
void GetSyncLockHorizontalBounds( const wxRect &rect, wxRect &dest );
|
||||
void GetSyncLockIconRect(const wxRect & rect, wxRect &dest);
|
||||
|
||||
#ifdef USE_MIDI
|
||||
void GetMidiControlsHorizontalBounds
|
||||
( const wxRect &rect, wxRect &dest );
|
||||
void GetMidiControlsRect(const wxRect & rect, wxRect &dest);
|
||||
#endif
|
||||
|
||||
bool HideTopItem( const wxRect &rect, const wxRect &subRect,
|
||||
int allowance = 0 );
|
||||
|
||||
unsigned DefaultNoteTrackHeight();
|
||||
unsigned DefaultWaveTrackHeight();
|
||||
|
||||
LWSlider * GainSlider
|
||||
(const wxRect &sliderRect, const WaveTrack *t, bool captured,
|
||||
wxWindow *pParent);
|
||||
LWSlider * PanSlider
|
||||
(const wxRect &sliderRect, const WaveTrack *t, bool captured,
|
||||
wxWindow *pParent);
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
LWSlider * VelocitySlider
|
||||
(const wxRect &sliderRect, const NoteTrack *t, bool captured,
|
||||
wxWindow *pParent);
|
||||
#endif
|
||||
|
||||
// Non-member, namespace function relying on TrackPanel to invoke it
|
||||
// when it handles preference update events
|
||||
void UpdatePrefs( wxWindow *pParent );
|
||||
};
|
||||
|
||||
|
||||
const int DragThreshold = 3;// Anything over 3 pixels is a drag, else a click.
|
||||
|
||||
class AUDACITY_DLL_API TrackPanel final
|
||||
|
@ -370,10 +216,6 @@ public:
|
|||
(const std::shared_ptr< TrackPanelCell > &pCell);
|
||||
std::shared_ptr< TrackPanelCell > GetBackgroundCell();
|
||||
|
||||
public:
|
||||
// Accessors...
|
||||
static bool HasSoloButton(){ return gSoloPref!=wxT("None");}
|
||||
|
||||
public:
|
||||
|
||||
LWSlider *GainSlider( const WaveTrack *wt );
|
||||
|
@ -432,8 +274,6 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
static wxString gSoloPref;
|
||||
|
||||
// The screenshot class needs to access internals
|
||||
friend class ScreenshotCommand;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "../ProjectHistory.h"
|
||||
#include "../ProjectSettings.h"
|
||||
#include "../ProjectWindow.h"
|
||||
#include "../TrackInfo.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../UndoManager.h"
|
||||
#include "../ViewInfo.h"
|
||||
|
|
|
@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../../../NoteTrack.h"
|
||||
#include "../../../../ProjectHistory.h"
|
||||
#include "../../../../RefreshCode.h"
|
||||
#include "../../../../TrackInfo.h"
|
||||
#include "../../../../TrackPanel.h"
|
||||
|
||||
NoteTrackButtonHandle::NoteTrackButtonHandle
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
#include "../../../../ProjectHistory.h"
|
||||
#include "../../../../RefreshCode.h"
|
||||
#include "../../../../TrackPanel.h" // for TrackInfo
|
||||
#include "../../../../TrackInfo.h"
|
||||
#include "../../../../TrackPanel.h"
|
||||
#include "../../../../UndoManager.h"
|
||||
#include "../../../../NoteTrack.h"
|
||||
#include "../../../../ViewInfo.h"
|
||||
|
|
|
@ -23,7 +23,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../../../TrackPanelMouseEvent.h"
|
||||
#include "../../../ui/SelectHandle.h"
|
||||
#include "StretchHandle.h"
|
||||
#include "../../../../TrackPanel.h"
|
||||
#include "../../../../TrackInfo.h"
|
||||
|
||||
NoteTrackView::NoteTrackView( const std::shared_ptr<Track> &pTrack )
|
||||
: CommonTrackView{ pTrack }
|
||||
|
|
|
@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../../ProjectSettings.h"
|
||||
#include "../../../RefreshCode.h"
|
||||
#include "../../../Track.h"
|
||||
#include "../../../TrackInfo.h"
|
||||
#include "../../../TrackPanel.h"
|
||||
#include "../../../TrackPanelMouseEvent.h"
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
|
||||
#include "../../../../ProjectHistory.h"
|
||||
#include "../../../../RefreshCode.h"
|
||||
#include "../../../../TrackInfo.h"
|
||||
#include "../../../../TrackPanel.h"
|
||||
#include "../../../../UndoManager.h"
|
||||
#include "../../../../WaveTrack.h"
|
||||
|
|
|
@ -20,7 +20,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "WaveTrackVRulerControls.h"
|
||||
#include "../../../../HitTestResult.h"
|
||||
#include "../../../../prefs/SpectrogramSettings.h"
|
||||
#include "../../../../TrackPanel.h"
|
||||
#include "../../../../TrackInfo.h"
|
||||
#include "../../../../TrackPanelMouseEvent.h"
|
||||
|
||||
#include "CutlineHandle.h"
|
||||
|
|
|
@ -16,7 +16,7 @@ Paul Licameli split from TrackControls.cpp
|
|||
#include "../../Menus.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../ProjectHistory.h"
|
||||
#include "../../TrackPanel.h" // for TrackInfo
|
||||
#include "../../TrackInfo.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
#include <wx/textdlg.h>
|
||||
#include "../../commands/CommandType.h"
|
||||
|
|
|
@ -13,11 +13,11 @@ Paul Licameli split from class TrackView
|
|||
#include "BackgroundCell.h"
|
||||
#include "TimeShiftHandle.h"
|
||||
#include "TrackControls.h"
|
||||
#include "../../TrackPanel.h" // for TrackInfo
|
||||
#include "ZoomHandle.h"
|
||||
#include "../ui/SelectHandle.h"
|
||||
#include "../../ProjectSettings.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackInfo.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
|
||||
std::vector<UIHandlePtr> CommonTrackView::HitTest
|
||||
|
|
|
@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../ProjectHistory.h"
|
||||
#include "../../RefreshCode.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackInfo.h"
|
||||
#include "../../TrackPanel.h"
|
||||
#include "../../commands/CommandManager.h"
|
||||
#include "../../tracks/ui/TrackView.h"
|
||||
|
|
Loading…
Reference in New Issue