4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
27 #include "formatpresets.h"
30 #include "mwindow.inc"
31 #include "setformat.inc"
35 class SetFormatPresets;
39 class SetFormat : public BC_MenuItem
42 SetFormat(MWindow *mwindow);
45 SetFormatThread *thread;
50 class SetFormatThread : public Thread
53 SetFormatThread(MWindow *mwindow);
58 // Update image size based on ratio of dimensions to original.
60 // Update automatic aspect ratio based in image size
62 // Update all parameters from preset menu
67 SetFormatWindow *window;
72 int orig_dimension[2];
78 class SetSampleRateTextBox : public BC_TextBox
81 SetSampleRateTextBox(SetFormatThread *thread, int x, int y);
83 SetFormatThread *thread;
86 class SetChannelsTextBox : public BC_TextBox
89 SetChannelsTextBox(SetFormatThread *thread, int x, int y);
93 SetFormatThread *thread;
97 class SetChannelsReset : public BC_GenericButton
100 SetChannelsReset(SetFormatThread *thread, int x, int y, const char *text);
103 SetFormatThread *thread;
106 class SetChannelsCanvas : public BC_SubWindow
109 SetChannelsCanvas(MWindow *mwindow,
110 SetFormatThread *thread,
115 ~SetChannelsCanvas();
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();
124 int active_channel; // for selection
128 int poltoxy(int &x, int &y, int r, int d);
129 int xytopol(int &d, int x, int y);
131 SetFormatThread *thread;
133 RotateFrame *rotater;
137 class SetFrameRateTextBox : public BC_TextBox
140 SetFrameRateTextBox(SetFormatThread *thread, int x, int y);
142 SetFormatThread *thread;
145 class ScaleSizeText : public BC_TextBox
148 ScaleSizeText(int x, int y, SetFormatThread *thread, int *output);
151 SetFormatThread *thread;
156 class ScaleRatioText : public BC_TextBox
159 ScaleRatioText(int x, int y, SetFormatThread *thread, float *output);
162 SetFormatThread *thread;
166 class ScaleAspectAuto : public BC_CheckBox
169 ScaleAspectAuto(int x, int y, SetFormatThread *thread);
172 SetFormatThread *thread;
175 class ScaleAspectText : public BC_TextBox
178 ScaleAspectText(int x, int y, SetFormatThread *thread, float *output);
181 SetFormatThread *thread;
185 class SetFormatApply : public BC_GenericButton
188 SetFormatApply(int x, int y, SetFormatThread *thread);
190 SetFormatThread *thread;
193 class SetFormatPresets : public FormatPresets
196 SetFormatPresets(MWindow *mwindow, SetFormatWindow *gui, int x, int y);
202 class FormatSwapExtents : public BC_Button
205 FormatSwapExtents(MWindow *mwindow, SetFormatThread *thread,
206 SetFormatWindow *gui, int x, int y);
209 SetFormatThread *thread;
210 SetFormatWindow *gui;
213 class SetFormatWindow : public BC_Window
216 SetFormatWindow(MWindow *mwindow,
217 SetFormatThread *thread, int x, int y);
220 void create_objects();
221 const char* get_preset_text();
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];
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;