1 |
/* |
/* |
2 |
* Copyright (C) 2006, 2007 Andreas Persson |
* Copyright (C) 2006-2013 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
17 |
* 02110-1301 USA. |
* 02110-1301 USA. |
18 |
*/ |
*/ |
19 |
|
|
20 |
|
#include <cstring> |
21 |
|
|
22 |
#include "paramedit.h" |
#include "paramedit.h" |
23 |
|
|
24 |
|
#include "global.h" |
25 |
|
#include "compat.h" |
26 |
|
|
27 |
namespace { |
namespace { |
28 |
const char* const controlChangeTexts[] = { |
const char* const controlChangeTexts[] = { |
29 |
"none", "channelaftertouch", "velocity", |
_("none"), _("channelaftertouch"), _("velocity"), |
30 |
0, |
0, |
31 |
"modwheel", // "Modulation Wheel or Lever", |
_("modwheel"), // "Modulation Wheel or Lever", |
32 |
"breath", // "Breath Controller", |
_("breath"), // "Breath Controller", |
33 |
0, |
0, |
34 |
"foot", // "Foot Controller", |
_("foot"), // "Foot Controller", |
35 |
"portamentotime", // "Portamento Time", |
_("portamentotime"), // "Portamento Time", |
36 |
0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, |
37 |
"effect1", // "Effect Control 1", |
_("effect1"), // "Effect Control 1", |
38 |
"effect2", // "Effect Control 2", |
_("effect2"), // "Effect Control 2", |
39 |
0, 0, |
0, 0, |
40 |
"genpurpose1", // "General Purpose Controller 1", |
_("genpurpose1"), // "General Purpose Controller 1", |
41 |
"genpurpose2", // "General Purpose Controller 2", |
_("genpurpose2"), // "General Purpose Controller 2", |
42 |
"genpurpose3", // "General Purpose Controller 3", |
_("genpurpose3"), // "General Purpose Controller 3", |
43 |
"genpurpose4", // "General Purpose Controller 4", |
_("genpurpose4"), // "General Purpose Controller 4", |
44 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
45 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
46 |
0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, |
47 |
"sustainpedal", // "Damper Pedal on/off (Sustain)", |
_("sustainpedal"), // "Damper Pedal on/off (Sustain)", |
48 |
"portamento", // "Portamento On/Off", |
_("portamento"), // "Portamento On/Off", |
49 |
"sostenuto", // "Sustenuto On/Off", |
_("sostenuto"), // "Sustenuto On/Off", |
50 |
"softpedal", // "Soft Pedal On/Off", |
_("softpedal"), // "Soft Pedal On/Off", |
51 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
52 |
"genpurpose5", // "General Purpose Controller 5", |
_("genpurpose5"), // "General Purpose Controller 5", |
53 |
"genpurpose6", // "General Purpose Controller 6", |
_("genpurpose6"), // "General Purpose Controller 6", |
54 |
"genpurpose7", // "General Purpose Controller 7", |
_("genpurpose7"), // "General Purpose Controller 7", |
55 |
"genpurpose8", // "General Purpose Controller 8", |
_("genpurpose8"), // "General Purpose Controller 8", |
56 |
0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, |
57 |
"effect1depth", // "Effects 1 Depth", |
_("effect1depth"), // "Effects 1 Depth", |
58 |
"effect2depth", // "Effects 2 Depth", |
_("effect2depth"), // "Effects 2 Depth", |
59 |
"effect3depth", // "Effects 3 Depth", |
_("effect3depth"), // "Effects 3 Depth", |
60 |
"effect4depth", // "Effects 4 Depth", |
_("effect4depth"), // "Effects 4 Depth", |
61 |
"effect5depth", // "Effects 5 Depth" |
_("effect5depth"), // "Effects 5 Depth" |
62 |
}; |
}; |
63 |
} |
} |
64 |
|
|
66 |
label(Glib::ustring(labelText) + ":"), |
label(Glib::ustring(labelText) + ":"), |
67 |
widget(widget) |
widget(widget) |
68 |
{ |
{ |
69 |
label.set_alignment(Gtk::ALIGN_LEFT); |
label.set_alignment(Gtk::ALIGN_START); |
70 |
} |
} |
71 |
|
|
72 |
void LabelWidget::set_sensitive(bool sensitive) |
void LabelWidget::set_sensitive(bool sensitive) |
77 |
|
|
78 |
NumEntry::NumEntry(const char* labelText, double lower, double upper, |
NumEntry::NumEntry(const char* labelText, double lower, double upper, |
79 |
int decimals) : |
int decimals) : |
80 |
|
LabelWidget(labelText, box), |
81 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
82 |
adjust(lower, lower, upper, 1, 10), |
adjust(lower, lower, upper, 1, 10), |
83 |
|
#else |
84 |
|
adjust(Gtk::Adjustment::create(lower, lower, upper, 1, 10)), |
85 |
|
#endif |
86 |
scale(adjust), |
scale(adjust), |
87 |
spinbutton(adjust), |
spinbutton(adjust) |
|
LabelWidget(labelText, box) |
|
88 |
{ |
{ |
89 |
|
scale.set_size_request(70); |
90 |
spinbutton.set_digits(decimals); |
spinbutton.set_digits(decimals); |
91 |
spinbutton.set_value(0); |
spinbutton.set_value(0); |
92 |
scale.set_draw_value(false); |
scale.set_draw_value(false); |
98 |
double lower, double upper, |
double lower, double upper, |
99 |
int decimals, double coeff) : |
int decimals, double coeff) : |
100 |
NumEntry(labelText, lower, upper, decimals), |
NumEntry(labelText, lower, upper, decimals), |
|
coeff(coeff), |
|
101 |
value(0), |
value(0), |
102 |
|
coeff(coeff), |
103 |
connected(true) |
connected(true) |
104 |
{ |
{ |
105 |
spinbutton.signal_value_changed().connect( |
spinbutton.signal_value_changed().connect( |
189 |
NoteEntry::NoteEntry(const char* labelText) : |
NoteEntry::NoteEntry(const char* labelText) : |
190 |
NumEntryTemp<uint8_t>(labelText) |
NumEntryTemp<uint8_t>(labelText) |
191 |
{ |
{ |
192 |
|
spinbutton.set_width_chars(4); |
193 |
spinbutton.signal_input().connect( |
spinbutton.signal_input().connect( |
194 |
sigc::mem_fun(*this, &NoteEntry::on_input)); |
sigc::mem_fun(*this, &NoteEntry::on_input)); |
195 |
spinbutton.signal_output().connect( |
spinbutton.signal_output().connect( |
197 |
} |
} |
198 |
|
|
199 |
const char* notes[] = { |
const char* notes[] = { |
200 |
"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" |
_("C"), _("C#"), _("D"), _("D#"), _("E"), _("F"),_("F#"), |
201 |
|
_("G"), _("G#"), _("A"), _("A#"), _("B") |
202 |
}; |
}; |
203 |
|
|
204 |
|
|
233 |
} |
} |
234 |
|
|
235 |
ChoiceEntryLeverageCtrl::ChoiceEntryLeverageCtrl(const char* labelText) : |
ChoiceEntryLeverageCtrl::ChoiceEntryLeverageCtrl(const char* labelText) : |
236 |
align(0, 0, 0, 0), |
LabelWidget(labelText, align), |
237 |
LabelWidget(labelText, align) |
align(0, 0, 0, 0) |
238 |
{ |
{ |
239 |
for (int i = 0 ; i < 99 ; i++) { |
for (int i = 0 ; i < 99 ; i++) { |
240 |
if (controlChangeTexts[i]) { |
if (controlChangeTexts[i]) { |
241 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
242 |
combobox.append_text(controlChangeTexts[i]); |
combobox.append_text(controlChangeTexts[i]); |
243 |
|
#else |
244 |
|
combobox.append(controlChangeTexts[i]); |
245 |
|
#endif |
246 |
} |
} |
247 |
} |
} |
248 |
combobox.signal_changed().connect( |
combobox.signal_changed().connect( |
271 |
default: |
default: |
272 |
value.type = gig::leverage_ctrl_t::type_controlchange; |
value.type = gig::leverage_ctrl_t::type_controlchange; |
273 |
int x = 3; |
int x = 3; |
274 |
for (int cc = 0 ; cc < 96 ; cc++) { |
for (uint cc = 0 ; cc < 96 ; cc++) { |
275 |
if (controlChangeTexts[cc + 3]) { |
if (controlChangeTexts[cc + 3]) { |
276 |
if (rowno == x) { |
if (rowno == x) { |
277 |
value.controller_number = cc; |
value.controller_number = cc; |
301 |
break; |
break; |
302 |
case gig::leverage_ctrl_t::type_controlchange: |
case gig::leverage_ctrl_t::type_controlchange: |
303 |
x = -1; |
x = -1; |
304 |
for (int cc = 0 ; cc < 96 ; cc++) { |
for (uint cc = 0 ; cc < 96 ; cc++) { |
305 |
if (controlChangeTexts[cc + 3]) { |
if (controlChangeTexts[cc + 3]) { |
306 |
x++; |
x++; |
307 |
if (value.controller_number == cc) { |
if (value.controller_number == cc) { |
356 |
value.replace(i, 2, "\x0a"); |
value.replace(i, 2, "\x0a"); |
357 |
text_buffer->set_text(value); |
text_buffer->set_text(value); |
358 |
} |
} |
359 |
|
|
360 |
|
|
361 |
|
Table::Table(int x, int y) : Gtk::Table(x, y), rowno(0) { } |
362 |
|
|
363 |
|
void Table::add(BoolEntry& boolentry) |
364 |
|
{ |
365 |
|
attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
366 |
|
Gtk::FILL, Gtk::SHRINK); |
367 |
|
rowno++; |
368 |
|
} |
369 |
|
|
370 |
|
void Table::add(BoolEntryPlus6& boolentry) |
371 |
|
{ |
372 |
|
attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
373 |
|
Gtk::FILL, Gtk::SHRINK); |
374 |
|
rowno++; |
375 |
|
} |
376 |
|
|
377 |
|
void Table::add(LabelWidget& prop) |
378 |
|
{ |
379 |
|
attach(prop.label, 1, 2, rowno, rowno + 1, |
380 |
|
Gtk::FILL, Gtk::SHRINK); |
381 |
|
attach(prop.widget, 2, 3, rowno, rowno + 1, |
382 |
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
383 |
|
rowno++; |
384 |
|
} |