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.
This commit is contained in:
Johannes Mueller 2019-04-19 20:35:40 +02:00
parent 23b196952b
commit 8cbbd3dd00
2 changed files with 9 additions and 1 deletions

View file

@ -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<state_pair_t>::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) {

View file

@ -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));