remove "medium-length" press concept from faderport code and GUI

This commit is contained in:
Paul Davis 2015-12-01 09:23:02 -05:00
parent 3b4df61d83
commit daf02e8c73
4 changed files with 22 additions and 47 deletions

View file

@ -714,9 +714,7 @@ void
FaderPort::Button::invoke (FaderPort::ButtonState bs, bool press)
{
if (!press) {
if (long_press == 1) {
bs = FaderPort::ButtonState (bs | LongishPress);
} else if (long_press == 2) {
if (long_press) {
bs = FaderPort::ButtonState (bs | LongPress);
}
}
@ -753,16 +751,14 @@ FaderPort::Button::do_timing (bool press)
{
if (press) {
pressed_at = get_microseconds ();
long_press = 0;
long_press = false;
} else {
if (pressed_at > 0) {
const ARDOUR::microseconds_t delta = ARDOUR::get_microseconds () - pressed_at;
if (delta < 500000) {
long_press = 0;
} else if (delta < 1000000) {
long_press = 1;
if (delta < 1000000) {
long_press = false;
} else {
long_press = 2;
long_press = true;
}
pressed_at = 0;
}
@ -873,7 +869,6 @@ FaderPort::Button::set_state (XMLNode const& node)
state_pairs.push_back (make_pair (string ("plain"), ButtonState (0)));
state_pairs.push_back (make_pair (string ("shift"), ShiftDown));
state_pairs.push_back (make_pair (string ("longish"), LongishPress));
state_pairs.push_back (make_pair (string ("long"), LongPress));
on_press.clear ();
@ -914,7 +909,6 @@ FaderPort::Button::get_state () const
state_pairs.push_back (make_pair (string ("plain"), ButtonState (0)));
state_pairs.push_back (make_pair (string ("shift"), ShiftDown));
state_pairs.push_back (make_pair (string ("longish"), LongishPress));
state_pairs.push_back (make_pair (string ("long"), LongPress));
for (vector<state_pair_t>::const_iterator sp = state_pairs.begin(); sp != state_pairs.end(); ++sp) {

View file

@ -151,8 +151,7 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
RewindDown = 0x2,
StopDown = 0x4,
UserDown = 0x8,
LongishPress = 0x10,
LongPress = 0x20
LongPress = 0x10
};
void set_action (ButtonID, std::string const& action_name, bool on_press, FaderPort::ButtonState = ButtonState (0));
@ -217,7 +216,7 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
, led_on (false)
, flash (false)
, pressed_at (0)
, long_press (0)
, long_press (false)
{}
void set_action (std::string const& action_name, bool on_press, FaderPort::ButtonState = ButtonState (0));
@ -241,7 +240,7 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
bool led_on;
bool flash;
ARDOUR::microseconds_t pressed_at;
int long_press;
bool long_press;
struct ToDo {
ActionType type;

View file

@ -80,7 +80,7 @@ FaderPort::build_gui ()
FPGUI::FPGUI (FaderPort& p)
: fp (p)
, table (2, 5)
, action_table (4, 5)
, action_table (4, 4)
, ignore_active_change (false)
{
set_border_width (12);
@ -124,18 +124,15 @@ FPGUI::FPGUI (FaderPort& p)
build_mix_action_combo (mix_combo[0], FaderPort::ButtonState(0));
build_mix_action_combo (mix_combo[1], FaderPort::ShiftDown);
build_mix_action_combo (mix_combo[2], FaderPort::LongishPress);
build_mix_action_combo (mix_combo[3], FaderPort::LongPress);
build_mix_action_combo (mix_combo[2], FaderPort::LongPress);
build_proj_action_combo (proj_combo[0], FaderPort::ButtonState(0));
build_proj_action_combo (proj_combo[1], FaderPort::ShiftDown);
build_proj_action_combo (proj_combo[2], FaderPort::LongishPress);
build_proj_action_combo (proj_combo[3], FaderPort::LongPress);
build_proj_action_combo (proj_combo[2], FaderPort::LongPress);
build_trns_action_combo (trns_combo[0], FaderPort::ButtonState(0));
build_trns_action_combo (trns_combo[1], FaderPort::ShiftDown);
build_trns_action_combo (trns_combo[2], FaderPort::LongishPress);
build_trns_action_combo (trns_combo[3], FaderPort::LongPress);
build_trns_action_combo (trns_combo[2], FaderPort::LongPress);
action_table.set_row_spacings (4);
action_table.set_col_spacings (6);
@ -148,18 +145,15 @@ FPGUI::FPGUI (FaderPort& p)
l = manage (new Gtk::Label (_("Button")));
l->set_alignment (1.0, 0.5);
action_table.attach (*l, 0, 1, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
l = manage (new Gtk::Label (_("Press")));
l->set_alignment (1.0, 0.5);
l = manage (new Gtk::Label (_("Normal Press/Release Action")));
l->set_alignment (0.5, 0.5);
action_table.attach (*l, 1, 2, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
l = manage (new Gtk::Label (_("Shift")));
l->set_alignment (1.0, 0.5);
l = manage (new Gtk::Label (_("Shift-Press Action")));
l->set_alignment (0.5, 0.5);
action_table.attach (*l, 2, 3, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
l = manage (new Gtk::Label (_("Medium")));
l->set_alignment (1.0, 0.5);
l = manage (new Gtk::Label (_("Long Press Action")));
l->set_alignment (0.5, 0.5);
action_table.attach (*l, 3, 4, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
l = manage (new Gtk::Label (_("Long")));
l->set_alignment (1.0, 0.5);
action_table.attach (*l, 4, 5, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
action_row++;
l = manage (new Gtk::Label (_("Mix")));
@ -177,10 +171,6 @@ FPGUI::FPGUI (FaderPort& p)
align->set (0.0, 0.5);
align->add (mix_combo[2]);
action_table.attach (*align, 3, 4, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (mix_combo[3]);
action_table.attach (*align, 4, 5, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
action_row++;
l = manage (new Gtk::Label (_("Proj")));
@ -198,10 +188,6 @@ FPGUI::FPGUI (FaderPort& p)
align->set (0.0, 0.5);
align->add (proj_combo[2]);
action_table.attach (*align, 3, 4, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (proj_combo[3]);
action_table.attach (*align, 4, 5, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
action_row++;
l = manage (new Gtk::Label (_("Trns")));
@ -219,10 +205,6 @@ FPGUI::FPGUI (FaderPort& p)
align->set (0.0, 0.5);
align->add (trns_combo[2]);
action_table.attach (*align, 3, 4, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (trns_combo[3]);
action_table.attach (*align, 4, 5, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
action_row++;
table.attach (action_table, 0, 5, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));

View file

@ -58,10 +58,10 @@ private:
* functionality from a small, curated set of options.
*/
Gtk::ComboBox mix_combo[4];
Gtk::ComboBox proj_combo[4];
Gtk::ComboBox trns_combo[4];
Gtk::ComboBox user_combo[4];
Gtk::ComboBox mix_combo[3];
Gtk::ComboBox proj_combo[3];
Gtk::ComboBox trns_combo[3];
Gtk::ComboBox user_combo[3];
void update_port_combos ();
PBD::ScopedConnection connection_change_connection;