4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5 * Copyright (C) 2003-2016 Cinelerra CV contributors
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.
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.
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
28 #include "formatpresets.h"
31 #include "mwindow.inc"
32 #include "setformat.inc"
36 class SetFormatPresets;
40 class SetFormat : public BC_MenuItem
43 SetFormat(MWindow *mwindow);
46 SetFormatThread *thread;
51 class SetFormatThread : public Thread
54 SetFormatThread(MWindow *mwindow);
59 // Update image size based on ratio of dimensions to original.
61 // Update automatic aspect ratio based in image size
63 // Update all parameters from preset menu
68 SetFormatWindow *window;
73 int orig_dimension[2];
79 class SetSampleRateTextBox : public BC_TextBox
82 SetSampleRateTextBox(SetFormatThread *thread, int x, int y);
84 SetFormatThread *thread;
87 class SetChannelsTextBox : public BC_TextBox
90 SetChannelsTextBox(SetFormatThread *thread, int x, int y);
94 SetFormatThread *thread;
98 class SetChannelsReset : public BC_GenericButton
101 SetChannelsReset(SetFormatThread *thread, int x, int y, const char *text);
104 SetFormatThread *thread;
107 class SetChannelsCanvas : public BC_SubWindow
110 SetChannelsCanvas(MWindow *mwindow,
111 SetFormatThread *thread,
116 ~SetChannelsCanvas();
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();
125 int active_channel; // for selection
129 int poltoxy(int &x, int &y, int r, int d);
130 int xytopol(int &d, int x, int y);
132 SetFormatThread *thread;
134 RotateFrame *rotater;
138 class SetFrameRateTextBox : public BC_TextBox
141 SetFrameRateTextBox(SetFormatThread *thread, int x, int y);
143 SetFormatThread *thread;
146 class ScaleSizeText : public BC_TextBox
149 ScaleSizeText(int x, int y, SetFormatThread *thread, int *output);
152 SetFormatThread *thread;
157 class ScaleRatioText : public BC_TextBox
160 ScaleRatioText(int x, int y, SetFormatThread *thread, float *output);
163 SetFormatThread *thread;
167 class ScaleAspectAuto : public BC_CheckBox
170 ScaleAspectAuto(int x, int y, SetFormatThread *thread);
173 SetFormatThread *thread;
176 class ScaleAspectText : public BC_TextBox
179 ScaleAspectText(int x, int y, SetFormatThread *thread, float *output);
182 SetFormatThread *thread;
186 class SetFormatApply : public BC_GenericButton
189 SetFormatApply(int x, int y, SetFormatThread *thread);
191 SetFormatThread *thread;
194 class SetFormatPresets : public FormatPresets
197 SetFormatPresets(MWindow *mwindow, SetFormatWindow *gui, int x, int y);
203 class FormatSwapExtents : public BC_Button
206 FormatSwapExtents(MWindow *mwindow, SetFormatThread *thread,
207 SetFormatWindow *gui, int x, int y);
210 SetFormatThread *thread;
211 SetFormatWindow *gui;
214 class SetFormatWindow : public BC_Window
217 SetFormatWindow(MWindow *mwindow,
218 SetFormatThread *thread, int x, int y);
221 void create_objects();
222 const char* get_preset_text();
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];
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;