r1009: Move the dependencies to newer package names
[cinelerra_cv/mob.git] / cinelerra / fileformat.C
blob4def7de5364b9254cca3a691e1ac30ac9f738676
1 #include "asset.h"
2 #include "assets.h"
3 #include "bitspopup.h"
4 #include "fileformat.h"
5 #include "language.h"
6 #include "mwindow.h"
7 #include "mwindowgui.h"
8 #include "new.h"
12 FileFormat::FileFormat(MWindow *mwindow)
13  : BC_Window(PROGRAM_NAME ": File Format", 
14                 mwindow->gui->get_abs_cursor_x(1),
15                 mwindow->gui->get_abs_cursor_y(1),
16                 375, 
17                 300, 
18                 375, 
19                 300)
21         this->mwindow = mwindow;
24 FileFormat::~FileFormat()
26         delete lohi;
27         delete hilo;
28         delete signed_button;
29         delete header_button;
30         delete rate_button;
31         delete channels_button;
32         delete bitspopup;
35 int FileFormat::create_objects(Asset *asset, char *string2)
37 // ================================= copy values
38         this->asset = asset;
39         create_objects_(string2);
42 int FileFormat::create_objects_(char *string2)
44         char string[1024];
45         int x1 = 10, x2 = 180;
46         int x = x1, y = 10;
47         add_subwindow(new BC_Title(x, y, string2));
48         y += 20;
49         add_subwindow(new BC_Title(x, y, _("Assuming raw PCM:")));
51         y += 30;
52         add_subwindow(new BC_Title(x, y, _("Channels:")));
53         sprintf(string, "%d", asset->channels);
54         channels_button = new FileFormatChannels(x2, y, this, string);
55         channels_button->create_objects();
57         y += 30;
58         add_subwindow(new BC_Title(x, y, _("Sample rate:")));
59         sprintf(string, "%d", asset->sample_rate);
60         add_subwindow(rate_button = new FileFormatRate(x2, y, this, string));
61         add_subwindow(new SampleRatePulldown(mwindow, rate_button, x2 + 100, y));
62         
63         y += 30;
64         add_subwindow(new BC_Title(x, y, _("Bits:")));
65         bitspopup = new BitsPopup(this, 
66                 x2, 
67                 y, 
68                 &asset->bits, 
69                 0, 
70                 1, 
71                 1, 
72                 0, 
73                 1);
74         bitspopup->create_objects();
75         
76         y += 30;
77         add_subwindow(new BC_Title(x, y, _("Header length:")));
78         sprintf(string, "%d", asset->header);
79         add_subwindow(header_button = new FileFormatHeader(x2, y, this, string));
80         
81         y += 30;
83 //printf("FileFormat::create_objects_ 1 %d\n", asset->byte_order);
84         add_subwindow(new BC_Title(x, y, _("Byte order:")));
85         add_subwindow(lohi = new FileFormatByteOrderLOHI(x2, y, this, asset->byte_order));
86         add_subwindow(hilo = new FileFormatByteOrderHILO(x2 + 70, y, this, !asset->byte_order));
87         
88         y += 30;
89         add_subwindow(signed_button = new FileFormatSigned(x, y, this, asset->signed_));
90         
91         add_subwindow(new BC_OKButton(this));
92         add_subwindow(new BC_CancelButton(this));
93         return 0;
96 FileFormatChannels::FileFormatChannels(int x, int y, FileFormat *fwindow, char *text)
97  : BC_TumbleTextBox(fwindow, 
98         (int)atol(text), 
99         (int)1, 
100         (int)MAXCHANNELS, 
101         x, 
102         y, 
103         50)
105         this->fwindow = fwindow;
108 int FileFormatChannels::handle_event()
110         fwindow->asset->channels = atol(get_text());
111         return 0;
114 FileFormatRate::FileFormatRate(int x, int y, FileFormat *fwindow, char *text)
115  : BC_TextBox(x, y, 100, 1, text)
117         this->fwindow = fwindow;
120 int FileFormatRate::handle_event()
122         fwindow->asset->sample_rate = atol(get_text());
123         return 0;
126 FileFormatHeader::FileFormatHeader(int x, int y, FileFormat *fwindow, char *text)
127  : BC_TextBox(x, y, 100, 1, text)
129         this->fwindow = fwindow;
132 int FileFormatHeader::handle_event()
134         fwindow->asset->header = atol(get_text());
135         return 0;
138 FileFormatByteOrderLOHI::FileFormatByteOrderLOHI(int x, int y, FileFormat *fwindow, int value)
139  : BC_Radial(x, y, value, _("Lo Hi"))
141         this->fwindow = fwindow;
144 int FileFormatByteOrderLOHI::handle_event()
146         update(1);
147         fwindow->asset->byte_order = 1;
148         fwindow->hilo->update(0);
149         return 1;
152 FileFormatByteOrderHILO::FileFormatByteOrderHILO(int x, int y, FileFormat *fwindow, int value)
153  : BC_Radial(x, y, value, _("Hi Lo"))
155         this->fwindow = fwindow;
158 int FileFormatByteOrderHILO::handle_event()
160         update(1);
161         fwindow->asset->byte_order = 0;
162         fwindow->lohi->update(0);
163         return 1;
166 FileFormatSigned::FileFormatSigned(int x, int y, FileFormat *fwindow, int value)
167  : BC_CheckBox(x, y, value, _("Values are signed"))
169         this->fwindow = fwindow;
172 int FileFormatSigned::handle_event()
174         fwindow->asset->signed_ = get_value();
175         return 1;