-
Notifications
You must be signed in to change notification settings - Fork 0
/
GuitarView.h
249 lines (196 loc) · 5.78 KB
/
GuitarView.h
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
///////////////////////////////////////////////////////////////////
#include "GuitarModel.h"
#include <gtkmm.h>
#include <gtk/gtk.h>
#include <iostream> // For std::cout
///////////////////////////////////////////////////////////////////
extern const uint32_t g_num_frets;
extern const uint32_t g_num_strings;
///////////////////////////////////////////////////////////////////
class GuitarView;
///////////////////////////////////////////////////////////////////
class PhysicalView
{
public:
PhysicalView(GuitarView & parent)
: m_parent(parent)
{
}
void init(Glib::RefPtr<Gtk::Builder> & builder, Glib::RefPtr<Gtk::Application> & app);
void phyApplyButtonClicked();
public:
GuitarView & m_parent;
Gtk::Button* m_phyApplyButton;
Gtk::TreeView* m_phyTreeView;
Glib::RefPtr<Gtk::ListStore> m_phyModel;
};
///////////////////////////////////////////////////////////////////
class ChordView
{
public:
ChordView(GuitarView & parent)
: m_parent(parent)
{
}
void init(Glib::RefPtr<Gtk::Builder> & builder, Glib::RefPtr<Gtk::Application> & app);
void chordsApplyButtonClicked();
public:
GuitarView & m_parent;
Gtk::Button* m_chordsApplyButton;
Gtk::ComboBoxText* m_chordsNoteCombo;
Gtk::TreeView* m_chordsTreeView;
Glib::RefPtr<Gtk::ListStore> m_chordsModel;
};
///////////////////////////////////////////////////////////////////
class ScaleView
{
public:
ScaleView(GuitarView & parent)
: m_parent(parent)
{
}
void init(Glib::RefPtr<Gtk::Builder> & builder, Glib::RefPtr<Gtk::Application> & app);
void scalesApplyButtonClicked();
public:
GuitarView & m_parent;
Gtk::Button* m_scalesApplyButton;
Gtk::ComboBoxText* m_scalesNoteCombo;
Gtk::TreeView* m_scalesTreeView;
Glib::RefPtr<Gtk::ListStore> m_scalesModel;
};
///////////////////////////////////////////////////////////////////
class TuningView
{
public:
TuningView(GuitarView & parent)
: m_parent(parent)
{
}
void init(Glib::RefPtr<Gtk::Builder> & builder, Glib::RefPtr<Gtk::Application> & app);
public:
GuitarView & m_parent;
Gtk::ComboBoxText* m_tuningSelect;
Gtk::ComboBoxText* m_tuningNumString;
Gtk::TreeView* m_tuningTreeView;
Glib::RefPtr<Gtk::ListStore> m_tuningModel;
};
///////////////////////////////////////////////////////////////////
class Search1View
{
public:
Search1View(GuitarView & parent)
: m_parent(parent)
{
}
void init(Glib::RefPtr<Gtk::Builder> & builder, Glib::RefPtr<Gtk::Application> & app);
void search1SearchButtonClicked();
void search1ApplyButtonClicked();
public:
GuitarView & m_parent;
Gtk::Button* m_search1SearchButton;
Gtk::Button* m_search1ApplyButton;
Gtk::CheckButton* m_search1_2CheckButton;
Gtk::CheckButton* m_search1_3CheckButton;
Gtk::CheckButton* m_search1_4CheckButton;
Gtk::CheckButton* m_search1_5CheckButton;
Gtk::CheckButton* m_search1_6CheckButton;
Gtk::CheckButton* m_search1_7CheckButton;
Gtk::CheckButton* m_search1_8CheckButton;
Gtk::CheckButton* m_search1_phyCheckButton;
Gtk::CheckButton* m_search1_chordsCheckButton;
Gtk::CheckButton* m_search1_scalesCheckButton;
Gtk::CheckButton* m_search1_inexactCheckButton;
Gtk::ComboBoxText* m_search1_inexactCombo;
Gtk::TreeView* m_search1TreeView;
Glib::RefPtr<Gtk::ListStore> m_search1Model;
};
///////////////////////////////////////////////////////////////////
class NeckView
{
public:
NeckView(GuitarView & parent)
: m_parent(parent)
{
}
void init(Glib::RefPtr<Gtk::Builder> & builder, Glib::RefPtr<Gtk::Application> & app);
void on_draw(const Cairo::RefPtr<Cairo::Context>& cr, int width, int height);
void drawingAreaClicked(int n_press, double x, double y);
void drawingAreaMotion(double x, double y);
void neckPopoverActivate(const Glib::VariantBase& parameter);
uint32_t getString(double y); /* strings 0 -> 5 */
uint32_t getFret(double x); /* frets 0 -> 24 */
public:
GuitarView & m_parent;
Gtk::DrawingArea* m_drawingArea;
Gtk::Label* m_noteLabel;
Gtk::PopoverMenu* m_neckPopover;
int m_width;
int m_height;
Glib::RefPtr<Gtk::GestureClick> m_gcController;
Glib::RefPtr<Gtk::EventControllerMotion> m_mtController;
};
///////////////////////////////////////////////////////////////////
class MainButtons
{
public:
MainButtons(GuitarView & parent)
: m_parent(parent)
{
}
void init(Glib::RefPtr<Gtk::Builder> & builder, Glib::RefPtr<Gtk::Application> & app);
void clearButtonClicked();
void expandButtonClicked();
void mr1ButtonClicked();
void mr2ButtonClicked();
void mr3ButtonClicked();
void mr4ButtonClicked();
void ms1ButtonClicked();
void ms2ButtonClicked();
void ms3ButtonClicked();
void ms4ButtonClicked();
public:
GuitarView & m_parent;
Gtk::Button* m_clearButton;
Gtk::Button* m_expandButton;
Gtk::Button* m_mr1Button;
Gtk::Button* m_mr2Button;
Gtk::Button* m_mr3Button;
Gtk::Button* m_mr4Button;
Gtk::Button* m_ms1Button;
Gtk::Button* m_ms2Button;
Gtk::Button* m_ms3Button;
Gtk::Button* m_ms4Button;
GuitarModel::MarkerList m_memory1;
GuitarModel::MarkerList m_memory2;
GuitarModel::MarkerList m_memory3;
GuitarModel::MarkerList m_memory4;
};
///////////////////////////////////////////////////////////////////
class GuitarView
{
public:
GuitarView()
: m_mainButtons(*this)
, m_physicalView(*this)
, m_chordView(*this)
, m_scaleView(*this)
, m_tuningView(*this)
, m_search1View(*this)
, m_neckView(*this)
{
}
void init(Glib::RefPtr<Gtk::Builder> & builder, Glib::RefPtr<Gtk::Application> & app);
void shutdown();
public:
Glib::RefPtr<Gtk::Builder> m_builder;
Glib::RefPtr<Gtk::Application> m_app;
MainButtons m_mainButtons;
PhysicalView m_physicalView;
ChordView m_chordView;
ScaleView m_scaleView;
TuningView m_tuningView;
Search1View m_search1View;
NeckView m_neckView;
GuitarModel m_guitarModel;
};
///////////////////////////////////////////////////////////////////