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