19 |
|
|
20 |
#include "paramedit.h" |
#include "paramedit.h" |
21 |
|
|
|
bool update_gui; |
|
|
|
|
22 |
namespace { |
namespace { |
23 |
const char* const controlChangeTexts[] = { |
const char* const controlChangeTexts[] = { |
24 |
"none", "channelaftertouch", "velocity", |
"none", "channelaftertouch", "velocity", |
95 |
|
|
96 |
void NumEntryGain::value_changed() |
void NumEntryGain::value_changed() |
97 |
{ |
{ |
98 |
if (ptr && update_gui) { |
if (ptr) { |
99 |
*ptr = int32_t(spinbutton.get_value() * coeff); |
const double f = pow(10, spinbutton.get_digits()); |
100 |
|
int new_value = round_to_int(spinbutton.get_value() * f); |
101 |
|
|
102 |
|
if (new_value != round_to_int(*ptr / coeff * f)) |
103 |
|
{ |
104 |
|
*ptr = round_to_int(new_value / f * coeff); |
105 |
|
sig_changed(); |
106 |
|
} |
107 |
} |
} |
108 |
} |
} |
109 |
|
|
119 |
|
|
120 |
BoolEntryPlus6::BoolEntryPlus6(const char* labelText, NumEntryGain& eGain, int32_t plus6value) : |
BoolEntryPlus6::BoolEntryPlus6(const char* labelText, NumEntryGain& eGain, int32_t plus6value) : |
121 |
LabelWidget(labelText, checkbutton), |
LabelWidget(labelText, checkbutton), |
122 |
|
checkbutton(labelText), |
123 |
eGain(eGain), |
eGain(eGain), |
124 |
plus6value(plus6value) |
plus6value(plus6value) |
125 |
{ |
{ |
129 |
|
|
130 |
void BoolEntryPlus6::value_changed() |
void BoolEntryPlus6::value_changed() |
131 |
{ |
{ |
132 |
if (ptr && update_gui) { |
if (ptr) { |
133 |
bool plus6 = checkbutton.get_active(); |
bool plus6 = checkbutton.get_active(); |
134 |
if (plus6) { |
if (plus6) { |
135 |
eGain.set_value(0); |
eGain.set_value(0); |
136 |
*ptr = plus6value; |
*ptr = plus6value; |
137 |
|
sig_changed(); |
138 |
} else { |
} else { |
139 |
if (*ptr < 0) { |
if (*ptr < 0) { |
140 |
*ptr = 0; |
*ptr = 0; |
141 |
|
sig_changed(); |
142 |
} |
} |
143 |
} |
} |
144 |
eGain.set_sensitive(!plus6); |
eGain.set_sensitive(!plus6); |
162 |
|
|
163 |
void NumEntryPermille::value_changed() |
void NumEntryPermille::value_changed() |
164 |
{ |
{ |
165 |
if (ptr && update_gui) { |
if (ptr) { |
166 |
*ptr = uint16_t(spinbutton.get_value() * 10 + 0.5); |
uint16_t new_value = uint16_t(spinbutton.get_value() * 10 + 0.5); |
167 |
|
if (new_value != *ptr) { |
168 |
|
*ptr = uint16_t(spinbutton.get_value() * 10 + 0.5); |
169 |
|
sig_changed(); |
170 |
|
} |
171 |
} |
} |
172 |
} |
} |
173 |
|
|
216 |
// Convert the Adjustment position to text |
// Convert the Adjustment position to text |
217 |
bool NoteEntry::on_output() |
bool NoteEntry::on_output() |
218 |
{ |
{ |
219 |
int x = int(spinbutton.get_adjustment()->get_value()); |
int x = int(spinbutton.get_adjustment()->get_value() + 0.5); |
220 |
char buf[10]; |
char buf[10]; |
221 |
sprintf(buf, "%s%d", notes[x % 12], x / 12 - 1); |
sprintf(buf, "%s%d", notes[x % 12], x / 12 - 1); |
222 |
spinbutton.set_text(buf); |
spinbutton.set_text(buf); |
239 |
|
|
240 |
void ChoiceEntryLeverageCtrl::value_changed() |
void ChoiceEntryLeverageCtrl::value_changed() |
241 |
{ |
{ |
242 |
if (ptr && update_gui) { |
if (ptr) { |
243 |
int rowno = combobox.get_active_row_number(); |
int rowno = combobox.get_active_row_number(); |
244 |
switch (rowno) |
switch (rowno) |
245 |
{ |
{ |
268 |
} |
} |
269 |
break; |
break; |
270 |
} |
} |
271 |
|
if (rowno >= 0) sig_changed(); |
272 |
} |
} |
273 |
} |
} |
274 |
|
|
319 |
|
|
320 |
void BoolEntry::value_changed() |
void BoolEntry::value_changed() |
321 |
{ |
{ |
322 |
if (ptr && update_gui) { |
if (ptr) { |
323 |
*ptr = checkbutton.get_active(); |
*ptr = checkbutton.get_active(); |
324 |
|
sig_changed(); |
325 |
} |
} |
326 |
} |
} |
327 |
|
|
342 |
|
|
343 |
void StringEntry::value_changed() |
void StringEntry::value_changed() |
344 |
{ |
{ |
345 |
if (ptr && update_gui) { |
if (ptr) { |
346 |
*ptr = entry.get_text(); |
*ptr = entry.get_text(); |
347 |
|
sig_changed(); |
348 |
} |
} |
349 |
} |
} |
350 |
|
|