- initial_program_change_spinner.set_value (Config->get_initial_program_change());
- initial_program_change_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::initial_program_change_adjusted));
-
- add_midi_port_button.signal_clicked().connect (mem_fun (*this, &OptionEditor::add_midi_port));
-}
-
-void
-OptionEditor::initial_program_change_adjusted ()
-{
- Config->set_initial_program_change (((int32_t) floor (initial_program_change_adjustment.get_value())) & 0x7f);
-}
-
-void
-OptionEditor::redisplay_midi_ports ()
-{
- MIDI::Manager::PortMap::const_iterator i;
- const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
- int n;
-
- /* remove all existing widgets */
-
- // XXX broken in gtkmm 2.10
- // midi_port_table.clear ();
-
- for (vector<Widget*>::iterator w = midi_port_table_widgets.begin(); w != midi_port_table_widgets.end(); ++w) {
- midi_port_table.remove (**w);
- }
-
- midi_port_table_widgets.clear ();
-
- midi_port_table.resize (ports.size() + 4, 12);
-
- Gtk::Label* label;
-
- label = (manage (new Label (_("Port"))));
- label->show ();
- midi_port_table_widgets.push_back (label);
- midi_port_table.attach (*label, 0, 1, 0, 1);
- label = (manage (new Label (_("Offline"))));
- label->show ();
- midi_port_table_widgets.push_back (label);
- midi_port_table.attach (*label, 1, 2, 0, 1);
- label = (manage (new Label (_("Trace\nInput"))));
- label->show ();
- midi_port_table_widgets.push_back (label);
- midi_port_table.attach (*label, 2, 3, 0, 1);
- label = (manage (new Label (_("Trace\nOutput"))));
- label->show ();
- midi_port_table_widgets.push_back (label);
- midi_port_table.attach (*label, 3, 4, 0, 1);
- label = (manage (new Label (_("MTC"))));
- label->show ();
- midi_port_table_widgets.push_back (label);
- midi_port_table.attach (*label, 4, 5, 0, 1);
- label = (manage (new Label (_("MIDI\nClock"))));
- label->show ();
- midi_port_table_widgets.push_back (label);
- midi_port_table.attach (*label, 6, 7, 0, 1);
- label = (manage (new Label (_("MMC"))));
- label->show ();
- midi_port_table_widgets.push_back (label);
- midi_port_table.attach (*label, 8, 9, 0, 1);
- label = (manage (new Label (_("MIDI Parameter\nControl"))));
- label->show ();
- midi_port_table_widgets.push_back (label);
- midi_port_table.attach (*label, 10, 11, 0, 1);
-
- Gtk::HSeparator* hsep = (manage (new HSeparator()));
- hsep->show ();
- midi_port_table_widgets.push_back (hsep);
- midi_port_table.attach (*hsep, 0, 11, 1, 2);
- Gtk::VSeparator* vsep = (manage (new VSeparator()));
- vsep->show ();
- midi_port_table_widgets.push_back (vsep);
- midi_port_table.attach (*vsep, 5, 6, 0, 8);
- vsep = (manage (new VSeparator()));
- vsep->show ();
- midi_port_table_widgets.push_back (vsep);
- midi_port_table.attach (*vsep, 7, 8, 0, 8);
- vsep = (manage (new VSeparator()));
- vsep->show ();
- midi_port_table_widgets.push_back (vsep);
- midi_port_table.attach (*vsep, 9, 10, 0, 8);
-
- for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
-
- ToggleButton* tb;
- RadioButton* rb;
- Button* bb;
-
- /* the remove button. create early so we can pass it to various callbacks */
-
- bb = manage (new Button (Stock::REMOVE));
- bb->set_name ("OptionEditorToggleButton");
- bb->show ();
- midi_port_table_widgets.push_back (bb);
- midi_port_table.attach (*bb, 11, 12, n+2, n+3, FILL|EXPAND, FILL);
- bb->signal_clicked().connect (bind (mem_fun(*this, &OptionEditor::remove_midi_port), i->second));
- bb->set_sensitive (port_removable (i->second));
-
- label = (manage (new Label (i->first)));
- label->show ();
- midi_port_table_widgets.push_back (label);
- midi_port_table.attach (*label, 0, 1, n+2, n+3,FILL|EXPAND, FILL );
-
- 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);
- }
-
- if (i->second->input()) {
- tb->set_active (!i->second->input()->offline());
- tb->signal_toggled().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));
- }
- tb->show ();
- midi_port_table_widgets.push_back (tb);
- midi_port_table.attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
-
- // Trace MIDI Input
- tb = manage (new ToggleButton ());
- tb->set_name ("OptionEditorToggleButton");
- tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
- tb->set_size_request (10, 10);
- tb->show ();
- midi_port_table_widgets.push_back (tb);
- midi_port_table.attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
-
- // Trace MIDI Output
- tb = manage (new ToggleButton ());
- tb->set_name ("OptionEditorToggleButton");
- tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
- tb->set_size_request (10, 10);
- tb->show ();
- midi_port_table_widgets.push_back (tb);
- midi_port_table.attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);