diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index fa90fa9935..0ac64bff41 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -53,6 +53,7 @@ #include "ardour/clip_library.h" #include "ardour/control_protocol_manager.h" #include "ardour/dB.h" +#include "ardour/parameter_descriptor.h" #include "ardour/port_manager.h" #include "ardour/plugin_manager.h" #include "ardour/profile.h" @@ -3425,6 +3426,19 @@ These settings will only take effect after %1 is restarted.\n\ add_option (_("MIDI"), vkeybdlayout); + add_option (_("MIDI"), new OptionEditorHeading (_("Default Visible Note Range"))); + + mrl_option = new EntryOption ("lower-midi-note", _("Default lower visible MIDI note"), + sigc::mem_fun (*this, &RCOptionEditor::get_default_lower_midi_note), + sigc::mem_fun (*this, &RCOptionEditor::set_default_lower_midi_note)); + + mru_option = new EntryOption ("lower-midi-note", _("Default upper visible MIDI note"), + sigc::mem_fun (*this, &RCOptionEditor::get_default_upper_midi_note), + sigc::mem_fun (*this, &RCOptionEditor::set_default_upper_midi_note)); + + add_option (_("MIDI"), mrl_option); + add_option (_("MIDI"), mru_option); + /* MIDI PORTs */ add_option (_("MIDI"), new OptionEditorHeading (_("MIDI Port Options"))); @@ -4880,3 +4894,41 @@ RCOptionEditor::get_state () const node->add_child_nocopy (Tabbable::get_state()); return *node; } + +std::string +RCOptionEditor::get_default_lower_midi_note () +{ + return ParameterDescriptor::midi_note_name (UIConfiguration::instance().get_default_lower_midi_note()); +} + +bool +RCOptionEditor::set_default_lower_midi_note (std::string str) +{ + int note = ParameterDescriptor::midi_note_num (str); + + if (note < 0) { + mru_option->set_state_from_config (); + return false; + } + + return UIConfiguration::instance().set_default_lower_midi_note (note); +} + +std::string +RCOptionEditor::get_default_upper_midi_note () +{ + return ParameterDescriptor::midi_note_name (UIConfiguration::instance().get_default_upper_midi_note()); +} + +bool +RCOptionEditor::set_default_upper_midi_note (std::string str) +{ + int note = ParameterDescriptor::midi_note_num (str); + + if (note < 0) { + mru_option->set_state_from_config (); + return false; + } + + return UIConfiguration::instance().set_default_upper_midi_note (note); +} diff --git a/gtk2_ardour/rc_option_editor.h b/gtk2_ardour/rc_option_editor.h index 6d0d7f9bf4..f1b1cdce82 100644 --- a/gtk2_ardour/rc_option_editor.h +++ b/gtk2_ardour/rc_option_editor.h @@ -70,6 +70,13 @@ private: void reset_clip_library_dir (); + EntryOption* mrl_option; + EntryOption* mru_option; + std::string get_default_lower_midi_note (); + bool set_default_lower_midi_note (std::string); + std::string get_default_upper_midi_note (); + bool set_default_upper_midi_note (std::string); + /* plugin actions */ void plugin_scan_refresh (); void plugin_reset_stats ();