2 Copyright (C) 2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <sigc++/bind.h>
24 #include <gtkmm/stock.h>
25 #include <gtkmm/messagedialog.h>
26 #include <gtkmm/separator.h>
27 #include <gtkmm/table.h>
29 #include "pbd/error.h"
30 #include "pbd/convert.h"
32 #include "gtkmm2ext/utils.h"
33 #include "gtkmm2ext/doi.h"
35 #include "widgets/tooltips.h"
37 #include "ardour/plugin_manager.h"
38 #include "ardour/profile.h"
39 #include "ardour/template_utils.h"
40 #include "ardour/route_group.h"
41 #include "ardour/session.h"
42 #include "ardour/vca.h"
45 #include "add_route_dialog.h"
46 #include "route_group_dialog.h"
50 using namespace Gtkmm2ext;
53 using namespace ARDOUR;
54 using namespace ARDOUR_UI_UTILS;
56 std::vector<std::string> AddRouteDialog::channel_combo_strings;
58 AddRouteDialog::AddRouteDialog ()
59 : ArdourDialog (_("Add Track/Bus/VCA"))
60 , routes_adjustment (1, 1, 128, 1, 4)
61 , routes_spinner (routes_adjustment)
62 , configuration_label (_("Configuration:"))
63 , manual_label (_("Manual Configuration:"))
64 , add_label (_("Add:"))
65 , type_label (_("Type:"))
66 , name_label (_("Name:"))
67 , group_label (_("Group:"))
68 , insert_label (_("Insert At:"))
69 , strict_io_label (_("Pin Mode:"))
70 , mode_label (_("Record Mode:"))
71 , instrument_label (_("Instrument:"))
72 , name_edited_by_user (false)
74 set_name ("AddRouteDialog");
75 set_skip_taskbar_hint (true);
76 set_resizable (false);
77 set_position (WIN_POS_MOUSE);
79 name_template_entry.set_name (X_("AddRouteDialogNameTemplateEntry"));
80 // routes_spinner.set_name (X_("AddRouteDialogSpinner"));
81 channel_combo.set_name (X_("ChannelCountSelector"));
82 mode_combo.set_name (X_("ChannelCountSelector"));
84 refill_track_modes ();
86 track_bus_combo.append_text (_("Audio Tracks"));
87 track_bus_combo.append_text (_("MIDI Tracks"));
88 track_bus_combo.append_text (_("Audio+MIDI Tracks"));
89 track_bus_combo.append_text (_("Audio Busses"));
90 track_bus_combo.append_text (_("MIDI Busses"));
91 track_bus_combo.append_text (_("VCA Masters"));
92 track_bus_combo.set_active (0);
94 insert_at_combo.append_text (_("First"));
95 insert_at_combo.append_text (_("Before Selection"));
96 insert_at_combo.append_text (_("After Selection"));
97 insert_at_combo.append_text (_("Last"));
98 insert_at_combo.set_active (3);
100 strict_io_combo.append_text (_("Flexible-I/O"));
101 strict_io_combo.append_text (_("Strict-I/O"));
102 strict_io_combo.set_active (Config->get_strict_io () ? 1 : 0);
104 VBox* vbox = manage (new VBox);
106 get_vbox()->set_spacing (4);
108 vbox->set_spacing (18);
109 vbox->set_border_width (5);
111 { //Template & Template Description area
112 HBox* template_hbox = manage (new HBox);
113 template_hbox->set_spacing (8);
115 Gtk::ScrolledWindow *template_scroller = manage (new Gtk::ScrolledWindow());
116 template_scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
117 template_scroller->add (trk_template_chooser);
119 Gtk::ScrolledWindow *desc_scroller = manage (new Gtk::ScrolledWindow());
120 desc_scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
121 desc_scroller->add (trk_template_desc);
123 template_hbox->pack_start (*template_scroller, true, true);
125 trk_template_desc_frame.set_name (X_("TextHighlightFrame"));
126 trk_template_desc_frame.add (*desc_scroller);
127 template_hbox->pack_start (trk_template_desc_frame, true, true);
129 //template_chooser is the treeview showing available templates
130 trk_template_model = TreeStore::create (track_template_columns);
131 trk_template_chooser.set_model (trk_template_model);
132 trk_template_chooser.append_column (_("Template"), track_template_columns.name);
133 trk_template_chooser.append_column (_("Created With"), track_template_columns.created_with);
134 trk_template_chooser.set_headers_visible (true);
135 trk_template_chooser.get_selection()->set_mode (SELECTION_SINGLE);
136 trk_template_chooser.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &AddRouteDialog::trk_template_row_selected));
137 trk_template_chooser.set_sensitive (true);
139 //template_desc is the textview that displays the currently selected template's description
140 trk_template_desc.set_editable (false);
141 trk_template_desc.set_wrap_mode (Gtk::WRAP_WORD);
142 trk_template_desc.set_size_request(400,200);
143 trk_template_desc.set_name (X_("TextOnBackground"));
144 trk_template_desc.set_border_width (6);
146 vbox->pack_start (*template_hbox, true, true);
150 // HBox *trk_go_hbox = manage (new HBox);
151 // trk_go_hbox->pack_start (*(manage (new Gtk::HSeparator)), true, true);
152 // trk_go_hbox->pack_start (*(manage (new Gtk::Button(_("Add template")))), false, false);
153 // trk_go_hbox->set_spacing (6);
154 // vbox->pack_start (*trk_go_hbox, true, true);
158 HBox *separator_hbox = manage (new HBox);
159 separator_hbox->pack_start (manual_label, false, false);
160 separator_hbox->pack_start (*(manage (new Gtk::HSeparator)), true, true);
161 separator_hbox->set_spacing (6);
162 vbox->pack_start (*separator_hbox, true, true);
165 /* track/bus choice */
168 Table *add_table = manage (new Table (8, 8, false));
169 add_table->set_row_spacings (8);
170 add_table->set_col_spacings (3);
171 add_table->set_col_spacing (1, 12);
172 add_table->set_col_spacing (3, 12);
173 add_table->set_col_spacing (5, 12);
174 add_table->set_border_width (0);
179 add_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
180 add_table->attach (add_label, 0, 1, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
181 add_table->attach (routes_spinner, 1, 2, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
184 type_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
185 add_table->attach (type_label, 2,3, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
186 add_table->attach (track_bus_combo, 3, 4, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
189 name_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
190 add_table->attach (name_label, 4, 5, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
191 add_table->attach (name_template_entry, 5, 8, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
195 // Route configuration
196 configuration_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
197 add_table->attach (configuration_label, 2, 3, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
198 add_table->attach (channel_combo, 3, 4, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
201 group_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
202 add_table->attach (group_label, 4, 5, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
203 add_table->attach (route_group_combo, 5, 8, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
207 // instrument choice (for MIDI)
208 instrument_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
209 add_table->attach (instrument_label, 2, 3, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
210 add_table->attach (instrument_combo, 3, 4, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
214 // New Route's I/O is.. {strict/flexible}
215 if (Profile->get_mixbus ()) {
216 strict_io_combo.set_active (1);
218 strict_io_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
219 add_table->attach (strict_io_label, 2, 3, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
220 add_table->attach (strict_io_combo, 3, 4, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
222 ArdourWidgets::set_tooltip (strict_io_combo,
223 _("With strict-i/o enabled, Effect Processors will not modify the number of channels on a track. The number of output channels will always match the number of input channels."));
226 mode_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
227 add_table->attach (mode_label, 4, 5, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
228 add_table->attach (mode_combo, 5, 8, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
235 add_table->attach (*(manage (new Gtk::HSeparator)), 0, 8, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
239 // New route will be inserted at..
240 insert_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
241 add_table->attach (insert_label, 2, 3, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
242 add_table->attach (insert_at_combo, 3, 4, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
244 add_table->attach (*(manage (new Gtk::Button(_("Add selected items (and leave dialog open)"), Add))), 5, 8, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
247 vbox->pack_start (*add_table, false, true);
249 get_vbox()->pack_start (*vbox, false, false);
251 name_template_entry.signal_insert_text ().connect (sigc::mem_fun (*this, &AddRouteDialog::name_template_entry_insertion));
252 name_template_entry.signal_delete_text ().connect (sigc::mem_fun (*this, &AddRouteDialog::name_template_entry_deletion));
253 track_bus_combo.signal_changed().connect (sigc::mem_fun (*this, &AddRouteDialog::track_type_chosen));
254 channel_combo.signal_changed().connect (sigc::mem_fun (*this, &AddRouteDialog::channel_combo_changed));
255 channel_combo.set_row_separator_func (sigc::mem_fun (*this, &AddRouteDialog::channel_separator));
256 route_group_combo.set_row_separator_func (sigc::mem_fun (*this, &AddRouteDialog::route_separator));
257 route_group_combo.signal_changed ().connect (sigc::mem_fun (*this, &AddRouteDialog::group_changed));
259 show_all_children ();
261 /* track template info will be managed whenever
262 this dialog is shown, via ::on_show()
265 add_button (_("Add and Close"), AddAndClose);
266 // add_button (_("Add"), Add);
267 set_response_sensitive (AddAndClose, true);
268 set_default_response (AddAndClose);
270 track_type_chosen ();
273 AddRouteDialog::~AddRouteDialog ()
278 AddRouteDialog::on_response (int r)
280 name_edited_by_user = false;
281 /* Don't call ArdourDialog::on_response() because that will
282 automatically hide the dialog.
284 Gtk::Dialog::on_response (r);
288 AddRouteDialog::trk_template_row_selected ()
290 if (trk_template_chooser.get_selection()->count_selected_rows() > 0) {
291 TreeIter iter = trk_template_chooser.get_selection()->get_selected();
297 string d = (*iter)[track_template_columns.description];
298 trk_template_desc.get_buffer()->set_text (d);
300 string n = (*iter)[track_template_columns.name];
301 if ( n != _("Manual Configuration") ) {
303 trk_template_desc.set_sensitive(true);
305 manual_label.set_sensitive(false);
306 add_label.set_sensitive(false);
307 type_label.set_sensitive(false);
308 name_label.set_sensitive(false);
309 group_label.set_sensitive(false);
310 strict_io_label.set_sensitive(false);
311 configuration_label.set_sensitive(false);
312 mode_label.set_sensitive(false);
314 routes_spinner.set_sensitive(false);
315 track_bus_combo.set_sensitive(false);
316 name_template_entry.set_sensitive(false);
317 channel_combo.set_sensitive(false);
318 mode_combo.set_sensitive(false);
319 instrument_combo.set_sensitive(false);
320 strict_io_combo.set_sensitive(false);
321 route_group_combo.set_sensitive(false);
325 trk_template_desc.set_sensitive(false);
327 manual_label.set_sensitive(true);
328 add_label.set_sensitive(true);
329 type_label.set_sensitive(true);
330 name_label.set_sensitive(true);
331 group_label.set_sensitive(true);
332 strict_io_label.set_sensitive(true);
334 track_bus_combo.set_sensitive(true);
335 routes_spinner.set_sensitive(true);
336 name_template_entry.set_sensitive(true);
344 AddRouteDialog::name_template_entry_insertion (Glib::ustring const &,int*)
346 name_edited_by_user = true;
350 AddRouteDialog::name_template_entry_deletion (int, int)
352 name_edited_by_user = true;
356 AddRouteDialog::channel_combo_changed ()
358 refill_track_modes ();
362 AddRouteDialog::get_template_path ()
366 if (trk_template_chooser.get_selection()->count_selected_rows() > 0) {
367 TreeIter iter = trk_template_chooser.get_selection()->get_selected();
370 string n = (*iter)[track_template_columns.name];
371 if ( n != _("Manual Configuration") ) {
372 p = (*iter)[track_template_columns.path];
381 AddRouteDialog::TypeWanted
382 AddRouteDialog::type_wanted() const
384 std::string str = track_bus_combo.get_active_text();
385 if (str == _("Audio Busses")) {
387 } else if (str == _("MIDI Busses")){
389 } else if (str == _("MIDI Tracks")){
391 } else if (str == _("Audio+MIDI Tracks")) {
393 } else if (str == _("Audio Tracks")) {
401 AddRouteDialog::maybe_update_name_template_entry ()
403 if (name_edited_by_user) {
407 switch (type_wanted()) {
409 name_template_entry.set_text (_("Audio"));
412 name_template_entry.set_text (_("MIDI"));
415 name_template_entry.set_text (_("Audio+MIDI"));
419 name_template_entry.set_text (_("Bus"));
422 name_template_entry.set_text (VCA::default_name_template());
425 name_edited_by_user = false;
429 AddRouteDialog::track_type_chosen ()
431 switch (type_wanted()) {
433 mode_combo.set_sensitive (true);
434 channel_combo.set_sensitive (true);
435 instrument_combo.set_sensitive (false);
436 configuration_label.set_sensitive (true);
437 mode_label.set_sensitive (true);
438 instrument_label.set_sensitive (false);
439 route_group_combo.set_sensitive (true);
440 strict_io_combo.set_sensitive (true);
441 insert_at_combo.set_sensitive (true);
444 channel_combo.set_sensitive (false);
445 mode_combo.set_sensitive (false);
446 instrument_combo.set_sensitive (true);
447 configuration_label.set_sensitive (false);
448 mode_label.set_sensitive (false);
449 instrument_label.set_sensitive (true);
450 route_group_combo.set_sensitive (true);
451 strict_io_combo.set_sensitive (true);
452 insert_at_combo.set_sensitive (true);
456 MessageDialog msg (_("Audio+MIDI tracks are intended for use <b>ONLY</b> with plugins that use both audio and MIDI input data\n\n"
457 "If you do not plan to use such a plugin, then use a normal audio or MIDI track instead."),
458 true, MESSAGE_INFO, BUTTONS_OK, true);
459 msg.set_position (WIN_POS_MOUSE);
462 channel_combo.set_sensitive (true);
463 mode_combo.set_sensitive (true);
464 instrument_combo.set_sensitive (true);
465 configuration_label.set_sensitive (true);
466 mode_label.set_sensitive (true);
467 instrument_label.set_sensitive (true);
468 route_group_combo.set_sensitive (true);
469 strict_io_combo.set_sensitive (true);
470 insert_at_combo.set_sensitive (true);
473 mode_combo.set_sensitive (false);
474 channel_combo.set_sensitive (true);
475 instrument_combo.set_sensitive (false);
476 configuration_label.set_sensitive (true);
477 mode_label.set_sensitive (true);
478 instrument_label.set_sensitive (false);
479 route_group_combo.set_sensitive (true);
480 strict_io_combo.set_sensitive (true);
481 insert_at_combo.set_sensitive (true);
484 mode_combo.set_sensitive (false);
485 channel_combo.set_sensitive (false);
486 instrument_combo.set_sensitive (false);
487 configuration_label.set_sensitive (false);
488 mode_label.set_sensitive (false);
489 instrument_label.set_sensitive (false);
490 route_group_combo.set_sensitive (false);
491 strict_io_combo.set_sensitive (false);
492 insert_at_combo.set_sensitive (false);
495 mode_combo.set_sensitive (false);
496 channel_combo.set_sensitive (false);
497 instrument_combo.set_sensitive (true);
498 configuration_label.set_sensitive (false);
499 mode_label.set_sensitive (true);
500 instrument_label.set_sensitive (true);
501 strict_io_combo.set_sensitive (true);
502 insert_at_combo.set_sensitive (true);
506 maybe_update_name_template_entry ();
512 AddRouteDialog::name_template () const
514 return name_template_entry.get_text ();
518 AddRouteDialog::name_template_is_default() const
520 string n = name_template();
522 if (n == _("Audio") ||
524 n == _("Audio+MIDI") ||
526 n == VCA::default_name_template()) {
534 AddRouteDialog::count ()
536 return (int) floor (routes_adjustment.get_value ());
540 AddRouteDialog::refill_track_modes ()
544 s.push_back (_("Normal"));
545 #ifdef XXX_OLD_DESTRUCTIVE_API_XXX
546 s.push_back (_("Non Layered"));
548 if (!ARDOUR::Profile->get_mixbus ()) {
549 s.push_back (_("Tape"));
552 set_popdown_strings (mode_combo, s);
553 mode_combo.set_active_text (s.front());
557 AddRouteDialog::mode ()
559 std::string str = mode_combo.get_active_text();
560 if (str == _("Normal")) {
561 return ARDOUR::Normal;
562 } else if (str == _("Non Layered")){
563 return ARDOUR::NonLayered;
564 } else if (str == _("Tape")) {
565 return ARDOUR::Destructive;
567 fatal << string_compose (X_("programming error: unknown track mode in add route dialog combo = %1"), str)
569 abort(); /*NOTREACHED*/
572 return ARDOUR::Normal;
576 AddRouteDialog::channels ()
580 switch (type_wanted()) {
583 str = channel_combo.get_active_text();
584 for (ChannelSetups::iterator i = channel_setups.begin(); i != channel_setups.end(); ++i) {
585 if (str == (*i).name) {
586 ret.set (DataType::AUDIO, (*i).channels);
590 ret.set (DataType::MIDI, 0);
595 ret.set (DataType::AUDIO, 0);
596 ret.set (DataType::MIDI, 1);
600 str = channel_combo.get_active_text();
601 for (ChannelSetups::iterator i = channel_setups.begin(); i != channel_setups.end(); ++i) {
602 if (str == (*i).name) {
603 ret.set (DataType::AUDIO, (*i).channels);
607 ret.set (DataType::MIDI, 1);
617 AddRouteDialog::track_template ()
619 string str = channel_combo.get_active_text();
621 for (ChannelSetups::iterator i = channel_setups.begin(); i != channel_setups.end(); ++i) {
622 if (str == (*i).name) {
623 return (*i).template_path;
631 AddRouteDialog::on_show ()
633 routes_spinner.grab_focus ();
634 name_edited_by_user = false;
636 refill_channel_setups ();
637 refill_route_groups ();
643 AddRouteDialog::refill_channel_setups ()
647 route_templates.clear ();
649 string channel_current_choice = channel_combo.get_active_text();
651 channel_combo_strings.clear ();
652 channel_setups.clear ();
654 chn.name = _("Mono");
656 channel_setups.push_back (chn);
658 chn.name = _("Stereo");
660 channel_setups.push_back (chn);
662 chn.name = "separator";
663 channel_setups.push_back (chn);
665 ARDOUR::find_route_templates (route_templates);
667 if (!route_templates.empty()) {
669 for (vector<TemplateInfo>::iterator x = route_templates.begin(); x != route_templates.end(); ++x) {
672 chn.template_path = x->path;
673 channel_setups.push_back (chn);
677 trk_template_model->clear();
679 //Add any Lua scripts (factory templates) found in the scripts folder
680 LuaScriptList& ms (LuaScripting::instance ().scripts (LuaScriptInfo::TrackSetup));
681 for (LuaScriptList::const_iterator s = ms.begin(); s != ms.end(); ++s) {
683 if ( (*s)->name == "Add tracks") { //somewhat-special, most-used template
684 row = *(trk_template_model->prepend ());
686 row = *(trk_template_model->append ());
688 row[track_template_columns.name] = (*s)->name;
689 row[track_template_columns.path] = "urn:ardour:" + (*s)->path;
690 row[track_template_columns.description] = (*s)->description;
691 row[track_template_columns.created_with] = _("{Factory Template}");
693 if ( (*s)->name == "Add tracks") { //somewhat-special, most-used template
694 trk_template_chooser.get_selection()->select(row);
698 //Add a special item for "Manual Configuration)
699 TreeModel::Row row = *(trk_template_model->prepend ());
700 row[track_template_columns.name] = _("Manual Configuration");
701 row[track_template_columns.path] = "urn:ardour:manual";
702 row[track_template_columns.description] = _("Use the controls, below, to add tracks.");
703 row[track_template_columns.created_with] = "";
705 /* clear template path for the rest */
707 chn.template_path = "";
709 chn.name = _("3 Channel");
711 channel_setups.push_back (chn);
713 chn.name = _("4 Channel");
715 channel_setups.push_back (chn);
717 chn.name = _("5 Channel");
719 channel_setups.push_back (chn);
721 chn.name = _("6 Channel");
723 channel_setups.push_back (chn);
725 chn.name = _("8 Channel");
727 channel_setups.push_back (chn);
729 chn.name = _("12 Channel");
731 channel_setups.push_back (chn);
733 chn.name = _("Custom");
735 channel_setups.push_back (chn);
737 for (ChannelSetups::iterator i = channel_setups.begin(); i != channel_setups.end(); ++i) {
738 channel_combo_strings.push_back ((*i).name);
741 set_popdown_strings (channel_combo, channel_combo_strings);
743 if (!channel_current_choice.empty()) {
744 channel_combo.set_active_text (channel_current_choice);
746 channel_combo.set_active_text (channel_combo_strings.front());
751 AddRouteDialog::add_route_group (RouteGroup* g)
753 route_group_combo.insert_text (3, g->name ());
757 AddRouteDialog::route_group ()
759 if (!_session || route_group_combo.get_active_row_number () == 2) {
763 return _session->route_group_by_name (route_group_combo.get_active_text());
767 AddRouteDialog::use_strict_io() {
768 return strict_io_combo.get_active_row_number () == 1;
772 AddRouteDialog::refill_route_groups ()
774 route_group_combo.clear ();
775 route_group_combo.append_text (_("New Group..."));
777 route_group_combo.append_text ("separator");
779 route_group_combo.append_text (_("No Group"));
782 _session->foreach_route_group (sigc::mem_fun (*this, &AddRouteDialog::add_route_group));
785 route_group_combo.set_active (2);
789 AddRouteDialog::group_changed ()
791 if (_session && route_group_combo.get_active_text () == _("New Group...")) {
792 RouteGroup* g = new RouteGroup (*_session, "");
793 RouteGroupDialog* d = new RouteGroupDialog (g, true);
795 d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &AddRouteDialog::new_group_dialog_finished), d));
801 AddRouteDialog::new_group_dialog_finished (int r, RouteGroupDialog* d)
803 if (r == RESPONSE_OK) {
805 if (!d->name_check()) {
810 _session->add_route_group (d->group());
813 add_route_group (d->group());
814 route_group_combo.set_active (3);
817 route_group_combo.set_active (2);
820 delete_when_idle (d);
823 RouteDialogs::InsertAt
824 AddRouteDialog::insert_at ()
826 using namespace RouteDialogs;
828 std::string str = insert_at_combo.get_active_text();
830 if (str == _("First")) {
832 } else if (str == _("After Selection")) {
833 return AfterSelection;
834 } else if (str == _("Before Selection")){
835 return BeforeSelection;
841 AddRouteDialog::channel_separator (const Glib::RefPtr<Gtk::TreeModel> &, const Gtk::TreeModel::iterator &i)
843 channel_combo.set_active (i);
845 return channel_combo.get_active_text () == "separator";
849 AddRouteDialog::route_separator (const Glib::RefPtr<Gtk::TreeModel> &, const Gtk::TreeModel::iterator &i)
851 route_group_combo.set_active (i);
853 return route_group_combo.get_active_text () == "separator";
857 AddRouteDialog::requested_instrument ()
859 return instrument_combo.selected_instrument();