Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / setformat.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * Copyright (C) 2003-2016 Cinelerra CV contributors
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22
23 #ifndef SETFORMAT_H
24 #define SETFORMAT_H
25
26
27 #include "edl.inc"
28 #include "formatpresets.h"
29 #include "guicast.h"
30 #include "mutex.inc"
31 #include "mwindow.inc"
32 #include "setformat.inc"
33 #include "thread.h"
34
35
36 class SetFormatPresets;
37
38
39
40 class SetFormat : public BC_MenuItem
41 {
42 public:
43         SetFormat(MWindow *mwindow);
44         ~SetFormat();
45         int handle_event();
46         SetFormatThread *thread;
47         MWindow *mwindow;
48 };
49
50
51 class SetFormatThread : public Thread
52 {
53 public:
54         SetFormatThread(MWindow *mwindow);
55         ~SetFormatThread();
56         void run();
57
58         void apply_changes();
59 // Update image size based on ratio of dimensions to original.
60         void update_window();
61 // Update automatic aspect ratio based in image size
62         void update_aspect();
63 // Update all parameters from preset menu
64         void update();
65
66
67         Mutex *window_lock;
68         SetFormatWindow *window;
69         MWindow *mwindow;
70         EDL *new_settings;
71         float ratio[2];
72         int dimension[2];
73         int orig_dimension[2];
74         int auto_aspect;
75         int constrain_ratio;
76 };
77
78
79 class SetSampleRateTextBox : public BC_TextBox
80 {
81 public:
82         SetSampleRateTextBox(SetFormatThread *thread, int x, int y);
83         int handle_event();
84         SetFormatThread *thread;
85 };
86
87 class SetChannelsTextBox : public BC_TextBox
88 {
89 public:
90         SetChannelsTextBox(SetFormatThread *thread, int x, int y);
91
92         int handle_event();
93
94         SetFormatThread *thread;
95         MWindow *mwindow;
96 };
97
98 class SetChannelsReset : public BC_GenericButton
99 {
100 public:
101         SetChannelsReset(SetFormatThread *thread, int x, int y, const char *text);
102         int handle_event();
103
104         SetFormatThread *thread;
105 };
106
107 class SetChannelsCanvas : public BC_SubWindow
108 {
109 public:
110         SetChannelsCanvas(MWindow *mwindow,
111                 SetFormatThread *thread,
112                 int x,
113                 int y,
114                 int w,
115                 int h);
116         ~SetChannelsCanvas();
117
118         int draw(int angle = -1);
119         int get_dimensions(int channel_position, int &x, int &y, int &w, int &h);
120         int button_press_event();
121         int button_release_event();
122         int cursor_motion_event();
123
124 private:
125         int active_channel;   // for selection
126         int degree_offset;
127         int box_r;
128
129         int poltoxy(int &x, int &y, int r, int d);
130         int xytopol(int &d, int x, int y);
131         MWindow *mwindow;
132         SetFormatThread *thread;
133         VFrame *temp_picon;
134         RotateFrame *rotater;
135 };
136
137
138 class SetFrameRateTextBox : public BC_TextBox
139 {
140 public:
141         SetFrameRateTextBox(SetFormatThread *thread, int x, int y);
142         int handle_event();
143         SetFormatThread *thread;
144 };
145
146 class ScaleSizeText : public BC_TextBox
147 {
148 public:
149         ScaleSizeText(int x, int y, SetFormatThread *thread, int *output);
150         ~ScaleSizeText();
151         int handle_event();
152         SetFormatThread *thread;
153         int *output;
154 };
155
156
157 class ScaleRatioText : public BC_TextBox
158 {
159 public:
160         ScaleRatioText(int x, int y, SetFormatThread *thread, float *output);
161         ~ScaleRatioText();
162         int handle_event();
163         SetFormatThread *thread;
164         float *output;
165 };
166
167 class ScaleAspectAuto : public BC_CheckBox
168 {
169 public:
170         ScaleAspectAuto(int x, int y, SetFormatThread *thread);
171         ~ScaleAspectAuto();
172         int handle_event();
173         SetFormatThread *thread;
174 };
175
176 class ScaleAspectText : public BC_TextBox
177 {
178 public:
179         ScaleAspectText(int x, int y, SetFormatThread *thread, float *output);
180         ~ScaleAspectText();
181         int handle_event();
182         SetFormatThread *thread;
183         float *output;
184 };
185
186 class SetFormatApply : public BC_GenericButton
187 {
188 public:
189         SetFormatApply(int x, int y, SetFormatThread *thread);
190         int handle_event();
191         SetFormatThread *thread;
192 };
193
194 class SetFormatPresets : public FormatPresets
195 {
196 public:
197         SetFormatPresets(MWindow *mwindow, SetFormatWindow *gui, int x, int y);
198         ~SetFormatPresets();
199         int handle_event();
200         EDL* get_edl();
201 };
202
203 class FormatSwapExtents : public BC_Button
204 {
205 public:
206         FormatSwapExtents(MWindow *mwindow, SetFormatThread *thread,
207                 SetFormatWindow *gui, int x, int y);
208         int handle_event();
209         MWindow *mwindow;
210         SetFormatThread *thread;
211         SetFormatWindow *gui;
212 };
213
214 class SetFormatWindow : public BC_Window
215 {
216 public:
217         SetFormatWindow(MWindow *mwindow,
218                 SetFormatThread *thread, int x, int y);
219         ~SetFormatWindow();
220
221         void create_objects();
222         const char* get_preset_text();
223
224         MWindow *mwindow;
225         SetFormatThread *thread;
226         SetChannelsReset *channels_reset;
227         SetChannelsCanvas *canvas;
228 // Screen size width, height
229         ScaleSizeText* dimension[2];
230         SetFormatPresets *presets;
231 // Size ratio width, height
232         ScaleRatioText* ratio[2];
233 // Aspect ratio
234         ScaleAspectText *aspect_w;
235         ScaleAspectText *aspect_h;
236         SetSampleRateTextBox *sample_rate;
237         SetChannelsTextBox *channels;
238         SetFrameRateTextBox *frame_rate;
239         ColormodelPulldown *color_model;
240         ScaleAspectAuto *auto_aspect;
241         InterlacemodePulldown *interlace_pulldown;
242 };
243
244
245
246
247
248
249
250
251 #endif