first compiling and theoretically correct version of Push2 canvas display.
[ardour.git] / libs / surfaces / push2 / scale.cc
1 /*
2   Copyright (C) 2016 Paul Davis
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU General Public License for more details.
13
14   You should have received a copy of the GNU General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 #include <cairomm/region.h>
20 #include <pangomm/layout.h>
21
22 #include "pbd/compose.h"
23 #include "pbd/convert.h"
24 #include "pbd/debug.h"
25 #include "pbd/failed_constructor.h"
26 #include "pbd/file_utils.h"
27 #include "pbd/search_path.h"
28 #include "pbd/enumwriter.h"
29
30 #include "midi++/parser.h"
31 #include "timecode/time.h"
32 #include "timecode/bbt_time.h"
33
34 #include "ardour/async_midi_port.h"
35 #include "ardour/audioengine.h"
36 #include "ardour/debug.h"
37 #include "ardour/filesystem_paths.h"
38 #include "ardour/midiport_manager.h"
39 #include "ardour/midi_track.h"
40 #include "ardour/midi_port.h"
41 #include "ardour/session.h"
42 #include "ardour/tempo.h"
43
44 #include "menu.h"
45 #include "push2.h"
46 #include "scale.h"
47
48 #include "pbd/i18n.h"
49
50 using namespace ARDOUR;
51 using namespace std;
52 using namespace PBD;
53 using namespace Glib;
54 using namespace ArdourSurface;
55 using namespace ArdourCanvas;
56
57 ScaleLayout::ScaleLayout (Push2& p, Session& s)
58         : Push2Layout (p, s)
59 {
60         build_scale_menu ();
61 }
62
63 ScaleLayout::~ScaleLayout ()
64 {
65 }
66
67 void
68 ScaleLayout::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
69 {
70         context->set_source_rgb (0.764, 0.882, 0.882);
71         context->rectangle (0, 0, 960, 160);
72         context->fill ();
73
74         scale_menu->render (area, context);
75 }
76
77 void
78 ScaleLayout::button_upper (uint32_t n)
79 {
80 }
81
82 void
83 ScaleLayout::button_lower (uint32_t n)
84 {
85 }
86
87 void
88 ScaleLayout::strip_vpot (int n, int delta)
89 {
90         if (n == 0) {
91                 scale_menu->step_active (n, delta);
92                 return;
93         }
94 }
95
96 void
97 ScaleLayout::strip_vpot_touch (int, bool)
98 {
99 }
100
101 void
102 ScaleLayout::build_scale_menu ()
103 {
104         vector<string> v;
105
106         scale_menu = new Push2Menu (this);
107
108         v.push_back ("Dorian");
109         v.push_back ("IonianMajor");
110         v.push_back ("Minor");
111         v.push_back ("HarmonicMinor");
112         v.push_back ("MelodicMinorAscending");
113         v.push_back ("MelodicMinorDescending");
114         v.push_back ("Phrygian");
115         v.push_back ("Lydian");
116         v.push_back ("Mixolydian");
117         v.push_back ("Aeolian");
118         v.push_back ("Locrian");
119         v.push_back ("PentatonicMajor");
120         v.push_back ("PentatonicMinor");
121         v.push_back ("Chromatic");
122         v.push_back ("BluesScale");
123         v.push_back ("NeapolitanMinor");
124         v.push_back ("NeapolitanMajor");
125         v.push_back ("Oriental");
126         v.push_back ("DoubleHarmonic");
127         v.push_back ("Enigmatic");
128         v.push_back ("Hirajoshi");
129         v.push_back ("HungarianMinor");
130         v.push_back ("HungarianMajor");
131         v.push_back ("Kumoi");
132         v.push_back ("Iwato");
133         v.push_back ("Hindu");
134         v.push_back ("Spanish8Tone");
135         v.push_back ("Pelog");
136         v.push_back ("HungarianGypsy");
137         v.push_back ("Overtone");
138         v.push_back ("LeadingWholeTone");
139         v.push_back ("Arabian");
140         v.push_back ("Balinese");
141         v.push_back ("Gypsy");
142         v.push_back ("Mohammedan");
143         v.push_back ("Javanese");
144         v.push_back ("Persian");
145         v.push_back ("Algeria");
146
147         scale_menu->fill_column (0, v);
148
149         v.clear ();
150 }