ardour
midi_port_dialog.cc
Go to the documentation of this file.
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 "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 
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);
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
70 {
71  response (RESPONSE_ACCEPT);
72 }
73 
75 {
76 
77 }
Gtk::Label port_label
Definition: ardour_ui.h:130
Definition: Beats.hpp:239
Gtk::Entry port_name
static const char * mode_strings[]
LIBGTKMM2EXT_API void set_popdown_strings(Gtk::ComboBoxText &, const std::vector< std::string > &)
#define _(Text)
Definition: i18n.h:11
vector< string > internationalize(const char *package_name, const char **array)
Definition: convert.cc:164
Definition: debug.h:30
Gtk::ComboBoxText port_mode_combo
#define N_(Text)
Definition: i18n.h:12