22 |
|
|
23 |
#include "compat.h" |
#include "compat.h" |
24 |
|
|
25 |
|
#if USE_GTKMM_GRID |
26 |
|
# include <gtkmm/grid.h> |
27 |
|
#else |
28 |
|
# include <gtkmm/table.h> |
29 |
|
#endif |
30 |
|
|
31 |
|
#include "Settings.h" |
32 |
|
|
33 |
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) : |
34 |
getter(getter), dimreg(0) { |
getter(getter), dimreg(0) { |
35 |
set_size_request(80, 80); |
set_size_request(80, 80); |
189 |
)); |
)); |
190 |
} |
} |
191 |
|
|
192 |
|
void EGStateOptions::on_show_tooltips_changed() { |
193 |
|
const bool b = Settings::singleton()->showTooltips; |
194 |
|
|
195 |
|
checkBoxAttack.set_has_tooltip(b); |
196 |
|
checkBoxAttackHold.set_has_tooltip(b); |
197 |
|
checkBoxDecay1.set_has_tooltip(b); |
198 |
|
checkBoxDecay2.set_has_tooltip(b); |
199 |
|
checkBoxRelease.set_has_tooltip(b); |
200 |
|
} |
201 |
|
|
202 |
|
|
203 |
DimRegionEdit::DimRegionEdit() : |
DimRegionEdit::DimRegionEdit() : |
204 |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation), |
291 |
eGain(_("Gain"), -96, 0, 2, -655360), |
eGain(_("Gain"), -96, 0, 2, -655360), |
292 |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360), |
293 |
eSampleLoopEnabled(_("Enabled")), |
eSampleLoopEnabled(_("Enabled")), |
294 |
eSampleLoopStart(_("Loop start positon")), |
eSampleLoopStart(_("Loop start position")), |
295 |
eSampleLoopLength(_("Loop size")), |
eSampleLoopLength(_("Loop size")), |
296 |
eSampleLoopType(_("Loop type")), |
eSampleLoopType(_("Loop type")), |
297 |
eSampleLoopInfinite(_("Infinite loop")), |
eSampleLoopInfinite(_("Infinite loop")), |
455 |
); |
); |
456 |
|
|
457 |
for (int i = 0 ; i < 7 ; i++) { |
for (int i = 0 ; i < 7 ; i++) { |
458 |
|
#if USE_GTKMM_GRID |
459 |
|
table[i] = new Gtk::Grid; |
460 |
|
table[i]->set_column_spacing(7); |
461 |
|
#else |
462 |
table[i] = new Gtk::Table(3, 1); |
table[i] = new Gtk::Table(3, 1); |
463 |
table[i]->set_col_spacings(7); |
table[i]->set_col_spacings(7); |
464 |
|
#endif |
465 |
|
|
466 |
|
// on Gtk 3 there is absolutely no margin by default |
467 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
468 |
|
# if GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 12 |
469 |
|
table[i]->set_margin_left(12); |
470 |
|
table[i]->set_margin_right(12); |
471 |
|
# else |
472 |
|
table[i]->set_margin_start(12); |
473 |
|
table[i]->set_margin_end(12); |
474 |
|
# endif |
475 |
|
#endif |
476 |
} |
} |
477 |
|
|
478 |
// set tooltips |
// set tooltips |
657 |
|
|
658 |
Gtk::Frame* frame = new Gtk::Frame; |
Gtk::Frame* frame = new Gtk::Frame; |
659 |
frame->add(crossfade_curve); |
frame->add(crossfade_curve); |
660 |
|
// on Gtk 3 there is no margin at all by default |
661 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
662 |
|
frame->set_margin_top(12); |
663 |
|
frame->set_margin_bottom(12); |
664 |
|
#endif |
665 |
|
#if USE_GTKMM_GRID |
666 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
667 |
|
#else |
668 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
669 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
670 |
|
#endif |
671 |
rowno++; |
rowno++; |
672 |
|
|
673 |
eCrossfade_in_start.signal_value_changed().connect( |
eCrossfade_in_start.signal_value_changed().connect( |
741 |
|
|
742 |
frame = new Gtk::Frame; |
frame = new Gtk::Frame; |
743 |
frame->add(cutoff_curve); |
frame->add(cutoff_curve); |
744 |
|
// on Gtk 3 there is no margin at all by default |
745 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
746 |
|
frame->set_margin_top(12); |
747 |
|
frame->set_margin_bottom(12); |
748 |
|
#endif |
749 |
|
#if USE_GTKMM_GRID |
750 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
751 |
|
#else |
752 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
753 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
754 |
|
#endif |
755 |
rowno++; |
rowno++; |
756 |
|
|
757 |
addProp(eVCFResonance); |
addProp(eVCFResonance); |
852 |
|
|
853 |
frame = new Gtk::Frame; |
frame = new Gtk::Frame; |
854 |
frame->add(velocity_curve); |
frame->add(velocity_curve); |
855 |
|
// on Gtk 3 there is no margin at all by default |
856 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
857 |
|
frame->set_margin_top(12); |
858 |
|
frame->set_margin_bottom(12); |
859 |
|
#endif |
860 |
|
#if USE_GTKMM_GRID |
861 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
862 |
|
#else |
863 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
864 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
865 |
|
#endif |
866 |
rowno++; |
rowno++; |
867 |
|
|
868 |
addHeader(_("Release Velocity Response")); |
addHeader(_("Release Velocity Response")); |
877 |
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
sigc::mem_fun(release_curve, &VelocityCurve::queue_draw)); |
878 |
frame = new Gtk::Frame; |
frame = new Gtk::Frame; |
879 |
frame->add(release_curve); |
frame->add(release_curve); |
880 |
|
// on Gtk 3 there is no margin at all by default |
881 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
882 |
|
frame->set_margin_top(12); |
883 |
|
frame->set_margin_bottom(12); |
884 |
|
#endif |
885 |
|
#if USE_GTKMM_GRID |
886 |
|
table[pageno]->attach(*frame, 1, rowno, 2); |
887 |
|
#else |
888 |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1, |
889 |
Gtk::SHRINK, Gtk::SHRINK); |
Gtk::SHRINK, Gtk::SHRINK); |
890 |
|
#endif |
891 |
rowno++; |
rowno++; |
892 |
|
|
893 |
addProp(eReleaseTriggerDecay); |
addProp(eReleaseTriggerDecay); |
972 |
append_page(*table[4], _("Filter (2)")); |
append_page(*table[4], _("Filter (2)")); |
973 |
append_page(*table[5], _("Pitch")); |
append_page(*table[5], _("Pitch")); |
974 |
append_page(*table[6], _("Misc")); |
append_page(*table[6], _("Misc")); |
975 |
|
|
976 |
|
Settings::singleton()->showTooltips.get_proxy().signal_changed().connect( |
977 |
|
sigc::mem_fun(*this, &DimRegionEdit::on_show_tooltips_changed) |
978 |
|
); |
979 |
|
|
980 |
|
on_show_tooltips_changed(); |
981 |
} |
} |
982 |
|
|
983 |
DimRegionEdit::~DimRegionEdit() |
DimRegionEdit::~DimRegionEdit() |
988 |
Gtk::Entry*& widget) |
Gtk::Entry*& widget) |
989 |
{ |
{ |
990 |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
991 |
|
#if HAS_GTKMM_ALIGNMENT |
992 |
label->set_alignment(Gtk::ALIGN_START); |
label->set_alignment(Gtk::ALIGN_START); |
993 |
|
#else |
994 |
|
label->set_halign(Gtk::Align::START); |
995 |
|
#endif |
996 |
|
|
997 |
|
#if USE_GTKMM_GRID |
998 |
|
table[pageno]->attach(*label, 1, rowno); |
999 |
|
#else |
1000 |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
1001 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1002 |
|
#endif |
1003 |
|
|
1004 |
widget = new Gtk::Entry(); |
widget = new Gtk::Entry(); |
1005 |
|
|
1006 |
|
#if USE_GTKMM_GRID |
1007 |
|
table[pageno]->attach(*widget, 2, rowno); |
1008 |
|
#else |
1009 |
table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1, |
table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1, |
1010 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
1011 |
|
#endif |
1012 |
|
|
1013 |
rowno++; |
rowno++; |
1014 |
} |
} |
1017 |
Gtk::Entry*& widget, Gtk::Button*& button) |
Gtk::Entry*& widget, Gtk::Button*& button) |
1018 |
{ |
{ |
1019 |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
label = new Gtk::Label(Glib::ustring(labelText) + ":"); |
1020 |
|
#if HAS_GTKMM_ALIGNMENT |
1021 |
label->set_alignment(Gtk::ALIGN_START); |
label->set_alignment(Gtk::ALIGN_START); |
1022 |
|
#else |
1023 |
|
label->set_halign(Gtk::Align::START); |
1024 |
|
#endif |
1025 |
|
|
1026 |
|
#if USE_GTKMM_GRID |
1027 |
|
table[pageno]->attach(*label, 1, rowno); |
1028 |
|
#else |
1029 |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
table[pageno]->attach(*label, 1, 2, rowno, rowno + 1, |
1030 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1031 |
|
#endif |
1032 |
|
|
1033 |
widget = new Gtk::Entry(); |
widget = new Gtk::Entry(); |
1034 |
button = new Gtk::Button(); |
button = new Gtk::Button(); |
1035 |
|
|
1036 |
Gtk::HBox* hbox = new Gtk::HBox; |
HBox* hbox = new HBox; |
1037 |
hbox->pack_start(*widget); |
hbox->pack_start(*widget); |
1038 |
hbox->pack_start(*button, Gtk::PACK_SHRINK); |
hbox->pack_start(*button, Gtk::PACK_SHRINK); |
1039 |
|
|
1040 |
|
#if USE_GTKMM_GRID |
1041 |
|
table[pageno]->attach(*hbox, 2, rowno); |
1042 |
|
#else |
1043 |
table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1, |
table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1, |
1044 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
1045 |
|
#endif |
1046 |
|
|
1047 |
rowno++; |
rowno++; |
1048 |
} |
} |
1052 |
if (firstRowInBlock < rowno - 1) |
if (firstRowInBlock < rowno - 1) |
1053 |
{ |
{ |
1054 |
Gtk::Label* filler = new Gtk::Label(" "); |
Gtk::Label* filler = new Gtk::Label(" "); |
1055 |
|
#if USE_GTKMM_GRID |
1056 |
|
table[pageno]->attach(*filler, 0, firstRowInBlock); |
1057 |
|
#else |
1058 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
1059 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1060 |
|
#endif |
1061 |
} |
} |
1062 |
Glib::ustring str = "<b>"; |
Glib::ustring str = "<b>"; |
1063 |
str += text; |
str += text; |
1064 |
str += "</b>"; |
str += "</b>"; |
1065 |
Gtk::Label* label = new Gtk::Label(str); |
Gtk::Label* label = new Gtk::Label(str); |
1066 |
label->set_use_markup(); |
label->set_use_markup(); |
1067 |
|
#if HAS_GTKMM_ALIGNMENT |
1068 |
label->set_alignment(Gtk::ALIGN_START); |
label->set_alignment(Gtk::ALIGN_START); |
1069 |
|
#else |
1070 |
|
label->set_halign(Gtk::Align::START); |
1071 |
|
#endif |
1072 |
|
// on GTKMM 3 there is absolutely no margin by default |
1073 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
1074 |
|
label->set_margin_top(18); |
1075 |
|
label->set_margin_bottom(13); |
1076 |
|
#endif |
1077 |
|
#if USE_GTKMM_GRID |
1078 |
|
table[pageno]->attach(*label, 0, rowno, 3); |
1079 |
|
#else |
1080 |
table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, |
table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, |
1081 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1082 |
|
#endif |
1083 |
rowno++; |
rowno++; |
1084 |
firstRowInBlock = rowno; |
firstRowInBlock = rowno; |
1085 |
return label; |
return label; |
1086 |
} |
} |
1087 |
|
|
1088 |
|
void DimRegionEdit::on_show_tooltips_changed() { |
1089 |
|
const bool b = Settings::singleton()->showTooltips; |
1090 |
|
|
1091 |
|
buttonSelectSample.set_has_tooltip(b); |
1092 |
|
buttonNullSampleReference->set_has_tooltip(b); |
1093 |
|
wSample->set_has_tooltip(b); |
1094 |
|
|
1095 |
|
eEG1StateOptions.on_show_tooltips_changed(); |
1096 |
|
eEG2StateOptions.on_show_tooltips_changed(); |
1097 |
|
|
1098 |
|
set_has_tooltip(b); |
1099 |
|
} |
1100 |
|
|
1101 |
void DimRegionEdit::nextPage() |
void DimRegionEdit::nextPage() |
1102 |
{ |
{ |
1103 |
if (firstRowInBlock < rowno - 1) |
if (firstRowInBlock < rowno - 1) |
1104 |
{ |
{ |
1105 |
Gtk::Label* filler = new Gtk::Label(" "); |
Gtk::Label* filler = new Gtk::Label(" "); |
1106 |
|
#if USE_GTKMM_GRID |
1107 |
|
table[pageno]->attach(*filler, 0, firstRowInBlock); |
1108 |
|
#else |
1109 |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, |
1110 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1111 |
|
#endif |
1112 |
} |
} |
1113 |
pageno++; |
pageno++; |
1114 |
rowno = 0; |
rowno = 0; |
1117 |
|
|
1118 |
void DimRegionEdit::addProp(BoolEntry& boolentry) |
void DimRegionEdit::addProp(BoolEntry& boolentry) |
1119 |
{ |
{ |
1120 |
|
#if USE_GTKMM_GRID |
1121 |
|
table[pageno]->attach(boolentry.widget, 1, rowno, 2); |
1122 |
|
#else |
1123 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
1124 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1125 |
|
#endif |
1126 |
rowno++; |
rowno++; |
1127 |
} |
} |
1128 |
|
|
1129 |
void DimRegionEdit::addProp(BoolEntryPlus6& boolentry) |
void DimRegionEdit::addProp(BoolEntryPlus6& boolentry) |
1130 |
{ |
{ |
1131 |
|
#if USE_GTKMM_GRID |
1132 |
|
table[pageno]->attach(boolentry.widget, 1, rowno, 2); |
1133 |
|
#else |
1134 |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, |
1135 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1136 |
|
#endif |
1137 |
rowno++; |
rowno++; |
1138 |
} |
} |
1139 |
|
|
1140 |
void DimRegionEdit::addProp(LabelWidget& prop) |
void DimRegionEdit::addProp(LabelWidget& prop) |
1141 |
{ |
{ |
1142 |
|
#if USE_GTKMM_GRID |
1143 |
|
table[pageno]->attach(prop.label, 1, rowno); |
1144 |
|
table[pageno]->attach(prop.widget, 2, rowno); |
1145 |
|
#else |
1146 |
table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1, |
table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1, |
1147 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1148 |
table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1, |
table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1, |
1149 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
1150 |
|
#endif |
1151 |
rowno++; |
rowno++; |
1152 |
} |
} |
1153 |
|
|
1154 |
void DimRegionEdit::addLine(Gtk::HBox& line) |
void DimRegionEdit::addLine(HBox& line) |
1155 |
{ |
{ |
1156 |
|
#if USE_GTKMM_GRID |
1157 |
|
table[pageno]->attach(line, 1, rowno, 2); |
1158 |
|
#else |
1159 |
table[pageno]->attach(line, 1, 3, rowno, rowno + 1, |
table[pageno]->attach(line, 1, 3, rowno, rowno + 1, |
1160 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
1161 |
|
#endif |
1162 |
rowno++; |
rowno++; |
1163 |
} |
} |
1164 |
|
|
1165 |
void DimRegionEdit::addRightHandSide(Gtk::Widget& widget) |
void DimRegionEdit::addRightHandSide(Gtk::Widget& widget) |
1166 |
{ |
{ |
1167 |
|
#if USE_GTKMM_GRID |
1168 |
|
table[pageno]->attach(widget, 2, rowno); |
1169 |
|
#else |
1170 |
table[pageno]->attach(widget, 2, 3, rowno, rowno + 1, |
table[pageno]->attach(widget, 2, 3, rowno, rowno + 1, |
1171 |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
1172 |
|
#endif |
1173 |
rowno++; |
rowno++; |
1174 |
} |
} |
1175 |
|
|