use new method in MidiPatchManager to use MIDNAM data when setting a MidiTimeAxisView
[ardour.git] / gtk2_ardour / instrument_selector.h
1 /*
2  * Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19 #ifndef __gtk_ardour_instrument_selector_h__
20 #define __gtk_ardour_instrument_selector_h__
21
22 #include <string>
23
24 #include <gtkmm/combobox.h>
25 #include <gtkmm/comboboxtext.h>
26 #include <gtkmm/treemodel.h>
27 #include <gtkmm/liststore.h>
28
29 #include "pbd/signals.h"
30
31 #include "ardour/plugin.h"
32 #include "ardour/types.h"
33 #include "ardour/template_utils.h"
34
35 #include "ardour_dialog.h"
36
37 class Editor;
38
39 class InstrumentSelector : public Gtk::ComboBox
40 {
41 public:
42         InstrumentSelector();
43
44         ARDOUR::PluginInfoPtr selected_instrument();
45
46 private:
47         struct InstrumentListColumns : public Gtk::TreeModel::ColumnRecord {
48                 InstrumentListColumns() {
49                         add(name);
50                         add(info_ptr);
51                 }
52                 Gtk::TreeModelColumn<std::string>           name;
53                 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> info_ptr;
54         };
55
56         void build_instrument_list();
57         void refill();
58
59         Glib::RefPtr<Gtk::ListStore> _instrument_list;
60         InstrumentListColumns        _instrument_list_columns;
61         uint32_t                     _reasonable_synth_id;
62         uint32_t                     _gmsynth_id;
63         PBD::ScopedConnection        _update_connection;
64 };
65
66 #endif /* __gtk_ardour_instrument_selector_h__ */