4 #include "fileformat.h"
7 #include "mwindowgui.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),
21 this->mwindow = mwindow;
24 FileFormat::~FileFormat()
31 delete channels_button;
35 int FileFormat::create_objects(Asset *asset, char *string2)
37 // ================================= copy values
39 create_objects_(string2);
42 int FileFormat::create_objects_(char *string2)
45 int x1 = 10, x2 = 180;
47 add_subwindow(new BC_Title(x, y, string2));
49 add_subwindow(new BC_Title(x, y, _("Assuming raw PCM:")));
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();
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));
64 add_subwindow(new BC_Title(x, y, _("Bits:")));
65 bitspopup = new BitsPopup(this,
74 bitspopup->create_objects();
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));
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));
89 add_subwindow(signed_button = new FileFormatSigned(x, y, this, asset->signed_));
91 add_subwindow(new BC_OKButton(this));
92 add_subwindow(new BC_CancelButton(this));
96 FileFormatChannels::FileFormatChannels(int x, int y, FileFormat *fwindow, char *text)
97 : BC_TumbleTextBox(fwindow,
105 this->fwindow = fwindow;
108 int FileFormatChannels::handle_event()
110 fwindow->asset->channels = atol(get_text());
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());
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());
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()
147 fwindow->asset->byte_order = 1;
148 fwindow->hilo->update(0);
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()
161 fwindow->asset->byte_order = 0;
162 fwindow->lohi->update(0);
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();