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;
98 class SetChannelsCanvas : public BC_SubWindow
101 SetChannelsCanvas(MWindow *mwindow,
102 SetFormatThread *thread,
107 ~SetChannelsCanvas();
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();
116 int active_channel; // for selection
120 int poltoxy(int &x, int &y, int r, int d);
121 int xytopol(int &d, int x, int y);
123 SetFormatThread *thread;
125 RotateFrame *rotater;
129 class SetFrameRateTextBox : public BC_TextBox
132 SetFrameRateTextBox(SetFormatThread *thread, int x, int y);
134 SetFormatThread *thread;
137 class ScaleSizeText : public BC_TextBox
140 ScaleSizeText(int x, int y, SetFormatThread *thread, int *output);
143 SetFormatThread *thread;
148 class ScaleRatioText : public BC_TextBox
151 ScaleRatioText(int x, int y, SetFormatThread *thread, float *output);
154 SetFormatThread *thread;
158 class ScaleAspectAuto : public BC_CheckBox
161 ScaleAspectAuto(int x, int y, SetFormatThread *thread);
164 SetFormatThread *thread;
167 class ScaleAspectText : public BC_TextBox
170 ScaleAspectText(int x, int y, SetFormatThread *thread, float *output);
173 SetFormatThread *thread;
177 class SetFormatApply : public BC_GenericButton
180 SetFormatApply(int x, int y, SetFormatThread *thread);
182 SetFormatThread *thread;
185 class SetFormatPresets : public FormatPresets
188 SetFormatPresets(MWindow *mwindow, SetFormatWindow *gui, int x, int y);
194 class FormatSwapExtents : public BC_Button
197 FormatSwapExtents(MWindow *mwindow,
198 SetFormatThread *thread,
199 SetFormatWindow *gui,
204 SetFormatThread *thread;
205 SetFormatWindow *gui;
208 class SetFormatWindow : public BC_Window
211 SetFormatWindow(MWindow *mwindow,
212 SetFormatThread *thread,
216 void create_objects();
217 const char* get_preset_text();
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];
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;