00001 #include "assets.h"
00002 #include "file.h"
00003 #include "formatwindow.h"
00004 #include <string.h>
00005
00006
00007 FormatAWindow::FormatAWindow(Asset *asset, int *dither)
00008 : BC_Window(PROGRAM_NAME ": File format", 410,
00009 (asset->format == FILE_WAV || asset->format == FILE_MOV) ? 115 : 185,
00010 0, 0)
00011 { this->asset = asset; this->dither = dither; }
00012
00013 FormatAWindow::~FormatAWindow()
00014 {
00015 }
00016
00017 int FormatAWindow::create_objects()
00018 {
00019 int x;
00020 int init_x;
00021 int y = 10;
00022 File file;
00023 x = init_x = 10;
00024
00025 add_subwindow(new BC_Title(x, y, _("Set parameters for this audio format:")));
00026 y += 30;
00027 add_subwindow(new BC_Title(x, y, _("Bits:")));
00028 x += 45;
00029 add_subwindow(new FormatBits(x, y, asset));
00030 x += 100;
00031 add_subwindow(new FormatDither(x, y, this->dither));
00032
00033 if(asset->format == FILE_PCM || asset->format == FILE_MOV)
00034 {
00035 x += 90;
00036 add_subwindow(new FormatSigned(x, y, asset));
00037 }
00038 y += 40;
00039 x = init_x;
00040
00041 if(asset->format == FILE_PCM)
00042 {
00043 add_subwindow(new BC_Title(x, y, _("Byte order:")));
00044 y += 25;
00045 add_subwindow(new BC_Title(x, y, _("HiLo:"), SMALLFONT));
00046 add_subwindow(hilo_button = new FormatHILO(x + 30, y, asset));
00047 x += 50;
00048 add_subwindow(new BC_Title(x, y, _("LoHi:"), SMALLFONT));
00049 add_subwindow(lohi_button = new FormatLOHI(x + 30, y, hilo_button, asset));
00050 hilo_button->lohi = lohi_button;
00051 y += 30;
00052 }
00053
00054 x = init_x;
00055
00056 add_subwindow(new BC_OKButton(x + 170, y));
00057 }
00058
00059
00060 int FormatAWindow::close_event()
00061 {
00062 set_done(0);
00063 }
00064
00065
00066
00067
00068 FormatVWindow::FormatVWindow(Asset *asset, int recording)
00069 : BC_Window(PROGRAM_NAME ": File format", 410, 115, 0, 0)
00070 { this->asset = asset; this->recording = recording; }
00071
00072 FormatVWindow::~FormatVWindow()
00073 {
00074 }
00075
00076 int FormatVWindow::create_objects()
00077 {
00078 int x, y = 10;
00079 int init_x;
00080
00081 init_x = x = 10;
00082
00083 if(asset->format == FILE_MOV)
00084 {
00085 add_subwindow(new BC_Title(x, y, _("Set parameters for this video format:")));
00086 y += 30;
00087 add_subwindow(new BC_Title(x, y, _("Compression:")));
00088 x += 110;
00089 add_subwindow(new FormatCompress(x, y, recording, asset, asset->compression));
00090 x += 90;
00091 add_subwindow(new BC_Title(x, y, _("Quality:")));
00092 x += 70;
00093 add_subwindow(new FormatQuality(x, y, asset, asset->quality));
00094 y += 40;
00095 x = init_x;
00096 }
00097 else
00098 if(asset->format == FILE_JPEG_LIST)
00099 {
00100 add_subwindow(new BC_Title(x, y, _("Set parameters for this video format:")));
00101 y += 30;
00102 add_subwindow(new BC_Title(x, y, _("Quality:")));
00103 x += 70;
00104 add_subwindow(new FormatQuality(x, y, asset, asset->quality));
00105 y += 40;
00106 x = init_x;
00107 }
00108 else
00109 {
00110 add_subwindow(new BC_Title(x, y, _("Video is not supported in this format.")));
00111 y += 40;
00112 }
00113
00114 add_subwindow(new BC_OKButton(x + 170, y));
00115 }
00116
00117 int FormatVWindow::close_event()
00118 {
00119 set_done(0);
00120 }
00121
00122
00123
00124
00125
00126
00127
00128 FormatCompress::FormatCompress(int x, int y, int recording, Asset *asset, char* default_)
00129 : CompressPopup(x, y, recording, default_)
00130 {
00131 this->asset = asset;
00132 }
00133 FormatCompress::~FormatCompress()
00134 {
00135 }
00136 int FormatCompress::handle_event()
00137 {
00138 strcpy(asset->compression, get_compression());
00139 }
00140
00141 FormatQuality::FormatQuality(int x, int y, Asset *asset, int default_)
00142 : BC_ISlider(x,
00143 y,
00144 0,
00145 100,
00146 100,
00147 0,
00148 100,
00149 default_,
00150 1)
00151 {
00152 this->asset = asset;
00153 }
00154 FormatQuality::~FormatQuality()
00155 {
00156 }
00157 int FormatQuality::handle_event()
00158 {
00159 asset->quality = get_value();
00160 }
00161
00162
00163
00164 FormatBits::FormatBits(int x, int y, Asset *asset)
00165 : BitsPopup(x, y, asset)
00166 { this->asset = asset; }
00167 FormatBits::~FormatBits() {}
00168 int FormatBits::handle_event()
00169 {
00170 asset->bits = get_bits();
00171 }
00172
00173
00174
00175 FormatDither::FormatDither(int x, int y, int *dither)
00176 : BC_CheckBox(x, y, *dither, _("Dither"))
00177 { this->dither = dither; }
00178 FormatDither::~FormatDither() {}
00179 int FormatDither::handle_event()
00180 {
00181 *dither = get_value();
00182 }
00183
00184
00185
00186
00187 FormatSigned::FormatSigned(int x, int y, Asset *asset)
00188 : BC_CheckBox(x, y, asset->signed_, _("Signed"))
00189 { this->asset = asset; }
00190 FormatSigned::~FormatSigned() {}
00191 int FormatSigned::handle_event()
00192 {
00193 asset->signed_ = get_value();
00194 }
00195
00196
00197
00198
00199
00200
00201 FormatHILO::FormatHILO(int x, int y, Asset *asset)
00202 : BC_Radial(x, y, asset->byte_order ^ 1)
00203 {
00204 this->asset = asset;
00205 }
00206 FormatHILO::~FormatHILO() {}
00207
00208 int FormatHILO::handle_event()
00209 {
00210 asset->byte_order = get_value() ^ 1;
00211 lohi->update(get_value() ^ 1);
00212 }
00213
00214 FormatLOHI::FormatLOHI(int x, int y, FormatHILO *hilo, Asset *asset)
00215 : BC_Radial(x, y, asset->byte_order)
00216 {
00217 this->hilo = hilo;
00218 this->asset = asset;
00219 }
00220 FormatLOHI::~FormatLOHI() {}
00221
00222 int FormatLOHI::handle_event()
00223 {
00224 asset->byte_order = get_value();
00225 hilo->update(get_value() ^ 1);
00226 }
00227