diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-29 21:31:14 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-29 21:31:14 +0000 |
commit | 77cc0f7cc84df5e242898cef0abb7d633de64d8c (patch) | |
tree | 71ec1c03dec23ac52949138cf8b5f7a1afb8e5ba /gtk2_ardour/rc_option_editor.cc | |
parent | e10d0339ccd3659e0de58db29131e528571bc8c4 (diff) |
editors for control protocols (generalized); editor for Generic MIDI that allows choosing a MIDI binding map (or none); support banking in binding URLs, and other miscellany related to generic MIDI; save+restore JACK_MidiPort connection state (but cause a crash at shutdown time)
git-svn-id: svn://localhost/ardour2/branches/3.0@6411 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/rc_option_editor.cc')
-rw-r--r-- | gtk2_ardour/rc_option_editor.cc | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 4a5bce4674..e35ec0026d 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -765,7 +765,8 @@ private: class ControlSurfacesOptions : public OptionEditorBox { public: - ControlSurfacesOptions () + ControlSurfacesOptions (ArdourDialog& parent) + : _parent (parent) { _store = ListStore::create (_model); _view.set_model (_store); @@ -777,7 +778,13 @@ public: _box->pack_start (_view, false, false); + Label* label = manage (new Label (_("Double-click on a name to edit settings for an enabled protocol"))); + + _box->pack_start (*label, false, false); + label->show (); + _store->signal_row_changed().connect (sigc::mem_fun (*this, &ControlSurfacesOptions::model_changed)); + _view.signal_button_press_event().connect_notify (sigc::mem_fun(*this, &ControlSurfacesOptions::edit_clicked)); } void parameter_changed (std::string const &) @@ -832,6 +839,38 @@ private: } } + void edit_clicked (GdkEventButton* ev) + { + if (ev->type != GDK_2BUTTON_PRESS) { + return; + } + + std::string name; + ControlProtocolInfo* cpi; + TreeModel::Row row; + + row = *(_view.get_selection()->get_selected()); + + Window* win = row[_model.editor]; + if (win && !win->is_visible()) { + win->present (); + } else { + cpi = row[_model.protocol_info]; + + if (cpi && cpi->protocol && cpi->protocol->has_editor ()) { + Box* box = (Box*) cpi->protocol->get_gui (); + if (box) { + string title = row[_model.name]; + ArdourDialog* win = new ArdourDialog (_parent, title); + win->get_vbox()->pack_start (*box, false, false); + box->show (); + win->present (); + row[_model.editor] = win; + } + } + } + } + class ControlSurfacesModelColumns : public TreeModelColumnRecord { public: @@ -842,17 +881,20 @@ private: add (enabled); add (feedback); add (protocol_info); + add (editor); } TreeModelColumn<string> name; TreeModelColumn<bool> enabled; TreeModelColumn<bool> feedback; TreeModelColumn<ControlProtocolInfo*> protocol_info; + TreeModelColumn<Gtk::Window*> editor; }; Glib::RefPtr<ListStore> _store; ControlSurfacesModelColumns _model; TreeView _view; + Gtk::Window& _parent; }; @@ -1355,7 +1397,7 @@ RCOptionEditor::RCOptionEditor () /* CONTROL SURFACES */ - add_option (_("Control surfaces"), new ControlSurfacesOptions); + add_option (_("Control surfaces"), new ControlSurfacesOptions (*this)); ComboOption<RemoteModel>* rm = new ComboOption<RemoteModel> ( "remote-model", |