13
0

Fix adding transport-master

Resolve ambiguity between Dialog::add_button() and add_button member,
also use clicked signal for ArdourButton.

signal_button_press_event() only works with
ArdourButton::set_fallthrough_to_parent
This commit is contained in:
Robin Gareus 2020-11-01 23:28:30 +01:00
parent 66c19647df
commit 10ea21a35f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 9 additions and 10 deletions

View File

@ -50,7 +50,7 @@ using namespace ArdourWidgets;
TransportMastersWidget::TransportMastersWidget () TransportMastersWidget::TransportMastersWidget ()
: table (4, 13) : table (4, 13)
, add_button (_("Add a new Transport Master")) , add_master_button (_("Add a new Transport Master"))
, lost_sync_button (_("Keep rolling if sync is lost")) , lost_sync_button (_("Keep rolling if sync is lost"))
, ignore_active_change (false) , ignore_active_change (false)
{ {
@ -61,7 +61,7 @@ TransportMastersWidget::TransportMastersWidget ()
update_ports (); update_ports ();
Gtk::Table *add_table = manage(new Gtk::Table(1,2)); Gtk::Table *add_table = manage(new Gtk::Table(1,2));
add_table->attach(add_button, 0,1, 0,1, Gtk::SHRINK); add_table->attach(add_master_button, 0,1, 0,1, Gtk::SHRINK);
pack_start (table, FALSE, FALSE, 12); pack_start (table, FALSE, FALSE, 12);
pack_start (*add_table, FALSE, FALSE); pack_start (*add_table, FALSE, FALSE);
@ -73,7 +73,7 @@ TransportMastersWidget::TransportMastersWidget ()
set_tooltip (lost_sync_button, string_compose (_("<b>When enabled</b>, if the signal from a transport master is lost, %1 will keep rolling at its current speed.\n" set_tooltip (lost_sync_button, string_compose (_("<b>When enabled</b>, if the signal from a transport master is lost, %1 will keep rolling at its current speed.\n"
"<b>When disabled</b>, loss of transport master sync causes %1 to stop"), PROGRAM_NAME)); "<b>When disabled</b>, loss of transport master sync causes %1 to stop"), PROGRAM_NAME));
add_button.signal_button_press_event().connect (sigc::mem_fun (*this, &TransportMastersWidget::add_master)); add_master_button.signal_clicked.connect (sigc::mem_fun (*this, &TransportMastersWidget::add_master));
col_title[0].set_markup (string_compose ("<span weight=\"bold\">%1</span>", _("Select"))); align[0]=0.0; col_title[0].set_markup (string_compose ("<span weight=\"bold\">%1</span>", _("Select"))); align[0]=0.0;
col_title[1].set_markup (string_compose ("<span weight=\"bold\">%1</span>", _("Name"))); align[1]=0.5; col_title[1].set_markup (string_compose ("<span weight=\"bold\">%1</span>", _("Name"))); align[1]=0.5;
@ -138,9 +138,10 @@ TransportMastersWidget::current_changed (boost::shared_ptr<TransportMaster> old_
} }
} }
bool void
TransportMastersWidget::add_master (GdkEventButton* ev) TransportMastersWidget::add_master ()
{ {
printf ("TransportMastersWidget::add_master\n");
AddTransportMasterDialog d; AddTransportMasterDialog d;
d.present (); d.present ();
@ -155,7 +156,7 @@ TransportMastersWidget::add_master (GdkEventButton* ev)
name = d.get_name(); name = d.get_name();
break; break;
default: default:
return true; return;
} }
} }
@ -165,8 +166,6 @@ TransportMastersWidget::add_master (GdkEventButton* ev)
MessageDialog msg (_("New transport master not added - check error log for details")); MessageDialog msg (_("New transport master not added - check error log for details"));
msg.run (); msg.run ();
} }
return true;
} }
void void

View File

@ -134,7 +134,7 @@ class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
Gtk::Table table; Gtk::Table table;
Gtk::Label col_title[14]; Gtk::Label col_title[14];
float align[14]; float align[14];
ArdourWidgets::ArdourButton add_button; ArdourWidgets::ArdourButton add_master_button;
Gtk::CheckButton lost_sync_button; Gtk::CheckButton lost_sync_button;
sigc::connection update_connection; sigc::connection update_connection;
@ -166,7 +166,7 @@ class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
void rebuild (); void rebuild ();
void clear (); void clear ();
void current_changed (boost::shared_ptr<ARDOUR::TransportMaster> old_master, boost::shared_ptr<ARDOUR::TransportMaster> new_master); void current_changed (boost::shared_ptr<ARDOUR::TransportMaster> old_master, boost::shared_ptr<ARDOUR::TransportMaster> new_master);
bool add_master (GdkEventButton* ev); void add_master ();
void update_usability (); void update_usability ();
void allow_master_select (bool); void allow_master_select (bool);