r870: Merge 2.1:
[cinelerra_cv.git] / cinelerra / setformat.h
blob6cced4bdbf48f6364850aace6645c8128289440b
1 #ifndef SETFORMAT_H
2 #define SETFORMAT_H
5 #include "edl.inc"
6 #include "formatpresets.h"
7 #include "guicast.h"
8 #include "mutex.inc"
9 #include "mwindow.inc"
10 #include "setformat.inc"
11 #include "thread.h"
14 class SetFormatPresets;
18 class SetFormat : public BC_MenuItem
20 public:
21 SetFormat(MWindow *mwindow);
22 int handle_event();
23 SetFormatThread *thread;
24 MWindow *mwindow;
28 class SetFormatThread : public Thread
30 public:
31 SetFormatThread(MWindow *mwindow);
33 void run();
35 void apply_changes();
36 // Update image size based on ratio of dimensions to original.
37 void update_window();
38 // Update automatic aspect ratio based in image size
39 void update_aspect();
40 // Update all parameters from preset menu
41 void update();
44 Mutex *window_lock;
45 SetFormatWindow *window;
46 MWindow *mwindow;
47 EDL *new_settings;
48 float ratio[2];
49 int dimension[2];
50 int orig_dimension[2];
51 int auto_aspect;
52 int constrain_ratio;
56 class SetSampleRateTextBox : public BC_TextBox
58 public:
59 SetSampleRateTextBox(SetFormatThread *thread, int x, int y);
60 int handle_event();
61 SetFormatThread *thread;
64 class SetChannelsTextBox : public BC_TextBox
66 public:
67 SetChannelsTextBox(SetFormatThread *thread, int x, int y);
69 int handle_event();
71 SetFormatThread *thread;
72 MWindow *mwindow;
76 class SetChannelsCanvas : public BC_SubWindow
78 public:
79 SetChannelsCanvas(MWindow *mwindow,
80 SetFormatThread *thread,
81 int x,
82 int y,
83 int w,
84 int h);
85 ~SetChannelsCanvas();
87 int draw(int angle = -1);
88 int get_dimensions(int channel_position, int &x, int &y, int &w, int &h);
89 int button_press_event();
90 int button_release_event();
91 int cursor_motion_event();
93 private:
94 int active_channel; // for selection
95 int degree_offset;
96 int box_r;
98 int poltoxy(int &x, int &y, int r, int d);
99 int xytopol(int &d, int x, int y);
100 MWindow *mwindow;
101 SetFormatThread *thread;
102 VFrame *temp_picon;
103 RotateFrame *rotater;
107 class SetFrameRateTextBox : public BC_TextBox
109 public:
110 SetFrameRateTextBox(SetFormatThread *thread, int x, int y);
111 int handle_event();
112 SetFormatThread *thread;
115 class ScaleSizeText : public BC_TextBox
117 public:
118 ScaleSizeText(int x, int y, SetFormatThread *thread, int *output);
119 ~ScaleSizeText();
120 int handle_event();
121 SetFormatThread *thread;
122 int *output;
126 class ScaleRatioText : public BC_TextBox
128 public:
129 ScaleRatioText(int x, int y, SetFormatThread *thread, float *output);
130 ~ScaleRatioText();
131 int handle_event();
132 SetFormatThread *thread;
133 float *output;
136 class ScaleAspectAuto : public BC_CheckBox
138 public:
139 ScaleAspectAuto(int x, int y, SetFormatThread *thread);
140 ~ScaleAspectAuto();
141 int handle_event();
142 SetFormatThread *thread;
145 class ScaleAspectText : public BC_TextBox
147 public:
148 ScaleAspectText(int x, int y, SetFormatThread *thread, float *output);
149 ~ScaleAspectText();
150 int handle_event();
151 SetFormatThread *thread;
152 float *output;
155 class SetFormatApply : public BC_GenericButton
157 public:
158 SetFormatApply(int x, int y, SetFormatThread *thread);
159 int handle_event();
160 SetFormatThread *thread;
163 class SetFormatPresets : public FormatPresets
165 public:
166 SetFormatPresets(MWindow *mwindow, SetFormatWindow *gui, int x, int y);
167 ~SetFormatPresets();
168 int handle_event();
169 EDL* get_edl();
172 class FormatSwapExtents : public BC_Button
174 public:
175 FormatSwapExtents(MWindow *mwindow,
176 SetFormatThread *thread,
177 SetFormatWindow *gui,
178 int x,
179 int y);
180 int handle_event();
181 MWindow *mwindow;
182 SetFormatThread *thread;
183 SetFormatWindow *gui;
186 class SetFormatWindow : public BC_Window
188 public:
189 SetFormatWindow(MWindow *mwindow,
190 SetFormatThread *thread,
191 int x,
192 int y);
194 void create_objects();
195 char* get_preset_text();
197 MWindow *mwindow;
198 SetFormatThread *thread;
199 SetChannelsCanvas *canvas;
200 // Screen size width, height
201 ScaleSizeText* dimension[2];
202 SetFormatPresets *presets;
203 // Size ratio width, height
204 ScaleRatioText* ratio[2];
205 // Aspect ratio
206 ScaleAspectText *aspect_w;
207 ScaleAspectText *aspect_h;
208 SetSampleRateTextBox *sample_rate;
209 SetChannelsTextBox *channels;
210 SetFrameRateTextBox *frame_rate;
211 BC_TextBox *color_model;
212 ScaleAspectAuto *auto_aspect;
222 #endif