Grey-out patch changes on inactive channels rather than not
[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
17 static const char* mode_strings[] = { "duplex", "output", "input",  (char*) 0 };
18
19 MidiPortDialog::MidiPortDialog ()
20         : ArdourDialog (_("Add MIDI Port"))
21         , port_label (_("Port name:"))
22 {
23         set_modal (true);
24         set_skip_taskbar_hint (true);
25         set_resizable (false);
26         set_position (Gtk::WIN_POS_MOUSE);
27         set_name (N_("MidiPortDialog"));
28
29         vector<string> str = internationalize (PACKAGE, mode_strings);
30         set_popdown_strings (port_mode_combo, str);
31         port_mode_combo.set_active_text (str.front());
32
33         hpacker.set_spacing (6);
34         hpacker.set_border_width (5);
35
36         hpacker.pack_start (port_label);
37         hpacker.pack_start (port_name);
38         hpacker.pack_start (port_mode_combo);
39
40         get_vbox()->pack_start (hpacker);
41
42         port_name.signal_activate().connect (sigc::mem_fun (*this, &MidiPortDialog::entry_activated));
43
44         add_button (Stock::CANCEL, RESPONSE_CANCEL);
45         add_button (Stock::ADD, RESPONSE_ACCEPT);
46
47         show_all_children ();
48 }
49
50 void
51 MidiPortDialog::entry_activated ()
52 {
53         response (RESPONSE_ACCEPT);
54 }
55
56 MidiPortDialog::~MidiPortDialog ()
57 {
58
59 }