remove <gtkmm/gtkmm.h> from all files, plus a small fix related to map/realize handling
[ardour.git] / gtk2_ardour / add_route_dialog.cc
1 /*
2     Copyright (C) 2003 Paul Davis 
3
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.
8
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.
13
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.
17
18     $Id$
19 */
20
21 #include <cstdio>
22 #include <cmath>
23
24 #include <sigc++/bind.h>
25
26 #include <gtkmm2ext/utils.h>
27
28 #include "utils.h"
29 #include "add_route_dialog.h"
30 #include "i18n.h"
31
32 using namespace Gtk;
33 using namespace Gtkmm2ext;
34 using namespace sigc;
35 using namespace std;
36
37 extern std::vector<string> channel_combo_strings;
38
39 AddRouteDialog::AddRouteDialog ()
40         : Dialog (_("ardour: add track/bus")),
41           track_button (_("Tracks")),
42           bus_button (_("Busses")),
43           routes_adjustment (1, 1, 32, 1, 4),
44           routes_spinner (routes_adjustment)
45 {
46         set_name ("AddRouteDialog");
47         set_wmclass (X_("ardour_add_track_bus"), "Ardour");
48         set_position (Gtk::WIN_POS_MOUSE);
49
50         name_template_entry.set_name ("AddRouteDialogNameTemplateEntry");
51         track_button.set_name ("AddRouteDialogRadioButton");
52         bus_button.set_name ("AddRouteDialogRadioButton");
53         routes_spinner.set_name ("AddRouteDialogSpinner");
54         
55         RadioButton::Group g = track_button.get_group();
56         bus_button.set_group (g);
57         track_button.set_active (true);
58
59         HBox *hbrb = manage (new HBox);
60
61         hbrb->set_spacing (6);
62         hbrb->pack_start (*(manage (new Label (_("Add")))), false, false);
63         hbrb->pack_start (routes_spinner, false, false);
64         hbrb->pack_start (track_button, false, false);
65         hbrb->pack_start (bus_button, false, false);
66
67         set_popdown_strings (channel_combo, channel_combo_strings);
68         channel_combo.set_name (X_("ChannelCountSelector"));
69         
70         VBox *vbcc = manage (new VBox);
71
72         vbcc->set_spacing (6);
73         vbcc->pack_start (*(manage (new Label ("Channel configuration"))), false, false);
74         vbcc->pack_start (channel_combo, false, false);
75
76 #if NOT_USEFUL_YET
77         HBox *hbnt = manage (new HBox);
78
79         hbnt->pack_start (*(manage (new Label (_("Name (template)")))), false, false);
80         hbnt->pack_start (name_template_entry, true, true);
81 #endif
82
83         VBox* vb2 = manage (new VBox);
84
85         vb2->set_border_width (12);
86         vb2->set_spacing (6);
87         vb2->pack_start (*hbrb, false, false);
88         vb2->pack_start (*vbcc, false, false);
89 #if NOT_USEFUL_YET
90         vb2->pack_start (*hbnt, false, false);
91 #endif
92         
93         get_vbox()->pack_start (*hbrb, false, false);
94         get_vbox()->pack_start (*vbcc, false, false);
95 #if NOT_USEFUL_YET
96         get_vbox()->pack_start (*hbnt, false, false);
97 #endif
98         
99         add_button (Stock::OK, RESPONSE_ACCEPT);
100         add_button (Stock::CANCEL, RESPONSE_CANCEL);
101 }
102
103 AddRouteDialog::~AddRouteDialog ()
104 {
105 }
106
107 bool
108 AddRouteDialog::track ()
109 {
110         return track_button.get_active ();
111 }
112
113 string
114 AddRouteDialog::name_template ()
115 {
116         return name_template_entry.get_text ();
117 }
118
119 int
120 AddRouteDialog::count ()
121 {
122         return (int) floor (routes_adjustment.get_value ());
123 }
124
125 int
126 AddRouteDialog::channels ()
127 {
128         return channel_combo_get_channel_count (channel_combo);
129 }