Guitarix
ladspalist.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Andreas Degert, Hermann Meyer
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #include <ladspa.h>
20 
21 namespace ladspa {
22 
23 /****************************************************************
24  ** class PluginDisplay
25  */
26 
27 class EnumListStore: public Gtk::ListStore {
28 public:
29  class Columns: public Gtk::TreeModel::ColumnRecord {
30  public:
31  Gtk::TreeModelColumn<int> value;
32  Gtk::TreeModelColumn<Glib::ustring> label;
33  Gtk::TreeModelColumn<PortDesc*> port;
34  Columns() { add(value); add(label); add(port); }
35  } col;
36  EnumListStore(): Gtk::ListStore(Columns()) {}
37 };
38 
39 class PortListStore: public Gtk::ListStore {
40 public:
41  class Columns: public Gtk::TreeModel::ColumnRecord {
42  public:
43  Gtk::TreeModelColumn<int> pos;
44  Gtk::TreeModelColumn<Glib::ustring> name;
45  Gtk::TreeModelColumn<Glib::ustring> dflt;
46  Gtk::TreeModelColumn<Glib::ustring> low;
47  Gtk::TreeModelColumn<Glib::ustring> up;
48  Gtk::TreeModelColumn<Glib::ustring> step;
49  Gtk::TreeModelColumn<Glib::ustring> display;
50  Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > display_types;
51  Gtk::TreeModelColumn<PortDesc*> port;
52  Gtk::TreeModelColumn<bool> newrow;
53  Gtk::TreeModelColumn<bool> use_sr;
54  Gtk::TreeModelColumn<bool> has_caption;
55  Columns() {
56  add(pos); add(name); add(dflt); add(low); add(up); add(step); add(display);
57  add(display_types); add(port); add(newrow); add(use_sr); add(has_caption);
58  }
59  } col;
60  PortListStore(): Gtk::ListStore(Columns()) {}
61 };
62 
63 class PluginListStore: public Gtk::ListStore {
64 public:
65  class Columns: public Gtk::TreeModel::ColumnRecord {
66  public:
67  Gtk::TreeModelColumn<Glib::ustring> name;
68  Gtk::TreeModelColumn<bool> active;
69  Gtk::TreeModelColumn<PluginDesc*> pdesc;
70  Columns() { add(name); add(active); add(pdesc); }
71  } col;
72  PluginListStore(): Gtk::ListStore(Columns()) {}
73 };
74 
75 class MasterIdxListStore: public Gtk::ListStore {
76 public:
77  class Columns: public Gtk::TreeModel::ColumnRecord {
78  public:
79  Gtk::TreeModelColumn<int> idx;
80  Columns() { add(idx); }
81  } col;
82  MasterIdxListStore(): Gtk::ListStore(Columns()) {}
83 };
84 
86 private:
89  std::vector<PluginDesc*> needs_reload;
91  int old_state;
92  Glib::RefPtr<gx_gui::GxBuilder> bld;
94  Glib::RefPtr<Gio::SimpleActionGroup> actiongroup;
95  Glib::RefPtr<EnumListStore> enum_liststore;
96  Glib::RefPtr<PortListStore> port_liststore;
97  Glib::RefPtr<PluginListStore> plugin_liststore;
98  Glib::RefPtr<MasterIdxListStore> masteridx_liststore;
99  sigc::connection on_reordered_conn;
100  Glib::RefPtr<Gtk::ListStore> display_type_list;
101  Glib::RefPtr<Gtk::ListStore> display_type_list_sr;
102  Glib::RefPtr<Gtk::ListStore> output_type_list;
103  sigc::slot<void,bool,bool> finished_callback;
105  // widget pointers, not initialized
106  Gtk::Window *window;
107  Gtk::TreeView *treeview1;
108  Gtk::TreeView *treeview2;
109  Gtk::TreeView *treeview3;
110  Gtk::Entry *ladspa_category;
111  Gtk::Entry *ladspa_maker;
112  Gtk::Entry *ladspa_uniqueid;
113  Gtk::Entry *search_entry;
114  Gtk::ComboBox *combobox_mono_stereo;
115  Gtk::ToggleButton *selected_only;
116  Gtk::ToggleButton *changed_only;
117  Gtk::ToggleButton *ladspa_only;
118  Gtk::ToggleButton *lv2_only;
119  Gtk::ToggleButton *show_all;
120  Gtk::Box *details_box;
121  Gtk::ToggleButton *show_details;
122  Gtk::Entry *plugin_name;
123  Gtk::ComboBox *plugin_category;
124  Gtk::ToggleButton *dry_wet_button;
125  Gtk::ToggleButton *stereo_to_mono_button;
126  Gtk::ComboBox *plugin_quirks;
127  Gtk::ComboBox *master_slider_idx;
128  Gtk::Entry *master_slider_name;
129  Gtk::CellRendererText *cellrenderer_master;
130  Gtk::CellRendererToggle *cellrenderer_newrow;
131  Gtk::CellRendererToggle *cellrenderer_caption;
132  Gtk::CellRendererToggle *cellrenderer_active;
133  Gtk::CellRendererText *cellrenderer_category;
134  Gtk::CellRendererText *cellrenderer_quirks;
135 private:
136  void set_title();
137  void on_save();
138  void on_apply();
139  void on_quit();
140  void on_select_all(bool v);
141  void on_find();
142  bool on_delete_event(GdkEventAny*);
143  void on_show_details();
144  void on_add_dry_wet_controller();
145  void on_stereo_to_mono_controller();
146  void on_stereo_to_mono();
147  void on_row_activated(const Gtk::TreePath& path, Gtk::TreeViewColumn* column);
148  void on_label_edited(const Glib::ustring& path, const Glib::ustring& newtext);
149  void on_parameter_selection_changed();
150  void on_reordered(const Gtk::TreePath& path);
151  void on_type_edited(const Glib::ustring& path, const Glib::ustring& newtext);
152  void on_step_edited(const Glib::ustring& path, const Glib::ustring& newtext);
153  void on_newrow_toggled(const Glib::ustring& path);
154  void on_caption_toggled(const Glib::ustring& path);
155  void on_name_edited(const Glib::ustring& path, const Glib::ustring& newtext);
156  void on_dflt_edited(const Glib::ustring& path, const Glib::ustring& newtext);
157  void on_low_edited(const Glib::ustring& path, const Glib::ustring& newtext);
158  void on_up_edited(const Glib::ustring& path, const Glib::ustring& newtext);
159  void on_search_entry_activate();
160  void selection_changed();
161  void on_active_toggled(const Glib::ustring& path);
162  void on_view_changed(const Gtk::ToggleButton*);
163  void display_category(const Gtk::TreeIter& it);
164  void display_quirks(const Gtk::TreeIter& it);
165  void on_mono_stereo_changed();
166  void on_delete_changes();
167  bool search_equal(const Glib::RefPtr<Gtk::TreeModel>& model, int column, const Glib::ustring& key, const Gtk::TreeIter& iter);
168  void display_label(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
169  void display_step(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
170  void display_ladspa(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
171  void display_idx(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
172  void display_name(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
173  void display_default(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
174  void display_lower(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
175  void display_upper(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
176  void display_SR(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
177  void display_type(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
178  void display_newrow(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
179  void display_caption(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
180  bool check_for_changes();
181  int ask_discard();
182  void save_current();
183  void load();
184  bool do_save();
185  void set_old_state(PluginDesc *p);
186  void display_master_idx(const Gtk::TreeIter& it);
187  void set_master_text();
188  void load_ladspalist(std::vector<unsigned long>& old_not_found, std::vector<PluginDesc*>& l);
189 public:
190  PluginDisplay(gx_engine::GxMachineBase& machine, Glib::RefPtr<Gdk::Pixbuf> icon, sigc::slot<void,bool,bool> finished_callback);
191  ~PluginDisplay();
192  bool check_exit();
193  void present() { window->present(); }
194  void hide() { window->hide(); }
195 };
196 
197 } // namespace ladspa
Glib::RefPtr< EnumListStore > enum_liststore
Definition: ladspalist.h:95
Gtk::Entry * plugin_name
Definition: ladspalist.h:122
Gtk::Entry * search_entry
Definition: ladspalist.h:113
Gtk::TreeModelColumn< Glib::ustring > dflt
Definition: ladspalist.h:45
Gtk::CellRendererText * cellrenderer_category
Definition: ladspalist.h:133
Glib::RefPtr< Gtk::ListStore > display_type_list
Definition: ladspalist.h:100
Gtk::TreeModelColumn< bool > use_sr
Definition: ladspalist.h:53
Gtk::TreeModelColumn< PortDesc * > port
Definition: ladspalist.h:33
gx_engine::GxMachineBase & machine
Definition: ladspalist.h:87
Gtk::CellRendererToggle * cellrenderer_newrow
Definition: ladspalist.h:130
Gtk::ToggleButton * ladspa_only
Definition: ladspalist.h:117
Gtk::Entry * ladspa_category
Definition: ladspalist.h:110
Gtk::TreeView * treeview1
Definition: ladspalist.h:107
Gtk::TreeModelColumn< int > idx
Definition: ladspalist.h:79
Gtk::TreeModelColumn< bool > has_caption
Definition: ladspalist.h:54
Gtk::ComboBox * plugin_category
Definition: ladspalist.h:123
Gtk::ToggleButton * selected_only
Definition: ladspalist.h:115
Glib::RefPtr< PortListStore > port_liststore
Definition: ladspalist.h:96
sigc::connection on_reordered_conn
Definition: ladspalist.h:99
Gtk::ComboBox * combobox_mono_stereo
Definition: ladspalist.h:114
Gtk::TreeModelColumn< Glib::ustring > low
Definition: ladspalist.h:46
Gtk::ToggleButton * changed_only
Definition: ladspalist.h:116
Gtk::Entry * ladspa_maker
Definition: ladspalist.h:111
std::vector< PluginDesc * > needs_reload
Definition: ladspalist.h:89
Gtk::TreeModelColumn< Glib::ustring > display
Definition: ladspalist.h:49
Gtk::ComboBox * plugin_quirks
Definition: ladspalist.h:126
Gtk::TreeModelColumn< bool > newrow
Definition: ladspalist.h:52
Gtk::CellRendererToggle * cellrenderer_caption
Definition: ladspalist.h:131
ladspa::EnumListStore::Columns col
Glib::RefPtr< Gio::SimpleActionGroup > actiongroup
Definition: ladspalist.h:94
Gtk::ToggleButton * dry_wet_button
Definition: ladspalist.h:124
Gtk::CellRendererText * cellrenderer_master
Definition: ladspalist.h:129
Gtk::TreeModelColumn< Glib::ustring > name
Definition: ladspalist.h:67
Glib::RefPtr< Gtk::ListStore > display_type_list_sr
Definition: ladspalist.h:101
Gtk::Entry * ladspa_uniqueid
Definition: ladspalist.h:112
Gtk::ToggleButton * lv2_only
Definition: ladspalist.h:118
Glib::RefPtr< MasterIdxListStore > masteridx_liststore
Definition: ladspalist.h:98
Gtk::TreeModelColumn< PluginDesc * > pdesc
Definition: ladspalist.h:69
Gtk::TreeModelColumn< PortDesc * > port
Definition: ladspalist.h:51
LadspaPluginList pluginlist
Definition: ladspalist.h:88
Gtk::CellRendererText * cellrenderer_quirks
Definition: ladspalist.h:134
Glib::RefPtr< Gtk::ListStore > output_type_list
Definition: ladspalist.h:102
Gtk::ToggleButton * show_details
Definition: ladspalist.h:121
Glib::RefPtr< PluginListStore > plugin_liststore
Definition: ladspalist.h:97
sigc::slot< void, bool, bool > finished_callback
Definition: ladspalist.h:103
Gtk::TreeView * treeview2
Definition: ladspalist.h:108
Gtk::TreeModelColumn< Glib::ustring > name
Definition: ladspalist.h:44
Gtk::ComboBox * master_slider_idx
Definition: ladspalist.h:127
Gtk::TreeModelColumn< int > pos
Definition: ladspalist.h:43
Glib::RefPtr< gx_gui::GxBuilder > bld
Definition: ladspalist.h:92
Gtk::TreeModelColumn< Glib::ustring > up
Definition: ladspalist.h:47
Gtk::ToggleButton * show_all
Definition: ladspalist.h:119
Gtk::Box * details_box
Definition: ladspalist.h:120
Gtk::TreeModelColumn< Glib::ustring > step
Definition: ladspalist.h:48
PluginDesc * current_plugin
Definition: ladspalist.h:90
Gtk::TreeModelColumn< Glib::RefPtr< Gtk::ListStore > > display_types
Definition: ladspalist.h:50
Gtk::CellRendererToggle * cellrenderer_active
Definition: ladspalist.h:132
Gtk::Window * window
Definition: ladspalist.h:106
Gtk::TreeView * treeview3
Definition: ladspalist.h:109
Gtk::TreeModelColumn< int > value
Definition: ladspalist.h:31
Gtk::ToggleButton * stereo_to_mono_button
Definition: ladspalist.h:125
Gtk::TreeModelColumn< bool > active
Definition: ladspalist.h:68
Gtk::TreeModelColumn< Glib::ustring > label
Definition: ladspalist.h:32
Gtk::Entry * master_slider_name
Definition: ladspalist.h:128