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

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

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

revision 2446 by persson, Sun Apr 28 15:40:43 2013 UTC revision 3460 by persson, Sat Feb 2 07:48:50 2019 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2013 Andreas Persson   * Copyright (C) 2006-2019 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
# Line 17  Line 17 
17   * 02110-1301 USA.   * 02110-1301 USA.
18   */   */
19    
20  #include <cstring>  #include "global.h"
   
21  #include "paramedit.h"  #include "paramedit.h"
22    
 #include "global.h"  
23  #include "compat.h"  #include "compat.h"
24    #include "Settings.h"
25    
26  std::string gig_encoding("CP1252");  #ifdef GLIBMM_HEADER_FILE
27    # include GLIBMM_HEADER_FILE(glibmm.h)
28  Glib::ustring gig_to_utf8(const gig::String& gig_string) {  #else
29      return Glib::convert_with_fallback(gig_string, "UTF-8", gig_encoding, "?");  # include <glibmm.h>
30  }  #endif
   
 gig::String gig_from_utf8(const Glib::ustring& utf8_string) {  
     return Glib::convert_with_fallback(utf8_string, gig_encoding, "UTF-8", "?");  
 }  
31    
32    #include <gtkmm/messagedialog.h>
33    
34  namespace {  namespace {
35      const char* const controlChangeTexts[] = {      struct CCText {
36          _("none"), _("channelaftertouch"), _("velocity"),          const char* const txt;
37          0,          bool isExtension; ///< True if this is a controller only supported by LinuxSampler, but not supperted by Gigasampler/GigaStudio.
38          _("modwheel"), // "Modulation Wheel or Lever",      };
39          _("breath"), // "Breath Controller",      static const CCText controlChangeTexts[] = {
40          0,          // 3 special ones (not being CCs)
41          _("foot"), // "Foot Controller",          { _("none") }, { _("channelaftertouch") }, { _("velocity") },
42          _("portamentotime"), // "Portamento Time",          {0}, // bank select MSB (hard coded in sampler, so discouraged to be used here, even though considerable)
43          0, 0, 0, 0, 0, 0,          { _("modwheel") }, // "Modulation Wheel or Lever",
44          _("effect1"), // "Effect Control 1",          { _("breath") }, // "Breath Controller",
45          _("effect2"), // "Effect Control 2",          { _("undefined"), true },
46          0, 0,          { _("foot") }, // "Foot Controller",
47          _("genpurpose1"), // "General Purpose Controller 1",          { _("portamentotime") }, // "Portamento Time",
48          _("genpurpose2"), // "General Purpose Controller 2",          { _("data entry MSB"), true },
49          _("genpurpose3"), // "General Purpose Controller 3",          { _("volume"), true },
50          _("genpurpose4"), // "General Purpose Controller 4",          { _("balance"), true },
51          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,          { _("undefined"), true },
52          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,          { _("pan"), true },
53          0, 0, 0, 0, 0, 0,          { _("expression"), true },
54          _("sustainpedal"), // "Damper Pedal on/off (Sustain)",          { _("effect1") }, // "Effect Control 1",
55          _("portamento"), // "Portamento On/Off",          { _("effect2") }, // "Effect Control 2",
56          _("sostenuto"), // "Sustenuto On/Off",          { _("undefined"), true },
57          _("softpedal"), // "Soft Pedal On/Off",          { _("undefined"), true },
58          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,          { _("genpurpose1") }, // "General Purpose Controller 1",
59          _("genpurpose5"), // "General Purpose Controller 5",          { _("genpurpose2") }, // "General Purpose Controller 2",
60          _("genpurpose6"), // "General Purpose Controller 6",          { _("genpurpose3") }, // "General Purpose Controller 3",
61          _("genpurpose7"), // "General Purpose Controller 7",          { _("genpurpose4") }, // "General Purpose Controller 4",
62          _("genpurpose8"), // "General Purpose Controller 8",          { _("undefined"), true },
63          0, 0, 0, 0, 0, 0, 0,          { _("undefined"), true },
64          _("effect1depth"), // "Effects 1 Depth",          { _("undefined"), true },
65          _("effect2depth"), // "Effects 2 Depth",          { _("undefined"), true },
66          _("effect3depth"), // "Effects 3 Depth",          { _("undefined"), true },
67          _("effect4depth"), // "Effects 4 Depth",          { _("undefined"), true },
68          _("effect5depth"), // "Effects 5 Depth"          { _("undefined"), true },
69            { _("undefined"), true },
70            { _("undefined"), true },
71            { _("undefined"), true },
72            { _("undefined"), true },
73            { _("undefined"), true },
74            
75            // LSB variant of the various controllers above
76            // (so discouraged to be used here for now)
77            {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
78            {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
79            {0}, {0}, {0}, {0},
80            
81            { _("sustainpedal") }, // "Damper Pedal on/off (Sustain)",
82            { _("portamento") }, // "Portamento On/Off",
83            { _("sostenuto") }, // "Sustenuto On/Off",
84            { _("softpedal") }, // "Soft Pedal On/Off",
85            { _("legato"), true },
86            { _("hold2"), true },
87            { _("soundvariation"), true },
88            { _("timbre"), true },
89            { _("releasetime"), true },
90            { _("attacktime"), true },
91            { _("brightness"), true },
92            { _("decaytime"), true },
93            { _("vibratorate"), true },
94            { _("vibratodepth"), true },
95            { _("vibratodelay"), true },
96            { _("undefined"), true },
97            { _("genpurpose5") }, // "General Purpose Controller 5",
98            { _("genpurpose6") }, // "General Purpose Controller 6",
99            { _("genpurpose7") }, // "General Purpose Controller 7",
100            { _("genpurpose8") }, // "General Purpose Controller 8",
101            { _("portamentoctrl"), true },
102            { _("undefined"), true },
103            { _("undefined"), true },
104            { _("undefined"), true },
105            {0}, // high resolution velocity prefix (so discouraged to be used here)
106            { _("undefined"), true },
107            { _("undefined"), true },
108            { _("effect1depth") }, // "Effects 1 Depth",
109            { _("effect2depth") }, // "Effects 2 Depth",
110            { _("effect3depth") }, // "Effects 3 Depth",
111            { _("effect4depth") }, // "Effects 4 Depth",
112            { _("effect5depth") }, // "Effects 5 Depth"
113            { _("dataincrement"), true },
114            { _("datadecrement"), true },
115            {0}, // NRPN LSB (so discouraged to be used here)
116            {0}, // NRPN MSB (so discouraged to be used here)
117            {0}, // RPN LSB (so discouraged to be used here)
118            {0}, // RPN MSB (so discouraged to be used here)
119            { _("undefined"), true },
120            { _("undefined"), true },
121            { _("undefined"), true },
122            { _("undefined"), true },
123            { _("undefined"), true },
124            { _("undefined"), true },
125            { _("undefined"), true },
126            { _("undefined"), true },
127            { _("undefined"), true },
128            { _("undefined"), true },
129            { _("undefined"), true },
130            { _("undefined"), true },
131            { _("undefined"), true },
132            { _("undefined"), true },
133            { _("undefined"), true },
134            { _("undefined"), true },
135            { _("undefined"), true },
136            { _("undefined"), true } // CC 119
137            // (all other ones that follow [CC 120- CC 127] are hard coded channel
138            // mode messages, so those are discouraged to be used here)
139      };      };
140  }  }
141    
142    #define controlChangeTextsSize  (sizeof(controlChangeTexts) / sizeof(CCText))
143    
144  LabelWidget::LabelWidget(const char* labelText, Gtk::Widget& widget) :  LabelWidget::LabelWidget(const char* labelText, Gtk::Widget& widget) :
145      label(Glib::ustring(labelText) + ":"),      label(Glib::ustring(labelText) + ":"),
146      widget(widget)      widget(widget)
147  {  {
148    #if HAS_GTKMM_ALIGNMENT
149      label.set_alignment(Gtk::ALIGN_START);      label.set_alignment(Gtk::ALIGN_START);
150    #else
151        label.set_halign(Gtk::Align::START);
152    #endif
153        Settings::singleton()->showTooltips.get_proxy().signal_changed().connect(
154            sigc::mem_fun(this, &LabelWidget::on_show_tooltips_changed)
155        );
156    
157        // workaround for a crash with certain gtkmm versions: postpone calling
158        // on_show_tooltips_changed() because widget.gobj() might be uninitialized
159        // at this point yet
160        Glib::signal_idle().connect_once( // timeout starts given amount of ms after the main loop became idle again ...
161            sigc::mem_fun(*this, &LabelWidget::on_show_tooltips_changed),
162            300
163        );
164    }
165    
166    void LabelWidget::on_show_tooltips_changed() {
167        const bool b = Settings::singleton()->showTooltips;
168        label.set_has_tooltip(b);
169        widget.set_has_tooltip(b);
170  }  }
171    
172  void LabelWidget::set_sensitive(bool sensitive)  void LabelWidget::set_sensitive(bool sensitive)
# Line 86  void LabelWidget::set_sensitive(bool sen Line 175  void LabelWidget::set_sensitive(bool sen
175      widget.set_sensitive(sensitive);      widget.set_sensitive(sensitive);
176  }  }
177    
178    ReadOnlyLabelWidget::ReadOnlyLabelWidget(const char* leftHandText)
179        : LabelWidget(leftHandText, text)
180    {
181    #if HAS_GTKMM_ALIGNMENT
182        text.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
183    #else
184        label.set_halign(Gtk::Align::START);
185        label.set_valign(Gtk::Align::START);
186    #endif
187    }
188    
189    ReadOnlyLabelWidget::ReadOnlyLabelWidget(const char* leftHandText, const char* rightHandText)
190       : LabelWidget(leftHandText, text)
191    {
192    #if HAS_GTKMM_ALIGNMENT
193        text.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
194    #else
195        text.set_halign(Gtk::Align::START);
196        text.set_valign(Gtk::Align::START);
197    #endif
198        text.set_text(rightHandText);
199    }
200    
201  NumEntry::NumEntry(const char* labelText, double lower, double upper,  NumEntry::NumEntry(const char* labelText, double lower, double upper,
202                     int decimals) :                     int decimals) :
203      LabelWidget(labelText, box),      LabelWidget(labelText, box),
# Line 100  NumEntry::NumEntry(const char* labelText Line 212  NumEntry::NumEntry(const char* labelText
212      scale.set_size_request(70);      scale.set_size_request(70);
213      spinbutton.set_digits(decimals);      spinbutton.set_digits(decimals);
214      spinbutton.set_value(0);      spinbutton.set_value(0);
215        spinbutton.set_numeric();
216      scale.set_draw_value(false);      scale.set_draw_value(false);
217      box.pack_start(spinbutton, Gtk::PACK_SHRINK);      box.pack_start(spinbutton, Gtk::PACK_SHRINK);
218      box.add(scale);      box.add(scale);
219  }  }
220    
221    void NumEntry::on_show_tooltips_changed() {
222        LabelWidget::on_show_tooltips_changed();
223    
224        const bool b = Settings::singleton()->showTooltips;
225        spinbutton.set_has_tooltip(b);
226        scale.set_has_tooltip(b);
227    }
228    
229  NumEntryGain::NumEntryGain(const char* labelText,  NumEntryGain::NumEntryGain(const char* labelText,
230                             double lower, double upper,                             double lower, double upper,
231                             int decimals, double coeff) :                             int decimals, double coeff) :
# Line 155  BoolEntryPlus6::BoolEntryPlus6(const cha Line 276  BoolEntryPlus6::BoolEntryPlus6(const cha
276          sigc::mem_fun(*this, &BoolEntryPlus6::value_changed));          sigc::mem_fun(*this, &BoolEntryPlus6::value_changed));
277  }  }
278    
279    void BoolEntryPlus6::on_show_tooltips_changed() {
280        LabelWidget::on_show_tooltips_changed();
281    
282        eGain.on_show_tooltips_changed();
283    }
284    
285  void BoolEntryPlus6::value_changed()  void BoolEntryPlus6::value_changed()
286  {  {
287      if (checkbutton.get_active()) eGain.set_value(plus6value);      if (checkbutton.get_active()) eGain.set_value(plus6value);
# Line 200  void NumEntryPermille::set_value(uint16_ Line 327  void NumEntryPermille::set_value(uint16_
327  NoteEntry::NoteEntry(const char* labelText) :  NoteEntry::NoteEntry(const char* labelText) :
328      NumEntryTemp<uint8_t>(labelText)      NumEntryTemp<uint8_t>(labelText)
329  {  {
330      spinbutton.set_width_chars(4);      spin_button_show_notes(spinbutton);
331      spinbutton.signal_input().connect(  }
332          sigc::mem_fun(*this, &NoteEntry::on_input));  
333      spinbutton.signal_output().connect(  namespace {
334          sigc::mem_fun(*this, &NoteEntry::on_output));      const char* notes[] = {
335  }          _("C"), _("C#"), _("D"), _("D#"), _("E"), _("F"),_("F#"),
336            _("G"), _("G#"), _("A"), _("A#"), _("B")
337  const char* notes[] = {      };
338      _("C"), _("C#"), _("D"), _("D#"), _("E"), _("F"),_("F#"),  
339      _("G"), _("G#"), _("A"), _("A#"), _("B")      int note_value(const Glib::ustring& note, double* value)
340  };      {
341            const char* str = note.c_str();
342    
343  // Convert the Entry text to a number          int i;
344  int NoteEntry::on_input(double* new_value)          for (i = 11 ; i >= 0 ; i--) {
345  {              if (strncasecmp(str, notes[i], strlen(notes[i])) == 0) break;
346      const char* str = spinbutton.get_text().c_str();          }
347            if (i >= 0) {
348      int i;              char* endptr;
349      for (i = 11 ; i >= 0 ; i--) {              long x = strtol(str + strlen(notes[i]), &endptr, 10);
350          if (strncmp(str, notes[i], strlen(notes[i])) == 0) break;              if (endptr != str + strlen(notes[i])) {
351      }                  *value = std::max(0L, std::min(i + (x + 1) * 12, 127L));
352      if (i >= 0) {                  return true;
353          char* endptr;              }
354          long x = strtol(str + strlen(notes[i]), &endptr, 10);          } else {
355          if (endptr != str + strlen(notes[i])) {              char* endptr;
356              *new_value = i + (x + 1) * 12;              long x = strtol(str, &endptr, 10);
357              return true;              if (endptr != str) {
358                    *value = std::max(0L, std::min(x, 127L));
359                    return true;
360                }
361          }          }
362    
363    #if HAS_GTKMM_CPP11_ENUMS
364            return Gtk::SpinButton::INPUT_ERROR;
365    #else
366            return Gtk::INPUT_ERROR;
367    #endif
368      }      }
     return Gtk::INPUT_ERROR;  
369  }  }
370    
371  // Convert the Adjustment position to text  int note_value(const Glib::ustring& note)
372  bool NoteEntry::on_output()  {
373        double value = 0;
374        note_value(note, &value);
375        return value;
376    }
377    
378    Glib::ustring note_str(int note)
379  {  {
     int x = int(spinbutton.get_adjustment()->get_value() + 0.5);  
380      char buf[10];      char buf[10];
381      sprintf(buf, "%s%d", notes[x % 12], x / 12 - 1);      sprintf(buf, "%s%d", notes[note % 12], note / 12 - 1);
382      spinbutton.set_text(buf);      return buf;
383      return true;  }
384    
385    namespace {
386        // Convert the Entry text to a number
387    #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
388        int on_input(double& new_value, Gtk::SpinButton* spinbutton) {
389            return note_value(spinbutton->get_text(), &new_value);
390        }
391    #else
392        int on_input(double* new_value, Gtk::SpinButton* spinbutton) {
393            return note_value(spinbutton->get_text(), new_value);
394        }
395    #endif
396    
397        // Convert the Adjustment position to text
398        bool on_output(Gtk::SpinButton* spinbutton) {
399            spinbutton->set_text(
400                note_str(spinbutton->get_adjustment()->get_value() + 0.5));
401            return true;
402        }
403    }
404    
405    // Make a SpinButton show notes instead of numbers
406    void spin_button_show_notes(Gtk::SpinButton& spin_button)
407    {
408        spin_button.set_numeric(false);
409        spin_button.set_width_chars(4);
410        spin_button.signal_input().connect(
411            sigc::bind(sigc::ptr_fun(&on_input), &spin_button));
412        spin_button.signal_output().connect(
413            sigc::bind(sigc::ptr_fun(&on_output), &spin_button));
414    }
415    
416    void ChoiceEntryBase::on_show_tooltips_changed() {
417        LabelWidget::on_show_tooltips_changed();
418    
419        const bool b = Settings::singleton()->showTooltips;
420        combobox.set_has_tooltip(b);
421  }  }
422    
423  ChoiceEntryLeverageCtrl::ChoiceEntryLeverageCtrl(const char* labelText) :  ChoiceEntryLeverageCtrl::ChoiceEntryLeverageCtrl(const char* labelText) :
424    #if HAS_GTKMM_ALIGNMENT
425      LabelWidget(labelText, align),      LabelWidget(labelText, align),
426      align(0, 0, 0, 0)      align(0, 0, 0, 0)
427    #else
428        LabelWidget(labelText, combobox)
429    #endif
430  {  {
431      for (int i = 0 ; i < 99 ; i++) {      for (int i = 0 ; i < controlChangeTextsSize ; i++) {
432          if (controlChangeTexts[i]) {          if (controlChangeTexts[i].txt) {
433  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2              const int cc = i - 3;
434              combobox.append_text(controlChangeTexts[i]);              Glib::ustring s = (i < 3)
435                    ? controlChangeTexts[i].txt
436                    : Glib::ustring::compose("CC%1: %2%3", cc, controlChangeTexts[i].txt, controlChangeTexts[i].isExtension ? " [EXT]" : "");
437    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 24) || GTKMM_MAJOR_VERSION < 2
438                combobox.append_text(s);
439  #else  #else
440              combobox.append(controlChangeTexts[i]);              combobox.append(s);
441  #endif  #endif
442          }          }
443      }      }
444        combobox.set_wrap_width(4);
445      combobox.signal_changed().connect(      combobox.signal_changed().connect(
446          sigc::mem_fun(*this, &ChoiceEntryLeverageCtrl::value_changed));          sigc::mem_fun(*this, &ChoiceEntryLeverageCtrl::value_changed));
447    #if HAS_GTKMM_ALIGNMENT
448      align.add(combobox);      align.add(combobox);
449    #else
450        combobox.set_halign(Gtk::Align::FILL);
451        combobox.set_valign(Gtk::Align::FILL);
452    #endif
453      value.type = gig::leverage_ctrl_t::type_none;      value.type = gig::leverage_ctrl_t::type_none;
454      value.controller_number = 0;      value.controller_number = 0;
455  }  }
456    
457    void ChoiceEntryLeverageCtrl::on_show_tooltips_changed() {
458        LabelWidget::on_show_tooltips_changed();
459    
460        const bool b = Settings::singleton()->showTooltips;
461        combobox.set_has_tooltip(b);
462    }
463    
464  void ChoiceEntryLeverageCtrl::value_changed()  void ChoiceEntryLeverageCtrl::value_changed()
465  {  {
466      int rowno = combobox.get_active_row_number();      int rowno = combobox.get_active_row_number();
# Line 282  void ChoiceEntryLeverageCtrl::value_chan Line 480  void ChoiceEntryLeverageCtrl::value_chan
480      default:      default:
481          value.type = gig::leverage_ctrl_t::type_controlchange;          value.type = gig::leverage_ctrl_t::type_controlchange;
482          int x = 3;          int x = 3;
483          for (uint cc = 0 ; cc < 96 ; cc++) {          for (uint cc = 0 ; cc < controlChangeTextsSize - 3 ; cc++) {
484              if (controlChangeTexts[cc + 3]) {              if (controlChangeTexts[cc + 3].txt) {
485                  if (rowno == x) {                  if (rowno == x) {
486                      value.controller_number = cc;                      value.controller_number = cc;
487                        if (controlChangeTexts[cc + 3].isExtension &&
488                            Settings::singleton()->warnUserOnExtensions)
489                        {
490                            Glib::ustring txt = _("<b>Format Extension</b>\n\nAll controllers marked with \"<b>[EXT]</b>\" are an extension to the original gig sound format. They will only work with LinuxSampler, but they will <b>not work</b> with Gigasampler/GigaStudio!\n\n(You may disable this warning in the <i>Settings</i> menu.)");
491                            Gtk::MessageDialog msg(
492                                txt, true, Gtk::MESSAGE_WARNING
493                            );
494                            msg.run();
495                        }
496                      break;                      break;
497                  }                  }
498                  x++;                  x++;
# Line 298  void ChoiceEntryLeverageCtrl::value_chan Line 505  void ChoiceEntryLeverageCtrl::value_chan
505    
506  void ChoiceEntryLeverageCtrl::set_value(gig::leverage_ctrl_t value)  void ChoiceEntryLeverageCtrl::set_value(gig::leverage_ctrl_t value)
507  {  {
508      int x;      int comboIndex;
509      switch (value.type)      switch (value.type)
510      {      {
511      case gig::leverage_ctrl_t::type_none:      case gig::leverage_ctrl_t::type_none:
512          x = 0;          comboIndex = 0;
513          break;          break;
514      case gig::leverage_ctrl_t::type_channelaftertouch:      case gig::leverage_ctrl_t::type_channelaftertouch:
515          x = 1;          comboIndex = 1;
516          break;          break;
517      case gig::leverage_ctrl_t::type_velocity:      case gig::leverage_ctrl_t::type_velocity:
518          x = 2;          comboIndex = 2;
519          break;          break;
520      case gig::leverage_ctrl_t::type_controlchange:      case gig::leverage_ctrl_t::type_controlchange: {
521          x = -1;          comboIndex = -1;
522          for (uint cc = 0 ; cc < 96 ; cc++) {          int x = 3;
523              if (controlChangeTexts[cc + 3]) {          for (uint cc = 0 ; cc < controlChangeTextsSize - 3 ; cc++) {
524                  x++;              if (controlChangeTexts[cc + 3].txt) {
525                  if (value.controller_number == cc) {                  if (value.controller_number == cc) {
526                      x += 3;                      comboIndex = x;
527                      break;                      break;
528                  }                  }
529                    x++;
530              }              }
531          }          }
532          break;          break;
533        }
534      default:      default:
535          x = -1;          comboIndex = -1;
536          break;          break;
537      }      }
538      combobox.set_active(x);      combobox.set_active(comboIndex);
539    }
540    
541    
542    BoolBox::BoolBox(const char* labelText) : Gtk::CheckButton(labelText) {
543        signal_toggled().connect(sig_changed.make_slot());
544        Settings::singleton()->showTooltips.get_proxy().signal_changed().connect(
545            sigc::mem_fun(this, &BoolBox::on_show_tooltips_changed)
546        );
547        on_show_tooltips_changed();
548    }
549    
550    void BoolBox::on_show_tooltips_changed() {
551        const bool b = Settings::singleton()->showTooltips;
552        set_has_tooltip(b);
553  }  }
554    
555    
# Line 379  void StringEntryMultiLine::set_value(con Line 602  void StringEntryMultiLine::set_value(con
602      text_buffer->set_text(text);      text_buffer->set_text(text);
603  }  }
604    
605    void StringEntryMultiLine::on_show_tooltips_changed() {
606        LabelWidget::on_show_tooltips_changed();
607    
608        const bool b = Settings::singleton()->showTooltips;
609        text_view.set_has_tooltip(b);
610    }
611    
612    
613  Table::Table(int x, int y) : Gtk::Table(x, y), rowno(0) {  }  Table::Table(int x, int y) :
614    #if USE_GTKMM_GRID
615        Gtk::Grid(),
616        cols(x),
617    #else
618        Gtk::Table(x, y),
619    #endif
620        rowno(0)
621    {
622    }
623    
624  void Table::add(BoolEntry& boolentry)  void Table::add(BoolEntry& boolentry)
625  {  {
626    #if USE_GTKMM_GRID
627        attach(boolentry.widget, 0, rowno, 2);
628    #else
629      attach(boolentry.widget, 0, 2, rowno, rowno + 1,      attach(boolentry.widget, 0, 2, rowno, rowno + 1,
630             Gtk::FILL, Gtk::SHRINK);             Gtk::FILL, Gtk::SHRINK);
631    #endif
632      rowno++;      rowno++;
633  }  }
634    
635  void Table::add(BoolEntryPlus6& boolentry)  void Table::add(BoolEntryPlus6& boolentry)
636  {  {
637    #if USE_GTKMM_GRID
638        attach(boolentry.widget, 0, rowno, 2);
639    #else
640      attach(boolentry.widget, 0, 2, rowno, rowno + 1,      attach(boolentry.widget, 0, 2, rowno, rowno + 1,
641             Gtk::FILL, Gtk::SHRINK);             Gtk::FILL, Gtk::SHRINK);
642    #endif
643      rowno++;      rowno++;
644  }  }
645    
646  void Table::add(LabelWidget& prop)  void Table::add(LabelWidget& prop)
647  {  {
648    #if USE_GTKMM_GRID
649        attach(prop.label, 1, rowno);
650        attach(prop.widget, 2, rowno);
651    #else
652      attach(prop.label, 1, 2, rowno, rowno + 1,      attach(prop.label, 1, 2, rowno, rowno + 1,
653             Gtk::FILL, Gtk::SHRINK);             Gtk::FILL, Gtk::SHRINK);
654      attach(prop.widget, 2, 3, rowno, rowno + 1,      attach(prop.widget, 2, 3, rowno, rowno + 1,
655             Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);             Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
656    #endif
657      rowno++;      rowno++;
658  }  }

Legend:
Removed from v.2446  
changed lines
  Added in v.3460

  ViewVC Help
Powered by ViewVC