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"), 410,
30 (asset->format == FILE_WAV) ? 115 : 185,
32 { this->asset = asset; this->dither = dither; }
34 FormatAWindow::~FormatAWindow()
38 void FormatAWindow::create_objects()
40 lock_window("FormatAWindow::create_objects");
47 add_subwindow(new BC_Title(x, y, _("Set parameters for this audio format:")));
49 add_subwindow(new BC_Title(x, y, _("Bits:")));
51 add_subwindow(new FormatBits(x, y, asset));
53 add_subwindow(new FormatDither(x, y, this->dither));
55 if(asset->format == FILE_PCM)
58 add_subwindow(new FormatSigned(x, y, asset));
63 if(asset->format == FILE_PCM)
65 add_subwindow(new BC_Title(x, y, _("Byte order:")));
67 add_subwindow(new BC_Title(x, y, _("HiLo:"), SMALLFONT));
68 add_subwindow(hilo_button = new FormatHILO(x + 30, y, asset));
70 add_subwindow(new BC_Title(x, y, _("LoHi:"), SMALLFONT));
71 add_subwindow(lohi_button = new FormatLOHI(x + 30, y, hilo_button, asset));
72 hilo_button->lohi = lohi_button;
78 add_subwindow(new BC_OKButton(x + 170, y));
83 int FormatAWindow::close_event()
90 FormatVWindow::FormatVWindow(Asset *asset, int recording)
91 : BC_Window(_(PROGRAM_NAME ": File format"), 410, 115, 0, 0)
92 { this->asset = asset; this->recording = recording; }
94 FormatVWindow::~FormatVWindow()
98 void FormatVWindow::create_objects()
100 lock_window("FormatVWindow::create_objects");
106 if(asset->format == FILE_JPEG_LIST)
108 add_subwindow(new BC_Title(x, y, _("Set parameters for this video format:")));
110 add_subwindow(new BC_Title(x, y, _("Quality:")));
112 add_subwindow(new FormatQuality(x, y, asset, asset->quality));
118 add_subwindow(new BC_Title(x, y, _("Video is not supported in this format.")));
122 add_subwindow(new BC_OKButton(x + 170, y));
126 int FormatVWindow::close_event()
132 FormatQuality::FormatQuality(int x, int y, Asset *asset, int default_)
133 : BC_ISlider(x, y, 0, 100, 100, 0, 100, default_, 1)
137 FormatQuality::~FormatQuality()
140 int FormatQuality::handle_event()
142 asset->quality = get_value();
146 FormatBits::FormatBits(int x, int y, Asset *asset)
147 : BitsPopup(x, y, asset)
148 { this->asset = asset; }
149 FormatBits::~FormatBits() {}
150 int FormatBits::handle_event()
152 asset->bits = get_bits();
156 FormatDither::FormatDither(int x, int y, int *dither)
157 : BC_CheckBox(x, y, *dither, _("Dither"))
158 { this->dither = dither; }
159 FormatDither::~FormatDither() {}
160 int FormatDither::handle_event()
162 *dither = get_value();
168 FormatSigned::FormatSigned(int x, int y, Asset *asset)
169 : BC_CheckBox(x, y, asset->signed_, _("Signed"))
170 { this->asset = asset; }
171 FormatSigned::~FormatSigned() {}
172 int FormatSigned::handle_event()
174 asset->signed_ = get_value();
178 FormatHILO::FormatHILO(int x, int y, Asset *asset)
179 : BC_Radial(x, y, asset->byte_order ^ 1)
183 FormatHILO::~FormatHILO() {}
185 int FormatHILO::handle_event()
187 asset->byte_order = get_value() ^ 1;
188 lohi->update(get_value() ^ 1);
191 FormatLOHI::FormatLOHI(int x, int y, FormatHILO *hilo, Asset *asset)
192 : BC_Radial(x, y, asset->byte_order)
197 FormatLOHI::~FormatLOHI() {}
199 int FormatLOHI::handle_event()
201 asset->byte_order = get_value();
202 hilo->update(get_value() ^ 1);