Midi radiobuttons now work.
authorSampo Savolainen <v2@iki.fi>
Sun, 5 Feb 2006 21:29:22 +0000 (21:29 +0000)
committerSampo Savolainen <v2@iki.fi>
Sun, 5 Feb 2006 21:29:22 +0000 (21:29 +0000)
git-svn-id: svn://localhost/trunk/ardour2@310 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/option_editor.cc
gtk2_ardour/option_editor.h

index 491579b286f38841e33dd6054ad06f6280752a71..86e7ff5473438ee41bc8fae647cdf0c7829297cb 100644 (file)
@@ -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
index cf70e65a36968e98eca1e097de53793fb6873d25..e607a9bbb4154547ae1af5a0a7d1a81aa22e4c9a 100644 (file)
@@ -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*);