4 #include "browsebutton.h"
5 #include "channelpicker.h"
10 #include "edlsession.h"
13 #include "filesystem.h"
18 #include "mwindowgui.h"
19 #include "preferences.h"
21 #include "recconfirmdelete.h"
22 #include "recordgui.h"
24 #include "recordlabel.h"
25 #include "recordmonitor.h"
26 #include "recordtransport.h"
27 #include "recordvideo.h"
28 #include "mainsession.h"
31 #include "videodevice.h"
38 RecordGUI::RecordGUI(MWindow *mwindow, Record *record)
39 : BC_Window(PROGRAM_NAME ": Recording",
40 mwindow->session->rwindow_x,
41 mwindow->session->rwindow_y,
42 mwindow->session->rwindow_w,
43 mwindow->session->rwindow_h,
50 this->mwindow = mwindow;
51 this->record = record;
54 RecordGUI::~RecordGUI()
56 TRACE("RecordGUI::~RecordGUI 1");
60 delete startover_thread;
61 delete interrupt_thread;
63 delete batch_duration;
65 TRACE("RecordGUI::~RecordGUI 2");
69 char* RecordGUI::batch_titles[] =
80 void RecordGUI::load_defaults()
82 static int default_columnwidth[] =
93 char string[BCTEXTLEN];
94 for(int i = 0; i < BATCH_COLUMNS; i++)
96 sprintf(string, "BATCH_COLUMNWIDTH_%d", i);
97 column_widths[i] = mwindow->defaults->get(string, default_columnwidth[i]);
101 void RecordGUI::save_defaults()
103 char string[BCTEXTLEN];
104 for(int i = 0; i < BATCH_COLUMNS; i++)
106 sprintf(string, "BATCH_COLUMNWIDTH_%d", i);
107 mwindow->defaults->update(string, column_widths[i]);
112 int RecordGUI::create_objects()
114 char string[BCTEXTLEN];
117 status_thread = new RecordStatusThread(mwindow, this);
118 status_thread->start();
119 set_icon(mwindow->theme->get_image("record_icon"));
121 mwindow->theme->get_recordgui_sizes(this, get_w(), get_h());
122 //printf("RecordGUI::create_objects 1\n");
123 mwindow->theme->draw_rwindow_bg(this);
128 total_dropped_frames = 0;
131 modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_INFINITE)));
132 modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_TIMED)));
133 // modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_LOOP)));
134 // modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_SCENETOSCENE)));
140 int pad = MAX(BC_TextBox::calculate_h(this, MEDIUMFONT, 1, 1),
141 BC_Title::calculate_h(this, "X")) + 5;
145 add_subwindow(title = new BC_Title(x, y, _("Path:")));
146 x1 = MAX(title->get_w(), x1);
148 add_subwindow(title = new BC_Title(x, y, _("Start time:")));
149 x1 = MAX(title->get_w(), x1);
151 add_subwindow(title = new BC_Title(x, y, _("Duration time:")));
152 x1 = MAX(title->get_w(), x1);
154 add_subwindow(title = new BC_Title(x, y, _("Source:")));
155 x1 = MAX(title->get_w(), x1);
157 add_subwindow(title = new BC_Title(x, y, _("Mode:")));
158 x1 = MAX(title->get_w(), x1);
160 add_subwindow(title = new BC_Title(x, y, _("Transport:")));
161 x1 = MAX(title->get_w(), x1);
164 button_y = MAX(y, button_y);
171 add_subwindow(batch_path = new RecordPath(mwindow, record, x, y));
172 add_subwindow(batch_browse = new BrowseButton(mwindow,
175 batch_path->get_x() + batch_path->get_w(),
177 record->default_asset->path,
178 PROGRAM_NAME ": Record path",
179 _("Select a file to record to:"),
181 x2 = MAX(x2, batch_path->get_w() + batch_browse->get_w());
183 batch_start = new RecordStart(mwindow, record, x, y);
184 batch_start->create_objects();
185 x2 = MAX(x2, batch_start->get_w());
187 batch_duration = new RecordDuration(mwindow, record, x, y);
188 batch_duration->create_objects();
189 x2 = MAX(x2, batch_duration->get_w());
191 batch_source = new RecordSource(mwindow, record, this, x, y);
192 batch_source->create_objects();
193 x2 = MAX(x2, batch_source->get_w());
195 batch_mode = new RecordMode(mwindow, record, this, x, y);
196 batch_mode->create_objects();
197 x2 = MAX(x2, batch_mode->get_w());
199 record_transport = new RecordTransport(mwindow,
204 record_transport->create_objects();
205 x2 = MAX(x2, record_transport->get_w());
210 // Compression settings
214 pad = BC_Title::calculate_h(this, "X") + 5;
215 add_subwindow(title = new BC_Title(x, y, _("Format:")));
216 x3 = MAX(title->get_w(), x3);
219 if(record->default_asset->audio_data)
221 add_subwindow(title = new BC_Title(x, y, _("Audio compression:")));
222 x3 = MAX(title->get_w(), x3);
224 add_subwindow(title = new BC_Title(x, y, _("Samplerate:")));
225 x3 = MAX(title->get_w(), x3);
227 add_subwindow(title = new BC_Title(x, y, _("Clipped samples:")));
228 x3 = MAX(title->get_w(), x3);
232 if(record->default_asset->video_data)
234 add_subwindow(title = new BC_Title(x, y, _("Video compression:")));
235 x3 = MAX(title->get_w(), x3);
237 add_subwindow(title = new BC_Title(x, y, _("Framerate:")));
238 x3 = MAX(title->get_w(), x3);
240 add_subwindow(title = new BC_Title(x, y, _("Frames behind:")));
241 x3 = MAX(title->get_w(), x3);
245 add_subwindow(title = new BC_Title(x, y, _("Position:")));
246 x3 = MAX(title->get_w(), x3);
248 add_subwindow(title = new BC_Title(x, y, _("Prev label:")));
249 x3 = MAX(title->get_w(), x3);
252 button_y = MAX(y, button_y);
254 x = x3 + x2 + x1 + 40;
256 add_subwindow(new BC_Title(x,
258 File::formattostr(mwindow->plugindb,
259 record->default_asset->format),
261 mwindow->theme->recordgui_fixed_color));
264 if(record->default_asset->audio_data)
266 add_subwindow(new BC_Title(x,
268 File::bitstostr(record->default_asset->bits),
270 mwindow->theme->recordgui_fixed_color));
273 sprintf(string, "%d", record->default_asset->sample_rate);
274 add_subwindow(new BC_Title(x,
278 mwindow->theme->recordgui_fixed_color));
281 add_subwindow(samples_clipped = new BC_Title(x,
285 mwindow->theme->recordgui_variable_color));
289 if(record->default_asset->video_data)
291 add_subwindow(new BC_Title(x,
293 FileMOV::compressiontostr(record->default_asset->vcodec),
295 mwindow->theme->recordgui_fixed_color));
298 sprintf(string, "%0.2f", record->default_asset->frame_rate);
299 add_subwindow(new BC_Title(x,
303 mwindow->theme->recordgui_fixed_color));
306 add_subwindow(frames_dropped = new BC_Title(x,
310 mwindow->theme->recordgui_variable_color));
314 add_subwindow(position_title = new BC_Title(x,
318 mwindow->theme->recordgui_variable_color));
321 add_subwindow(prev_label_title = new BC_Title(x,
325 mwindow->theme->recordgui_variable_color));
328 button_y = MAX(y, button_y);
344 add_subwindow(title = new BC_Title(x,y, _("Batches:")));
345 x += title->get_w() + 5;
346 add_subwindow(activate_batch = new RecordGUIActivateBatch(mwindow, record, x, y));
347 x += activate_batch->get_w();
348 add_subwindow(start_batches = new RecordGUIStartBatches(mwindow, record, x, y));
349 x += start_batches->get_w();
350 add_subwindow(delete_batch = new RecordGUIDeleteBatch(mwindow, record, x, y));
351 x += delete_batch->get_w();
352 add_subwindow(new_batch = new RecordGUINewBatch(mwindow, record, x, y));
353 x += new_batch->get_w();
354 add_subwindow(label_button = new RecordGUILabel(mwindow, record, x, y));
359 y += MAX(label_button->get_h(), record_transport->get_h()) + 5;
364 if(record->default_asset->video_data)
366 add_subwindow(fill_frames = new RecordGUIFillFrames(mwindow, record, x, y));
367 x += fill_frames->get_w() + 5;
368 add_subwindow(monitor_video = new RecordGUIMonitorVideo(mwindow, record, x, y));
369 x += monitor_video->get_w() + 5;
372 if(record->default_asset->audio_data)
373 add_subwindow(monitor_audio = new RecordGUIMonitorAudio(mwindow, record, x, y));
378 if(fill_frames) y += fill_frames->get_h();
380 if(monitor_audio) y += monitor_audio->get_h();
382 int bottom_margin = MAX(BC_OKButton::calculate_h(),
383 LoadMode::calculate_h(this)) + 5;
386 add_subwindow(batch_list = new RecordGUIBatches(record,
391 get_h() - y - bottom_margin - 10));
392 y += batch_list->get_h() + 5;
395 load_mode = new LoadMode(mwindow,
397 get_w() / 2 - mwindow->theme->loadmode_w / 2,
401 load_mode->create_objects();
402 y += load_mode->get_h() + 5;
404 add_subwindow(new RecordGUIOK(record, this));
406 interrupt_thread = new EndRecordThread(record, this);
407 // add_subwindow(new RecordGUISave(record, this));
408 add_subwindow(new RecordGUICancel(record, this));
410 startover_thread = new RecordStartoverThread(record, this);
415 void RecordGUI::flash_batch()
417 if(record->current_batch < batches[0].total)
419 if(flash_color == GREEN)
424 //printf("RecordGUI::flash_batch %x\n", flash_color);
426 for(int i = 0; i < BATCH_COLUMNS; i++)
428 BC_ListBoxItem *batch = batches[i].values[record->current_batch];
429 batch->set_color(flash_color);
431 batch_list->update(batches,
435 batch_list->get_yposition(),
436 batch_list->get_xposition(),
437 batch_list->get_highlighted_item());
443 void RecordGUI::update_batches()
445 char string[BCTEXTLEN], string2[BCTEXTLEN];
448 int selection_number = batch_list ? batch_list->get_selection_number(0, 0) : -1;
449 for(int j = 0; j < BATCH_COLUMNS; j++)
451 batches[j].remove_all_objects();
454 for(int i = 0; i < record->batches.total; i++)
456 Batch *batch = record->batches.values[i];
457 int color = (i == record->current_batch) ? RED : BLACK;
458 if(batch->waiting && time(0) & 0x1) color = GREEN;
460 batches[0].append(new BC_ListBoxItem((char*)(batch->enabled ? "X" : " "), color));
461 batches[1].append(new BC_ListBoxItem(batch->get_current_asset()->path, color));
462 sprintf(string, "%s", batch->news);
463 batches[2].append(new BC_ListBoxItem(string, RED));
464 Units::totext(string2,
467 record->default_asset->sample_rate,
468 record->default_asset->frame_rate,
469 mwindow->edl->session->frames_per_foot);
470 sprintf(string, "%s %s", TimeEntry::day_table[batch->start_day], string2);
472 batches[3].append(new BC_ListBoxItem(string, color));
473 Units::totext(string,
476 record->default_asset->sample_rate,
477 record->default_asset->frame_rate,
478 mwindow->edl->session->frames_per_foot);
479 batches[4].append(new BC_ListBoxItem(string, color));
480 record->source_to_text(string, batch);
481 batches[5].append(new BC_ListBoxItem(string, color));
482 sprintf(string, "%s", Batch::mode_to_text(batch->record_mode));
483 batches[6].append(new BC_ListBoxItem(string, color));
485 if(i == selection_number)
487 for(int j = 0; j < BATCH_COLUMNS; j++)
489 batches[j].values[i]->set_selected(1);
496 batch_list->update(batches,
500 batch_list->get_yposition(),
501 batch_list->get_xposition(),
502 record->editing_batch,
508 void RecordGUI::update_batch_sources()
510 //printf("RecordGUI::update_batch_sources 1\n");
511 if(record->record_monitor->window->channel_picker)
512 batch_source->update_list(
513 &record->record_monitor->window->channel_picker->channel_listitems);
514 //printf("RecordGUI::update_batch_sources 2\n");
517 int RecordGUI::translation_event()
519 mwindow->session->rwindow_x = get_x();
520 mwindow->session->rwindow_y = get_y();
525 int RecordGUI::resize_event(int w, int h)
529 // Recompute batch list based on previous extents
530 int bottom_margin = mwindow->session->rwindow_h -
531 batch_list->get_y() -
533 int mode_margin = mwindow->session->rwindow_h - load_mode->get_y();
534 mwindow->session->rwindow_x = get_x();
535 mwindow->session->rwindow_y = get_y();
536 mwindow->session->rwindow_w = w;
537 mwindow->session->rwindow_h = h;
538 mwindow->theme->get_recordgui_sizes(this, w, h);
539 mwindow->theme->draw_rwindow_bg(this);
542 int new_h = mwindow->session->rwindow_h - bottom_margin - batch_list->get_y();
543 if(new_h < 10) new_h = 10;
544 printf("RecordGUI::resize_event 1 %d\n", mwindow->session->rwindow_h - bottom_margin - batch_list->get_y());
545 batch_list->reposition_window(batch_list->get_x(),
547 mwindow->session->rwindow_w - 20,
548 mwindow->session->rwindow_h - bottom_margin - batch_list->get_y());
550 load_mode->reposition_window(mwindow->session->rwindow_w / 2 -
551 mwindow->theme->loadmode_w / 2,
552 mwindow->session->rwindow_h - mode_margin);
560 void RecordGUI::update_batch_tools()
562 //printf("RecordGUI::update_batch_tools 1\n");
563 char string[BCTEXTLEN];
564 Batch *batch = record->get_editing_batch();
565 batch_path->update(batch->get_current_asset()->path);
567 // File is open in editing batch
568 // if(record->current_batch == record->editing_batch && record->file)
569 // batch_path->disable();
571 // batch_path->enable();
573 batch_start->update(&batch->start_day, &batch->start_time);
574 batch_duration->update(0, &batch->duration);
575 batch_source->update(batch->get_source_text());
576 batch_mode->update(Batch::mode_to_text(batch->record_mode));
581 RecordGUIBatches::RecordGUIBatches(Record *record, RecordGUI *gui, int x, int y, int w, int h)
586 LISTBOX_TEXT, // Display text list or icons
587 gui->batches, // Each column has an ArrayList of BC_ListBoxItems.
588 gui->batch_titles, // Titles for columns. Set to 0 for no titles
589 gui->column_widths, // width of each column
590 BATCH_COLUMNS, // Total columns.
591 0, // Pixel of top of window.
592 0, // If this listbox is a popup window
593 LISTBOX_SINGLE, // Select one item or multiple items
594 ICON_LEFT, // Position of icon relative to text of each item
597 this->record = record;
602 // Do nothing for double clicks to protect active batch
603 int RecordGUIBatches::handle_event()
608 int RecordGUIBatches::selection_changed()
610 if(get_selection_number(0, 0) >= 0)
612 int i = get_selection_number(0, 0);
613 record->change_editing_batch(get_selection_number(0, 0));
614 if(get_cursor_x() < gui->column_widths[0])
616 record->batches.values[i]->enabled =
617 !record->batches.values[i]->enabled;
618 gui->update_batches();
624 int RecordGUIBatches::column_resize_event()
626 for(int i = 0; i < BATCH_COLUMNS; i++)
628 gui->column_widths[i] = get_column_width(i);
633 int RecordGUIBatches::drag_start_event()
635 if(BC_ListBox::drag_start_event())
644 int RecordGUIBatches::drag_motion_event()
646 if(BC_ListBox::drag_motion_event())
653 int RecordGUIBatches::drag_stop_event()
657 int src = record->editing_batch;
658 int dst = get_highlighted_item();
659 Batch *src_item = record->batches.values[src];
660 if(dst < 0) dst = record->batches.total;
662 for(int i = src; i < record->batches.total - 1; i++)
664 record->batches.values[i] = record->batches.values[i + 1];
668 for(int i = record->batches.total - 1; i > dst; i--)
670 record->batches.values[i] = record->batches.values[i - 1];
672 record->batches.values[dst] = src_item;
674 BC_ListBox::drag_stop_event();
677 gui->update_batches();
691 RecordGUISave::RecordGUISave(Record *record,
692 RecordGUI *record_gui)
694 record_gui->get_h() - BC_WindowBase::get_resources()->ok_images[0]->get_h() - 10,
695 BC_WindowBase::get_resources()->ok_images)
697 set_tooltip(_("Save the recording and quit."));
698 this->record = record;
699 this->gui = record_gui;
702 int RecordGUISave::handle_event()
708 int RecordGUISave::keypress_event()
710 // if(get_keypress() == RETURN)
719 RecordGUICancel::RecordGUICancel(Record *record,
720 RecordGUI *record_gui)
721 : BC_CancelButton(record_gui)
723 set_tooltip(_("Quit without pasting into project."));
724 this->record = record;
725 this->gui = record_gui;
728 int RecordGUICancel::handle_event()
730 gui->interrupt_thread->start(0);
734 int RecordGUICancel::keypress_event()
736 if(get_keypress() == ESC)
749 RecordGUIOK::RecordGUIOK(Record *record,
750 RecordGUI *record_gui)
751 : BC_OKButton(record_gui)
753 set_tooltip(_("Quit and paste into project."));
754 this->record = record;
755 this->gui = record_gui;
758 int RecordGUIOK::handle_event()
760 gui->interrupt_thread->start(1);
771 RecordGUIStartOver::RecordGUIStartOver(Record *record, RecordGUI *record_gui, int x, int y)
772 : BC_GenericButton(x, y, _("Start Over"))
774 set_tooltip(_("Rewind the current file and erase."));
775 this->record = record;
776 this->gui = record_gui;
778 RecordGUIStartOver::~RecordGUIStartOver()
782 int RecordGUIStartOver::handle_event()
784 if(!gui->startover_thread->running())
785 gui->startover_thread->start();
789 RecordGUIFillFrames::RecordGUIFillFrames(MWindow *mwindow, Record *record, int x, int y)
790 : BC_CheckBox(x, y, record->fill_frames, _("Fill frames"))
792 this->mwindow = mwindow;
793 this->record = record;
794 set_tooltip(_("Write extra frames when behind."));
797 int RecordGUIFillFrames::handle_event()
799 // Video capture constitutively, just like audio, but only flash on screen if 1
800 record->fill_frames = get_value();
804 RecordGUIMonitorVideo::RecordGUIMonitorVideo(MWindow *mwindow, Record *record, int x, int y)
805 : BC_CheckBox(x, y, record->monitor_video, _("Monitor video"))
807 this->mwindow = mwindow;
808 this->record = record;
811 int RecordGUIMonitorVideo::handle_event()
813 // Video capture constitutively, just like audio, but only flash on screen if 1
814 record->monitor_video = get_value();
815 if(record->monitor_video)
820 record->record_monitor->window->lock_window("RecordGUIMonitorVideo::handle_event");
821 record->record_monitor->window->show_window();
822 record->record_monitor->window->raise_window();
823 record->record_monitor->window->flush();
824 record->record_monitor->window->unlock_window();
826 lock_window("RecordGUIMonitorVideo::handle_event");
827 record->video_window_open = 1;
833 RecordGUIMonitorAudio::RecordGUIMonitorAudio(MWindow *mwindow, Record *record, int x, int y)
834 : BC_CheckBox(x, y, record->monitor_audio, _("Monitor audio"))
836 this->mwindow = mwindow;
837 this->record = record;
840 int RecordGUIMonitorAudio::handle_event()
842 record->monitor_audio = get_value();
843 if(record->monitor_audio)
848 record->record_monitor->window->lock_window("RecordGUIMonitorAudio::handle_event");
849 record->record_monitor->window->show_window();
850 record->record_monitor->window->raise_window();
851 record->record_monitor->window->flush();
852 record->record_monitor->window->unlock_window();
855 lock_window("RecordGUIMonitorVideo::handle_event");
856 record->video_window_open = 1;
861 RecordBatch::RecordBatch(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
862 : BC_PopupTextBox(gui,
864 gui->batch_numbers.values[record->editing_batch]->get_text(),
871 this->mwindow = mwindow;
872 this->record = record;
874 int RecordBatch::handle_event()
879 RecordPath::RecordPath(MWindow *mwindow, Record *record, int x, int y)
880 : BC_TextBox(x, y, 200, 1, record->get_editing_batch()->get_current_asset()->path)
882 this->mwindow = mwindow;
883 this->record = record;
885 int RecordPath::handle_event()
887 strcpy(record->get_editing_batch()->assets.values[0]->path, get_text());
888 record->get_editing_batch()->calculate_news();
889 record->record_gui->update_batches();
893 RecordStartType::RecordStartType(MWindow *mwindow, Record *record, int x, int y)
894 : BC_CheckBox(x, y, record->get_editing_batch()->start_type, _("Offset"))
896 this->mwindow = mwindow;
897 this->record = record;
899 int RecordStartType::handle_event()
905 RecordStart::RecordStart(MWindow *mwindow, Record *record, int x, int y)
906 : TimeEntry(record->record_gui,
909 &(record->get_editing_batch()->start_day),
910 &(record->get_editing_batch()->start_time),
913 this->mwindow = mwindow;
914 this->record = record;
916 int RecordStart::handle_event()
918 record->record_gui->update_batches();
922 RecordDuration::RecordDuration(MWindow *mwindow, Record *record, int x, int y)
923 : TimeEntry(record->record_gui,
927 &(record->get_editing_batch()->duration),
930 this->mwindow = mwindow;
931 this->record = record;
933 int RecordDuration::handle_event()
935 record->record_gui->update_batches();
939 RecordSource::RecordSource(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
940 : BC_PopupTextBox(gui,
942 record->get_editing_batch()->get_source_text(),
948 this->mwindow = mwindow;
949 this->record = record;
952 int RecordSource::handle_event()
954 record->set_channel(get_number());
958 RecordMode::RecordMode(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
959 : BC_PopupTextBox(gui,
961 Batch::mode_to_text(record->get_editing_batch()->record_mode),
967 this->mwindow = mwindow;
968 this->record = record;
970 int RecordMode::handle_event()
972 record->get_editing_batch()->record_mode = Batch::text_to_mode(get_text());
973 record->record_gui->update_batches();
977 RecordNews::RecordNews(MWindow *mwindow, Record *record, int x, int y)
978 : BC_TextBox(x, y, 200, 1, record->get_editing_batch()->news)
980 this->mwindow = mwindow;
981 this->record = record;
983 int RecordNews::handle_event()
989 RecordGUINewBatch::RecordGUINewBatch(MWindow *mwindow, Record *record, int x, int y)
990 : BC_GenericButton(x, y, _("New"))
992 this->mwindow = mwindow;
993 this->record = record;
994 set_tooltip(_("Create new clip."));
996 int RecordGUINewBatch::handle_event()
999 record->record_gui->update_batches();
1004 RecordGUIDeleteBatch::RecordGUIDeleteBatch(MWindow *mwindow, Record *record, int x, int y)
1005 : BC_GenericButton(x, y, _("Delete"))
1007 this->mwindow = mwindow;
1008 this->record = record;
1009 set_tooltip(_("Delete clip."));
1011 int RecordGUIDeleteBatch::handle_event()
1013 record->delete_batch();
1014 record->record_gui->update_batches();
1019 RecordGUIStartBatches::RecordGUIStartBatches(MWindow *mwindow, Record *record, int x, int y)
1020 : BC_GenericButton(x, y, _("Start"))
1022 this->mwindow = mwindow;
1023 this->record = record;
1024 set_tooltip(_("Start batch recording\nfrom the current position."));
1026 int RecordGUIStartBatches::handle_event()
1029 record->start_recording(0, CONTEXT_BATCH);
1030 lock_window("RecordGUIStartBatches::handle_event");
1035 RecordGUIStopbatches::RecordGUIStopbatches(MWindow *mwindow, Record *record, int x, int y)
1036 : BC_GenericButton(x, y, _("Stop"))
1038 this->mwindow = mwindow;
1039 this->record = record;
1041 int RecordGUIStopbatches::handle_event()
1047 RecordGUIActivateBatch::RecordGUIActivateBatch(MWindow *mwindow, Record *record, int x, int y)
1048 : BC_GenericButton(x, y, _("Activate"))
1050 this->mwindow = mwindow;
1051 this->record = record;
1052 set_tooltip(_("Make the highlighted\nclip active."));
1054 int RecordGUIActivateBatch::handle_event()
1056 record->activate_batch(record->editing_batch, 1);
1061 RecordGUILabel::RecordGUILabel(MWindow *mwindow, Record *record, int x, int y)
1062 : BC_GenericButton(x, y, _("Label"))
1064 this->mwindow = mwindow;
1065 this->record = record;
1070 RecordGUILabel::~RecordGUILabel()
1074 int RecordGUILabel::handle_event()
1076 record->toggle_label();
1080 int RecordGUILabel::keypress_event()
1082 if(get_keypress() == 'l')
1106 EndRecordThread::EndRecordThread(Record *record, RecordGUI *record_gui)
1109 this->record = record;
1110 this->gui = record_gui;
1114 EndRecordThread::~EndRecordThread()
1116 if(Thread::running())
1118 window->lock_window("EndRecordThread::~EndRecordThread");
1119 window->set_done(1);
1120 window->unlock_window();
1125 void EndRecordThread::start(int is_ok)
1127 this->is_ok = is_ok;
1128 if(record->capture_state == IS_RECORDING)
1135 gui->set_done(!is_ok);
1139 void EndRecordThread::run()
1141 window = new QuestionWindow(record->mwindow);
1142 window->create_objects(_("Interrupt recording in progress?"), 0);
1143 int result = window->run_window();
1145 if(result == 2) gui->set_done(!is_ok);
1149 RecordStartoverThread::RecordStartoverThread(Record *record, RecordGUI *record_gui)
1152 this->record = record;
1153 this->gui = record_gui;
1155 RecordStartoverThread::~RecordStartoverThread()
1157 if(Thread::running())
1159 window->lock_window("RecordStartoverThread::~RecordStartoverThread");
1160 window->set_done(1);
1161 window->unlock_window();
1166 void RecordStartoverThread::run()
1168 window = new QuestionWindow(record->mwindow);
1169 window->create_objects(_("Rewind batch and overwrite?"), 0);
1170 int result = window->run_window();
1171 if(result == 2) record->start_over();
1208 int RecordGUI::set_translation(int x, int y, float z)
1210 record->video_x = x;
1211 record->video_y = y;
1212 record->video_zoom = z;
1215 int RecordGUI::update_dropped_frames(long new_dropped)
1217 status_thread->update_dropped_frames(new_dropped);
1221 int RecordGUI::update_position(double new_position)
1223 status_thread->update_position(new_position);
1227 int RecordGUI::update_clipped_samples(long new_clipped)
1229 status_thread->update_clipped_samples(new_clipped);
1233 int RecordGUI::keypress_event()
1235 return record_transport->keypress_event();
1238 void RecordGUI::update_labels(double new_position)
1240 RecordLabel *prev, *next;
1241 char string[BCTEXTLEN];
1243 for(prev = record->get_current_batch()->labels->last;
1245 prev = prev->previous)
1247 if(prev->position <= new_position) break;
1250 for(next = record->get_current_batch()->labels->first;
1254 if(next->position > new_position) break;
1258 update_title(prev_label_title,
1261 update_title(prev_label_title, -1);
1264 // update_title(next_label_title, (double)next->position / record->default_asset->sample_rate);
1266 // update_title(next_label_title, -1);
1271 int RecordGUI::update_prev_label(long new_position)
1273 update_title(prev_label_title, new_position);
1276 // int RecordGUI::update_next_label(long new_position)
1278 // update_title(next_label_title, new_position);
1281 int RecordGUI::update_title(BC_Title *title, double position)
1283 static char string[256];
1287 Units::totext(string,
1289 mwindow->edl->session->time_format,
1290 record->default_asset->sample_rate,
1291 record->default_asset->frame_rate,
1292 mwindow->edl->session->frames_per_foot);
1296 sprintf(string, "-");
1298 lock_window("RecordGUI::update_title");
1299 title->update(string);
1303 int RecordGUI::update_duration_boxes()
1306 // sprintf(string, "%d", engine->get_loop_hr());
1307 // loop_hr->update(string);
1308 // sprintf(string, "%d", engine->get_loop_min());
1309 // loop_min->update(string);
1310 // sprintf(string, "%d", engine->get_loop_sec());
1311 // loop_sec->update(string);
1319 // ===================================== GUI
1325 // ================================================== modes
1327 RecordGUIModeMenu::RecordGUIModeMenu(int x,
1331 : BC_PopupMenu(x, y, w, text)
1335 RecordGUIModeMenu::~RecordGUIModeMenu()
1342 int RecordGUIModeMenu::add_items()
1344 add_item(linear = new RecordGUIMode(_("Untimed")));
1345 add_item(timed = new RecordGUIMode(_("Timed")));
1346 // add_item(loop = new RecordGUIMode("_(Loop")));
1350 int RecordGUIModeMenu::handle_event()
1352 // engine->set_record_mode(get_text());
1355 RecordGUIMode::RecordGUIMode(char *text)
1360 RecordGUIMode::~RecordGUIMode()
1364 int RecordGUIMode::handle_event()
1366 get_popup_menu()->set_text(get_text());
1367 get_popup_menu()->handle_event();
1375 RecordStatusThread::RecordStatusThread(MWindow *mwindow, RecordGUI *gui)
1378 this->mwindow = mwindow;
1380 new_dropped_frames = -1;
1382 new_clipped_samples = -1;
1383 input_lock = new Condition(0, "RecordStatusThread::input_lock");
1387 RecordStatusThread::~RecordStatusThread()
1389 if(Thread::running())
1392 input_lock->unlock();
1397 void RecordStatusThread::update_dropped_frames(long value)
1399 new_dropped_frames = value;
1400 input_lock->unlock();
1403 void RecordStatusThread::update_position(double new_position)
1405 this->new_position = new_position;
1406 input_lock->unlock();
1409 void RecordStatusThread::update_clipped_samples(long new_clipped_samples)
1411 this->new_clipped_samples = new_clipped_samples;
1412 input_lock->unlock();
1415 void RecordStatusThread::run()
1419 input_lock->lock("RecordStatusThread::run");
1420 if(new_dropped_frames >= 0)
1423 if(gui->total_dropped_frames != new_dropped_frames)
1425 gui->total_dropped_frames = new_dropped_frames;
1426 sprintf(string, "%d\n", gui->total_dropped_frames);
1427 gui->lock_window("RecordStatusThread::run 1");
1428 gui->frames_dropped->update(string);
1429 gui->unlock_window();
1433 if(new_position >= 0)
1435 gui->update_title(gui->position_title, new_position);
1436 gui->update_labels(new_position);
1439 if(new_clipped_samples >= 0)
1441 if(gui->total_clipped_samples != new_clipped_samples)
1444 gui->total_clipped_samples = new_clipped_samples;
1445 sprintf(string, "%d\n", gui->total_clipped_samples);
1446 gui->lock_window("RecordStatusThread::run 2");
1447 gui->samples_clipped->update(string);
1448 gui->unlock_window();
1452 new_clipped_samples = -1;
1453 new_dropped_frames = -1;
1465 RecordGUIDCOffset::RecordGUIDCOffset(MWindow *mwindow, int y)
1466 : BC_Button(230, y, mwindow->theme->calibrate_data)
1470 RecordGUIDCOffset::~RecordGUIDCOffset() {}
1472 int RecordGUIDCOffset::handle_event()
1474 // engine->calibrate_dc_offset();
1478 int RecordGUIDCOffset::keypress_event() { return 0; }
1480 RecordGUIDCOffsetText::RecordGUIDCOffsetText(char *text, int y, int number)
1481 : BC_TextBox(30, y+1, 67, 1, text, 0)
1483 this->number = number;
1486 RecordGUIDCOffsetText::~RecordGUIDCOffsetText()
1490 int RecordGUIDCOffsetText::handle_event()
1492 // if(!engine->is_previewing)
1494 // engine->calibrate_dc_offset(atol(get_text()), number);
1499 RecordGUIReset::RecordGUIReset(MWindow *mwindow, RecordGUI *gui, int y)
1500 : BC_Button(400, y, mwindow->theme->over_button)
1501 { this->gui = gui; }
1503 RecordGUIReset::~RecordGUIReset()
1507 int RecordGUIReset::handle_event()
1509 // for(int i = 0; i < gui->engine->get_input_channels(); i++)
1511 // gui->meter[i]->reset_over();
1516 RecordGUIResetTranslation::RecordGUIResetTranslation(MWindow *mwindow, RecordGUI *gui, int y)
1517 : BC_Button(250, y, mwindow->theme->reset_data)
1518 { this->gui = gui; }
1520 RecordGUIResetTranslation::~RecordGUIResetTranslation()
1524 int RecordGUIResetTranslation::handle_event()
1526 gui->set_translation(0, 0, 1);