summaryrefslogtreecommitdiff
path: root/libs/surfaces/us2400
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-02-20 12:53:13 -0700
committerPaul Davis <paul@linuxaudiosystems.com>2020-02-20 12:53:57 -0700
commit2398f6127fd5db23cacdf828144f20f237874b95 (patch)
treed8e43c5e6cb46f0484a9942418e3adae2cb60322 /libs/surfaces/us2400
parent444ef73c7de0839b015d9da81404f8a4293f831b (diff)
fix up apparent design thinkos in US2400 key binding handler
Diffstat (limited to 'libs/surfaces/us2400')
-rw-r--r--libs/surfaces/us2400/gui.cc23
-rw-r--r--libs/surfaces/us2400/gui.h4
2 files changed, 15 insertions, 12 deletions
diff --git a/libs/surfaces/us2400/gui.cc b/libs/surfaces/us2400/gui.cc
index 6fe51c9988..16eec80cec 100644
--- a/libs/surfaces/us2400/gui.cc
+++ b/libs/surfaces/us2400/gui.cc
@@ -353,7 +353,7 @@ US2400ProtocolGUI::make_action_renderer (Glib::RefPtr<TreeStore> model, Gtk::Tre
renderer->property_editable() = true;
renderer->property_text_column() = 0;
renderer->property_has_entry() = false;
- renderer->signal_edited().connect (sigc::bind (sigc::mem_fun(*this, &US2400ProtocolGUI::action_changed), column));
+ renderer->signal_changed().connect (sigc::bind (sigc::mem_fun(*this, &US2400ProtocolGUI::action_changed), column));
return renderer;
}
@@ -437,26 +437,31 @@ US2400ProtocolGUI::refresh_function_key_editor ()
}
void
-US2400ProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib::ustring &text, TreeModelColumnBase col)
+US2400ProtocolGUI::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
@@ -467,7 +472,7 @@ US2400ProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib::ustri
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
@@ -499,7 +504,7 @@ US2400ProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib::ustri
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/us2400/gui.h b/libs/surfaces/us2400/gui.h
index 2adb690093..a6baad6b8b 100644
--- a/libs/surfaces/us2400/gui.h
+++ b/libs/surfaces/us2400/gui.h
@@ -106,13 +106,11 @@ class US2400ProtocolGUI : 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 profile_combo_changed ();
- std::map<std::string,std::string> action_map; // map from action names to paths
-
Gtk::Widget* device_dependent_widget ();
Gtk::Widget* _device_dependent_widget;
int device_dependent_row;