X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Ffaderport%2Fgui.cc;h=186fbd04e96e6d73420a06bc55ddec57894608ee;hb=e52c8e376a068c11a9a771a15977a65c067c71e6;hp=78f7ec5bc0979cd246d82c56963cce1645f37142;hpb=03a4926790b04d4f3929e88240fcddca76f24fd4;p=ardour.git diff --git a/libs/surfaces/faderport/gui.cc b/libs/surfaces/faderport/gui.cc index 78f7ec5bc0..186fbd04e9 100644 --- a/libs/surfaces/faderport/gui.cc +++ b/libs/surfaces/faderport/gui.cc @@ -25,7 +25,7 @@ #include "pbd/strsplit.h" #include "pbd/file_utils.h" -#include "gtkmm2ext/actions.h" +#include "gtkmm2ext/bindings.h" #include "gtkmm2ext/gtk_ui.h" #include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/utils.h" @@ -36,7 +36,7 @@ #include "faderport.h" #include "gui.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace PBD; using namespace ARDOUR; @@ -80,7 +80,7 @@ FaderPort::build_gui () FPGUI::FPGUI (FaderPort& p) : fp (p) , table (2, 5) - , action_table (4, 4) + , action_table (5, 4) , ignore_active_change (false) { set_border_width (12); @@ -138,9 +138,16 @@ FPGUI::FPGUI (FaderPort& p) build_available_action_menu (); + build_foot_action_combo (foot_combo[0], FaderPort::ButtonState(0)); + build_foot_action_combo (foot_combo[1], FaderPort::ShiftDown); + build_foot_action_combo (foot_combo[2], FaderPort::LongPress); + + /* No shift-press combo for User because that is labelled as "next" + * (marker) + */ + build_user_action_combo (user_combo[0], FaderPort::ButtonState(0)); - build_user_action_combo (user_combo[1], FaderPort::ShiftDown); - build_user_action_combo (user_combo[2], FaderPort::LongPress); + build_user_action_combo (user_combo[1], FaderPort::LongPress); action_table.set_row_spacings (4); action_table.set_col_spacings (6); @@ -225,13 +232,28 @@ FPGUI::FPGUI (FaderPort& p) align->set (0.0, 0.5); align->add (user_combo[0]); action_table.attach (*align, 1, 2, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); + /* skip shift press combo */ align = manage (new Alignment); align->set (0.0, 0.5); align->add (user_combo[1]); + action_table.attach (*align, 3, 4, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); + action_row++; + + l = manage (new Gtk::Label); + l->set_markup (string_compose ("%1", _("Footswitch"))); + l->set_alignment (1.0, 0.5); + action_table.attach (*l, 0, 1, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); + align = manage (new Alignment); + align->set (0.0, 0.5); + align->add (foot_combo[0]); + action_table.attach (*align, 1, 2, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); + align = manage (new Alignment); + align->set (0.0, 0.5); + align->add (foot_combo[1]); action_table.attach (*align, 2, 3, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); align = manage (new Alignment); align->set (0.0, 0.5); - align->add (user_combo[2]); + align->add (foot_combo[2]); action_table.attach (*align, 3, 4, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); action_row++; @@ -335,12 +357,14 @@ FPGUI::build_available_action_menu () vector labels; vector tooltips; vector keys; - vector bindings; + vector > actions; + + Gtkmm2ext::ActionMap::get_all_actions (paths, labels, tooltips, keys, actions); + typedef std::map NodeMap; NodeMap nodes; NodeMap::iterator r; - ActionManager::get_all_actions (labels, paths, tooltips, keys, bindings); vector::iterator k; vector::iterator p; @@ -349,14 +373,14 @@ FPGUI::build_available_action_menu () available_action_model->clear (); - /* Because there are button bindings built in that are not - in the key binding map, there needs to be a way to undo - a profile edit. */ TreeIter rowp; TreeModel::Row parent; + + /* Disabled item (row 0) */ + rowp = available_action_model->append(); parent = *(rowp); - parent[action_columns.name] = _("Remove Binding"); + parent[action_columns.name] = _("Disabled"); /* Key aliasing */ @@ -495,7 +519,9 @@ FPGUI::build_mix_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs) { vector > actions; - actions.push_back (make_pair (string (_("Toggle Editor & Mixer Windows")), string (X_("Common/toggle-editor-mixer")))); + actions.push_back (make_pair (string (_("Show Mixer Window")), string (X_("Window/show-mixer")))); + actions.push_back (make_pair (string (_("Show/Hide Mixer list")), string (X_("Common/ToggleMixerList")))); + actions.push_back (make_pair (string("Toggle Meterbridge"), string(X_("Common/toggle-meterbridge")))); actions.push_back (make_pair (string (_("Show/Hide Editor mixer strip")), string (X_("Editor/show-editor-mixer")))); build_action_combo (cb, actions, FaderPort::Mix, bs); @@ -506,12 +532,14 @@ FPGUI::build_proj_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs) { vector > actions; - actions.push_back (make_pair (string("Toggle Meterbridge"), string(X_("Common/toggle-meterbridge")))); - actions.push_back (make_pair (string("Toggle Summary"), string(X_("Editor/ToggleSummary")))); + actions.push_back (make_pair (string (_("Show Editor Window")), string (X_("Mixer/show-editor")))); actions.push_back (make_pair (string("Toggle Editor Lists"), string(X_("Editor/show-editor-list")))); + actions.push_back (make_pair (string("Toggle Summary"), string(X_("Editor/ToggleSummary")))); + actions.push_back (make_pair (string("Toggle Meterbridge"), string(X_("Common/toggle-meterbridge")))); actions.push_back (make_pair (string (_("Zoom to Session")), string (X_("Editor/zoom-to-session")))); - actions.push_back (make_pair (string (_("Zoom In")), string (X_("Editor/temporal-zoom-in")))); - actions.push_back (make_pair (string (_("Zoom Out")), string (X_("Editor/temporal-zoom-out")))); + +// actions.push_back (make_pair (string (_("Zoom In")), string (X_("Editor/temporal-zoom-in")))); +// actions.push_back (make_pair (string (_("Zoom Out")), string (X_("Editor/temporal-zoom-out")))); build_action_combo (cb, actions, FaderPort::Proj, bs); } @@ -521,20 +549,72 @@ FPGUI::build_trns_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs) { vector > actions; - actions.push_back (make_pair (string("Toggle Locations"), string(X_("Window/toggle-locations")))); + actions.push_back (make_pair (string("Toggle Big Clock"), string(X_("Window/toggle-big-clock")))); //note: this would really make sense if the Big Clock had transport buttons on it + actions.push_back (make_pair (string("Toggle Locations window"), string(X_("Window/toggle-locations")))); actions.push_back (make_pair (string("Toggle Metronome"), string(X_("Transport/ToggleClick")))); - actions.push_back (make_pair (string("Toggle Sync"), string(X_("Transport/ToggleExternalSync")))); - actions.push_back (make_pair (string("Set Playhead @pointer"), string(X_("Editor/set-playhead")))); + actions.push_back (make_pair (string("Toggle External Sync"), string(X_("Transport/ToggleExternalSync")))); + actions.push_back (make_pair (string("Toggle Follow Playhead"), string(X_("Editor/toggle-follow-playhead")))); + +// actions.push_back (make_pair (string("Set Playhead @pointer"), string(X_("Editor/set-playhead")))); + build_action_combo (cb, actions, FaderPort::Trns, bs); } +void +FPGUI::build_foot_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs) +{ + vector > actions; + + actions.push_back (make_pair (string("Toggle Roll"), string(X_("Transport/ToggleRoll")))); + actions.push_back (make_pair (string("Toggle Rec-Enable"), string(X_("Transport/Record")))); + actions.push_back (make_pair (string("Toggle Roll+Rec"), string(X_("Transport/record-roll")))); + actions.push_back (make_pair (string("Toggle Loop"), string(X_("Transport/Loop")))); + actions.push_back (make_pair (string("Toggle Click"), string(X_("Transport/ToggleClick")))); + + build_action_combo (cb, actions, FaderPort::Footswitch, bs); +} + +bool +FPGUI::find_action_in_model (const TreeModel::iterator& iter, std::string const & action_path, TreeModel::iterator* found) +{ + TreeModel::Row row = *iter; + string path = row[action_columns.path]; + + if (path == action_path) { + *found = iter; + return true; + } + + return false; +} + void FPGUI::build_user_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs) { 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)); + + /* set the active "row" to the right value for the current button binding */ + + string current_action = fp.get_action (FaderPort::User, false, bs); /* lookup release action */ + + if (current_action.empty()) { + cb.set_active (0); /* "disabled" */ + return; + } + + TreeModel::iterator iter = available_action_model->children().end(); + + available_action_model->foreach_iter (sigc::bind (sigc::mem_fun (*this, &FPGUI::find_action_in_model), current_action, &iter)); + + if (iter != available_action_model->children().end()) { + cb.set_active (iter); + } else { + cb.set_active (0); + } + } Glib::RefPtr