r370: Heroine Virutal's official release 1.2.1
[cinelerra_cv/mob.git] / hvirtual / cinelerra / formatwindow.C
blobba9e541c8d1237a905d5f6aa181655502864cd34
1 #include "assets.h"
2 #include "file.h"
3 #include "formatwindow.h"
4 #include <string.h>
7 FormatAWindow::FormatAWindow(Asset *asset, int *dither)
8  : BC_Window(PROGRAM_NAME ": File format", 410, 
9         (asset->format == FILE_WAV || asset->format == FILE_MOV) ? 115 : 185, 
10         0, 0)
11 { this->asset = asset; this->dither = dither; }
13 FormatAWindow::~FormatAWindow()
17 int FormatAWindow::create_objects()
19         int x;
20         int init_x;
21         int y = 10;
22         File file;
23         x = init_x = 10;
25         add_subwindow(new BC_Title(x, y, _("Set parameters for this audio format:")));
26         y += 30;
27         add_subwindow(new BC_Title(x, y, _("Bits:")));
28         x += 45;
29         add_subwindow(new FormatBits(x, y, asset));
30         x += 100;
31         add_subwindow(new FormatDither(x, y, this->dither));
33         if(asset->format == FILE_PCM || asset->format == FILE_MOV)
34         {
35                 x += 90;
36                 add_subwindow(new FormatSigned(x, y, asset));
37         }
38         y += 40;
39         x = init_x;
41         if(asset->format == FILE_PCM)
42         {
43                 add_subwindow(new BC_Title(x, y, _("Byte order:")));
44                 y += 25;
45                 add_subwindow(new BC_Title(x, y, _("HiLo:"), SMALLFONT));
46                 add_subwindow(hilo_button = new FormatHILO(x + 30, y, asset));
47                 x += 50;
48                 add_subwindow(new BC_Title(x, y, _("LoHi:"), SMALLFONT));
49                 add_subwindow(lohi_button = new FormatLOHI(x + 30, y, hilo_button, asset));
50                 hilo_button->lohi = lohi_button;
51                 y += 30;
52         }
54         x = init_x;
56         add_subwindow(new BC_OKButton(x + 170, y));
60 int FormatAWindow::close_event()
62         set_done(0);
68 FormatVWindow::FormatVWindow(Asset *asset, int recording)
69  : BC_Window(PROGRAM_NAME ": File format", 410, 115, 0, 0)
70 { this->asset = asset; this->recording = recording; }
72 FormatVWindow::~FormatVWindow()
76 int FormatVWindow::create_objects()
78         int x, y = 10;
79         int init_x;
81         init_x = x = 10;
83         if(asset->format == FILE_MOV)
84         {
85                 add_subwindow(new BC_Title(x, y, _("Set parameters for this video format:")));
86                 y += 30;
87                 add_subwindow(new BC_Title(x, y, _("Compression:")));
88                 x += 110;
89                 add_subwindow(new FormatCompress(x, y, recording, asset, asset->compression));
90                 x += 90;
91                 add_subwindow(new BC_Title(x, y, _("Quality:")));
92                 x += 70;
93                 add_subwindow(new FormatQuality(x, y, asset, asset->quality));
94                 y += 40;
95                 x = init_x;
96         }
97         else
98         if(asset->format == FILE_JPEG_LIST)
99         {
100                 add_subwindow(new BC_Title(x, y, _("Set parameters for this video format:")));
101                 y += 30;
102                 add_subwindow(new BC_Title(x, y, _("Quality:")));
103                 x += 70;
104                 add_subwindow(new FormatQuality(x, y, asset, asset->quality));
105                 y += 40;
106                 x = init_x;
107         }
108         else
109         {
110                 add_subwindow(new BC_Title(x, y, _("Video is not supported in this format.")));
111                 y += 40;
112         }
114         add_subwindow(new BC_OKButton(x + 170, y));
117 int FormatVWindow::close_event()
119         set_done(0);
128 FormatCompress::FormatCompress(int x, int y, int recording, Asset *asset, char* default_)
129  : CompressPopup(x, y, recording, default_)
131         this->asset = asset; 
133 FormatCompress::~FormatCompress() 
136 int FormatCompress::handle_event()
138         strcpy(asset->compression, get_compression());
141 FormatQuality::FormatQuality(int x, int y, Asset *asset, int default_)
142  : BC_ISlider(x, 
143         y, 
144         0,
145         100, 
146         100, 
147         0, 
148         100, 
149         default_, 
150         1)
152         this->asset = asset; 
154 FormatQuality::~FormatQuality() 
157 int FormatQuality::handle_event()
159         asset->quality = get_value();
164 FormatBits::FormatBits(int x, int y, Asset *asset)
165  : BitsPopup(x, y, asset)
166 { this->asset = asset; }
167 FormatBits::~FormatBits() {}
168 int FormatBits::handle_event()
170         asset->bits = get_bits();
175 FormatDither::FormatDither(int x, int y, int *dither)
176  : BC_CheckBox(x, y, *dither, _("Dither"))
177 { this->dither = dither; }
178 FormatDither::~FormatDither() {}
179 int FormatDither::handle_event()
181         *dither = get_value();
187 FormatSigned::FormatSigned(int x, int y, Asset *asset)
188  : BC_CheckBox(x, y, asset->signed_, _("Signed"))
189 { this->asset = asset; }
190 FormatSigned::~FormatSigned() {}
191 int FormatSigned::handle_event()
193         asset->signed_ = get_value();
201 FormatHILO::FormatHILO(int x, int y, Asset *asset)
202  : BC_Radial(x, y, asset->byte_order ^ 1)
204         this->asset = asset;
206 FormatHILO::~FormatHILO() {}
208 int FormatHILO::handle_event()
210         asset->byte_order = get_value() ^ 1;
211         lohi->update(get_value() ^ 1);
214 FormatLOHI::FormatLOHI(int x, int y, FormatHILO *hilo, Asset *asset)
215  : BC_Radial(x, y, asset->byte_order)
217         this->hilo = hilo;
218         this->asset = asset;
220 FormatLOHI::~FormatLOHI() {}
222 int FormatLOHI::handle_event()
224         asset->byte_order = get_value();
225         hilo->update(get_value() ^ 1);