1 |
/* |
/* |
2 |
* Copyright (C) 2006-2015 Andreas Persson |
* Copyright (C) 2006-2017 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 |
139 |
label(Glib::ustring(labelText) + ":"), |
label(Glib::ustring(labelText) + ":"), |
140 |
widget(widget) |
widget(widget) |
141 |
{ |
{ |
142 |
|
#if HAS_GTKMM_ALIGNMENT |
143 |
label.set_alignment(Gtk::ALIGN_START); |
label.set_alignment(Gtk::ALIGN_START); |
144 |
|
#else |
145 |
|
label.set_halign(Gtk::Align::START); |
146 |
|
#endif |
147 |
} |
} |
148 |
|
|
149 |
void LabelWidget::set_sensitive(bool sensitive) |
void LabelWidget::set_sensitive(bool sensitive) |
155 |
ReadOnlyLabelWidget::ReadOnlyLabelWidget(const char* leftHandText) |
ReadOnlyLabelWidget::ReadOnlyLabelWidget(const char* leftHandText) |
156 |
: LabelWidget(leftHandText, text) |
: LabelWidget(leftHandText, text) |
157 |
{ |
{ |
158 |
|
#if HAS_GTKMM_ALIGNMENT |
159 |
text.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START); |
text.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START); |
160 |
|
#else |
161 |
|
label.set_halign(Gtk::Align::START); |
162 |
|
label.set_valign(Gtk::Align::START); |
163 |
|
#endif |
164 |
} |
} |
165 |
|
|
166 |
ReadOnlyLabelWidget::ReadOnlyLabelWidget(const char* leftHandText, const char* rightHandText) |
ReadOnlyLabelWidget::ReadOnlyLabelWidget(const char* leftHandText, const char* rightHandText) |
167 |
: LabelWidget(leftHandText, text) |
: LabelWidget(leftHandText, text) |
168 |
{ |
{ |
169 |
|
#if HAS_GTKMM_ALIGNMENT |
170 |
text.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START); |
text.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START); |
171 |
|
#else |
172 |
|
text.set_halign(Gtk::Align::START); |
173 |
|
text.set_valign(Gtk::Align::START); |
174 |
|
#endif |
175 |
text.set_text(rightHandText); |
text.set_text(rightHandText); |
176 |
} |
} |
177 |
|
|
322 |
return true; |
return true; |
323 |
} |
} |
324 |
} |
} |
325 |
|
|
326 |
|
#if HAS_GTKMM_CPP11_ENUMS |
327 |
|
return Gtk::SpinButton::INPUT_ERROR; |
328 |
|
#else |
329 |
return Gtk::INPUT_ERROR; |
return Gtk::INPUT_ERROR; |
330 |
|
#endif |
331 |
} |
} |
332 |
} |
} |
333 |
|
|
347 |
|
|
348 |
namespace { |
namespace { |
349 |
// Convert the Entry text to a number |
// Convert the Entry text to a number |
350 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
351 |
|
int on_input(double& new_value, Gtk::SpinButton* spinbutton) { |
352 |
|
return note_value(spinbutton->get_text(), &new_value); |
353 |
|
} |
354 |
|
#else |
355 |
int on_input(double* new_value, Gtk::SpinButton* spinbutton) { |
int on_input(double* new_value, Gtk::SpinButton* spinbutton) { |
356 |
return note_value(spinbutton->get_text(), new_value); |
return note_value(spinbutton->get_text(), new_value); |
357 |
} |
} |
358 |
|
#endif |
359 |
|
|
360 |
// Convert the Adjustment position to text |
// Convert the Adjustment position to text |
361 |
bool on_output(Gtk::SpinButton* spinbutton) { |
bool on_output(Gtk::SpinButton* spinbutton) { |
377 |
} |
} |
378 |
|
|
379 |
ChoiceEntryLeverageCtrl::ChoiceEntryLeverageCtrl(const char* labelText) : |
ChoiceEntryLeverageCtrl::ChoiceEntryLeverageCtrl(const char* labelText) : |
380 |
|
#if HAS_GTKMM_ALIGNMENT |
381 |
LabelWidget(labelText, align), |
LabelWidget(labelText, align), |
382 |
align(0, 0, 0, 0) |
align(0, 0, 0, 0) |
383 |
|
#else |
384 |
|
LabelWidget(labelText, combobox) |
385 |
|
#endif |
386 |
{ |
{ |
387 |
for (int i = 0 ; i < controlChangeTextsSize ; i++) { |
for (int i = 0 ; i < controlChangeTextsSize ; i++) { |
388 |
if (controlChangeTexts[i].txt) { |
if (controlChangeTexts[i].txt) { |
399 |
} |
} |
400 |
combobox.signal_changed().connect( |
combobox.signal_changed().connect( |
401 |
sigc::mem_fun(*this, &ChoiceEntryLeverageCtrl::value_changed)); |
sigc::mem_fun(*this, &ChoiceEntryLeverageCtrl::value_changed)); |
402 |
|
#if HAS_GTKMM_ALIGNMENT |
403 |
align.add(combobox); |
align.add(combobox); |
404 |
|
#else |
405 |
|
combobox.set_halign(Gtk::Align::FILL); |
406 |
|
combobox.set_valign(Gtk::Align::FILL); |
407 |
|
#endif |
408 |
value.type = gig::leverage_ctrl_t::type_none; |
value.type = gig::leverage_ctrl_t::type_none; |
409 |
value.controller_number = 0; |
value.controller_number = 0; |
410 |
} |
} |
537 |
} |
} |
538 |
|
|
539 |
|
|
540 |
Table::Table(int x, int y) : Gtk::Table(x, y), rowno(0) { } |
Table::Table(int x, int y) : |
541 |
|
#if USE_GTKMM_GRID |
542 |
|
Gtk::Grid(), |
543 |
|
cols(x), |
544 |
|
#else |
545 |
|
Gtk::Table(x, y), |
546 |
|
#endif |
547 |
|
rowno(0) |
548 |
|
{ |
549 |
|
} |
550 |
|
|
551 |
void Table::add(BoolEntry& boolentry) |
void Table::add(BoolEntry& boolentry) |
552 |
{ |
{ |
553 |
|
#if USE_GTKMM_GRID |
554 |
|
attach(boolentry.widget, 0, rowno, 2); |
555 |
|
#else |
556 |
attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
557 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
558 |
|
#endif |
559 |
rowno++; |
rowno++; |
560 |
} |
} |
561 |
|
|
562 |
void Table::add(BoolEntryPlus6& boolentry) |
void Table::add(BoolEntryPlus6& boolentry) |
563 |
{ |
{ |
564 |
|
#if USE_GTKMM_GRID |
565 |
|
attach(boolentry.widget, 0, rowno, 2); |
566 |
|
#else |
567 |
attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
568 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
569 |
|
#endif |
570 |
rowno++; |
rowno++; |
571 |
} |
} |
572 |
|
|
573 |
void Table::add(LabelWidget& prop) |
void Table::add(LabelWidget& prop) |
574 |
{ |
{ |
575 |
|
#if USE_GTKMM_GRID |
576 |
|
attach(prop.label, 1, rowno); |
577 |
|
attach(prop.widget, 2, rowno); |
578 |
|
#else |
579 |
attach(prop.label, 1, 2, rowno, rowno + 1, |
attach(prop.label, 1, 2, rowno, rowno + 1, |
580 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
581 |
attach(prop.widget, 2, 3, rowno, rowno + 1, |
attach(prop.widget, 2, 3, rowno, rowno + 1, |
582 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
583 |
|
#endif |
584 |
rowno++; |
rowno++; |
585 |
} |
} |