205 |
text.set_text(rightHandText); |
text.set_text(rightHandText); |
206 |
} |
} |
207 |
|
|
208 |
|
static double stepForDecimals(int decimals) { |
209 |
|
switch (decimals) { |
210 |
|
case 0: return 1.0; |
211 |
|
case 1: return 0.1; |
212 |
|
case 2: default: return 0.01; |
213 |
|
} |
214 |
|
} |
215 |
|
|
216 |
|
static double pageForDecimals(int decimals) { |
217 |
|
switch (decimals) { |
218 |
|
case 0: return 10.0; |
219 |
|
case 1: return 1.0; |
220 |
|
case 2: default: return 0.1; |
221 |
|
} |
222 |
|
} |
223 |
|
|
224 |
NumEntry::NumEntry(const char* labelText, double lower, double upper, |
NumEntry::NumEntry(const char* labelText, double lower, double upper, |
225 |
int decimals) : |
int decimals) : |
226 |
LabelWidget(labelText, box), |
LabelWidget(labelText, box), |
227 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
228 |
adjust(lower, lower, upper, 1, 10), |
adjust(lower, lower, upper, stepForDecimals(decimals), pageForDecimals(decimals)), |
229 |
#else |
#else |
230 |
adjust(Gtk::Adjustment::create(lower, lower, upper, 1, 10)), |
adjust(Gtk::Adjustment::create(lower, lower, upper, stepForDecimals(decimals), pageForDecimals(decimals))), |
231 |
#endif |
#endif |
232 |
scale(adjust), |
scale(adjust), |
233 |
spinbutton(adjust) |
spinbutton(adjust) |
257 |
coeff(coeff), |
coeff(coeff), |
258 |
connected(true) |
connected(true) |
259 |
{ |
{ |
260 |
|
spinbutton.set_increments(0.1, 1.0); |
261 |
spinbutton.signal_value_changed().connect( |
spinbutton.signal_value_changed().connect( |
262 |
sigc::mem_fun(*this, &NumEntryGain::value_changed)); |
sigc::mem_fun(*this, &NumEntryGain::value_changed)); |
263 |
} |
} |