1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
/*
* Mainbar.h
* ---------
* Purpose: Implementation of OpenMPT's window toolbar.
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "openmpt/all/BuildSettings.hpp"
#include "UpdateToolTip.h"
OPENMPT_NAMESPACE_BEGIN
class CStereoVU: public CStatic
{
protected:
uint8 numChannels;
uint32 vuMeter[4];
DWORD lastVuUpdateTime;
int lastV[4];
bool lastClip[4];
bool horizontal;
bool allowRightToLeft;
public:
CStereoVU() { numChannels = 2; MemsetZero(vuMeter); lastVuUpdateTime = timeGetTime(); horizontal = true; MemsetZero(lastV); MemsetZero(lastClip); allowRightToLeft = false; }
void SetVuMeter(uint8 validChannels, const uint32 channels[4], bool force=false);
void SetOrientation(bool h) { horizontal = h; }
protected:
void DrawVuMeters(CDC &dc, bool redraw=false);
void DrawVuMeter(CDC &dc, const CRect &rect, int index, bool redraw=false);
protected:
afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT, CPoint);
DECLARE_MESSAGE_MAP();
};
#define MIN_BASEOCTAVE 0
#define MAX_BASEOCTAVE 8
class CSoundFile;
class CModDoc;
class CModTree;
class CMainFrame;
class CToolBarEx: public CToolBar
{
protected:
bool m_bVertical = false, m_bFlatButtons = false;
public:
CToolBarEx() {}
~CToolBarEx() override {}
public:
BOOL EnableControl(CWnd &wnd, UINT nIndex, UINT nHeight=0);
void ChangeCtrlStyle(LONG lStyle, BOOL bSetStyle);
void EnableFlatButtons(BOOL bFlat);
public:
//{{AFX_VIRTUAL(CToolBarEx)
CSize CalcDynamicLayout(int nLength, DWORD dwMode) override;
virtual void SetHorizontal();
virtual void SetVertical();
//}}AFX_VIRTUAL
};
class CMainToolBar: public CToolBarEx
{
protected:
UpdateToolTip m_tooltip;
CImageListEx m_ImageList, m_ImageListDisabled;
CStatic m_EditTempo, m_EditSpeed, m_EditOctave, m_EditRowsPerBeat;
CStatic m_StaticTempo, m_StaticSpeed, m_StaticRowsPerBeat;
CSpinButtonCtrl m_SpinTempo, m_SpinSpeed, m_SpinOctave, m_SpinRowsPerBeat;
int nCurrentSpeed, nCurrentOctave, nCurrentRowsPerBeat;
TEMPO nCurrentTempo;
public:
CStereoVU m_VuMeter;
public:
CMainToolBar() {}
~CMainToolBar() override {}
protected:
void SetRowsPerBeat(ROWINDEX nNewRPB);
public:
//{{AFX_VIRTUAL(CMainToolBar)
void SetHorizontal() override;
void SetVertical() override;
//}}AFX_VIRTUAL
public:
#if MPT_COMPILER_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif // MPT_COMPILER_CLANG
BOOL Create(CWnd *parent);
#if MPT_COMPILER_CLANG
#pragma clang diagnostic pop
#endif // MPT_COMPILER_CLANG
void Init(CMainFrame *);
UINT GetBaseOctave() const;
BOOL SetBaseOctave(UINT nOctave);
BOOL SetCurrentSong(CSoundFile *pModDoc);
bool ShowUpdateInfo(const CString &newVersion, const CString &infoURL, bool showHighLight);
void RemoveUpdateInfo();
protected:
//{{AFX_MSG(CMainToolBar)
afx_msg void OnVScroll(UINT, UINT, CScrollBar *);
afx_msg void OnTbnDropDownToolBar(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg BOOL OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSelectMIDIDevice(UINT id);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
class CModTreeBar: public CDialogBar
{
protected:
enum Status
{
MTB_VERTICAL = 0x01,
MTB_CAPTURE = 0x02,
MTB_DRAGGING = 0x04,
MTB_TRACKER = 0x08,
};
DWORD m_dwStatus = 0; // MTB_XXXX
UINT m_nCursorDrag = 0;
CPoint ptDragging;
UINT m_cxOriginal = 0, m_cyOriginal = 0, m_nTrackPos = 0;
UINT m_nTreeSplitRatio = 0;
public:
CModTree *m_pModTree = nullptr, *m_pModTreeData = nullptr;
CModTreeBar();
~CModTreeBar() override;
public:
void Init();
void RecalcLayout();
void DoMouseMove(CPoint point);
void DoLButtonDown(CPoint point);
void DoLButtonUp();
void CancelTracking();
void OnInvertTracker(UINT x);
void RefreshDlsBanks();
void RefreshMidiLibrary();
void OnOptionsChanged();
void OnDocumentCreated(CModDoc *pModDoc);
void OnDocumentClosed(CModDoc *pModDoc);
void OnUpdate(CModDoc *pModDoc, UpdateHint hint, CObject *pHint = nullptr);
void UpdatePlayPos(CModDoc *pModDoc, Notification *pNotify);
HWND GetModTreeHWND(); //rewbs.customKeys
LRESULT SendMessageToModTree(UINT cmdID, WPARAM wParam, LPARAM lParam);
bool SetTreeSoundfile(FileReader &file);
protected:
//{{AFX_VIRTUAL(CModTreeBar)
CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz) override;
//}}AFX_VIRTUAL
protected:
//{{AFX_MSG(CModTreeBar)
afx_msg void OnNcPaint();
afx_msg LRESULT OnNcHitTest(CPoint point);
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnNcMouseMove(UINT nHitTest, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnNcLButtonDown(UINT, CPoint);
afx_msg void OnLButtonDown(UINT, CPoint);
afx_msg void OnNcLButtonUp(UINT, CPoint);
afx_msg void OnLButtonUp(UINT, CPoint);
afx_msg void OnNcRButtonDown(UINT, CPoint) { CancelTracking(); }
afx_msg void OnRButtonDown(UINT, CPoint) { CancelTracking(); }
afx_msg LRESULT OnInitDialog(WPARAM, LPARAM);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
OPENMPT_NAMESPACE_END
|