6e692c6eac2bc86489524c77159f362e0e3b6ac2
[ardour.git] / gtk2_ardour / midi_port_dialog.cc
1 #include <string>
2 #include <sigc++/bind.h>
3 #include <gtkmm/stock.h>
4
5 #include "pbd/convert.h"
6 #include <gtkmm2ext/utils.h>
7
8 #include "midi_port_dialog.h"
9
10 #include "i18n.h"
11
12 using namespace std;
13 using namespace PBD;
14 using namespace Gtk;
15 using namespace Gtkmm2ext;
16 using namespace sigc;
17
18 static const char* mode_strings[] = { "duplex", "output", "input",  (char*) 0 };
19
20 MidiPortDialog::MidiPortDialog ()
21         : ArdourDialog ("Add MIDI port"),
22           port_label (_("Port name"))
23         
24 {
25         vector<string> str = internationalize (PACKAGE, mode_strings);
26         set_popdown_strings (port_mode_combo, str);
27         port_mode_combo.set_active_text (str.front());
28
29         hpacker.pack_start (port_label);
30         hpacker.pack_start (port_name);
31         hpacker.pack_start (port_mode_combo);
32
33         port_label.show ();
34         port_name.show ();
35         port_mode_combo.show ();
36         hpacker.show ();
37
38         get_vbox()->pack_start (hpacker);
39
40         port_name.signal_activate().connect (mem_fun (*this, &MidiPortDialog::entry_activated));
41
42         add_button (Stock::ADD, RESPONSE_ACCEPT);
43         add_button (Stock::CANCEL, RESPONSE_CANCEL);
44 }
45
46 void
47 MidiPortDialog::entry_activated ()
48 {
49         response (RESPONSE_ACCEPT);
50 }
51
52 MidiPortDialog::~MidiPortDialog ()
53 {
54
55 }