forked from thunderox/triceratops-old-version-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
presets.h
executable file
·172 lines (126 loc) · 3.04 KB
/
presets.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#ifndef PRESETCAT
#define PRESETCAT
#include <cairomm/context.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <gtkmm/drawingarea.h>
#include <iostream>
#include <string>
#include <sstream>
// LV2UI stuff
#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
#include "dco_gui.h"
#include "lfo_gui.h"
#include "unison_gui.h"
#include "adsr_gui.h"
#include "adsr_lfo_gui.h"
#include "amp_gui.h"
#include "echo_gui.h"
#include "reverb_gui.h"
#include "modifier_gui.h"
#include "widget_button.h"
using namespace std;
// LV2UI stuff
#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
class presets : public Gtk::DrawingArea
{
public:
vector<string>preset_file_names;
typedef struct
{
string name;
string directory;
} preset;
typedef struct
{
string name;
vector <preset> presets;
} category;
vector <category> categories;
// POINTERS TO TRICERATOPS GUI OBJECTS
dco_gui* dco1;
dco_gui* dco2;
dco_gui* dco3;
unison_gui* unison;
lfo_gui* lfo1;
lfo_gui* lfo2;
lfo_gui* lfo3;
adsr_gui* adsr_amp;
adsr_gui* adsr_filter;
adsr_lfo_gui* adsr_lfo;
amp_gui* amp_and_filter;
echo_gui* echo;
reverb_gui* reverb;
modifier_gui* modifier;
widget_button* button_go_back;
widget_button* button_save_preset;
int port_number;
// LV2 COMMUNICATION STUFF
LV2UI_Controller controller;
LV2UI_Write_Function write_function;
// VARIABLES & VECTORS
Gdk::Color top_colour;
Gdk::Color bottom_colour;
int current_preset_number;
int current_category;
int preset_scroll_offset;
int old_category;
string bundle_path;
enum
{
PRESET_TYPE_NULL,
PRESET_TYPE_CATEGORY,
PRESET_TYPE_PRESET
};
typedef struct
{
int type; // applies to both presets & categories
int category; // applies only to presets
string name; // applies to voth presets & categories
string dir; // applies only to presets
bool unfold; // applies only to categories
} presets_object;
vector<presets_object>preset_list;
static bool sortByName(const presets_object &lhs, const presets_object &rhs) { return lhs.name < rhs.name; }
// FUNCTIONS USED IN THIS CLASS
presets(const std::string& bundle_path_in);
~presets();
void position_top(bool);
int pos_mode;
void set_value(int);
void set_gui_widget(int,float);
void init();
void load_preset(int);
void create_new_preset(string);
int get_symbol_port(string);
protected:
int val;
bool hover_create_new_preset;
string text;
stringstream text_stream;
vector<int>display_list;
float grad_top_colour;
float grad_bottom_colour;
int number_of_categories;
enum
{
gui_status_category,
gui_status_presets
};
int gui_status;
void get_preset_names();
virtual bool on_expose_event(GdkEventExpose*);
virtual bool on_button_press_event(GdkEventButton*);
virtual bool on_scroll_event(GdkEventScroll*);
virtual bool on_button_release_event(GdkEventButton*);
virtual bool on_key_press_event(GdkEventKey* eventData);
bool read_category_file();
};
#endif