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