From 8cbbd3dd00af150ac6b4f2f33771fa12b4a36f21 Mon Sep 17 00:00:00 2001 From: Johannes Mueller Date: Fri, 19 Apr 2019 20:35:40 +0200 Subject: [PATCH] Fadeport: Fix User button state save and restore Since we (since ddfc37e4) set the UserDown flag for the User button actions, we need to set it also when we lookup actions when saving the state. Furthermore, we need also look for the UserDown flag, when we set the state of the configuration combos for the User button. --- libs/surfaces/faderport/faderport.cc | 7 ++++++- libs/surfaces/faderport/gui.cc | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/surfaces/faderport/faderport.cc b/libs/surfaces/faderport/faderport.cc index da2792dbd5..e828b5773f 100644 --- a/libs/surfaces/faderport/faderport.cc +++ b/libs/surfaces/faderport/faderport.cc @@ -925,7 +925,7 @@ FaderPort::connected () _output_port->write (buf, 6, 0); } -bool +bool FaderPort::Button::invoke (FaderPort::ButtonState bs, bool press) { DEBUG_TRACE (DEBUG::FaderPort, string_compose ("invoke button %1 for %2 state %3%4%5\n", id, (press ? "press":"release"), hex, bs, dec)); @@ -1102,6 +1102,11 @@ FaderPort::Button::get_state () const state_pairs.push_back (make_pair (string ("shift"), ShiftDown)); state_pairs.push_back (make_pair (string ("long"), LongPress)); +#ifndef MIXBUS + state_pairs.push_back (make_pair (string ("plain"), UserDown)); + state_pairs.push_back (make_pair (string ("long"), ButtonState (LongPress | UserDown))); +#endif + for (vector::const_iterator sp = state_pairs.begin(); sp != state_pairs.end(); ++sp) { if ((x = on_press.find (sp->second)) != on_press.end()) { if (x->second.type == NamedAction) { diff --git a/libs/surfaces/faderport/gui.cc b/libs/surfaces/faderport/gui.cc index e428da44f0..5040b925cb 100644 --- a/libs/surfaces/faderport/gui.cc +++ b/libs/surfaces/faderport/gui.cc @@ -589,6 +589,9 @@ FPGUI::find_action_in_model (const TreeModel::iterator& iter, std::string const void FPGUI::build_user_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs) { +#ifndef MIXBUS + bs = FaderPort::ButtonState (bs|FaderPort::UserDown); +#endif cb.set_model (available_action_model); cb.pack_start (action_columns.name); cb.signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &FPGUI::action_changed), &cb, FaderPort::User, bs));