add new cakewalk icons, add new shapewipe shapes, rework shapewipe plugin, fix 3rd...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / shapewipe / shapewipe.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef SHAPEWIPE_H
23 #define SHAPEWIPE_H
24
25 class ShapeWipeConfig;
26 class ShapeWipeMain;
27 class ShapeWipeWindow;
28 class ShapeWipeW2B;
29 class ShapeWipeB2W;
30 class ShapeWipeTumble;
31 class ShapeWipeFeather;
32 class ShapeWipeShape;
33 class ShapeWipePreserveAspectRatio;
34 class ShapePackage;
35 class ShapeUnit;
36 class ShapeEngine;
37
38 #include "overlayframe.inc"
39 #include "pluginvclient.h"
40 #include "vframe.inc"
41
42 class ShapeWipeW2B : public BC_Radial
43 {
44 public:
45         ShapeWipeW2B(ShapeWipeMain *plugin,
46                 ShapeWipeWindow *window,
47                 int x,
48                 int y);
49         int handle_event();
50         ShapeWipeMain *plugin;
51         ShapeWipeWindow *window;
52 };
53
54 class ShapeWipeB2W : public BC_Radial
55 {
56 public:
57         ShapeWipeB2W(ShapeWipeMain *plugin,
58                 ShapeWipeWindow *window,
59                 int x,
60                 int y);
61         int handle_event();
62         ShapeWipeMain *plugin;
63         ShapeWipeWindow *window;
64 };
65
66
67 class ShapeWipeTumble : public BC_Tumbler
68 {
69 public:
70         ShapeWipeTumble(ShapeWipeMain *client,
71                 ShapeWipeWindow *window,
72                 int x,
73                 int y);
74
75         int handle_up_event();
76         int handle_down_event();
77
78         ShapeWipeMain *client;
79         ShapeWipeWindow *window;
80 };
81
82 class ShapeWipeFeather : public BC_FSlider
83 {
84 public:
85         ShapeWipeFeather(ShapeWipeMain *client,
86                 ShapeWipeWindow *window, int x, int y);
87         char *get_caption();
88         int handle_event();
89
90         ShapeWipeMain *client;
91         ShapeWipeWindow *window;
92 };
93
94 class ShapeWipeShape : public BC_PopupTextBox
95 {
96 public:
97         ShapeWipeShape(ShapeWipeMain *client, ShapeWipeWindow *window,
98                 int x, int y, int text_w, int list_h);
99         int handle_event();
100         ShapeWipeMain *client;
101         ShapeWipeWindow *window;
102 };
103
104 class ShapeWipePreserveAspectRatio : public BC_CheckBox
105 {
106 public:
107         ShapeWipePreserveAspectRatio(ShapeWipeMain *plugin,
108                 ShapeWipeWindow *window,
109                 int x,
110                 int y);
111         int handle_event();
112         ShapeWipeMain *plugin;
113         ShapeWipeWindow *window;
114 };
115
116
117 class ShapeWipeWindow : public PluginClientWindow
118 {
119 public:
120         ShapeWipeWindow(ShapeWipeMain *plugin);
121         ~ShapeWipeWindow();
122         void create_objects();
123         void next_shape();
124         void prev_shape();
125
126         ShapeWipeMain *plugin;
127         ShapeWipeW2B *left;
128         ShapeWipeB2W *right;
129         ShapeWipeTumble *shape_tumbler;
130         ShapeWipeShape *shape_text;
131         ShapeWipeFeather *shape_feather;
132         ArrayList<BC_ListBoxItem*> shapes;
133 };
134
135 class ShapeWipeConfig
136 {
137 public:
138         ShapeWipeConfig();
139         ~ShapeWipeConfig();
140         void read_xml(KeyFrame *keyframe);
141         void save_xml(KeyFrame *keyframe);
142
143         int direction;
144         float feather;
145         int preserve_aspect;
146         char shape_name[BCTEXTLEN];
147 };
148
149 class ShapeWipeMain : public PluginVClient
150 {
151 public:
152         ShapeWipeMain(PluginServer *server);
153         ~ShapeWipeMain();
154
155         PLUGIN_CLASS_MEMBERS(ShapeWipeConfig)
156         int process_realtime(VFrame *input, VFrame *output);
157         int uses_gui();
158         int is_transition();
159         void read_data(KeyFrame *keyframe);
160         void save_data(KeyFrame *keyframe);
161
162         int read_pattern_image(char *shape_name,
163                 int new_frame_width, int new_frame_height);
164         void reset_pattern_image();
165         void init_shapes();
166
167         VFrame *input, *output;
168         ShapeEngine *engine;
169         ArrayList<char*> shape_paths;
170         ArrayList<char*> shape_titles;
171
172         int shapes_initialized;
173         int threshold;
174         char current_filename[BCTEXTLEN];
175         char current_name[BCTEXTLEN];
176         unsigned char **pattern_image;
177         unsigned char min_value;
178         unsigned char max_value;
179         int frame_width;
180         int frame_height;
181         int preserve_aspect;
182         int last_preserve_aspect;
183 };
184
185
186 class ShapePackage : public LoadPackage
187 {
188 public:
189         ShapePackage();
190         int y1, y2;
191 };
192
193 class ShapeUnit : public LoadClient
194 {
195 public:
196         ShapeUnit(ShapeEngine *server);
197         ~ShapeUnit();
198         void process_package(LoadPackage *package);
199         ShapeEngine *server;
200         unsigned char threshold;
201 };
202
203 class ShapeEngine : public LoadServer
204 {
205 public:
206         ShapeEngine(ShapeWipeMain *plugin,
207                 int total_clients, int total_packages);
208         ~ShapeEngine();
209
210         void init_packages();
211         LoadClient *new_client();
212         LoadPackage *new_package();
213         ShapeWipeMain *plugin;
214 };
215
216 #endif