/[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 3623 by persson, Sat Feb 2 17:53:36 2019 UTC revision 3624 by schoenebeck, Wed Oct 2 17:11:30 2019 UTC
# Line 137  namespace { Line 137  namespace {
137          // (all other ones that follow [CC 120- CC 127] are hard coded channel          // (all other ones that follow [CC 120- CC 127] are hard coded channel
138          // mode messages, so those are discouraged to be used here)          // mode messages, so those are discouraged to be used here)
139      };      };
140        static const char* const lfoWaveTexts[] = {
141            _("Sine"),
142            _("Triangle"),
143            _("Saw"),
144            _("Square"),
145        };
146  }  }
147    
148  #define controlChangeTextsSize  (sizeof(controlChangeTexts) / sizeof(CCText))  #define controlChangeTextsSize  (sizeof(controlChangeTexts) / sizeof(CCText))
149    #define lfoWaveTextsSize        (sizeof(lfoWaveTexts) / sizeof(char*))
150    
151  LabelWidget::LabelWidget(const char* labelText, Gtk::Widget& widget) :  LabelWidget::LabelWidget(const char* labelText, Gtk::Widget& widget) :
152      label(Glib::ustring(labelText) + ":"),      label(Glib::ustring(labelText) + ":"),
# Line 461  void ChoiceEntryLeverageCtrl::on_show_to Line 468  void ChoiceEntryLeverageCtrl::on_show_to
468      combobox.set_has_tooltip(b);      combobox.set_has_tooltip(b);
469  }  }
470    
471    static void _showGigFormatExtWarning() {
472        if (!Settings::singleton()->warnUserOnExtensions) return;
473        Glib::ustring txt =
474            _("<b>Format Extension</b>\n\nAll options 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.)");
475        Gtk::MessageDialog msg(txt, true, Gtk::MESSAGE_WARNING);
476        msg.run();
477    }
478    
479  void ChoiceEntryLeverageCtrl::value_changed()  void ChoiceEntryLeverageCtrl::value_changed()
480  {  {
481      int rowno = combobox.get_active_row_number();      int rowno = combobox.get_active_row_number();
# Line 484  void ChoiceEntryLeverageCtrl::value_chan Line 499  void ChoiceEntryLeverageCtrl::value_chan
499              if (controlChangeTexts[cc + 3].txt) {              if (controlChangeTexts[cc + 3].txt) {
500                  if (rowno == x) {                  if (rowno == x) {
501                      value.controller_number = cc;                      value.controller_number = cc;
502                      if (controlChangeTexts[cc + 3].isExtension &&                      if (controlChangeTexts[cc + 3].isExtension) {
503                          Settings::singleton()->warnUserOnExtensions)                          _showGigFormatExtWarning();
                     {  
                         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.)");  
                         Gtk::MessageDialog msg(  
                             txt, true, Gtk::MESSAGE_WARNING  
                         );  
                         msg.run();  
504                      }                      }
505                      break;                      break;
506                  }                  }
# Line 537  void ChoiceEntryLeverageCtrl::set_value( Line 546  void ChoiceEntryLeverageCtrl::set_value(
546      }      }
547      combobox.set_active(comboIndex);      combobox.set_active(comboIndex);
548  }  }
549    
550    
551    ChoiceEntryLfoWave::ChoiceEntryLfoWave(const char* labelText) :
552    #if HAS_GTKMM_ALIGNMENT
553        LabelWidget(labelText, align),
554        align(0, 0, 0, 0)
555    #else
556        LabelWidget(labelText, combobox)
557    #endif
558    {
559        for (int i = 0 ; i < lfoWaveTextsSize; i++) {
560            if (lfoWaveTexts[i]) {
561                Glib::ustring s = (i == 0)
562                    ? lfoWaveTexts[i]
563                    : Glib::ustring::compose("%1 [EXT]", lfoWaveTexts[i]);
564    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 24) || GTKMM_MAJOR_VERSION < 2
565                combobox.append_text(s);
566    #else
567                combobox.append(s);
568    #endif
569            }
570        }
571        //combobox.set_wrap_width(4);
572        combobox.signal_changed().connect(
573            sigc::mem_fun(*this, &ChoiceEntryLfoWave::value_changed));
574    #if HAS_GTKMM_ALIGNMENT
575        align.add(combobox);
576    #else
577        combobox.set_halign(Gtk::Align::FILL);
578        combobox.set_valign(Gtk::Align::FILL);
579    #endif
580        value = gig::lfo_wave_sine;
581    }
582    
583    void ChoiceEntryLfoWave::on_show_tooltips_changed() {
584        LabelWidget::on_show_tooltips_changed();
585    
586        const bool b = Settings::singleton()->showTooltips;
587        combobox.set_has_tooltip(b);
588    }
589    
590    void ChoiceEntryLfoWave::value_changed() {
591        const int rowno = combobox.get_active_row_number();
592        switch (rowno) {
593            case -1:
594                break;
595            case 0:
596                value = gig::lfo_wave_sine;
597                break;
598            case 1:
599                value = gig::lfo_wave_triangle;
600                _showGigFormatExtWarning();
601                break;
602            case 2:
603                value = gig::lfo_wave_saw;
604                _showGigFormatExtWarning();
605                break;
606            case 3:
607                value = gig::lfo_wave_square;
608                _showGigFormatExtWarning();
609                break;
610        }
611        if (rowno >= 0) sig_changed();
612    }
613    
614    void ChoiceEntryLfoWave::set_value(gig::lfo_wave_t value) {
615        int comboIndex;
616        switch (value) {
617            case gig::lfo_wave_sine:
618                comboIndex = 0;
619                break;
620            case gig::lfo_wave_triangle:
621                comboIndex = 1;
622                break;
623            case gig::lfo_wave_saw:
624                comboIndex = 2;
625                break;
626            case gig::lfo_wave_square:
627                comboIndex = 3;
628                break;
629            default:
630                comboIndex = -1;
631                break;
632        }
633        combobox.set_active(comboIndex);
634    }
635    
636    
637  BoolBox::BoolBox(const char* labelText) : Gtk::CheckButton(labelText) {  BoolBox::BoolBox(const char* labelText) : Gtk::CheckButton(labelText) {

Legend:
Removed from v.3623  
changed lines
  Added in v.3624

  ViewVC Help
Powered by ViewVC