Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

recordprefs.C

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

Generated on Sun Jan 8 13:38:59 2006 for Cinelerra-svn by  doxygen 1.4.4