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 int fontSize = 10;
41 gFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
42
43 mInitialized = true;
44 }
45};
46
48{
49 static Settings theSettings;
50 if ( !theSettings.mInitialized )
51 theSettings.UpdatePrefs();
52 return theSettings;
53}
54
55// return y value and height
56std::pair< int, int >
57TrackInfo::CalcItemY( const TCPLines &lines, unsigned iItem )
58{
59 int y = 0;
60 auto pLines = lines.begin();
61 while ( pLines != lines.end() &&
62 0 == (pLines->items & iItem) ) {
63 y += pLines->height + pLines->extraSpace;
64 ++pLines;
65 }
66 int height = 0;
67 if ( pLines != lines.end() )
68 height = pLines->height;
69 return { y, height };
70}
71
74{
75 dc->SetFont(settings().gFont);
76}
77
Extends Track with notions of mute and solo setting.
static Settings & settings()
Definition: TrackInfo.cpp:47
A listener notified of changes in preferences.
Definition: Prefs.h:652
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
Definition: TrackInfo.cpp:73
std::vector< TCPLine > TCPLines
Definition: TrackInfo.h:59
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
Definition: TrackInfo.cpp:57
bool mInitialized
Definition: TrackInfo.cpp:36
void UpdatePrefs() override
Definition: TrackInfo.cpp:38
wxFont gFont
Definition: TrackInfo.cpp:34