8402f47ea1a6aa3859349f5c5c8b101abb4b6ada
[ardour.git] / gtk2_ardour / add_midi_cc_track_dialog.cc
1 /*
2     Copyright (C) 2000-2007 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 */
19
20 #include <cstdio>
21 #include <cmath>
22
23 #include <sigc++/bind.h>
24 #include <gtkmm/stock.h>
25 #include <pbd/error.h>
26 #include <pbd/convert.h>
27
28 #include "utils.h"
29 #include "add_midi_cc_track_dialog.h"
30 #include "i18n.h"
31
32 using namespace Gtk;
33 using namespace sigc;
34 using namespace std;
35 using namespace PBD;
36 using namespace ARDOUR;
37
38 AddMidiCCTrackDialog::AddMidiCCTrackDialog ()
39         : Dialog (_("ardour: add midi controller track")),
40           _cc_num_adjustment (1, 0, 127, 1, 10),
41           _cc_num_spinner (_cc_num_adjustment)
42 {
43         set_name ("AddMidiCCTrackDialog");
44         set_wmclass (X_("ardour_add_track_bus"), "Ardour");
45         set_position (Gtk::WIN_POS_MOUSE);
46         set_resizable (false);
47
48
49         _cc_num_spinner.set_name ("AddMidiCCTrackDialogSpinner");
50         
51         HBox *hbox = manage (new HBox());
52
53         hbox->pack_start(*manage(new Label("Controller Number: ")), true, true, 4);
54         hbox->pack_start(_cc_num_spinner, false, false, 4);
55
56         get_vbox()->pack_start(*hbox, true, true, 4);
57
58         show_all();
59
60         add_button (Stock::CANCEL, RESPONSE_CANCEL);
61         add_button (Stock::ADD, RESPONSE_ACCEPT);
62 }
63
64
65 ARDOUR::Parameter
66 AddMidiCCTrackDialog::parameter ()
67 {
68         int cc_num = _cc_num_spinner.get_value_as_int();
69
70         return Parameter(MidiCCAutomation, cc_num);
71 }
72