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.
24 #include <sigc++/bind.h>
26 #include <gtkmm2ext/utils.h>
29 #include "add_route_dialog.h"
33 using namespace Gtkmm2ext;
36 extern std::vector<string> channel_combo_strings;
38 AddRouteDialog::AddRouteDialog ()
39 : ArdourDialog ("add route dialog"),
41 cancel_button (_("Cancel")),
42 track_button (_("Tracks")),
43 bus_button (_("Busses")),
44 routes_adjustment (1, 1, 32, 1, 4),
45 routes_spinner (routes_adjustment)
47 set_name ("AddRouteDialog");
48 set_title (_("ardour: add track/bus"));
49 set_wmclass (X_("ardour_add_track_bus"), "Ardour");
50 set_position (Gtk::WIN_POS_MOUSE);
51 set_keyboard_input (true);
53 name_template_entry.set_name ("AddRouteDialogNameTemplateEntry");
54 track_button.set_name ("AddRouteDialogRadioButton");
55 bus_button.set_name ("AddRouteDialogRadioButton");
56 ok_button.set_name ("AddRouteDialogButton");
57 cancel_button.set_name ("AddRouteDialogButton");
58 routes_spinner.set_name ("AddRouteDialogSpinner");
60 RadioButton::Group g = track_button.get_group();
61 bus_button.set_group (g);
62 track_button.set_active (true);
64 HBox *hbrb = manage (new HBox);
66 hbrb->set_spacing (6);
67 hbrb->pack_start (*(manage (new Label (_("Add")))), false, false);
68 hbrb->pack_start (routes_spinner, false, false);
69 hbrb->pack_start (track_button, false, false);
70 hbrb->pack_start (bus_button, false, false);
72 set_popdown_strings (channel_combo, channel_combo_strings);
73 channel_combo.set_name (X_("ChannelCountSelector"));
75 VBox *vbcc = manage (new VBox);
77 vbcc->set_spacing (6);
78 vbcc->pack_start (*(manage (new Label ("Channel configuration"))), false, false);
79 vbcc->pack_start (channel_combo, false, false);
82 HBox *hbnt = manage (new HBox);
84 hbnt->pack_start (*(manage (new Label (_("Name (template)")))), false, false);
85 hbnt->pack_start (name_template_entry, true, true);
88 HBox* hbbut = manage (new HBox);
90 set_size_request_to_display_given_text (ok_button, _("Cancel"), 20, 15); // this is cancel on purpose
91 set_size_request_to_display_given_text (cancel_button, _("Cancel"), 20, 15);
93 hbbut->set_homogeneous (true);
94 hbbut->set_spacing (6);
95 hbbut->pack_end (cancel_button, false, false);
96 hbbut->pack_end (ok_button, false, false);
98 HBox* hbbutouter = manage (new HBox);
99 hbbutouter->set_border_width (12);
100 hbbutouter->pack_end (*hbbut, false, false);
102 VBox* vb2 = manage (new VBox);
104 vb2->set_border_width (12);
105 vb2->set_spacing (6);
106 vb2->pack_start (*hbrb, false, false);
107 vb2->pack_start (*vbcc, false, false);
109 vb2->pack_start (*hbnt, false, false);
111 vb2->pack_start (*hbbutouter, false, false);
115 // signal_delete_event().connect (mem_fun(*this, &ArdourDialog::wm_close_event));
116 ok_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 0));
117 cancel_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 1));
120 AddRouteDialog::~AddRouteDialog ()
125 AddRouteDialog::track ()
127 return track_button.get_active ();
131 AddRouteDialog::name_template ()
133 return name_template_entry.get_text ();
137 AddRouteDialog::count ()
139 return (int) floor (routes_adjustment.get_value ());
143 AddRouteDialog::channels ()
145 return channel_combo_get_channel_count (channel_combo);