enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / gtk2_ardour / midi_port_dialog.cc
1 /*
2     Copyright (C) 2012 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 <string>
21 #include <sigc++/bind.h>
22 #include <gtkmm/stock.h>
23
24 #include "pbd/convert.h"
25 #include <gtkmm2ext/utils.h>
26
27 #include "midi_port_dialog.h"
28
29 #include "pbd/i18n.h"
30
31 using namespace std;
32 using namespace PBD;
33 using namespace Gtk;
34 using namespace Gtkmm2ext;
35
36 static const char* mode_strings[] = { "duplex", "output", "input",  (char*) 0 };
37
38 MidiPortDialog::MidiPortDialog ()
39         : ArdourDialog (_("Add MIDI Port"))
40         , port_label (_("Port name:"))
41 {
42         set_modal (true);
43         set_skip_taskbar_hint (true);
44         set_resizable (false);
45         set_name (N_("MidiPortDialog"));
46
47         vector<string> str = internationalize (PACKAGE, mode_strings);
48         set_popdown_strings (port_mode_combo, str);
49         port_mode_combo.set_active_text (str.front());
50
51         hpacker.set_spacing (6);
52         hpacker.set_border_width (5);
53
54         hpacker.pack_start (port_label);
55         hpacker.pack_start (port_name);
56         hpacker.pack_start (port_mode_combo);
57
58         get_vbox()->pack_start (hpacker);
59
60         port_name.signal_activate().connect (sigc::mem_fun (*this, &MidiPortDialog::entry_activated));
61
62         add_button (Stock::CANCEL, RESPONSE_CANCEL);
63         add_button (Stock::ADD, RESPONSE_ACCEPT);
64
65         show_all_children ();
66 }
67
68 void
69 MidiPortDialog::entry_activated ()
70 {
71         response (RESPONSE_ACCEPT);
72 }
73
74 MidiPortDialog::~MidiPortDialog ()
75 {
76
77 }