diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2020-02-20 12:52:54 -0700 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2020-02-20 12:53:57 -0700 |
commit | 444ef73c7de0839b015d9da81404f8a4293f831b (patch) | |
tree | d402c5a01829555f76caedf94e5b294921c44a8d /libs/surfaces/mackie | |
parent | 938e65f12a502b51873f851c9e02d097c511b40c (diff) |
fix up apparent design thinkos in Mackie key binding handler
Diffstat (limited to 'libs/surfaces/mackie')
-rw-r--r-- | libs/surfaces/mackie/gui.cc | 23 | ||||
-rw-r--r-- | libs/surfaces/mackie/gui.h | 4 |
2 files changed, 15 insertions, 12 deletions
diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc index 74e314b2e7..8f734a3539 100644 --- a/libs/surfaces/mackie/gui.cc +++ b/libs/surfaces/mackie/gui.cc @@ -441,7 +441,7 @@ MackieControlProtocolGUI::make_action_renderer (Glib::RefPtr<TreeStore> model, G renderer->property_editable() = true; renderer->property_text_column() = 0; renderer->property_has_entry() = false; - renderer->signal_edited().connect (sigc::bind (sigc::mem_fun(*this, &MackieControlProtocolGUI::action_changed), column)); + renderer->signal_changed().connect (sigc::bind (sigc::mem_fun(*this, &MackieControlProtocolGUI::action_changed), column)); return renderer; } @@ -633,26 +633,31 @@ MackieControlProtocolGUI::refresh_function_key_editor () } void -MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib::ustring &text, TreeModelColumnBase col) +MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const TreeModel::iterator & iter, TreeModelColumnBase col) { + string action_path = (*iter)[action_model.columns().path]; + // Remove Binding is not in the action map but still valid - bool remove (false); - if ( text == "Remove Binding") { + + bool remove = false; + + if (action_path == "Remove Binding") { remove = true; } + Gtk::TreePath path(sPath); Gtk::TreeModel::iterator row = function_key_model->get_iter(path); if (row) { - std::map<std::string,std::string>::iterator i = action_map.find (text); + Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (action_path, false); - if (i == action_map.end()) { + if (!act) { + cerr << action_path << " not found in action map\n"; if (!remove) { return; } } - Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (i->second, false); if (act || remove) { /* update visible text, using string supplied by @@ -663,7 +668,7 @@ MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib Glib::ustring dot = "\u2022"; (*row).set_value (col.index(), dot); } else { - (*row).set_value (col.index(), text); + (*row).set_value (col.index(), act->get_label()); } /* update the current DeviceProfile, using the full @@ -695,7 +700,7 @@ MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib if (remove) { _cp.device_profile().set_button_action ((*row)[function_key_columns.id], modifier, ""); } else { - _cp.device_profile().set_button_action ((*row)[function_key_columns.id], modifier, i->second); + _cp.device_profile().set_button_action ((*row)[function_key_columns.id], modifier, action_path); } _ignore_profile_changed = true; diff --git a/libs/surfaces/mackie/gui.h b/libs/surfaces/mackie/gui.h index 56313cde47..390a4bbfe5 100644 --- a/libs/surfaces/mackie/gui.h +++ b/libs/surfaces/mackie/gui.h @@ -106,15 +106,13 @@ class MackieControlProtocolGUI : public Gtk::Notebook void refresh_function_key_editor (); void build_function_key_editor (); - void action_changed (const Glib::ustring &sPath, const Glib::ustring &text, Gtk::TreeModelColumnBase); + void action_changed (const Glib::ustring &sPath, const Gtk::TreeModel::iterator &, Gtk::TreeModelColumnBase); Gtk::CellRendererCombo* make_action_renderer (Glib::RefPtr<Gtk::TreeStore> model, Gtk::TreeModelColumnBase); void surface_combo_changed (); void profile_combo_changed (); void ipmidi_spinner_changed (); - std::map<std::string,std::string> action_map; // map from action names to paths - Gtk::CheckButton relay_click_button; Gtk::CheckButton backlight_button; Gtk::RadioButton absolute_touch_mode_button; |