Audacity  3.0.3
TrackInfo.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 TrackInfo.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_TRACK_INFO__
12 #define __AUDACITY_TRACK_INFO__
13 
14 
15 
16 
17 #include <vector>
18 
19 class wxDC;
20 class wxPoint;
21 class wxRect;
22 class wxWindow;
23 
24 class ButtonHandle;
25 class LWSlider;
26 class Track;
28 
29 static const int TitleSoloBorderOverlap = 1;
30 
31 namespace TrackInfo
32 {
33  AUDACITY_DLL_API
34  unsigned MinimumTrackHeight();
35 
36  struct TCPLine {
37  enum : unsigned {
38  // The sequence is not significant, just keep bits distinct
39  kItemBarButtons = 1 << 0,
40  kItemStatusInfo1 = 1 << 1,
41  kItemMute = 1 << 2,
42  kItemSolo = 1 << 3,
43  kItemGain = 1 << 4,
44  kItemPan = 1 << 5,
45  kItemVelocity = 1 << 6,
47  kItemMinimize = 1 << 8,
48  kItemSyncLock = 1 << 9,
49  kItemStatusInfo2 = 1 << 10,
50 
52  };
53 
54  using DrawFunction = void (*)(
55  TrackPanelDrawingContext &context,
56  const wxRect &rect,
57  const Track *maybeNULL
58  );
59 
60  unsigned items; // a bitwise OR of values of the enum above
61  int height;
64  };
65 
66  using TCPLines = std::vector< TCPLine >;
67 
68  // return y value and height
69  AUDACITY_DLL_API
70  std::pair< int, int > CalcItemY( const TCPLines &lines, unsigned iItem );
71 
72  AUDACITY_DLL_API
73  unsigned DefaultTrackHeight( const TCPLines &topLines );
74 
75  AUDACITY_DLL_API
76  void DrawItems
77  ( TrackPanelDrawingContext &context,
78  const wxRect &rect, const Track &track );
79 
80  AUDACITY_DLL_API
81  void DrawItems
82  ( TrackPanelDrawingContext &context,
83  const wxRect &rect, const Track *pTrack,
84  const std::vector<TCPLine> &topLines,
85  const std::vector<TCPLine> &bottomLines );
86 
87  AUDACITY_DLL_API
88  void DrawCloseButton(
89  TrackPanelDrawingContext &context, const wxRect &bev,
90  const Track *pTrack, ButtonHandle *target );
91 
92  AUDACITY_DLL_API
94  ( TrackPanelDrawingContext &context,
95  const wxRect &rect, const Track *pTrack );
96 
97  AUDACITY_DLL_API
99  ( TrackPanelDrawingContext &context,
100  const wxRect &rect, const Track *pTrack );
101 
102  AUDACITY_DLL_API
103  void SetTrackInfoFont(wxDC *dc);
104 
105 
106  AUDACITY_DLL_API
107  void GetCloseBoxHorizontalBounds( const wxRect & rect, wxRect &dest );
108  AUDACITY_DLL_API
109  void GetCloseBoxRect(const wxRect & rect, wxRect &dest);
110 
111  AUDACITY_DLL_API
112  void GetTitleBarHorizontalBounds( const wxRect & rect, wxRect &dest );
113  AUDACITY_DLL_API
114  void GetTitleBarRect(const wxRect & rect, wxRect &dest);
115 
116  AUDACITY_DLL_API
117  void GetSliderHorizontalBounds( const wxPoint &topleft, wxRect &dest );
118 
119  AUDACITY_DLL_API
120  void GetMinimizeHorizontalBounds( const wxRect &rect, wxRect &dest );
121  AUDACITY_DLL_API
122  void GetMinimizeRect(const wxRect & rect, wxRect &dest);
123 
124  AUDACITY_DLL_API
125  void GetSelectButtonHorizontalBounds( const wxRect &rect, wxRect &dest );
126  AUDACITY_DLL_API
127  void GetSelectButtonRect(const wxRect & rect, wxRect &dest);
128 
129  AUDACITY_DLL_API
130  void GetSyncLockHorizontalBounds( const wxRect &rect, wxRect &dest );
131  AUDACITY_DLL_API
132  void GetSyncLockIconRect(const wxRect & rect, wxRect &dest);
133 
134  AUDACITY_DLL_API
135  bool HideTopItem( const wxRect &rect, const wxRect &subRect,
136  int allowance = 0 );
137 
138  // Non-member, namespace function relying on TrackPanel to invoke it
139  // when it handles preference update events
140  AUDACITY_DLL_API
141  void UpdatePrefs( wxWindow *pParent );
142 
143  AUDACITY_DLL_API
144  bool HasSoloButton();
145 };
146 
147 #endif
TrackInfo::TCPLine::kItemMidiControlsRect
@ kItemMidiControlsRect
Definition: TrackInfo.h:46
TrackInfo::GetSyncLockIconRect
AUDACITY_DLL_API void GetSyncLockIconRect(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:548
TitleSoloBorderOverlap
static const int TitleSoloBorderOverlap
Definition: TrackInfo.h:29
TrackInfo::CloseTitleDrawFunction
AUDACITY_DLL_API void CloseTitleDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
Definition: TrackInfo.cpp:300
TrackInfo::TCPLine::kItemBarButtons
@ kItemBarButtons
Definition: TrackInfo.h:39
TrackInfo::GetCloseBoxRect
AUDACITY_DLL_API void GetCloseBoxRect(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:462
TrackInfo::MinimumTrackHeight
AUDACITY_DLL_API unsigned MinimumTrackHeight()
Definition: TrackInfo.cpp:195
TrackInfo::TCPLine::items
unsigned items
Definition: TrackInfo.h:60
TrackPanelDrawingContext
Definition: TrackPanelDrawingContext.h:22
TrackInfo::TCPLine::kItemGain
@ kItemGain
Definition: TrackInfo.h:43
TrackInfo::CalcItemY
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
Definition: TrackInfo.cpp:145
TrackInfo::TCPLine::extraSpace
int extraSpace
Definition: TrackInfo.h:62
TrackInfo::UpdatePrefs
AUDACITY_DLL_API void UpdatePrefs(wxWindow *pParent)
TrackInfo::TCPLine::kItemVelocity
@ kItemVelocity
Definition: TrackInfo.h:45
TrackInfo::TCPLine::kItemMinimize
@ kItemMinimize
Definition: TrackInfo.h:47
TrackInfo::DrawItems
AUDACITY_DLL_API void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)
Definition: TrackInfo.cpp:217
TrackInfo::GetCloseBoxHorizontalBounds
AUDACITY_DLL_API void GetCloseBoxHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:456
TrackInfo::TCPLine::kItemMute
@ kItemMute
Definition: TrackInfo.h:41
TrackInfo::GetTitleBarRect
AUDACITY_DLL_API void GetTitleBarRect(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:479
TrackInfo::GetTitleBarHorizontalBounds
AUDACITY_DLL_API void GetTitleBarHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:470
TrackInfo::SetTrackInfoFont
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
Definition: TrackInfo.cpp:558
TrackInfo::TCPLine::kItemSolo
@ kItemSolo
Definition: TrackInfo.h:42
TrackInfo::TCPLine::kItemStatusInfo2
@ kItemStatusInfo2
Definition: TrackInfo.h:49
ButtonHandle
A UIHandle for a TrackPanel button, such as the Mute and Solo buttons.
Definition: ButtonHandle.h:26
LWSlider
Lightweight version of ASlider. In other words it does not have a window permanently associated with ...
Definition: ASlider.h:62
TrackInfo::DrawCloseButton
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Track *pTrack, ButtonHandle *target)
Definition: TrackInfo.cpp:266
TrackInfo::TCPLines
std::vector< TCPLine > TCPLines
Definition: TrackInfo.h:66
TrackInfo::GetSelectButtonRect
AUDACITY_DLL_API void GetSelectButtonRect(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:533
TrackInfo::TCPLine::kItemStatusInfo1
@ kItemStatusInfo1
Definition: TrackInfo.h:40
TrackInfo::HasSoloButton
AUDACITY_DLL_API bool HasSoloButton()
Definition: TrackInfo.cpp:94
TrackInfo::TCPLine::drawFunction
DrawFunction drawFunction
Definition: TrackInfo.h:63
TrackInfo::TCPLine::kItemPan
@ kItemPan
Definition: TrackInfo.h:44
TrackInfo::MinimizeSyncLockDrawFunction
AUDACITY_DLL_API void MinimizeSyncLockDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
Definition: TrackInfo.cpp:374
TrackInfo
Functions for drawing the track control panel, which is shown to the side of a track It has the menus...
TrackInfo::HideTopItem
AUDACITY_DLL_API bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
Definition: TrackInfo.cpp:207
TrackInfo::GetMinimizeHorizontalBounds
AUDACITY_DLL_API void GetMinimizeHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:493
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
TrackInfo::DefaultTrackHeight
AUDACITY_DLL_API unsigned DefaultTrackHeight(const TCPLines &topLines)
Definition: TrackInfo.cpp:565
TrackInfo::GetSyncLockHorizontalBounds
AUDACITY_DLL_API void GetSyncLockHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:542
TrackInfo::TCPLine::DrawFunction
void(*)(TrackPanelDrawingContext &context, const wxRect &rect, const Track *maybeNULL) DrawFunction
Definition: TrackInfo.h:58
TrackInfo::TCPLine
Definition: TrackInfo.h:36
TrackInfo::TCPLine::height
int height
Definition: TrackInfo.h:61
TrackInfo::GetMinimizeRect
AUDACITY_DLL_API void GetMinimizeRect(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:507
TrackInfo::TCPLine::kHighestBottomItem
@ kHighestBottomItem
Definition: TrackInfo.h:51
TrackInfo::GetSliderHorizontalBounds
AUDACITY_DLL_API void GetSliderHorizontalBounds(const wxPoint &topleft, wxRect &dest)
Definition: TrackInfo.cpp:487
TrackInfo::TCPLine::kItemSyncLock
@ kItemSyncLock
Definition: TrackInfo.h:48
TrackInfo::GetSelectButtonHorizontalBounds
AUDACITY_DLL_API void GetSelectButtonHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:516