fit keyframe spanning for sketcher,tracer,crikey, rework keyframegui preset, tweak...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / rotate / rotate.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 ROTATE_H
23 #define ROTATE_H
24
25
26
27 #include "affine.h"
28 #include "bcdisplayinfo.h"
29 #include "clip.h"
30 #include "bchash.h"
31 #include "filexml.h"
32 #include "guicast.h"
33 #include "language.h"
34 #include "pluginvclient.h"
35 #include "rotateframe.h"
36 #include "vframe.h"
37
38
39 #include <string.h>
40
41
42 class RotateEffect;
43 class RotateWindow;
44 class RotateToggle;
45 class RotateDrawPivot;
46 class RotateInterpolate;
47 class RotateAngleText;
48 class RotateAngleSlider;
49 class RotatePivotXText;
50 class RotatePivotXSlider;
51 class RotatePivotYText;
52 class RotatePivotYSlider;
53 class RotateClr;
54 class RotateReset;
55
56
57 #define RESET_DEFAULT_SETTINGS 10
58 #define RESET_ALL     0
59 #define RESET_ANGLE   1
60 #define RESET_PIVOT_X 2
61 #define RESET_PIVOT_Y 3
62
63
64 class RotateConfig
65 {
66 public:
67         RotateConfig();
68
69         void reset(int clear);
70         int equivalent(RotateConfig &that);
71         void copy_from(RotateConfig &that);
72         void interpolate(RotateConfig &prev,
73                 RotateConfig &next,
74                 long prev_frame,
75                 long next_frame,
76                 long current_frame);
77
78         float angle;
79         float pivot_x;
80         float pivot_y;
81         int draw_pivot;
82 //      int bilinear;
83 };
84
85 class RotateToggle : public BC_Radial
86 {
87 public:
88         RotateToggle(RotateWindow *window,
89                 RotateEffect *plugin,
90                 int init_value,
91                 int x,
92                 int y,
93                 int value,
94                 const char *string);
95         int handle_event();
96
97         RotateEffect *plugin;
98         RotateWindow *window;
99         int value;
100 };
101
102 class RotateDrawPivot : public BC_CheckBox
103 {
104 public:
105         RotateDrawPivot(RotateWindow *window,
106                 RotateEffect *plugin,
107                 int x,
108                 int y);
109         int handle_event();
110         RotateEffect *plugin;
111         RotateWindow *window;
112         int value;
113 };
114
115 class RotateInterpolate : public BC_CheckBox
116 {
117 public:
118         RotateInterpolate(RotateEffect *plugin, int x, int y);
119         int handle_event();
120         RotateEffect *plugin;
121 };
122
123 class RotateAngleText : public BC_TumbleTextBox
124 {
125 public:
126         RotateAngleText(RotateWindow *window,
127                 RotateEffect *plugin,
128                 int x,
129                 int y);
130         int handle_event();
131
132         RotateEffect *plugin;
133         RotateWindow *window;
134 };
135
136 class RotateAngleSlider : public BC_FSlider
137 {
138 public:
139         RotateAngleSlider(RotateWindow *window,
140                 RotateEffect *plugin,
141                 int x, int y, int w);
142         int handle_event();
143
144         RotateEffect *plugin;
145         RotateWindow *window;
146 };
147
148
149 class RotatePivotXText : public BC_TumbleTextBox
150 {
151 public:
152         RotatePivotXText(RotateWindow *window,
153                 RotateEffect *plugin,
154                 int x,
155                 int y);
156         int handle_event();
157
158         RotateEffect *plugin;
159         RotateWindow *window;
160 };
161
162 class RotatePivotXSlider : public BC_FSlider
163 {
164 public:
165         RotatePivotXSlider(RotateWindow *window,
166                 RotateEffect *plugin,
167                 int x, int y, int w);
168         int handle_event();
169
170         RotateEffect *plugin;
171         RotateWindow *window;
172 };
173
174
175 class RotatePivotYText : public BC_TumbleTextBox
176 {
177 public:
178         RotatePivotYText(RotateWindow *window,
179                 RotateEffect *plugin,
180                 int x,
181                 int y);
182         int handle_event();
183
184         RotateEffect *plugin;
185         RotateWindow *window;
186 };
187
188 class RotatePivotYSlider : public BC_FSlider
189 {
190 public:
191         RotatePivotYSlider(RotateWindow *window,
192                 RotateEffect *plugin,
193                 int x, int y, int w);
194         int handle_event();
195
196         RotateEffect *plugin;
197         RotateWindow *window;
198 };
199
200
201
202
203 class RotateClr : public BC_Button
204 {
205 public:
206         RotateClr(RotateWindow *window, RotateEffect *plugin,
207                 int x, int y, int clear);
208         ~RotateClr();
209         int handle_event();
210         RotateEffect *plugin;
211         RotateWindow *window;
212         int clear;
213 };
214
215
216 class RotateReset : public BC_GenericButton
217 {
218 public:
219         RotateReset(RotateEffect *plugin, RotateWindow *window,
220         int x, int y);
221         ~RotateReset();
222         int handle_event();
223         RotateEffect *plugin;
224         RotateWindow *window;
225 };
226
227
228 class RotateWindow : public PluginClientWindow
229 {
230 public:
231         RotateWindow(RotateEffect *plugin);
232
233         void create_objects();
234
235         int update();
236         int update_sliders();
237         int update_texts();
238         int update_toggles();
239
240         RotateEffect *plugin;
241         RotateToggle *toggle180neg;
242         RotateToggle *toggle90neg;
243         RotateToggle *toggle0;
244         RotateToggle *toggle90;
245         RotateToggle *toggle180;
246
247         RotateAngleText *rotate_angle_text;
248         RotateAngleSlider *rotate_angle_slider;
249         RotateClr *rotate_angle_clr;
250
251         RotateDrawPivot *draw_pivot;
252
253         RotatePivotXText *rotate_pivot_x_text;
254         RotatePivotXSlider *rotate_pivot_x_slider;
255         RotateClr *rotate_pivot_x_clr;
256
257         RotatePivotYText *rotate_pivot_y_text;
258         RotatePivotYSlider *rotate_pivot_y_slider;
259         RotateClr *rotate_pivot_y_clr;
260
261 //      RotateInterpolate *bilinear;
262         RotateReset *reset;
263 };
264
265
266
267
268 class RotateEffect : public PluginVClient
269 {
270 public:
271         RotateEffect(PluginServer *server);
272         ~RotateEffect();
273
274         PLUGIN_CLASS_MEMBERS(RotateConfig)
275         int process_buffer(VFrame *frame,
276                 int64_t start_position,
277                 double frame_rate);
278         int is_realtime();
279         void update_gui();
280         void save_data(KeyFrame *keyframe);
281         void read_data(KeyFrame *keyframe);
282         int handle_opengl();
283
284         AffineEngine *engine;
285         int need_reconfigure;
286 };
287
288 #endif