update shuttlerc, fix vwdw lock update_position
[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  *
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 SETFORMAT_H
23 #define SETFORMAT_H
24
25
26 #include "edl.inc"
27 #include "formatpresets.h"
28 #include "guicast.h"
29 #include "mutex.inc"
30 #include "mwindow.inc"
31 #include "setformat.inc"
32 #include "thread.h"
33
34
35 class SetFormatPresets;
36
37
38
39 class SetFormat : public BC_MenuItem
40 {
41 public:
42         SetFormat(MWindow *mwindow);
43         ~SetFormat();
44         int handle_event();
45         SetFormatThread *thread;
46         MWindow *mwindow;
47 };
48
49
50 class SetFormatThread : public Thread
51 {
52 public:
53         SetFormatThread(MWindow *mwindow);
54         ~SetFormatThread();
55         void run();
56
57         void apply_changes();
58 // Update image size based on ratio of dimensions to original.
59         void update_window();
60 // Update automatic aspect ratio based in image size
61         void update_aspect();
62 // Update all parameters from preset menu
63         void update();
64
65
66         Mutex *window_lock;
67         SetFormatWindow *window;
68         MWindow *mwindow;
69         EDL *new_settings;
70         float ratio[2];
71         int dimension[2];
72         int orig_dimension[2];
73         int auto_aspect;
74         int constrain_ratio;
75 };
76
77
78 class SetSampleRateTextBox : public BC_TextBox
79 {
80 public:
81         SetSampleRateTextBox(SetFormatThread *thread, int x, int y);
82         int handle_event();
83         SetFormatThread *thread;
84 };
85
86 class SetChannelsTextBox : public BC_TextBox
87 {
88 public:
89         SetChannelsTextBox(SetFormatThread *thread, int x, int y);
90
91         int handle_event();
92
93         SetFormatThread *thread;
94         MWindow *mwindow;
95 };
96
97 class SetChannelsReset : public BC_GenericButton
98 {
99 public:
100         SetChannelsReset(SetFormatThread *thread, int x, int y, const char *text);
101         int handle_event();
102
103         SetFormatThread *thread;
104 };
105
106 class SetChannelsCanvas : public BC_SubWindow
107 {
108 public:
109         SetChannelsCanvas(MWindow *mwindow,
110                 SetFormatThread *thread,
111                 int x,
112                 int y,
113                 int w,
114                 int h);
115         ~SetChannelsCanvas();
116
117         int draw(int angle = -1);
118         int get_dimensions(int channel_position, int &x, int &y, int &w, int &h);
119         int button_press_event();
120         int button_release_event();
121         int cursor_motion_event();
122
123 private:
124         int active_channel;   // for selection
125         int degree_offset;
126         int box_r;
127
128         int poltoxy(int &x, int &y, int r, int d);
129         int xytopol(int &d, int x, int y);
130         MWindow *mwindow;
131         SetFormatThread *thread;
132         VFrame *temp_picon;
133         RotateFrame *rotater;
134 };
135
136
137 class SetFrameRateTextBox : public BC_TextBox
138 {
139 public:
140         SetFrameRateTextBox(SetFormatThread *thread, int x, int y);
141         int handle_event();
142         SetFormatThread *thread;
143 };
144
145 class ScaleSizeText : public BC_TextBox
146 {
147 public:
148         ScaleSizeText(int x, int y, SetFormatThread *thread, int *output);
149         ~ScaleSizeText();
150         int handle_event();
151         SetFormatThread *thread;
152         int *output;
153 };
154
155
156 class ScaleRatioText : public BC_TextBox
157 {
158 public:
159         ScaleRatioText(int x, int y, SetFormatThread *thread, float *output);
160         ~ScaleRatioText();
161         int handle_event();
162         SetFormatThread *thread;
163         float *output;
164 };
165
166 class ScaleAspectAuto : public BC_CheckBox
167 {
168 public:
169         ScaleAspectAuto(int x, int y, SetFormatThread *thread);
170         ~ScaleAspectAuto();
171         int handle_event();
172         SetFormatThread *thread;
173 };
174
175 class ScaleAspectText : public BC_TextBox
176 {
177 public:
178         ScaleAspectText(int x, int y, SetFormatThread *thread, float *output);
179         ~ScaleAspectText();
180         int handle_event();
181         SetFormatThread *thread;
182         float *output;
183 };
184
185 class SetFormatApply : public BC_GenericButton
186 {
187 public:
188         SetFormatApply(int x, int y, SetFormatThread *thread);
189         int handle_event();
190         SetFormatThread *thread;
191 };
192
193 class SetFormatPresets : public FormatPresets
194 {
195 public:
196         SetFormatPresets(MWindow *mwindow, SetFormatWindow *gui, int x, int y);
197         ~SetFormatPresets();
198         int handle_event();
199         EDL* get_edl();
200 };
201
202 class FormatSwapExtents : public BC_Button
203 {
204 public:
205         FormatSwapExtents(MWindow *mwindow, SetFormatThread *thread,
206                 SetFormatWindow *gui, int x, int y);
207         int handle_event();
208         MWindow *mwindow;
209         SetFormatThread *thread;
210         SetFormatWindow *gui;
211 };
212
213 class SetFormatWindow : public BC_Window
214 {
215 public:
216         SetFormatWindow(MWindow *mwindow,
217                 SetFormatThread *thread, int x, int y);
218         ~SetFormatWindow();
219
220         void create_objects();
221         const char* get_preset_text();
222
223         MWindow *mwindow;
224         SetFormatThread *thread;
225         SetChannelsCanvas *canvas;
226 // Screen size width, height
227         ScaleSizeText* dimension[2];
228         SetFormatPresets *presets;
229 // Size ratio width, height
230         ScaleRatioText* ratio[2];
231 // Aspect ratio
232         ScaleAspectText *aspect_w;
233         ScaleAspectText *aspect_h;
234         SetSampleRateTextBox *sample_rate;
235         SetChannelsTextBox *channels;
236         SetFrameRateTextBox *frame_rate;
237         ColormodelPulldown *color_model;
238         ScaleAspectAuto *auto_aspect;
239         InterlacemodePulldown *interlace_pulldown;
240 };
241
242
243
244
245
246
247
248
249 #endif