From 0f39de64361286c5df6632e626b5de6dcc7d58fe Mon Sep 17 00:00:00 2001 From: Sampo Savolainen Date: Sun, 5 Feb 2006 21:29:22 +0000 Subject: Midi radiobuttons now work. git-svn-id: svn://localhost/trunk/ardour2@310 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/option_editor.cc | 31 +++++++++++++++---------------- gtk2_ardour/option_editor.h | 6 +++--- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index 491579b286..86e7ff5473 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -618,7 +618,7 @@ OptionEditor::setup_midi_options () } table->attach (*rb, 4, 5, n+2, n+3, FILL|EXPAND, FILL); - rb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::mtc_port_chosen), (*i).second, rb)); + rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mtc_port_chosen), (*i).second, rb)); if (Config->get_mtc_port_name() == i->first) { rb->set_active (true); @@ -633,7 +633,7 @@ OptionEditor::setup_midi_options () rb->set_group (mmc_button_group); } table->attach (*rb, 6, 7, n+2, n+3, FILL|EXPAND, FILL); - rb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb)); + rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb)); if (Config->get_mmc_port_name() == i->first) { rb->set_active (true); @@ -648,7 +648,7 @@ OptionEditor::setup_midi_options () rb->set_group (midi_button_group); } table->attach (*rb, 8, 9, n+2, n+3, FILL|EXPAND, FILL); - rb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb)); + rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb)); if (Config->get_midi_port_name() == i->first) { rb->set_active (true); @@ -665,11 +665,12 @@ OptionEditor::setup_midi_options () midi_packer.pack_start (*hbox, false, false); } -bool -OptionEditor::mtc_port_chosen (GdkEventButton* ev, MIDI::Port *port, Gtk::RadioButton* rb) +void +OptionEditor::mtc_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb) { if (session) { - if (!rb->get_active()) { + if (rb->get_active()) { + cerr << "Activating MTC port " << port->name() << endl; if (port) { session->set_mtc_port (port->name()); Config->set_mtc_port_name (port->name()); @@ -679,15 +680,14 @@ OptionEditor::mtc_port_chosen (GdkEventButton* ev, MIDI::Port *port, Gtk::RadioB rb->set_active (true); } } - - return false; } -bool -OptionEditor::mmc_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioButton* rb) +void +OptionEditor::mmc_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb) { if (session) { - if (!rb->get_active()) { + if (rb->get_active()) { + cerr << "Activating MMC port " << port->name() << endl; if (port) { session->set_mmc_port (port->name()); Config->set_mtc_port_name (port->name()); @@ -697,14 +697,14 @@ OptionEditor::mmc_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioB rb->set_active (true); } } - return false; } -bool -OptionEditor::midi_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioButton* rb) +void +OptionEditor::midi_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb) { if (session) { - if (!rb->get_active()) { + if (rb->get_active()) { + cerr << "Activating MIDI port " << port->name() << endl; if (port) { session->set_midi_port (port->name()); Config->set_midi_port_name (port->name()); @@ -714,7 +714,6 @@ OptionEditor::midi_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::Radio rb->set_active (true); } } - return false; } gint diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index cf70e65a36..e607a9bbb4 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -137,9 +137,9 @@ class OptionEditor : public Gtk::Dialog gint port_trace_in_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*); gint port_trace_out_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*); - bool mmc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*); - bool mtc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*); - bool midi_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*); + void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*); + void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*); + void midi_port_chosen (MIDI::Port*,Gtk::RadioButton*); void map_port_online (MIDI::Port*, Gtk::ToggleButton*); -- cgit v1.2.3