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:
87  gx_engine::GxMachineBase& machine;
88  LadspaPluginList pluginlist;
89  PluginDesc *current_plugin;
90  int old_state;
91  Glib::RefPtr<gx_gui::GxBuilder> bld;
92  int change_count;
93  Glib::RefPtr<Gtk::ActionGroup> actiongroup;
94  Glib::RefPtr<Gtk::UIManager> uimanager;
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;
104  //
105  Glib::RefPtr<Gtk::Action> quit_action;
106  Glib::RefPtr<Gtk::Action> save_action;
107  Glib::RefPtr<Gtk::Action> apply_action;
108  Glib::RefPtr<Gtk::Action> select_all_action;
109  Glib::RefPtr<Gtk::Action> select_none_action;
110  //
111  Gtk::Window *window;
112  Gtk::TreeView *treeview1;
113  Gtk::TreeView *treeview2;
114  Gtk::TreeView *treeview3;
115  Gtk::Entry *ladspa_category;
116  Gtk::Entry *ladspa_maker;
117  Gtk::Entry *ladspa_uniqueid;
118  Gtk::Entry *search_entry;
119  Gtk::ComboBox *combobox_mono_stereo;
120  Gtk::ToggleButton *selected_only;
121  Gtk::ToggleButton *changed_only;
122  Gtk::ToggleButton *ladspa_only;
123  Gtk::ToggleButton *lv2_only;
124  Gtk::ToggleButton *show_all;
125  Gtk::Box *details_box;
126  Gtk::ToggleButton *show_details;
127  Gtk::Entry *plugin_name;
128  Gtk::ComboBox *plugin_category;
129  Gtk::ToggleButton *dry_wet_button;
130  Gtk::ComboBox *plugin_quirks;
131  Gtk::ComboBox *master_slider_idx;
132  Gtk::Entry *master_slider_name;
133  Gtk::CellRendererText *cellrenderer_master;
134  Gtk::CellRendererToggle *cellrenderer_newrow;
135  Gtk::CellRendererToggle *cellrenderer_caption;
136  Gtk::CellRendererToggle *cellrenderer_active;
137  Gtk::CellRendererText *cellrenderer_category;
138  Gtk::CellRendererText *cellrenderer_quirks;
139 private:
140  void set_title();
141  void on_save();
142  void on_apply();
143  void on_quit();
144  void on_select_all(bool v);
145  void on_find();
146  bool on_delete_event(GdkEventAny*);
147  void on_show_details();
148  void on_add_dry_wet_controller();
149  void on_row_activated(const Gtk::TreePath& path, Gtk::TreeViewColumn* column);
150  void on_label_edited(const Glib::ustring& path, const Glib::ustring& newtext);
151  void on_parameter_selection_changed();
152  void on_reordered(const Gtk::TreePath& path);
153  void on_type_edited(const Glib::ustring& path, const Glib::ustring& newtext);
154  void on_step_edited(const Glib::ustring& path, const Glib::ustring& newtext);
155  void on_newrow_toggled(const Glib::ustring& path);
156  void on_caption_toggled(const Glib::ustring& path);
157  void on_name_edited(const Glib::ustring& path, const Glib::ustring& newtext);
158  void on_dflt_edited(const Glib::ustring& path, const Glib::ustring& newtext);
159  void on_low_edited(const Glib::ustring& path, const Glib::ustring& newtext);
160  void on_up_edited(const Glib::ustring& path, const Glib::ustring& newtext);
161  void on_search_entry_activate();
162  void selection_changed();
163  void on_active_toggled(const Glib::ustring& path);
164  void on_view_changed(const Gtk::ToggleButton*);
165  void display_category(const Gtk::TreeIter& it);
166  void display_quirks(const Gtk::TreeIter& it);
167  void on_mono_stereo_changed();
168  void on_delete_changes();
169  bool search_equal(const Glib::RefPtr<Gtk::TreeModel>& model, int column, const Glib::ustring& key, const Gtk::TreeIter& iter);
170  void display_label(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
171  void display_step(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
172  void display_ladspa(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
173  void display_idx(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
174  void display_name(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
175  void display_default(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
176  void display_lower(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
177  void display_upper(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
178  void display_SR(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
179  void display_type(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
180  void display_newrow(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
181  void display_caption(Gtk::CellRenderer *cell, const Gtk::TreeIter& it);
182  bool check_for_changes();
183  int ask_discard();
184  void save_current();
185  void load();
186  bool do_save();
187  void set_old_state(PluginDesc *p);
188  void display_master_idx(const Gtk::TreeIter& it);
189  void set_master_text();
190  void load_ladspalist(std::vector<unsigned long>& old_not_found, std::vector<PluginDesc*>& l);
191 public:
192  PluginDisplay(gx_engine::GxMachineBase& machine, Glib::RefPtr<Gdk::Pixbuf> icon, sigc::slot<void,bool,bool> finished_callback);
193  ~PluginDisplay();
194  bool check_exit();
195  void present() { window->present(); }
196  void hide() { window->hide(); }
197 };
198 
199 } // namespace ladspa
Gtk::TreeModelColumn< Glib::ustring > dflt
Definition: ladspalist.h:45
Gtk::TreeModelColumn< bool > use_sr
Definition: ladspalist.h:53
Gtk::TreeModelColumn< PortDesc * > port
Definition: ladspalist.h:33
Gtk::TreeModelColumn< int > idx
Definition: ladspalist.h:79
Gtk::TreeModelColumn< bool > has_caption
Definition: ladspalist.h:54
Gtk::TreeModelColumn< Glib::ustring > low
Definition: ladspalist.h:46
Gtk::TreeModelColumn< Glib::ustring > display
Definition: ladspalist.h:49
Gtk::TreeModelColumn< bool > newrow
Definition: ladspalist.h:52
ladspa::EnumListStore::Columns col
Gtk::TreeModelColumn< Glib::ustring > name
Definition: ladspalist.h:67
Gtk::TreeModelColumn< PluginDesc * > pdesc
Definition: ladspalist.h:69
Gtk::TreeModelColumn< PortDesc * > port
Definition: ladspalist.h:51
Gtk::TreeModelColumn< Glib::ustring > name
Definition: ladspalist.h:44
Gtk::TreeModelColumn< int > pos
Definition: ladspalist.h:43
Gtk::TreeModelColumn< Glib::ustring > up
Definition: ladspalist.h:47
Gtk::TreeModelColumn< Glib::ustring > step
Definition: ladspalist.h:48
Gtk::TreeModelColumn< Glib::RefPtr< Gtk::ListStore > > display_types
Definition: ladspalist.h:50
Gtk::TreeModelColumn< int > value
Definition: ladspalist.h:31
Gtk::TreeModelColumn< bool > active
Definition: ladspalist.h:68
Gtk::TreeModelColumn< Glib::ustring > label
Definition: ladspalist.h:32