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
24 #include "formatwindow.h"
28 FormatAWindow::FormatAWindow(Asset *asset, int *dither)
29 : BC_Window(_(PROGRAM_NAME ": File format"), xS(410),
30 yS((asset->format == FILE_WAV) ? 115 : 185), 0, 0)
31 { this->asset = asset; this->dither = dither; }
33 FormatAWindow::~FormatAWindow()
37 void FormatAWindow::create_objects()
39 lock_window("FormatAWindow::create_objects");
46 add_subwindow(new BC_Title(x, y, _("Set parameters for this audio format:")));
48 add_subwindow(new BC_Title(x, y, _("Bits:")));
50 add_subwindow(new FormatBits(x, y, asset));
52 add_subwindow(new FormatDither(x, y, this->dither));
54 if(asset->format == FILE_PCM)
57 add_subwindow(new FormatSigned(x, y, asset));
62 if(asset->format == FILE_PCM)
64 add_subwindow(new BC_Title(x, y, _("Byte order:")));
66 add_subwindow(new BC_Title(x, y, _("HiLo:"), SMALLFONT));
67 add_subwindow(hilo_button = new FormatHILO(x + xS(30), y, asset));
69 add_subwindow(new BC_Title(x, y, _("LoHi:"), SMALLFONT));
70 add_subwindow(lohi_button = new FormatLOHI(x + xS(30), y, hilo_button, asset));
71 hilo_button->lohi = lohi_button;
77 add_subwindow(new BC_OKButton(x + xS(170), y));
82 int FormatAWindow::close_event()
89 FormatVWindow::FormatVWindow(Asset *asset, int recording)
90 : BC_Window(_(PROGRAM_NAME ": File format"), xS(410), yS(115), 0, 0)
93 this->recording = recording;
96 FormatVWindow::~FormatVWindow()
100 void FormatVWindow::create_objects()
102 lock_window("FormatVWindow::create_objects");
108 if(asset->format == FILE_JPEG_LIST)
110 add_subwindow(new BC_Title(x, y, _("Set parameters for this video format:")));
112 add_subwindow(new BC_Title(x, y, _("Quality:")));
114 add_subwindow(new FormatQuality(x, y, asset, asset->quality));
120 add_subwindow(new BC_Title(x, y, _("Video is not supported in this format.")));
124 add_subwindow(new BC_OKButton(x + xS(170), y));
128 int FormatVWindow::close_event()
134 FormatQuality::FormatQuality(int x, int y, Asset *asset, int default_)
135 : BC_ISlider(x, y, 0, xS(100), xS(100), 0, 100, default_, 1)
139 FormatQuality::~FormatQuality()
142 int FormatQuality::handle_event()
144 asset->quality = get_value();
149 FormatBits::FormatBits(int x, int y, Asset *asset)
150 : BitsPopup(x, y, asset)
151 { this->asset = asset; }
152 FormatBits::~FormatBits() {}
153 int FormatBits::handle_event()
155 asset->bits = get_bits();
160 FormatDither::FormatDither(int x, int y, int *dither)
161 : BC_CheckBox(x, y, *dither, _("Dither"))
162 { this->dither = dither; }
163 FormatDither::~FormatDither() {}
164 int FormatDither::handle_event()
166 *dither = get_value();
173 FormatSigned::FormatSigned(int x, int y, Asset *asset)
174 : BC_CheckBox(x, y, asset->signed_, _("Signed"))
175 { this->asset = asset; }
176 FormatSigned::~FormatSigned() {}
177 int FormatSigned::handle_event()
179 asset->signed_ = get_value();
184 FormatHILO::FormatHILO(int x, int y, Asset *asset)
185 : BC_Radial(x, y, asset->byte_order ^ 1)
189 FormatHILO::~FormatHILO() {}
191 int FormatHILO::handle_event()
193 asset->byte_order = get_value() ^ 1;
194 lohi->update(get_value() ^ 1);
198 FormatLOHI::FormatLOHI(int x, int y, FormatHILO *hilo, Asset *asset)
199 : BC_Radial(x, y, asset->byte_order)
204 FormatLOHI::~FormatLOHI() {}
206 int FormatLOHI::handle_event()
208 asset->byte_order = get_value();
209 hilo->update(get_value() ^ 1);