/[svn]/gigedit/trunk/src/gigedit/dimregionedit.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/dimregionedit.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3329 by schoenebeck, Sun Jul 23 18:31:53 2017 UTC revision 3408 by schoenebeck, Fri Jan 19 19:17:41 2018 UTC
# Line 22  Line 22 
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  VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) :  VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) :
32      getter(getter), dimreg(0) {      getter(getter), dimreg(0) {
33      set_size_request(80, 80);      set_size_request(80, 80);
# Line 273  DimRegionEdit::DimRegionEdit() : Line 279  DimRegionEdit::DimRegionEdit() :
279      eGain(_("Gain"), -96, 0, 2, -655360),      eGain(_("Gain"), -96, 0, 2, -655360),
280      eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),      eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),
281      eSampleLoopEnabled(_("Enabled")),      eSampleLoopEnabled(_("Enabled")),
282      eSampleLoopStart(_("Loop start positon")),      eSampleLoopStart(_("Loop start position")),
283      eSampleLoopLength(_("Loop size")),      eSampleLoopLength(_("Loop size")),
284      eSampleLoopType(_("Loop type")),      eSampleLoopType(_("Loop type")),
285      eSampleLoopInfinite(_("Infinite loop")),      eSampleLoopInfinite(_("Infinite loop")),
# Line 437  DimRegionEdit::DimRegionEdit() : Line 443  DimRegionEdit::DimRegionEdit() :
443      );      );
444    
445      for (int i = 0 ; i < 7 ; i++) {      for (int i = 0 ; i < 7 ; i++) {
446    #if USE_GTKMM_GRID
447            table[i] = new Gtk::Grid;
448            table[i]->set_column_spacing(7);
449    #else
450          table[i] = new Gtk::Table(3, 1);          table[i] = new Gtk::Table(3, 1);
451          table[i]->set_col_spacings(7);          table[i]->set_col_spacings(7);
452    #endif
453    
454    // on Gtk 3 there is absolutely no margin by default
455    #if GTKMM_MAJOR_VERSION >= 3
456    # if GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 12
457            table[i]->set_margin_left(12);
458            table[i]->set_margin_right(12);
459    # else
460            table[i]->set_margin_start(12);
461            table[i]->set_margin_end(12);
462    # endif
463    #endif
464      }      }
465    
466      // set tooltips      // set tooltips
# Line 623  DimRegionEdit::DimRegionEdit() : Line 645  DimRegionEdit::DimRegionEdit() :
645    
646      Gtk::Frame* frame = new Gtk::Frame;      Gtk::Frame* frame = new Gtk::Frame;
647      frame->add(crossfade_curve);      frame->add(crossfade_curve);
648        // on Gtk 3 there is no margin at all by default
649    #if GTKMM_MAJOR_VERSION >= 3
650        frame->set_margin_top(12);
651        frame->set_margin_bottom(12);
652    #endif
653    #if USE_GTKMM_GRID
654        table[pageno]->attach(*frame, 1, rowno, 2);
655    #else
656      table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,      table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
657                            Gtk::SHRINK, Gtk::SHRINK);                            Gtk::SHRINK, Gtk::SHRINK);
658    #endif
659      rowno++;      rowno++;
660    
661      eCrossfade_in_start.signal_value_changed().connect(      eCrossfade_in_start.signal_value_changed().connect(
# Line 698  DimRegionEdit::DimRegionEdit() : Line 729  DimRegionEdit::DimRegionEdit() :
729    
730      frame = new Gtk::Frame;      frame = new Gtk::Frame;
731      frame->add(cutoff_curve);      frame->add(cutoff_curve);
732        // on Gtk 3 there is no margin at all by default
733    #if GTKMM_MAJOR_VERSION >= 3
734        frame->set_margin_top(12);
735        frame->set_margin_bottom(12);
736    #endif
737    #if USE_GTKMM_GRID
738        table[pageno]->attach(*frame, 1, rowno, 2);
739    #else
740      table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,      table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
741                            Gtk::SHRINK, Gtk::SHRINK);                            Gtk::SHRINK, Gtk::SHRINK);
742    #endif
743      rowno++;      rowno++;
744    
745      addProp(eVCFResonance);      addProp(eVCFResonance);
# Line 800  DimRegionEdit::DimRegionEdit() : Line 840  DimRegionEdit::DimRegionEdit() :
840    
841      frame = new Gtk::Frame;      frame = new Gtk::Frame;
842      frame->add(velocity_curve);      frame->add(velocity_curve);
843        // on Gtk 3 there is no margin at all by default
844    #if GTKMM_MAJOR_VERSION >= 3
845        frame->set_margin_top(12);
846        frame->set_margin_bottom(12);
847    #endif
848    #if USE_GTKMM_GRID
849        table[pageno]->attach(*frame, 1, rowno, 2);
850    #else
851      table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,      table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
852                            Gtk::SHRINK, Gtk::SHRINK);                            Gtk::SHRINK, Gtk::SHRINK);
853    #endif
854      rowno++;      rowno++;
855    
856      addHeader(_("Release Velocity Response"));      addHeader(_("Release Velocity Response"));
# Line 816  DimRegionEdit::DimRegionEdit() : Line 865  DimRegionEdit::DimRegionEdit() :
865          sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));          sigc::mem_fun(release_curve, &VelocityCurve::queue_draw));
866      frame = new Gtk::Frame;      frame = new Gtk::Frame;
867      frame->add(release_curve);      frame->add(release_curve);
868        // on Gtk 3 there is no margin at all by default
869    #if GTKMM_MAJOR_VERSION >= 3
870        frame->set_margin_top(12);
871        frame->set_margin_bottom(12);
872    #endif
873    #if USE_GTKMM_GRID
874        table[pageno]->attach(*frame, 1, rowno, 2);
875    #else
876      table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,      table[pageno]->attach(*frame, 1, 3, rowno, rowno + 1,
877                            Gtk::SHRINK, Gtk::SHRINK);                            Gtk::SHRINK, Gtk::SHRINK);
878    #endif
879      rowno++;      rowno++;
880    
881      addProp(eReleaseTriggerDecay);      addProp(eReleaseTriggerDecay);
# Line 912  void DimRegionEdit::addString(const char Line 970  void DimRegionEdit::addString(const char
970                                Gtk::Entry*& widget)                                Gtk::Entry*& widget)
971  {  {
972      label = new Gtk::Label(Glib::ustring(labelText) + ":");      label = new Gtk::Label(Glib::ustring(labelText) + ":");
973    #if HAS_GTKMM_ALIGNMENT
974      label->set_alignment(Gtk::ALIGN_START);      label->set_alignment(Gtk::ALIGN_START);
975    #else
976        label->set_halign(Gtk::Align::START);
977    #endif
978    
979    #if USE_GTKMM_GRID
980        table[pageno]->attach(*label, 1, rowno);
981    #else
982      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
983                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
984    #endif
985    
986      widget = new Gtk::Entry();      widget = new Gtk::Entry();
987    
988    #if USE_GTKMM_GRID
989        table[pageno]->attach(*widget, 2, rowno);
990    #else
991      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(*widget, 2, 3, rowno, rowno + 1,
992                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
993    #endif
994    
995      rowno++;      rowno++;
996  }  }
# Line 929  void DimRegionEdit::addString(const char Line 999  void DimRegionEdit::addString(const char
999                                Gtk::Entry*& widget, Gtk::Button*& button)                                Gtk::Entry*& widget, Gtk::Button*& button)
1000  {  {
1001      label = new Gtk::Label(Glib::ustring(labelText) + ":");      label = new Gtk::Label(Glib::ustring(labelText) + ":");
1002    #if HAS_GTKMM_ALIGNMENT
1003      label->set_alignment(Gtk::ALIGN_START);      label->set_alignment(Gtk::ALIGN_START);
1004    #else
1005        label->set_halign(Gtk::Align::START);
1006    #endif
1007    
1008    #if USE_GTKMM_GRID
1009        table[pageno]->attach(*label, 1, rowno);
1010    #else
1011      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(*label, 1, 2, rowno, rowno + 1,
1012                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1013    #endif
1014    
1015      widget = new Gtk::Entry();      widget = new Gtk::Entry();
1016      button = new Gtk::Button();      button = new Gtk::Button();
1017    
1018      Gtk::HBox* hbox = new Gtk::HBox;      HBox* hbox = new HBox;
1019      hbox->pack_start(*widget);      hbox->pack_start(*widget);
1020      hbox->pack_start(*button, Gtk::PACK_SHRINK);      hbox->pack_start(*button, Gtk::PACK_SHRINK);
1021    
1022    #if USE_GTKMM_GRID
1023        table[pageno]->attach(*hbox, 2, rowno);
1024    #else
1025      table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1,      table[pageno]->attach(*hbox, 2, 3, rowno, rowno + 1,
1026                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1027    #endif
1028    
1029      rowno++;      rowno++;
1030  }  }
# Line 952  Gtk::Label* DimRegionEdit::addHeader(con Line 1034  Gtk::Label* DimRegionEdit::addHeader(con
1034      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1035      {      {
1036          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1037    #if USE_GTKMM_GRID
1038            table[pageno]->attach(*filler, 0, firstRowInBlock);
1039    #else
1040          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1041                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1042    #endif
1043      }      }
1044      Glib::ustring str = "<b>";      Glib::ustring str = "<b>";
1045      str += text;      str += text;
1046      str += "</b>";      str += "</b>";
1047      Gtk::Label* label = new Gtk::Label(str);      Gtk::Label* label = new Gtk::Label(str);
1048      label->set_use_markup();      label->set_use_markup();
1049    #if HAS_GTKMM_ALIGNMENT
1050      label->set_alignment(Gtk::ALIGN_START);      label->set_alignment(Gtk::ALIGN_START);
1051    #else
1052        label->set_halign(Gtk::Align::START);
1053    #endif
1054        // on GTKMM 3 there is absolutely no margin by default
1055    #if GTKMM_MAJOR_VERSION >= 3
1056        label->set_margin_top(18);
1057        label->set_margin_bottom(13);
1058    #endif
1059    #if USE_GTKMM_GRID
1060        table[pageno]->attach(*label, 0, rowno, 3);
1061    #else
1062      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,      table[pageno]->attach(*label, 0, 3, rowno, rowno + 1,
1063                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1064    #endif
1065      rowno++;      rowno++;
1066      firstRowInBlock = rowno;      firstRowInBlock = rowno;
1067      return label;      return label;
# Line 973  void DimRegionEdit::nextPage() Line 1072  void DimRegionEdit::nextPage()
1072      if (firstRowInBlock < rowno - 1)      if (firstRowInBlock < rowno - 1)
1073      {      {
1074          Gtk::Label* filler = new Gtk::Label("    ");          Gtk::Label* filler = new Gtk::Label("    ");
1075    #if USE_GTKMM_GRID
1076            table[pageno]->attach(*filler, 0, firstRowInBlock);
1077    #else
1078          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,          table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno,
1079                                Gtk::FILL, Gtk::SHRINK);                                Gtk::FILL, Gtk::SHRINK);
1080    #endif
1081      }      }
1082      pageno++;      pageno++;
1083      rowno = 0;      rowno = 0;
# Line 983  void DimRegionEdit::nextPage() Line 1086  void DimRegionEdit::nextPage()
1086    
1087  void DimRegionEdit::addProp(BoolEntry& boolentry)  void DimRegionEdit::addProp(BoolEntry& boolentry)
1088  {  {
1089    #if USE_GTKMM_GRID
1090        table[pageno]->attach(boolentry.widget, 1, rowno, 2);
1091    #else
1092      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
1093                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1094    #endif
1095      rowno++;      rowno++;
1096  }  }
1097    
1098  void DimRegionEdit::addProp(BoolEntryPlus6& boolentry)  void DimRegionEdit::addProp(BoolEntryPlus6& boolentry)
1099  {  {
1100    #if USE_GTKMM_GRID
1101        table[pageno]->attach(boolentry.widget, 1, rowno, 2);
1102    #else
1103      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,      table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1,
1104                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1105    #endif
1106      rowno++;      rowno++;
1107  }  }
1108    
1109  void DimRegionEdit::addProp(LabelWidget& prop)  void DimRegionEdit::addProp(LabelWidget& prop)
1110  {  {
1111    #if USE_GTKMM_GRID
1112        table[pageno]->attach(prop.label, 1, rowno);
1113        table[pageno]->attach(prop.widget, 2, rowno);
1114    #else
1115      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,      table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1,
1116                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1117      table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(prop.widget, 2, 3, rowno, rowno + 1,
1118                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1119    #endif
1120      rowno++;      rowno++;
1121  }  }
1122    
1123  void DimRegionEdit::addLine(Gtk::HBox& line)  void DimRegionEdit::addLine(HBox& line)
1124  {  {
1125    #if USE_GTKMM_GRID
1126        table[pageno]->attach(line, 1, rowno, 2);
1127    #else
1128      table[pageno]->attach(line, 1, 3, rowno, rowno + 1,      table[pageno]->attach(line, 1, 3, rowno, rowno + 1,
1129                            Gtk::FILL, Gtk::SHRINK);                            Gtk::FILL, Gtk::SHRINK);
1130    #endif
1131      rowno++;      rowno++;
1132  }  }
1133    
1134  void DimRegionEdit::addRightHandSide(Gtk::Widget& widget)  void DimRegionEdit::addRightHandSide(Gtk::Widget& widget)
1135  {  {
1136    #if USE_GTKMM_GRID
1137        table[pageno]->attach(widget, 2, rowno);
1138    #else
1139      table[pageno]->attach(widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(widget, 2, 3, rowno, rowno + 1,
1140                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);                            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
1141    #endif
1142      rowno++;      rowno++;
1143  }  }
1144    

Legend:
Removed from v.3329  
changed lines
  Added in v.3408

  ViewVC Help
Powered by ViewVC