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);
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;
99 class SetChannelsCanvas : public BC_SubWindow
102 SetChannelsCanvas(MWindow *mwindow,
103 SetFormatThread *thread,
108 ~SetChannelsCanvas();
110 int draw(int angle = -1);
111 int get_dimensions(int channel_position, int &x, int &y, int &w, int &h);
112 int button_press_event();
113 int button_release_event();
114 int cursor_motion_event();
117 int active_channel; // for selection
121 int poltoxy(int &x, int &y, int r, int d);
122 int xytopol(int &d, int x, int y);
124 SetFormatThread *thread;
126 RotateFrame *rotater;
130 class SetFrameRateTextBox : public BC_TextBox
133 SetFrameRateTextBox(SetFormatThread *thread, int x, int y);
135 SetFormatThread *thread;
138 class ScaleSizeText : public BC_TextBox
141 ScaleSizeText(int x, int y, SetFormatThread *thread, int *output);
144 SetFormatThread *thread;
149 class ScaleRatioText : public BC_TextBox
152 ScaleRatioText(int x, int y, SetFormatThread *thread, float *output);
155 SetFormatThread *thread;
159 class ScaleAspectAuto : public BC_CheckBox
162 ScaleAspectAuto(int x, int y, SetFormatThread *thread);
165 SetFormatThread *thread;
168 class ScaleAspectText : public BC_TextBox
171 ScaleAspectText(int x, int y, SetFormatThread *thread, float *output);
174 SetFormatThread *thread;
178 class SetFormatApply : public BC_GenericButton
181 SetFormatApply(int x, int y, SetFormatThread *thread);
183 SetFormatThread *thread;
186 class SetFormatPresets : public FormatPresets
189 SetFormatPresets(MWindow *mwindow, SetFormatWindow *gui, int x, int y);
195 class FormatSwapExtents : public BC_Button
198 FormatSwapExtents(MWindow *mwindow,
199 SetFormatThread *thread,
200 SetFormatWindow *gui,
205 SetFormatThread *thread;
206 SetFormatWindow *gui;
209 class SetFormatWindow : public BC_Window
212 SetFormatWindow(MWindow *mwindow,
213 SetFormatThread *thread,
217 void create_objects();
218 const char* get_preset_text();
221 SetFormatThread *thread;
222 SetChannelsCanvas *canvas;
223 // Screen size width, height
224 ScaleSizeText* dimension[2];
225 SetFormatPresets *presets;
226 // Size ratio width, height
227 ScaleRatioText* ratio[2];
229 ScaleAspectText *aspect_w;
230 ScaleAspectText *aspect_h;
231 SetSampleRateTextBox *sample_rate;
232 SetChannelsTextBox *channels;
233 SetFrameRateTextBox *frame_rate;
234 BC_TextBox *color_model;
235 ScaleAspectAuto *auto_aspect;