-OptionEditor::setup_midi_options ()
-{
- HBox* hbox;
- MIDI::Manager::PortMap::const_iterator i;
- const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
- int n;
- ToggleButton* tb;
- RadioButton* rb;
- RadioButton* first_mtc_button = 0;
- RadioButton* first_mmc_button = 0;
- RadioButton* first_midi_button = 0;
-
- Gtk::Table* table = manage (new Table (ports.size() + 4, 9));
-
- table->set_row_spacings (6);
- table->set_col_spacings (10);
-
- table->attach (*(manage (new Label (X_("Port")))), 0, 1, 0, 1);
- table->attach (*(manage (new Label (X_("Offline")))), 1, 2, 0, 1);
- table->attach (*(manage (new Label (X_("Trace\nInput")))), 2, 3, 0, 1);
- table->attach (*(manage (new Label (X_("Trace\nOutput")))), 3, 4, 0, 1);
- table->attach (*(manage (new Label (X_("MTC")))), 4, 5, 0, 1);
- table->attach (*(manage (new Label (X_("MMC")))), 6, 7, 0, 1);
- table->attach (*(manage (new Label (X_("MIDI Parameter\nControl")))), 8, 9, 0, 1);
-
- table->attach (*(manage (new HSeparator())), 0, 9, 1, 2);
- table->attach (*(manage (new VSeparator())), 5, 6, 0, 8);
- table->attach (*(manage (new VSeparator())), 7, 8, 0, 8);
-
- for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
-
- pair<MIDI::Port*,vector<RadioButton*> > newpair;
-
- newpair.first = i->second;
-
- table->attach (*(manage (new Label (i->first))), 0, 1, n+2, n+3, 0, 0);
- tb = manage (new ToggleButton (_("online")));
- tb->set_name ("OptionEditorToggleButton");
-
- /* remember, we have to handle the i18n case where the relative
- lengths of the strings in language N is different than in english.
- */
-
- if (strlen (_("offline")) > strlen (_("online"))) {
- set_size_request_to_display_given_text (*tb, _("offline"), 15, 12);
- } else {
- set_size_request_to_display_given_text (*tb, _("online"), 15, 12);
- }
-
- tb->set_active (!(*i).second->input()->offline());
- tb->signal_button_press_event.connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
- (*i).second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb));
- table->attach (*tb, 1, 2, n+2, n+3, 0, 0);
-
- tb = manage (new ToggleButton ());
- tb->set_name ("OptionEditorToggleButton");
- tb->signal_button_press_event.connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
- tb->set_size_request (10, 10);
- table->attach (*tb, 2, 3, n+2, n+3, 0, 0);
-
- tb = manage (new ToggleButton ());
- tb->set_name ("OptionEditorToggleButton");
- tb->signal_button_press_event.connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
- tb->set_size_request (10, 10);
- table->attach (*tb, 3, 4, n+2, n+3, 0, 0);
-
- rb = manage (new RadioButton ());
- newpair.second.push_back (rb);
- rb->set_name ("OptionEditorToggleButton");
- if (n == 0) {
- first_mtc_button = rb;
- } else {
- rb->set_group (first_mtc_button->group());
- }
- table->attach (*rb, 4, 5, n+2, n+3, 0, 0);
- rb->signal_button_press_event.connect (bind (mem_fun(*this, &OptionEditor::mtc_port_chosen), (*i).second, rb));
-
- if (Config->get_mtc_port_name() == i->first) {
- rb->set_active (true);
- }
-
- rb = manage (new RadioButton ());
- newpair.second.push_back (rb);
- rb->set_name ("OptionEditorToggleButton");
- if (n == 0) {
- first_mmc_button = rb;
- } else {
- rb->set_group (first_mmc_button->group());
- }
- table->attach (*rb, 6, 7, n+2, n+3, 0, 0);
- rb->signal_button_press_event.connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb));
-
- if (Config->get_mmc_port_name() == i->first) {
- rb->set_active (true);
- }
-
- rb = manage (new RadioButton ());
- newpair.second.push_back (rb);
- rb->set_name ("OptionEditorToggleButton");
- if (n == 0) {
- first_midi_button = rb;
- } else {
- rb->set_group (first_midi_button->group());
- }
- table->attach (*rb, 8, 9, n+2, n+3, 0, 0);
- rb->signal_button_press_event.connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb));
-
- if (Config->get_midi_port_name() == i->first) {
- rb->set_active (true);
- }
-
- port_toggle_buttons.insert (newpair);
- }
-
- table->show_all ();
-
- hbox = manage (new HBox);
- hbox->set_border_width (6);
- hbox->pack_start (*table, true, false);
- midi_packer.pack_start (*hbox, false, false);
-
- VBox* mmcbuttonbox = manage (new VBox);
-
- mmc_control_button.set_name ("OptionEditorToggleButton");
-
- hbox = manage (new HBox);
- hbox->set_border_width (6);
- hbox->pack_start (mmc_control_button, false, false, 36);
- mmcbuttonbox->pack_start (*hbox, false, false);
-
- midi_control_button.set_name ("OptionEditorToggleButton");
-
- hbox = manage (new HBox);
- hbox->set_border_width (6);
- hbox->pack_start (midi_control_button, false, false, 36);
- mmcbuttonbox->pack_start (*hbox, false, false);
-
- send_mmc_button.set_name ("OptionEditorToggleButton");
-
- hbox = manage (new HBox);
- hbox->set_border_width (6);
- hbox->pack_start (send_mmc_button, false, false, 36);
- mmcbuttonbox->pack_start (*hbox, false, false);
-
- midi_feedback_button.set_name ("OptionEditorToggleButton");
-
- hbox = manage (new HBox);
- hbox->set_border_width (6);
- hbox->pack_start (midi_feedback_button, false, false, 36);
- mmcbuttonbox->pack_start (*hbox, false, false);
-
- midi_packer.pack_start (*mmcbuttonbox, false, false);
-
- mmc_control_button.toggled.connect (bind (mem_fun(*this, &OptionEditor::mmc_control_toggled), &mmc_control_button));
- midi_control_button.toggled.connect (bind (mem_fun(*this, &OptionEditor::midi_control_toggled), &midi_control_button));
- send_mmc_button.toggled.connect (bind (mem_fun(*this, &OptionEditor::send_mmc_toggled), &send_mmc_button));
- midi_feedback_button.toggled.connect (bind (mem_fun(*this, &OptionEditor::midi_feedback_toggled), &midi_feedback_button));
-}
-
-gint
-OptionEditor::mtc_port_chosen (GdkEventButton* ev, MIDI::Port *port, Gtk::RadioButton* rb)