Audacity 3.2.0
TrackInfo.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5TrackInfo.cpp
6
7Paul Licameli split from TrackPanel.cpp
8
9
10**********************************************************************/
11
12
13#include "TrackInfo.h"
14
15#include <wx/app.h>
16#include <wx/dc.h>
17#include <wx/font.h>
18#include <wx/window.h>
19
20#include "AColor.h"
21#include "AllThemeResources.h"
22#include "PlayableTrack.h"
23#include "Prefs.h"
24#include "Project.h"
25#include "SyncLock.h"
26#include "Theme.h"
28#include "UIHandle.h"
29#include "ViewInfo.h"
31
32// Subscribe to preference changes to update static variables
34 wxFont gFont;
35
36 bool mInitialized{ false };
37
38 void UpdatePrefs() override
39 {
40#if defined __WXMAC__
41 int fontSize = 12;
42#else
43 int fontSize = 10;
44#endif
45 gFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
46
47 mInitialized = true;
48 }
49};
50
52{
53 static Settings theSettings;
54 if ( !theSettings.mInitialized )
55 theSettings.UpdatePrefs();
56 return theSettings;
57}
58
59// return y value and height
60std::pair< int, int >
61TrackInfo::CalcItemY( const TCPLines &lines, unsigned iItem )
62{
63 int y = 0;
64 auto pLines = lines.begin();
65 while ( pLines != lines.end() &&
66 0 == (pLines->items & iItem) ) {
67 y += pLines->height + pLines->extraSpace;
68 ++pLines;
69 }
70 int height = 0;
71 if ( pLines != lines.end() )
72 height = pLines->height;
73 return { y, height };
74}
75
78{
79 dc->SetFont(settings().gFont);
80}
81
Extends Track with notions of mute and solo setting.
static Settings & settings()
Definition: TrackInfo.cpp:51
A listener notified of changes in preferences.
Definition: Prefs.h:652
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
Definition: TrackInfo.cpp:77
std::vector< TCPLine > TCPLines
Definition: TrackInfo.h:58
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
Definition: TrackInfo.cpp:61
bool mInitialized
Definition: TrackInfo.cpp:36
void UpdatePrefs() override
Definition: TrackInfo.cpp:38
wxFont gFont
Definition: TrackInfo.cpp:34