initial commit
[goodguy/history.git] / cinelerra-5.0 / 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
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
99 class SetChannelsCanvas : public BC_SubWindow
100 {
101 public:
102         SetChannelsCanvas(MWindow *mwindow, 
103                 SetFormatThread *thread, 
104                 int x, 
105                 int y,
106                 int w,
107                 int h);
108         ~SetChannelsCanvas();
109         
110         int draw(int angle = -1);
111         int get_dimensions(int channel_position, int &x, int &y, int &w, int &h);
112         int button_press_event();
113         int button_release_event();
114         int cursor_motion_event();
115
116 private:        
117         int active_channel;   // for selection
118         int degree_offset;
119         int box_r;
120         
121         int poltoxy(int &x, int &y, int r, int d);
122         int xytopol(int &d, int x, int y);
123         MWindow *mwindow;
124         SetFormatThread *thread;
125         VFrame *temp_picon;
126         RotateFrame *rotater;
127 };
128
129
130 class SetFrameRateTextBox : public BC_TextBox
131 {
132 public:
133         SetFrameRateTextBox(SetFormatThread *thread, int x, int y);
134         int handle_event();
135         SetFormatThread *thread;
136 };
137
138 class ScaleSizeText : public BC_TextBox
139 {
140 public:
141         ScaleSizeText(int x, int y, SetFormatThread *thread, int *output);
142         ~ScaleSizeText();
143         int handle_event();
144         SetFormatThread *thread;
145         int *output;
146 };
147
148
149 class ScaleRatioText : public BC_TextBox
150 {
151 public:
152         ScaleRatioText(int x, int y, SetFormatThread *thread, float *output);
153         ~ScaleRatioText();
154         int handle_event();
155         SetFormatThread *thread;
156         float *output;
157 };
158
159 class ScaleAspectAuto : public BC_CheckBox
160 {
161 public:
162         ScaleAspectAuto(int x, int y, SetFormatThread *thread);
163         ~ScaleAspectAuto();
164         int handle_event();
165         SetFormatThread *thread;
166 };
167
168 class ScaleAspectText : public BC_TextBox
169 {
170 public:
171         ScaleAspectText(int x, int y, SetFormatThread *thread, float *output);
172         ~ScaleAspectText();
173         int handle_event();
174         SetFormatThread *thread;
175         float *output;
176 };
177
178 class SetFormatApply : public BC_GenericButton
179 {
180 public:
181         SetFormatApply(int x, int y, SetFormatThread *thread);
182         int handle_event();
183         SetFormatThread *thread;
184 };
185
186 class SetFormatPresets : public FormatPresets
187 {
188 public:
189         SetFormatPresets(MWindow *mwindow, SetFormatWindow *gui, int x, int y);
190         ~SetFormatPresets();
191         int handle_event();
192         EDL* get_edl();
193 };
194
195 class FormatSwapExtents : public BC_Button
196 {
197 public:
198         FormatSwapExtents(MWindow *mwindow, 
199                 SetFormatThread *thread,
200                 SetFormatWindow *gui, 
201                 int x, 
202                 int y);
203         int handle_event();
204         MWindow *mwindow;
205         SetFormatThread *thread;
206         SetFormatWindow *gui;
207 };
208
209 class SetFormatWindow : public BC_Window
210 {
211 public:
212         SetFormatWindow(MWindow *mwindow, 
213                 SetFormatThread *thread,
214                 int x,
215                 int y);
216
217         void create_objects();
218         const char* get_preset_text();
219
220         MWindow *mwindow;
221         SetFormatThread *thread;
222         SetChannelsCanvas *canvas;
223 // Screen size width, height
224         ScaleSizeText* dimension[2];
225         SetFormatPresets *presets;
226 // Size ratio width, height
227         ScaleRatioText* ratio[2];
228 // Aspect ratio
229         ScaleAspectText *aspect_w;
230         ScaleAspectText *aspect_h;
231         SetSampleRateTextBox *sample_rate;
232         SetChannelsTextBox *channels;
233         SetFrameRateTextBox *frame_rate;
234         BC_TextBox *color_model;
235         ScaleAspectAuto *auto_aspect;
236 };
237
238         
239         
240         
241
242
243
244
245 #endif