00001 #include "asset.h"
00002 #include "batch.h"
00003 #include "bcsignals.h"
00004 #include "browsebutton.h"
00005 #include "channelpicker.h"
00006 #include "clip.h"
00007 #include "condition.h"
00008 #include "bchash.h"
00009 #include "edl.h"
00010 #include "edlsession.h"
00011 #include "file.h"
00012 #include "filemov.h"
00013 #include "filesystem.h"
00014 #include "keys.h"
00015 #include "language.h"
00016 #include "loadmode.h"
00017 #include "mwindow.h"
00018 #include "mwindowgui.h"
00019 #include "preferences.h"
00020 #include "question.h"
00021 #include "recconfirmdelete.h"
00022 #include "recordgui.h"
00023 #include "record.h"
00024 #include "recordlabel.h"
00025 #include "recordmonitor.h"
00026 #include "recordtransport.h"
00027 #include "recordvideo.h"
00028 #include "mainsession.h"
00029 #include "theme.h"
00030 #include "units.h"
00031 #include "videodevice.h"
00032
00033 #include <time.h>
00034
00035
00036
00037
00038 RecordGUI::RecordGUI(MWindow *mwindow, Record *record)
00039 : BC_Window(PROGRAM_NAME ": Recording",
00040 mwindow->session->rwindow_x,
00041 mwindow->session->rwindow_y,
00042 mwindow->session->rwindow_w,
00043 mwindow->session->rwindow_h,
00044 10,
00045 10,
00046 1,
00047 0,
00048 1)
00049 {
00050 this->mwindow = mwindow;
00051 this->record = record;
00052 }
00053
00054 RecordGUI::~RecordGUI()
00055 {
00056 TRACE("RecordGUI::~RecordGUI 1");
00057 delete status_thread;
00058 delete batch_source;
00059 delete batch_mode;
00060 delete startover_thread;
00061 delete interrupt_thread;
00062 delete batch_start;
00063 delete batch_duration;
00064 delete load_mode;
00065 TRACE("RecordGUI::~RecordGUI 2");
00066 }
00067
00068
00069 char* RecordGUI::batch_titles[] =
00070 {
00071 N_("On"),
00072 N_("Path"),
00073 N_("News"),
00074 N_("Start time"),
00075 N_("Duration"),
00076 N_("Source"),
00077 N_("Mode")
00078 };
00079
00080 void RecordGUI::load_defaults()
00081 {
00082 static int default_columnwidth[] =
00083 {
00084 30,
00085 200,
00086 100,
00087 100,
00088 100,
00089 100,
00090 70
00091 };
00092
00093 char string[BCTEXTLEN];
00094 for(int i = 0; i < BATCH_COLUMNS; i++)
00095 {
00096 sprintf(string, "BATCH_COLUMNWIDTH_%d", i);
00097 column_widths[i] = mwindow->defaults->get(string, default_columnwidth[i]);
00098 }
00099 }
00100
00101 void RecordGUI::save_defaults()
00102 {
00103 char string[BCTEXTLEN];
00104 for(int i = 0; i < BATCH_COLUMNS; i++)
00105 {
00106 sprintf(string, "BATCH_COLUMNWIDTH_%d", i);
00107 mwindow->defaults->update(string, column_widths[i]);
00108 }
00109 }
00110
00111
00112 int RecordGUI::create_objects()
00113 {
00114 char string[BCTEXTLEN];
00115 flash_color = RED;
00116
00117 status_thread = new RecordStatusThread(mwindow, this);
00118 status_thread->start();
00119 set_icon(mwindow->theme->get_image("record_icon"));
00120
00121 mwindow->theme->get_recordgui_sizes(this, get_w(), get_h());
00122
00123 mwindow->theme->draw_rwindow_bg(this);
00124
00125
00126 monitor_video = 0;
00127 monitor_audio = 0;
00128 total_dropped_frames = 0;
00129 batch_list = 0;
00130 update_batches();
00131 modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_INFINITE)));
00132 modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_TIMED)));
00133
00134
00135
00136 int x = 10;
00137 int y = 10;
00138 int x1 = 0;
00139 BC_Title *title;
00140 int pad = MAX(BC_TextBox::calculate_h(this, MEDIUMFONT, 1, 1),
00141 BC_Title::calculate_h(this, "X")) + 5;
00142 int button_y = 0;
00143
00144
00145 add_subwindow(title = new BC_Title(x, y, _("Path:")));
00146 x1 = MAX(title->get_w(), x1);
00147 y += pad;
00148 add_subwindow(title = new BC_Title(x, y, _("Start time:")));
00149 x1 = MAX(title->get_w(), x1);
00150 y += pad;
00151 add_subwindow(title = new BC_Title(x, y, _("Duration time:")));
00152 x1 = MAX(title->get_w(), x1);
00153 y += pad;
00154 add_subwindow(title = new BC_Title(x, y, _("Source:")));
00155 x1 = MAX(title->get_w(), x1);
00156 y += pad;
00157 add_subwindow(title = new BC_Title(x, y, _("Mode:")));
00158 x1 = MAX(title->get_w(), x1);
00159 y += pad;
00160 add_subwindow(title = new BC_Title(x, y, _("Transport:")));
00161 x1 = MAX(title->get_w(), x1);
00162 y += pad;
00163
00164 button_y = MAX(y, button_y);
00165
00166
00167
00168 int x2 = 0;
00169 y = 10;
00170 x = x1 + 20;
00171 add_subwindow(batch_path = new RecordPath(mwindow, record, x, y));
00172 add_subwindow(batch_browse = new BrowseButton(mwindow,
00173 this,
00174 batch_path,
00175 batch_path->get_x() + batch_path->get_w(),
00176 y,
00177 record->default_asset->path,
00178 PROGRAM_NAME ": Record path",
00179 _("Select a file to record to:"),
00180 0));
00181 x2 = MAX(x2, batch_path->get_w() + batch_browse->get_w());
00182 y += pad;
00183 batch_start = new RecordStart(mwindow, record, x, y);
00184 batch_start->create_objects();
00185 x2 = MAX(x2, batch_start->get_w());
00186 y += pad;
00187 batch_duration = new RecordDuration(mwindow, record, x, y);
00188 batch_duration->create_objects();
00189 x2 = MAX(x2, batch_duration->get_w());
00190 y += pad;
00191 batch_source = new RecordSource(mwindow, record, this, x, y);
00192 batch_source->create_objects();
00193 x2 = MAX(x2, batch_source->get_w());
00194 y += pad;
00195 batch_mode = new RecordMode(mwindow, record, this, x, y);
00196 batch_mode->create_objects();
00197 x2 = MAX(x2, batch_mode->get_w());
00198 y += pad;
00199 record_transport = new RecordTransport(mwindow,
00200 record,
00201 this,
00202 x,
00203 y);
00204 record_transport->create_objects();
00205 x2 = MAX(x2, record_transport->get_w());
00206
00207
00208
00209
00210
00211 x = x2 + x1 + 30;
00212 y = 10;
00213 int x3 = 0;
00214 pad = BC_Title::calculate_h(this, "X") + 5;
00215 add_subwindow(title = new BC_Title(x, y, _("Format:")));
00216 x3 = MAX(title->get_w(), x3);
00217 y += pad;
00218
00219 if(record->default_asset->audio_data)
00220 {
00221 add_subwindow(title = new BC_Title(x, y, _("Audio compression:")));
00222 x3 = MAX(title->get_w(), x3);
00223 y += pad;
00224 add_subwindow(title = new BC_Title(x, y, _("Samplerate:")));
00225 x3 = MAX(title->get_w(), x3);
00226 y += pad;
00227 add_subwindow(title = new BC_Title(x, y, _("Clipped samples:")));
00228 x3 = MAX(title->get_w(), x3);
00229 y += pad;
00230 }
00231
00232 if(record->default_asset->video_data)
00233 {
00234 add_subwindow(title = new BC_Title(x, y, _("Video compression:")));
00235 x3 = MAX(title->get_w(), x3);
00236 y += pad;
00237 add_subwindow(title = new BC_Title(x, y, _("Framerate:")));
00238 x3 = MAX(title->get_w(), x3);
00239 y += pad;
00240 add_subwindow(title = new BC_Title(x, y, _("Frames behind:")));
00241 x3 = MAX(title->get_w(), x3);
00242 y += pad;
00243 }
00244
00245 add_subwindow(title = new BC_Title(x, y, _("Position:")));
00246 x3 = MAX(title->get_w(), x3);
00247 y += pad;
00248 add_subwindow(title = new BC_Title(x, y, _("Prev label:")));
00249 x3 = MAX(title->get_w(), x3);
00250 y += pad;
00251
00252 button_y = MAX(y, button_y);
00253 y = 10;
00254 x = x3 + x2 + x1 + 40;
00255
00256 add_subwindow(new BC_Title(x,
00257 y,
00258 File::formattostr(mwindow->plugindb,
00259 record->default_asset->format),
00260 MEDIUMFONT,
00261 mwindow->theme->recordgui_fixed_color));
00262 y += pad;
00263
00264 if(record->default_asset->audio_data)
00265 {
00266 add_subwindow(new BC_Title(x,
00267 y,
00268 File::bitstostr(record->default_asset->bits),
00269 MEDIUMFONT,
00270 mwindow->theme->recordgui_fixed_color));
00271
00272 y += pad;
00273 sprintf(string, "%d", record->default_asset->sample_rate);
00274 add_subwindow(new BC_Title(x,
00275 y,
00276 string,
00277 MEDIUMFONT,
00278 mwindow->theme->recordgui_fixed_color));
00279
00280 y += pad;
00281 add_subwindow(samples_clipped = new BC_Title(x,
00282 y,
00283 "0",
00284 MEDIUMFONT,
00285 mwindow->theme->recordgui_variable_color));
00286 y += pad;
00287 }
00288
00289 if(record->default_asset->video_data)
00290 {
00291 add_subwindow(new BC_Title(x,
00292 y,
00293 FileMOV::compressiontostr(record->default_asset->vcodec),
00294 MEDIUMFONT,
00295 mwindow->theme->recordgui_fixed_color));
00296
00297 y += pad;
00298 sprintf(string, "%0.2f", record->default_asset->frame_rate);
00299 add_subwindow(new BC_Title(x,
00300 y,
00301 string,
00302 MEDIUMFONT,
00303 mwindow->theme->recordgui_fixed_color));
00304
00305 y += pad;
00306 add_subwindow(frames_dropped = new BC_Title(x,
00307 y,
00308 "0",
00309 MEDIUMFONT,
00310 mwindow->theme->recordgui_variable_color));
00311 y += pad;
00312 }
00313
00314 add_subwindow(position_title = new BC_Title(x,
00315 y,
00316 "",
00317 MEDIUMFONT,
00318 mwindow->theme->recordgui_variable_color));
00319
00320 y += pad;
00321 add_subwindow(prev_label_title = new BC_Title(x,
00322 y,
00323 _("None"),
00324 MEDIUMFONT,
00325 mwindow->theme->recordgui_variable_color));
00326
00327 y += pad + 10;
00328 button_y = MAX(y, button_y);
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340 x = 10;
00341 y = button_y;
00342
00343
00344 add_subwindow(title = new BC_Title(x,y, _("Batches:")));
00345 x += title->get_w() + 5;
00346 add_subwindow(activate_batch = new RecordGUIActivateBatch(mwindow, record, x, y));
00347 x += activate_batch->get_w();
00348 add_subwindow(start_batches = new RecordGUIStartBatches(mwindow, record, x, y));
00349 x += start_batches->get_w();
00350 add_subwindow(delete_batch = new RecordGUIDeleteBatch(mwindow, record, x, y));
00351 x += delete_batch->get_w();
00352 add_subwindow(new_batch = new RecordGUINewBatch(mwindow, record, x, y));
00353 x += new_batch->get_w();
00354 add_subwindow(label_button = new RecordGUILabel(mwindow, record, x, y));
00355
00356
00357
00358 x = 10;
00359 y += MAX(label_button->get_h(), record_transport->get_h()) + 5;
00360
00361 fill_frames = 0;
00362 monitor_video = 0;
00363 monitor_audio = 0;
00364 if(record->default_asset->video_data)
00365 {
00366 add_subwindow(fill_frames = new RecordGUIFillFrames(mwindow, record, x, y));
00367 x += fill_frames->get_w() + 5;
00368 add_subwindow(monitor_video = new RecordGUIMonitorVideo(mwindow, record, x, y));
00369 x += monitor_video->get_w() + 5;
00370 }
00371
00372 if(record->default_asset->audio_data)
00373 add_subwindow(monitor_audio = new RecordGUIMonitorAudio(mwindow, record, x, y));
00374
00375
00376 x = 10;
00377 y += 5;
00378 if(fill_frames) y += fill_frames->get_h();
00379 else
00380 if(monitor_audio) y += monitor_audio->get_h();
00381
00382 int bottom_margin = MAX(BC_OKButton::calculate_h(),
00383 LoadMode::calculate_h(this)) + 5;
00384
00385
00386 add_subwindow(batch_list = new RecordGUIBatches(record,
00387 this,
00388 x,
00389 y,
00390 get_w() - 20,
00391 get_h() - y - bottom_margin - 10));
00392 y += batch_list->get_h() + 5;
00393
00394
00395 load_mode = new LoadMode(mwindow,
00396 this,
00397 get_w() / 2 - mwindow->theme->loadmode_w / 2,
00398 y,
00399 &record->load_mode,
00400 1);
00401 load_mode->create_objects();
00402 y += load_mode->get_h() + 5;
00403
00404 add_subwindow(new RecordGUIOK(record, this));
00405
00406 interrupt_thread = new EndRecordThread(record, this);
00407
00408 add_subwindow(new RecordGUICancel(record, this));
00409
00410 startover_thread = new RecordStartoverThread(record, this);
00411
00412 return 0;
00413 }
00414
00415 void RecordGUI::flash_batch()
00416 {
00417 if(record->current_batch < batches[0].total)
00418 {
00419 if(flash_color == GREEN)
00420 flash_color = RED;
00421 else
00422 flash_color = GREEN;
00423
00424
00425
00426 for(int i = 0; i < BATCH_COLUMNS; i++)
00427 {
00428 BC_ListBoxItem *batch = batches[i].values[record->current_batch];
00429 batch->set_color(flash_color);
00430 }
00431 batch_list->update(batches,
00432 batch_titles,
00433 column_widths,
00434 BATCH_COLUMNS,
00435 batch_list->get_yposition(),
00436 batch_list->get_xposition(),
00437 batch_list->get_highlighted_item());
00438
00439 batch_list->flush();
00440 }
00441 }
00442
00443 void RecordGUI::update_batches()
00444 {
00445 char string[BCTEXTLEN], string2[BCTEXTLEN];
00446 FileSystem fs;
00447
00448 int selection_number = batch_list ? batch_list->get_selection_number(0, 0) : -1;
00449 for(int j = 0; j < BATCH_COLUMNS; j++)
00450 {
00451 batches[j].remove_all_objects();
00452 }
00453
00454 for(int i = 0; i < record->batches.total; i++)
00455 {
00456 Batch *batch = record->batches.values[i];
00457 int color = (i == record->current_batch) ? RED : BLACK;
00458 if(batch->waiting && time(0) & 0x1) color = GREEN;
00459
00460 batches[0].append(new BC_ListBoxItem((char*)(batch->enabled ? "X" : " "), color));
00461 batches[1].append(new BC_ListBoxItem(batch->get_current_asset()->path, color));
00462 sprintf(string, "%s", batch->news);
00463 batches[2].append(new BC_ListBoxItem(string, RED));
00464 Units::totext(string2,
00465 batch->start_time,
00466 TIME_HMS,
00467 record->default_asset->sample_rate,
00468 record->default_asset->frame_rate,
00469 mwindow->edl->session->frames_per_foot);
00470 sprintf(string, "%s %s", TimeEntry::day_table[batch->start_day], string2);
00471
00472 batches[3].append(new BC_ListBoxItem(string, color));
00473 Units::totext(string,
00474 batch->duration,
00475 TIME_HMS,
00476 record->default_asset->sample_rate,
00477 record->default_asset->frame_rate,
00478 mwindow->edl->session->frames_per_foot);
00479 batches[4].append(new BC_ListBoxItem(string, color));
00480 record->source_to_text(string, batch);
00481 batches[5].append(new BC_ListBoxItem(string, color));
00482 sprintf(string, "%s", Batch::mode_to_text(batch->record_mode));
00483 batches[6].append(new BC_ListBoxItem(string, color));
00484
00485 if(i == selection_number)
00486 {
00487 for(int j = 0; j < BATCH_COLUMNS; j++)
00488 {
00489 batches[j].values[i]->set_selected(1);
00490 }
00491 }
00492 }
00493
00494 if(batch_list)
00495 {
00496 batch_list->update(batches,
00497 batch_titles,
00498 column_widths,
00499 BATCH_COLUMNS,
00500 batch_list->get_yposition(),
00501 batch_list->get_xposition(),
00502 record->editing_batch,
00503 1);
00504 }
00505 flush();
00506 }
00507
00508 void RecordGUI::update_batch_sources()
00509 {
00510
00511 if(record->record_monitor->window->channel_picker)
00512 batch_source->update_list(
00513 &record->record_monitor->window->channel_picker->channel_listitems);
00514
00515 }
00516
00517 int RecordGUI::translation_event()
00518 {
00519 mwindow->session->rwindow_x = get_x();
00520 mwindow->session->rwindow_y = get_y();
00521 return 0;
00522 }
00523
00524
00525 int RecordGUI::resize_event(int w, int h)
00526 {
00527 int x, y, x1;
00528
00529
00530 int bottom_margin = mwindow->session->rwindow_h -
00531 batch_list->get_y() -
00532 batch_list->get_h();
00533 int mode_margin = mwindow->session->rwindow_h - load_mode->get_y();
00534 mwindow->session->rwindow_x = get_x();
00535 mwindow->session->rwindow_y = get_y();
00536 mwindow->session->rwindow_w = w;
00537 mwindow->session->rwindow_h = h;
00538 mwindow->theme->get_recordgui_sizes(this, w, h);
00539 mwindow->theme->draw_rwindow_bg(this);
00540
00541
00542 int new_h = mwindow->session->rwindow_h - bottom_margin - batch_list->get_y();
00543 if(new_h < 10) new_h = 10;
00544 printf("RecordGUI::resize_event 1 %d\n", mwindow->session->rwindow_h - bottom_margin - batch_list->get_y());
00545 batch_list->reposition_window(batch_list->get_x(),
00546 batch_list->get_y(),
00547 mwindow->session->rwindow_w - 20,
00548 mwindow->session->rwindow_h - bottom_margin - batch_list->get_y());
00549
00550 load_mode->reposition_window(mwindow->session->rwindow_w / 2 -
00551 mwindow->theme->loadmode_w / 2,
00552 mwindow->session->rwindow_h - mode_margin);
00553
00554
00555
00556 flash();
00557 return 1;
00558 }
00559
00560 void RecordGUI::update_batch_tools()
00561 {
00562
00563 char string[BCTEXTLEN];
00564 Batch *batch = record->get_editing_batch();
00565 batch_path->update(batch->get_current_asset()->path);
00566
00567
00568
00569
00570
00571
00572
00573 batch_start->update(&batch->start_day, &batch->start_time);
00574 batch_duration->update(0, &batch->duration);
00575 batch_source->update(batch->get_source_text());
00576 batch_mode->update(Batch::mode_to_text(batch->record_mode));
00577 flush();
00578 }
00579
00580
00581 RecordGUIBatches::RecordGUIBatches(Record *record, RecordGUI *gui, int x, int y, int w, int h)
00582 : BC_ListBox(x,
00583 y,
00584 w,
00585 h,
00586 LISTBOX_TEXT,
00587 gui->batches,
00588 gui->batch_titles,
00589 gui->column_widths,
00590 BATCH_COLUMNS,
00591 0,
00592 0,
00593 LISTBOX_SINGLE,
00594 ICON_LEFT,
00595 1)
00596 {
00597 this->record = record;
00598 this->gui = gui;
00599 dragging_item = 0;
00600 }
00601
00602
00603 int RecordGUIBatches::handle_event()
00604 {
00605 return 1;
00606 }
00607
00608 int RecordGUIBatches::selection_changed()
00609 {
00610 if(get_selection_number(0, 0) >= 0)
00611 {
00612 int i = get_selection_number(0, 0);
00613 record->change_editing_batch(get_selection_number(0, 0));
00614 if(get_cursor_x() < gui->column_widths[0])
00615 {
00616 record->batches.values[i]->enabled =
00617 !record->batches.values[i]->enabled;
00618 gui->update_batches();
00619 }
00620 }
00621 return 1;
00622 }
00623
00624 int RecordGUIBatches::column_resize_event()
00625 {
00626 for(int i = 0; i < BATCH_COLUMNS; i++)
00627 {
00628 gui->column_widths[i] = get_column_width(i);
00629 }
00630 return 1;
00631 }
00632
00633 int RecordGUIBatches::drag_start_event()
00634 {
00635 if(BC_ListBox::drag_start_event())
00636 {
00637 dragging_item = 1;
00638 return 1;
00639 }
00640
00641 return 0;
00642 }
00643
00644 int RecordGUIBatches::drag_motion_event()
00645 {
00646 if(BC_ListBox::drag_motion_event())
00647 {
00648 return 1;
00649 }
00650 return 0;
00651 }
00652
00653 int RecordGUIBatches::drag_stop_event()
00654 {
00655 if(dragging_item)
00656 {
00657 int src = record->editing_batch;
00658 int dst = get_highlighted_item();
00659 Batch *src_item = record->batches.values[src];
00660 if(dst < 0) dst = record->batches.total;
00661
00662 for(int i = src; i < record->batches.total - 1; i++)
00663 {
00664 record->batches.values[i] = record->batches.values[i + 1];
00665 }
00666 if(dst > src) dst--;
00667
00668 for(int i = record->batches.total - 1; i > dst; i--)
00669 {
00670 record->batches.values[i] = record->batches.values[i - 1];
00671 }
00672 record->batches.values[dst] = src_item;
00673
00674 BC_ListBox::drag_stop_event();
00675
00676 dragging_item = 0;
00677 gui->update_batches();
00678 }
00679
00680 }
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691 RecordGUISave::RecordGUISave(Record *record,
00692 RecordGUI *record_gui)
00693 : BC_Button(10,
00694 record_gui->get_h() - BC_WindowBase::get_resources()->ok_images[0]->get_h() - 10,
00695 BC_WindowBase::get_resources()->ok_images)
00696 {
00697 set_tooltip(_("Save the recording and quit."));
00698 this->record = record;
00699 this->gui = record_gui;
00700 }
00701
00702 int RecordGUISave::handle_event()
00703 {
00704 gui->set_done(0);
00705 return 1;
00706 }
00707
00708 int RecordGUISave::keypress_event()
00709 {
00710
00711
00712
00713
00714
00715
00716 return 0;
00717 }
00718
00719 RecordGUICancel::RecordGUICancel(Record *record,
00720 RecordGUI *record_gui)
00721 : BC_CancelButton(record_gui)
00722 {
00723 set_tooltip(_("Quit without pasting into project."));
00724 this->record = record;
00725 this->gui = record_gui;
00726 }
00727
00728 int RecordGUICancel::handle_event()
00729 {
00730 gui->interrupt_thread->start(0);
00731 return 1;
00732 }
00733
00734 int RecordGUICancel::keypress_event()
00735 {
00736 if(get_keypress() == ESC)
00737 {
00738 handle_event();
00739 return 1;
00740 }
00741
00742 return 0;
00743 }
00744
00745
00746
00747
00748
00749 RecordGUIOK::RecordGUIOK(Record *record,
00750 RecordGUI *record_gui)
00751 : BC_OKButton(record_gui)
00752 {
00753 set_tooltip(_("Quit and paste into project."));
00754 this->record = record;
00755 this->gui = record_gui;
00756 }
00757
00758 int RecordGUIOK::handle_event()
00759 {
00760 gui->interrupt_thread->start(1);
00761 return 1;
00762 }
00763
00764
00765
00766
00767
00768
00769
00770
00771 RecordGUIStartOver::RecordGUIStartOver(Record *record, RecordGUI *record_gui, int x, int y)
00772 : BC_GenericButton(x, y, _("Start Over"))
00773 {
00774 set_tooltip(_("Rewind the current file and erase."));
00775 this->record = record;
00776 this->gui = record_gui;
00777 }
00778 RecordGUIStartOver::~RecordGUIStartOver()
00779 {
00780 }
00781
00782 int RecordGUIStartOver::handle_event()
00783 {
00784 if(!gui->startover_thread->running())
00785 gui->startover_thread->start();
00786 return 1;
00787 }
00788
00789 RecordGUIFillFrames::RecordGUIFillFrames(MWindow *mwindow, Record *record, int x, int y)
00790 : BC_CheckBox(x, y, record->fill_frames, _("Fill frames"))
00791 {
00792 this->mwindow = mwindow;
00793 this->record = record;
00794 set_tooltip(_("Write extra frames when behind."));
00795 }
00796
00797 int RecordGUIFillFrames::handle_event()
00798 {
00799
00800 record->fill_frames = get_value();
00801 return 1;
00802 }
00803
00804 RecordGUIMonitorVideo::RecordGUIMonitorVideo(MWindow *mwindow, Record *record, int x, int y)
00805 : BC_CheckBox(x, y, record->monitor_video, _("Monitor video"))
00806 {
00807 this->mwindow = mwindow;
00808 this->record = record;
00809 }
00810
00811 int RecordGUIMonitorVideo::handle_event()
00812 {
00813
00814 record->monitor_video = get_value();
00815 if(record->monitor_video)
00816 {
00817 unlock_window();
00818
00819
00820 record->record_monitor->window->lock_window("RecordGUIMonitorVideo::handle_event");
00821 record->record_monitor->window->show_window();
00822 record->record_monitor->window->raise_window();
00823 record->record_monitor->window->flush();
00824 record->record_monitor->window->unlock_window();
00825
00826 lock_window("RecordGUIMonitorVideo::handle_event");
00827 record->video_window_open = 1;
00828 }
00829 return 1;
00830 }
00831
00832
00833 RecordGUIMonitorAudio::RecordGUIMonitorAudio(MWindow *mwindow, Record *record, int x, int y)
00834 : BC_CheckBox(x, y, record->monitor_audio, _("Monitor audio"))
00835 {
00836 this->mwindow = mwindow;
00837 this->record = record;
00838 }
00839
00840 int RecordGUIMonitorAudio::handle_event()
00841 {
00842 record->monitor_audio = get_value();
00843 if(record->monitor_audio)
00844 {
00845 unlock_window();
00846
00847
00848 record->record_monitor->window->lock_window("RecordGUIMonitorAudio::handle_event");
00849 record->record_monitor->window->show_window();
00850 record->record_monitor->window->raise_window();
00851 record->record_monitor->window->flush();
00852 record->record_monitor->window->unlock_window();
00853
00854
00855 lock_window("RecordGUIMonitorVideo::handle_event");
00856 record->video_window_open = 1;
00857 }
00858 return 1;
00859 }
00860
00861 RecordBatch::RecordBatch(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
00862 : BC_PopupTextBox(gui,
00863 &gui->batch_numbers,
00864 gui->batch_numbers.values[record->editing_batch]->get_text(),
00865 x,
00866 y,
00867 100,
00868 200)
00869 {
00870 this->gui = gui;
00871 this->mwindow = mwindow;
00872 this->record = record;
00873 }
00874 int RecordBatch::handle_event()
00875 {
00876 return 1;
00877 }
00878
00879 RecordPath::RecordPath(MWindow *mwindow, Record *record, int x, int y)
00880 : BC_TextBox(x, y, 200, 1, record->get_editing_batch()->get_current_asset()->path)
00881 {
00882 this->mwindow = mwindow;
00883 this->record = record;
00884 }
00885 int RecordPath::handle_event()
00886 {
00887 strcpy(record->get_editing_batch()->assets.values[0]->path, get_text());
00888 record->get_editing_batch()->calculate_news();
00889 record->record_gui->update_batches();
00890 return 1;
00891 }
00892
00893 RecordStartType::RecordStartType(MWindow *mwindow, Record *record, int x, int y)
00894 : BC_CheckBox(x, y, record->get_editing_batch()->start_type, _("Offset"))
00895 {
00896 this->mwindow = mwindow;
00897 this->record = record;
00898 }
00899 int RecordStartType::handle_event()
00900 {
00901 return 1;
00902 }
00903
00904
00905 RecordStart::RecordStart(MWindow *mwindow, Record *record, int x, int y)
00906 : TimeEntry(record->record_gui,
00907 x,
00908 y,
00909 &(record->get_editing_batch()->start_day),
00910 &(record->get_editing_batch()->start_time),
00911 TIME_HMS3)
00912 {
00913 this->mwindow = mwindow;
00914 this->record = record;
00915 }
00916 int RecordStart::handle_event()
00917 {
00918 record->record_gui->update_batches();
00919 return 1;
00920 }
00921
00922 RecordDuration::RecordDuration(MWindow *mwindow, Record *record, int x, int y)
00923 : TimeEntry(record->record_gui,
00924 x,
00925 y,
00926 0,
00927 &(record->get_editing_batch()->duration),
00928 TIME_HMS2)
00929 {
00930 this->mwindow = mwindow;
00931 this->record = record;
00932 }
00933 int RecordDuration::handle_event()
00934 {
00935 record->record_gui->update_batches();
00936 return 1;
00937 }
00938
00939 RecordSource::RecordSource(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
00940 : BC_PopupTextBox(gui,
00941 &gui->sources,
00942 record->get_editing_batch()->get_source_text(),
00943 x,
00944 y,
00945 200,
00946 200)
00947 {
00948 this->mwindow = mwindow;
00949 this->record = record;
00950 this->gui = gui;
00951 }
00952 int RecordSource::handle_event()
00953 {
00954 record->set_channel(get_number());
00955 return 1;
00956 }
00957
00958 RecordMode::RecordMode(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
00959 : BC_PopupTextBox(gui,
00960 &gui->modes,
00961 Batch::mode_to_text(record->get_editing_batch()->record_mode),
00962 x,
00963 y,
00964 200,
00965 100)
00966 {
00967 this->mwindow = mwindow;
00968 this->record = record;
00969 }
00970 int RecordMode::handle_event()
00971 {
00972 record->get_editing_batch()->record_mode = Batch::text_to_mode(get_text());
00973 record->record_gui->update_batches();
00974 return 1;
00975 }
00976
00977 RecordNews::RecordNews(MWindow *mwindow, Record *record, int x, int y)
00978 : BC_TextBox(x, y, 200, 1, record->get_editing_batch()->news)
00979 {
00980 this->mwindow = mwindow;
00981 this->record = record;
00982 }
00983 int RecordNews::handle_event()
00984 {
00985 return 1;
00986 }
00987
00988
00989 RecordGUINewBatch::RecordGUINewBatch(MWindow *mwindow, Record *record, int x, int y)
00990 : BC_GenericButton(x, y, _("New"))
00991 {
00992 this->mwindow = mwindow;
00993 this->record = record;
00994 set_tooltip(_("Create new clip."));
00995 }
00996 int RecordGUINewBatch::handle_event()
00997 {
00998 record->new_batch();
00999 record->record_gui->update_batches();
01000 return 1;
01001 }
01002
01003
01004 RecordGUIDeleteBatch::RecordGUIDeleteBatch(MWindow *mwindow, Record *record, int x, int y)
01005 : BC_GenericButton(x, y, _("Delete"))
01006 {
01007 this->mwindow = mwindow;
01008 this->record = record;
01009 set_tooltip(_("Delete clip."));
01010 }
01011 int RecordGUIDeleteBatch::handle_event()
01012 {
01013 record->delete_batch();
01014 record->record_gui->update_batches();
01015 return 1;
01016 }
01017
01018
01019 RecordGUIStartBatches::RecordGUIStartBatches(MWindow *mwindow, Record *record, int x, int y)
01020 : BC_GenericButton(x, y, _("Start"))
01021 {
01022 this->mwindow = mwindow;
01023 this->record = record;
01024 set_tooltip(_("Start batch recording\nfrom the current position."));
01025 }
01026 int RecordGUIStartBatches::handle_event()
01027 {
01028 unlock_window();
01029 record->start_recording(0, CONTEXT_BATCH);
01030 lock_window("RecordGUIStartBatches::handle_event");
01031 return 1;
01032 }
01033
01034
01035 RecordGUIStopbatches::RecordGUIStopbatches(MWindow *mwindow, Record *record, int x, int y)
01036 : BC_GenericButton(x, y, _("Stop"))
01037 {
01038 this->mwindow = mwindow;
01039 this->record = record;
01040 }
01041 int RecordGUIStopbatches::handle_event()
01042 {
01043 return 1;
01044 }
01045
01046
01047 RecordGUIActivateBatch::RecordGUIActivateBatch(MWindow *mwindow, Record *record, int x, int y)
01048 : BC_GenericButton(x, y, _("Activate"))
01049 {
01050 this->mwindow = mwindow;
01051 this->record = record;
01052 set_tooltip(_("Make the highlighted\nclip active."));
01053 }
01054 int RecordGUIActivateBatch::handle_event()
01055 {
01056 record->activate_batch(record->editing_batch, 1);
01057 return 1;
01058 }
01059
01060
01061 RecordGUILabel::RecordGUILabel(MWindow *mwindow, Record *record, int x, int y)
01062 : BC_GenericButton(x, y, _("Label"))
01063 {
01064 this->mwindow = mwindow;
01065 this->record = record;
01066 set_underline(0);
01067 }
01068
01069
01070 RecordGUILabel::~RecordGUILabel()
01071 {
01072 }
01073
01074 int RecordGUILabel::handle_event()
01075 {
01076 record->toggle_label();
01077 return 1;
01078 }
01079
01080 int RecordGUILabel::keypress_event()
01081 {
01082 if(get_keypress() == 'l')
01083 {
01084 handle_event();
01085 return 1;
01086 }
01087 return 0;
01088 }
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106 EndRecordThread::EndRecordThread(Record *record, RecordGUI *record_gui)
01107 : Thread(1, 0, 0)
01108 {
01109 this->record = record;
01110 this->gui = record_gui;
01111 is_ok = 0;
01112 }
01113
01114 EndRecordThread::~EndRecordThread()
01115 {
01116 if(Thread::running())
01117 {
01118 window->lock_window("EndRecordThread::~EndRecordThread");
01119 window->set_done(1);
01120 window->unlock_window();
01121 Thread::join();
01122 }
01123 }
01124
01125 void EndRecordThread::start(int is_ok)
01126 {
01127 this->is_ok = is_ok;
01128 if(record->capture_state == IS_RECORDING)
01129 {
01130 if(!running())
01131 Thread::start();
01132 }
01133 else
01134 {
01135 gui->set_done(!is_ok);
01136 }
01137 }
01138
01139 void EndRecordThread::run()
01140 {
01141 window = new QuestionWindow(record->mwindow);
01142 window->create_objects(_("Interrupt recording in progress?"), 0);
01143 int result = window->run_window();
01144 delete window;
01145 if(result == 2) gui->set_done(!is_ok);
01146 }
01147
01148
01149 RecordStartoverThread::RecordStartoverThread(Record *record, RecordGUI *record_gui)
01150 : Thread(1, 0, 0)
01151 {
01152 this->record = record;
01153 this->gui = record_gui;
01154 }
01155 RecordStartoverThread::~RecordStartoverThread()
01156 {
01157 if(Thread::running())
01158 {
01159 window->lock_window("RecordStartoverThread::~RecordStartoverThread");
01160 window->set_done(1);
01161 window->unlock_window();
01162 Thread::join();
01163 }
01164 }
01165
01166 void RecordStartoverThread::run()
01167 {
01168 window = new QuestionWindow(record->mwindow);
01169 window->create_objects(_("Rewind batch and overwrite?"), 0);
01170 int result = window->run_window();
01171 if(result == 2) record->start_over();
01172 delete window;
01173 }
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208 int RecordGUI::set_translation(int x, int y, float z)
01209 {
01210 record->video_x = x;
01211 record->video_y = y;
01212 record->video_zoom = z;
01213 }
01214
01215 int RecordGUI::update_dropped_frames(long new_dropped)
01216 {
01217 status_thread->update_dropped_frames(new_dropped);
01218 return 0;
01219 }
01220
01221 int RecordGUI::update_position(double new_position)
01222 {
01223 status_thread->update_position(new_position);
01224 return 0;
01225 }
01226
01227 int RecordGUI::update_clipped_samples(long new_clipped)
01228 {
01229 status_thread->update_clipped_samples(new_clipped);
01230 return 0;
01231 }
01232
01233 int RecordGUI::keypress_event()
01234 {
01235 return record_transport->keypress_event();
01236 }
01237
01238 void RecordGUI::update_labels(double new_position)
01239 {
01240 RecordLabel *prev, *next;
01241 char string[BCTEXTLEN];
01242
01243 for(prev = record->get_current_batch()->labels->last;
01244 prev;
01245 prev = prev->previous)
01246 {
01247 if(prev->position <= new_position) break;
01248 }
01249
01250 for(next = record->get_current_batch()->labels->first;
01251 next;
01252 next = next->next)
01253 {
01254 if(next->position > new_position) break;
01255 }
01256
01257 if(prev)
01258 update_title(prev_label_title,
01259 prev->position);
01260 else
01261 update_title(prev_label_title, -1);
01262
01263
01264
01265
01266
01267 }
01268
01269
01270
01271 int RecordGUI::update_prev_label(long new_position)
01272 {
01273 update_title(prev_label_title, new_position);
01274 }
01275
01276
01277
01278
01279
01280
01281 int RecordGUI::update_title(BC_Title *title, double position)
01282 {
01283 static char string[256];
01284
01285 if(position > -1)
01286 {
01287 Units::totext(string,
01288 position,
01289 mwindow->edl->session->time_format,
01290 record->default_asset->sample_rate,
01291 record->default_asset->frame_rate,
01292 mwindow->edl->session->frames_per_foot);
01293 }
01294 else
01295 {
01296 sprintf(string, "-");
01297 }
01298 lock_window("RecordGUI::update_title");
01299 title->update(string);
01300 unlock_window();
01301 }
01302
01303 int RecordGUI::update_duration_boxes()
01304 {
01305 char string[1024];
01306
01307
01308
01309
01310
01311
01312 }
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327 RecordGUIModeMenu::RecordGUIModeMenu(int x,
01328 int y,
01329 int w,
01330 char *text)
01331 : BC_PopupMenu(x, y, w, text)
01332 {
01333 }
01334
01335 RecordGUIModeMenu::~RecordGUIModeMenu()
01336 {
01337 delete linear;
01338 delete timed;
01339 delete loop;
01340 }
01341
01342 int RecordGUIModeMenu::add_items()
01343 {
01344 add_item(linear = new RecordGUIMode(_("Untimed")));
01345 add_item(timed = new RecordGUIMode(_("Timed")));
01346
01347 return 0;
01348 }
01349
01350 int RecordGUIModeMenu::handle_event()
01351 {
01352
01353 }
01354
01355 RecordGUIMode::RecordGUIMode(char *text)
01356 : BC_MenuItem(text)
01357 {
01358 }
01359
01360 RecordGUIMode::~RecordGUIMode()
01361 {
01362 }
01363
01364 int RecordGUIMode::handle_event()
01365 {
01366 get_popup_menu()->set_text(get_text());
01367 get_popup_menu()->handle_event();
01368 return 1;
01369 }
01370
01371
01372
01373
01374
01375 RecordStatusThread::RecordStatusThread(MWindow *mwindow, RecordGUI *gui)
01376 : Thread(1, 0, 0)
01377 {
01378 this->mwindow = mwindow;
01379 this->gui = gui;
01380 new_dropped_frames = -1;
01381 new_position = -1;
01382 new_clipped_samples = -1;
01383 input_lock = new Condition(0, "RecordStatusThread::input_lock");
01384 done = 0;
01385 }
01386
01387 RecordStatusThread::~RecordStatusThread()
01388 {
01389 if(Thread::running())
01390 {
01391 done = 1;
01392 input_lock->unlock();
01393 Thread::join();
01394 }
01395 }
01396
01397 void RecordStatusThread::update_dropped_frames(long value)
01398 {
01399 new_dropped_frames = value;
01400 input_lock->unlock();
01401 }
01402
01403 void RecordStatusThread::update_position(double new_position)
01404 {
01405 this->new_position = new_position;
01406 input_lock->unlock();
01407 }
01408
01409 void RecordStatusThread::update_clipped_samples(long new_clipped_samples)
01410 {
01411 this->new_clipped_samples = new_clipped_samples;
01412 input_lock->unlock();
01413 }
01414
01415 void RecordStatusThread::run()
01416 {
01417 while(!done)
01418 {
01419 input_lock->lock("RecordStatusThread::run");
01420 if(new_dropped_frames >= 0)
01421 {
01422 char string[1024];
01423 if(gui->total_dropped_frames != new_dropped_frames)
01424 {
01425 gui->total_dropped_frames = new_dropped_frames;
01426 sprintf(string, "%d\n", gui->total_dropped_frames);
01427 gui->lock_window("RecordStatusThread::run 1");
01428 gui->frames_dropped->update(string);
01429 gui->unlock_window();
01430 }
01431 }
01432
01433 if(new_position >= 0)
01434 {
01435 gui->update_title(gui->position_title, new_position);
01436 gui->update_labels(new_position);
01437 }
01438
01439 if(new_clipped_samples >= 0)
01440 {
01441 if(gui->total_clipped_samples != new_clipped_samples)
01442 {
01443 char string[1024];
01444 gui->total_clipped_samples = new_clipped_samples;
01445 sprintf(string, "%d\n", gui->total_clipped_samples);
01446 gui->lock_window("RecordStatusThread::run 2");
01447 gui->samples_clipped->update(string);
01448 gui->unlock_window();
01449 }
01450 }
01451
01452 new_clipped_samples = -1;
01453 new_dropped_frames = -1;
01454 new_position = -1;
01455 }
01456 }
01457
01458
01459
01460
01461
01462
01463
01464
01465 RecordGUIDCOffset::RecordGUIDCOffset(MWindow *mwindow, int y)
01466 : BC_Button(230, y, mwindow->theme->calibrate_data)
01467 {
01468 }
01469
01470 RecordGUIDCOffset::~RecordGUIDCOffset() {}
01471
01472 int RecordGUIDCOffset::handle_event()
01473 {
01474
01475 return 1;
01476 }
01477
01478 int RecordGUIDCOffset::keypress_event() { return 0; }
01479
01480 RecordGUIDCOffsetText::RecordGUIDCOffsetText(char *text, int y, int number)
01481 : BC_TextBox(30, y+1, 67, 1, text, 0)
01482 {
01483 this->number = number;
01484 }
01485
01486 RecordGUIDCOffsetText::~RecordGUIDCOffsetText()
01487 {
01488 }
01489
01490 int RecordGUIDCOffsetText::handle_event()
01491 {
01492
01493
01494
01495
01496 return 1;
01497 }
01498
01499 RecordGUIReset::RecordGUIReset(MWindow *mwindow, RecordGUI *gui, int y)
01500 : BC_Button(400, y, mwindow->theme->over_button)
01501 { this->gui = gui; }
01502
01503 RecordGUIReset::~RecordGUIReset()
01504 {
01505 }
01506
01507 int RecordGUIReset::handle_event()
01508 {
01509
01510
01511
01512
01513 return 1;
01514 }
01515
01516 RecordGUIResetTranslation::RecordGUIResetTranslation(MWindow *mwindow, RecordGUI *gui, int y)
01517 : BC_Button(250, y, mwindow->theme->reset_data)
01518 { this->gui = gui; }
01519
01520 RecordGUIResetTranslation::~RecordGUIResetTranslation()
01521 {
01522 }
01523
01524 int RecordGUIResetTranslation::handle_event()
01525 {
01526 gui->set_translation(0, 0, 1);
01527 return 1;
01528 }
01529
01530
01531
01532
01533