00001 #include "adeviceprefs.h"
00002 #include "audioconfig.h"
00003 #include "clip.h"
00004 #include "edl.h"
00005 #include "edlsession.h"
00006 #include "formattools.h"
00007 #include "new.h"
00008 #include "language.h"
00009 #include "mwindow.h"
00010 #include "preferences.h"
00011 #include "recordconfig.h"
00012 #include "recordprefs.h"
00013 #include "theme.h"
00014 #include "vdeviceprefs.h"
00015
00016
00017
00018
00019 RecordPrefs::RecordPrefs(MWindow *mwindow, PreferencesWindow *pwindow)
00020 : PreferencesDialog(mwindow, pwindow)
00021 {
00022 this->mwindow = mwindow;
00023 }
00024
00025 RecordPrefs::~RecordPrefs()
00026 {
00027 delete audio_in_device;
00028 delete recording_format;
00029
00030 }
00031
00032 int RecordPrefs::create_objects()
00033 {
00034 int x, y, x2;
00035 char string[BCTEXTLEN];
00036 BC_Resources *resources = BC_WindowBase::get_resources();
00037 BC_Title *title;
00038
00039 x = mwindow->theme->preferencesoptions_x;
00040 y = mwindow->theme->preferencesoptions_y;
00041
00042 add_subwindow(title = new BC_Title(x,
00043 y,
00044 _("File Format:"),
00045 LARGEFONT,
00046 resources->text_default));
00047 y += title->get_h() + 5;
00048
00049 recording_format =
00050 new FormatTools(mwindow,
00051 this,
00052 pwindow->thread->edl->session->recording_format);
00053 recording_format->create_objects(x,
00054 y,
00055 1,
00056 1,
00057 1,
00058 1,
00059 0,
00060 1,
00061 0,
00062 1,
00063 0,
00064 0);
00065
00066
00067
00068
00069
00070
00071 add_subwindow(new BC_Bar(5, y, get_w() - 10));
00072 y += 5;
00073
00074
00075 add_subwindow(title = new BC_Title(x,
00076 y,
00077 _("Audio In"),
00078 LARGEFONT,
00079 resources->text_default));
00080
00081 y += title->get_h() + 5;
00082
00083 add_subwindow(new BC_Title(x, y, _("Record Driver:"), MEDIUMFONT, resources->text_default));
00084 audio_in_device = new ADevicePrefs(x + 110,
00085 y,
00086 pwindow,
00087 this,
00088 0,
00089 pwindow->thread->edl->session->aconfig_in,
00090 MODERECORD);
00091 audio_in_device->initialize(1);
00092 y += audio_in_device->get_h(1);
00093
00094
00095 BC_TextBox *textbox;
00096 BC_Title *title1, *title2, *title3;
00097 add_subwindow(title1 = new BC_Title(x, y, _("Samples to write to disk at a time:")));
00098 add_subwindow(title2 = new BC_Title(x, y + 30, _("Sample rate for recording:")));
00099 add_subwindow(title3 = new BC_Title(x, y + 60, _("Channels to record:")));
00100 x2 = MAX(title1->get_w(), title2->get_w()) + 10;
00101 x2 = MAX(x2, title3->get_w() + 10);
00102
00103 sprintf(string, "%ld", pwindow->thread->edl->session->record_write_length);
00104 add_subwindow(textbox = new RecordWriteLength(mwindow,
00105 pwindow,
00106 x2,
00107 y,
00108 string));
00109 add_subwindow(textbox = new RecordSampleRate(pwindow, x2, y + 30));
00110 add_subwindow(new SampleRatePulldown(mwindow, textbox, x2 + textbox->get_w(), y + 30));
00111
00112 RecordChannels *channels = new RecordChannels(pwindow, this, x2, y + 60);
00113 channels->create_objects();
00114
00115 y += 90;
00116
00117
00118 add_subwindow(new RecordRealTime(mwindow,
00119 pwindow,
00120 x,
00121 y,
00122 pwindow->thread->edl->session->real_time_record));
00123 y += 45;
00124 x = 5;
00125
00126
00127
00128
00129
00130 add_subwindow(new BC_Bar(5, y, get_w() - 10));
00131 y += 5;
00132
00133
00134 add_subwindow(new BC_Title(x, y, _("Video In"), LARGEFONT, resources->text_default));
00135 y += 25;
00136
00137 add_subwindow(new BC_Title(x,
00138 y,
00139 _("Record Driver:"),
00140 MEDIUMFONT,
00141 resources->text_default));
00142 video_in_device = new VDevicePrefs(x + 110,
00143 y,
00144 pwindow,
00145 this,
00146 0,
00147 pwindow->thread->edl->session->vconfig_in,
00148 MODERECORD);
00149 video_in_device->initialize(1);
00150
00151 y += 55;
00152 sprintf(string, "%d", pwindow->thread->edl->session->video_write_length);
00153 add_subwindow(textbox = new VideoWriteLength(pwindow, string, y));
00154 add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
00155 add_subwindow(new BC_Title(x, y, _("Frames to record to disk at a time:")));
00156 y += 27;
00157 sprintf(string, "%d", pwindow->thread->edl->session->vconfig_in->capture_length);
00158 add_subwindow(textbox = new VideoCaptureLength(pwindow, string, y));
00159 add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
00160 add_subwindow(new BC_Title(x, y, _("Frames to buffer in device:")));
00161 y += 27;
00162
00163 add_subwindow(new RecordSoftwareTimer(pwindow,
00164 pwindow->thread->edl->session->record_software_position,
00165 x,
00166 y));
00167 y += 27;
00168 add_subwindow(new RecordSyncDrives(pwindow,
00169 pwindow->thread->edl->session->record_sync_drives,
00170 x,
00171 y));
00172 y += 35;
00173
00174 BC_TextBox *w_text, *h_text;
00175 add_subwindow(new BC_Title(x, y, _("Size of captured frame:")));
00176 x += 170;
00177 add_subwindow(w_text = new RecordW(pwindow, x, y));
00178 x += w_text->get_w() + 2;
00179 add_subwindow(new BC_Title(x, y, "x"));
00180 x += 10;
00181 add_subwindow(h_text = new RecordH(pwindow, x, y));
00182 x += h_text->get_w();
00183 add_subwindow(new FrameSizePulldown(mwindow,
00184 w_text,
00185 h_text,
00186 x,
00187 y));
00188
00189 y += 30;
00190 x = 5;
00191 add_subwindow(new BC_Title(x, y, _("Frame rate for recording:")));
00192 x += 180;
00193 add_subwindow(textbox = new RecordFrameRate(pwindow, x, y));
00194 x += 75;
00195 add_subwindow(new FrameRatePulldown(mwindow, textbox, x, y));
00196 y += 45;
00197 x = 5;
00198
00199 add_subwindow(new BC_Title(x, y, _("Images"), LARGEFONT, BLACK));
00200 y += 25;
00201 add_subwindow(new StillImageUseDuration(pwindow,
00202 pwindow->thread->edl->session->si_useduration,
00203 x,
00204 y));
00205 x += 260;
00206 y += 5;
00207 add_subwindow(new StillImageDuration(pwindow, x, y));
00208 x += 80;
00209 y += 5;
00210 add_subwindow(new BC_Title(x, y, _("Seconds")));
00211 y += 30;
00212
00213 return 0;
00214 }
00215
00216
00217 RecordWriteLength::RecordWriteLength(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, char *text)
00218 : BC_TextBox(x, y, 100, 1, text)
00219 {
00220 this->pwindow = pwindow;
00221 }
00222
00223 int RecordWriteLength::handle_event()
00224 {
00225 pwindow->thread->edl->session->record_write_length = atol(get_text());
00226 return 1;
00227 }
00228
00229
00230
00231 RecordRealTime::RecordRealTime(MWindow *mwindow,
00232 PreferencesWindow *pwindow,
00233 int x,
00234 int y,
00235 int value)
00236 : BC_CheckBox(x,
00237 y,
00238 value,
00239 _("Record in realtime priority (root only)"))
00240 {
00241 this->pwindow = pwindow;
00242 }
00243
00244 int RecordRealTime::handle_event()
00245 {
00246 pwindow->thread->edl->session->real_time_record = get_value();
00247 }
00248
00249
00250 RecordSampleRate::RecordSampleRate(PreferencesWindow *pwindow, int x, int y)
00251 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->aconfig_in->in_samplerate)
00252 {
00253 this->pwindow = pwindow;
00254 }
00255 int RecordSampleRate::handle_event()
00256 {
00257 pwindow->thread->edl->session->aconfig_in->in_samplerate = atol(get_text());
00258 return 1;
00259 }
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273 RecordW::RecordW(PreferencesWindow *pwindow, int x, int y)
00274 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->w)
00275 {
00276 this->pwindow = pwindow;
00277 }
00278 int RecordW::handle_event()
00279 {
00280 pwindow->thread->edl->session->vconfig_in->w = atol(get_text());
00281 return 1;
00282 }
00283
00284 RecordH::RecordH(PreferencesWindow *pwindow, int x, int y)
00285 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->h)
00286 {
00287 this->pwindow = pwindow;
00288 }
00289 int RecordH::handle_event()
00290 {
00291 pwindow->thread->edl->session->vconfig_in->h = atol(get_text());
00292 return 1;
00293 }
00294
00295 RecordFrameRate::RecordFrameRate(PreferencesWindow *pwindow, int x, int y)
00296 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->in_framerate)
00297 {
00298 this->pwindow = pwindow;
00299 }
00300 int RecordFrameRate::handle_event()
00301 {
00302 pwindow->thread->edl->session->vconfig_in->in_framerate = atof(get_text());
00303 return 1;
00304 }
00305
00306
00307
00308 RecordChannels::RecordChannels(PreferencesWindow *pwindow, BC_SubWindow *gui, int x, int y)
00309 : BC_TumbleTextBox(gui,
00310 pwindow->thread->edl->session->aconfig_in->channels,
00311 1,
00312 MAX_CHANNELS,
00313 x,
00314 y,
00315 100)
00316 {
00317 this->pwindow = pwindow;
00318 }
00319
00320 int RecordChannels::handle_event()
00321 {
00322 pwindow->thread->edl->session->aconfig_in->channels = atoi(get_text());
00323 return 1;
00324 }
00325
00326
00327
00328 VideoWriteLength::VideoWriteLength(PreferencesWindow *pwindow, char *text, int y)
00329 : BC_TextBox(260, y, 100, 1, text)
00330 {
00331 this->pwindow = pwindow;
00332 }
00333
00334 int VideoWriteLength::handle_event()
00335 {
00336 pwindow->thread->edl->session->video_write_length = atol(get_text());
00337 return 1;
00338 }
00339
00340
00341 VideoCaptureLength::VideoCaptureLength(PreferencesWindow *pwindow, char *text, int y)
00342 : BC_TextBox(260, y, 100, 1, text)
00343 {
00344 this->pwindow = pwindow;
00345 }
00346
00347 int VideoCaptureLength::handle_event()
00348 {
00349 pwindow->thread->edl->session->vconfig_in->capture_length = atol(get_text());
00350 return 1;
00351 }
00352
00353 CaptureLengthTumbler::CaptureLengthTumbler(PreferencesWindow *pwindow, BC_TextBox *text, int x, int y)
00354 : BC_Tumbler(x, y)
00355 {
00356 this->pwindow;
00357 this->text = text;
00358 }
00359
00360 int CaptureLengthTumbler::handle_up_event()
00361 {
00362 int value = atol(text->get_text());
00363 value++;
00364 char string[BCTEXTLEN];
00365 sprintf(string, "%d", value);
00366 text->update(string);
00367 text->handle_event();
00368 return 1;
00369 }
00370
00371 int CaptureLengthTumbler::handle_down_event()
00372 {
00373 int value = atol(text->get_text());
00374 value--;
00375 value = MAX(1, value);
00376 char string[BCTEXTLEN];
00377 sprintf(string, "%d", value);
00378 text->update(string);
00379 text->handle_event();
00380 return 1;
00381 }
00382
00383
00384
00385 RecordSoftwareTimer::RecordSoftwareTimer(PreferencesWindow *pwindow, int value, int x, int y)
00386 : BC_CheckBox(x, y, value, _("Use software for positioning information"))
00387 {
00388 this->pwindow = pwindow;
00389 }
00390
00391 int RecordSoftwareTimer::handle_event()
00392 {
00393 pwindow->thread->edl->session->record_software_position = get_value();
00394 return 1;
00395 }
00396
00397
00398
00399 RecordSyncDrives::RecordSyncDrives(PreferencesWindow *pwindow, int value, int x, int y)
00400 : BC_CheckBox(x, y, value, _("Sync drives automatically"))
00401 {
00402 this->pwindow = pwindow;
00403 }
00404
00405 int RecordSyncDrives::handle_event()
00406 {
00407 pwindow->thread->edl->session->record_sync_drives = get_value();
00408 return 1;
00409 }
00410
00411 StillImageUseDuration::StillImageUseDuration(PreferencesWindow *pwindow, int value, int x, int y)
00412 : BC_CheckBox(x, y, value, _("Import images with a duration of"))
00413 {
00414 this->pwindow = pwindow;
00415 }
00416
00417 int StillImageUseDuration::handle_event()
00418 {
00419 pwindow->thread->edl->session->si_useduration = get_value();
00420 }
00421
00422 StillImageDuration::StillImageDuration(PreferencesWindow *pwindow, int x, int y)
00423 : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->si_duration)
00424 {
00425 this->pwindow = pwindow;
00426 }
00427 int StillImageDuration::handle_event()
00428 {
00429 pwindow->thread->edl->session->si_duration = atof(get_text());
00430 return 1;
00431 }
00432
00433