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;
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 BC_OKButton(this));
406 cancel_thread = new RecordCancelThread(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 batch_list->reposition_window(batch_list->get_x(),
546 mwindow->session->rwindow_w - 20,
547 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);
558 void RecordGUI::update_batch_tools()
560 //printf("RecordGUI::update_batch_tools 1\n");
561 char string[BCTEXTLEN];
562 Batch *batch = record->get_editing_batch();
563 batch_path->update(batch->get_current_asset()->path);
565 // File is open in editing batch
566 // if(record->current_batch == record->editing_batch && record->file)
567 // batch_path->disable();
569 // batch_path->enable();
571 batch_start->update(&batch->start_day, &batch->start_time);
572 batch_duration->update(0, &batch->duration);
573 batch_source->update(batch->get_source_text());
574 batch_mode->update(Batch::mode_to_text(batch->record_mode));
579 RecordGUIBatches::RecordGUIBatches(Record *record, RecordGUI *gui, int x, int y, int w, int h)
584 LISTBOX_TEXT, // Display text list or icons
585 gui->batches, // Each column has an ArrayList of BC_ListBoxItems.
586 gui->batch_titles, // Titles for columns. Set to 0 for no titles
587 gui->column_widths, // width of each column
588 BATCH_COLUMNS, // Total columns.
589 0, // Pixel of top of window.
590 0, // If this listbox is a popup window
591 LISTBOX_SINGLE, // Select one item or multiple items
592 ICON_LEFT, // Position of icon relative to text of each item
595 this->record = record;
600 // Do nothing for double clicks to protect active batch
601 int RecordGUIBatches::handle_event()
606 int RecordGUIBatches::selection_changed()
608 if(get_selection_number(0, 0) >= 0)
610 int i = get_selection_number(0, 0);
611 record->change_editing_batch(get_selection_number(0, 0));
612 if(get_cursor_x() < gui->column_widths[0])
614 record->batches.values[i]->enabled =
615 !record->batches.values[i]->enabled;
616 gui->update_batches();
622 int RecordGUIBatches::column_resize_event()
624 for(int i = 0; i < BATCH_COLUMNS; i++)
626 gui->column_widths[i] = get_column_width(i);
631 int RecordGUIBatches::drag_start_event()
633 if(BC_ListBox::drag_start_event())
642 int RecordGUIBatches::drag_motion_event()
644 if(BC_ListBox::drag_motion_event())
651 int RecordGUIBatches::drag_stop_event()
655 int src = record->editing_batch;
656 int dst = get_highlighted_item();
657 Batch *src_item = record->batches.values[src];
658 if(dst < 0) dst = record->batches.total;
660 for(int i = src; i < record->batches.total - 1; i++)
662 record->batches.values[i] = record->batches.values[i + 1];
666 for(int i = record->batches.total - 1; i > dst; i--)
668 record->batches.values[i] = record->batches.values[i - 1];
670 record->batches.values[dst] = src_item;
672 BC_ListBox::drag_stop_event();
675 gui->update_batches();
689 RecordGUISave::RecordGUISave(Record *record,
690 RecordGUI *record_gui)
692 record_gui->get_h() - BC_WindowBase::get_resources()->ok_images[0]->get_h() - 10,
693 BC_WindowBase::get_resources()->ok_images)
695 set_tooltip(_("Save the recording and quit."));
696 this->record = record;
697 this->gui = record_gui;
700 int RecordGUISave::handle_event()
706 int RecordGUISave::keypress_event()
708 // if(get_keypress() == RETURN)
717 RecordGUICancel::RecordGUICancel(Record *record,
718 RecordGUI *record_gui)
719 : BC_Button(record_gui->get_w() - BC_WindowBase::get_resources()->cancel_images[0]->get_w() - 10,
720 record_gui->get_h() - BC_WindowBase::get_resources()->cancel_images[0]->get_h() - 10,
721 BC_WindowBase::get_resources()->cancel_images)
723 set_tooltip(_("Quit without pasting into project."));
724 this->record = record;
725 this->gui = record_gui;
728 int RecordGUICancel::handle_event()
730 if(!gui->cancel_thread->running())
731 gui->cancel_thread->start();
735 int RecordGUICancel::keypress_event()
737 if(get_keypress() == ESC)
746 RecordGUIStartOver::RecordGUIStartOver(Record *record, RecordGUI *record_gui, int x, int y)
747 : BC_GenericButton(x, y, _("Start Over"))
749 set_tooltip(_("Rewind the current file and erase."));
750 this->record = record;
751 this->gui = record_gui;
753 RecordGUIStartOver::~RecordGUIStartOver()
757 int RecordGUIStartOver::handle_event()
759 if(!gui->startover_thread->running())
760 gui->startover_thread->start();
764 RecordGUIFillFrames::RecordGUIFillFrames(MWindow *mwindow, Record *record, int x, int y)
765 : BC_CheckBox(x, y, record->fill_frames, _("Fill frames"))
767 this->mwindow = mwindow;
768 this->record = record;
769 set_tooltip(_("Write extra frames when behind."));
772 int RecordGUIFillFrames::handle_event()
774 // Video capture constitutively, just like audio, but only flash on screen if 1
775 record->fill_frames = get_value();
779 RecordGUIMonitorVideo::RecordGUIMonitorVideo(MWindow *mwindow, Record *record, int x, int y)
780 : BC_CheckBox(x, y, record->monitor_video, _("Monitor video"))
782 this->mwindow = mwindow;
783 this->record = record;
786 int RecordGUIMonitorVideo::handle_event()
788 // Video capture constitutively, just like audio, but only flash on screen if 1
789 record->monitor_video = get_value();
790 if(record->monitor_video)
795 record->record_monitor->window->lock_window("RecordGUIMonitorVideo::handle_event");
796 record->record_monitor->window->show_window();
797 record->record_monitor->window->raise_window();
798 record->record_monitor->window->flush();
799 record->record_monitor->window->unlock_window();
801 lock_window("RecordGUIMonitorVideo::handle_event");
802 record->video_window_open = 1;
808 RecordGUIMonitorAudio::RecordGUIMonitorAudio(MWindow *mwindow, Record *record, int x, int y)
809 : BC_CheckBox(x, y, record->monitor_audio, _("Monitor audio"))
811 this->mwindow = mwindow;
812 this->record = record;
815 int RecordGUIMonitorAudio::handle_event()
817 record->monitor_audio = get_value();
818 if(record->monitor_audio)
823 record->record_monitor->window->lock_window("RecordGUIMonitorAudio::handle_event");
824 record->record_monitor->window->show_window();
825 record->record_monitor->window->raise_window();
826 record->record_monitor->window->flush();
827 record->record_monitor->window->unlock_window();
830 lock_window("RecordGUIMonitorVideo::handle_event");
831 record->video_window_open = 1;
836 RecordBatch::RecordBatch(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
837 : BC_PopupTextBox(gui,
839 gui->batch_numbers.values[record->editing_batch]->get_text(),
846 this->mwindow = mwindow;
847 this->record = record;
849 int RecordBatch::handle_event()
854 RecordPath::RecordPath(MWindow *mwindow, Record *record, int x, int y)
855 : BC_TextBox(x, y, 200, 1, record->get_editing_batch()->get_current_asset()->path)
857 this->mwindow = mwindow;
858 this->record = record;
860 int RecordPath::handle_event()
862 strcpy(record->get_editing_batch()->assets.values[0]->path, get_text());
863 record->get_editing_batch()->calculate_news();
864 record->record_gui->update_batches();
868 RecordStartType::RecordStartType(MWindow *mwindow, Record *record, int x, int y)
869 : BC_CheckBox(x, y, record->get_editing_batch()->start_type, _("Offset"))
871 this->mwindow = mwindow;
872 this->record = record;
874 int RecordStartType::handle_event()
880 RecordStart::RecordStart(MWindow *mwindow, Record *record, int x, int y)
881 : TimeEntry(record->record_gui,
884 &(record->get_editing_batch()->start_day),
885 &(record->get_editing_batch()->start_time),
888 this->mwindow = mwindow;
889 this->record = record;
891 int RecordStart::handle_event()
893 record->record_gui->update_batches();
897 RecordDuration::RecordDuration(MWindow *mwindow, Record *record, int x, int y)
898 : TimeEntry(record->record_gui,
902 &(record->get_editing_batch()->duration),
905 this->mwindow = mwindow;
906 this->record = record;
908 int RecordDuration::handle_event()
910 record->record_gui->update_batches();
914 RecordSource::RecordSource(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
915 : BC_PopupTextBox(gui,
917 record->get_editing_batch()->get_source_text(),
923 this->mwindow = mwindow;
924 this->record = record;
927 int RecordSource::handle_event()
929 record->set_channel(get_number());
933 RecordMode::RecordMode(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
934 : BC_PopupTextBox(gui,
936 Batch::mode_to_text(record->get_editing_batch()->record_mode),
942 this->mwindow = mwindow;
943 this->record = record;
945 int RecordMode::handle_event()
947 record->get_editing_batch()->record_mode = Batch::text_to_mode(get_text());
948 record->record_gui->update_batches();
952 RecordNews::RecordNews(MWindow *mwindow, Record *record, int x, int y)
953 : BC_TextBox(x, y, 200, 1, record->get_editing_batch()->news)
955 this->mwindow = mwindow;
956 this->record = record;
958 int RecordNews::handle_event()
964 RecordGUINewBatch::RecordGUINewBatch(MWindow *mwindow, Record *record, int x, int y)
965 : BC_GenericButton(x, y, _("New"))
967 this->mwindow = mwindow;
968 this->record = record;
969 set_tooltip(_("Create new clip."));
971 int RecordGUINewBatch::handle_event()
974 record->record_gui->update_batches();
979 RecordGUIDeleteBatch::RecordGUIDeleteBatch(MWindow *mwindow, Record *record, int x, int y)
980 : BC_GenericButton(x, y, _("Delete"))
982 this->mwindow = mwindow;
983 this->record = record;
984 set_tooltip(_("Delete clip."));
986 int RecordGUIDeleteBatch::handle_event()
988 record->delete_batch();
989 record->record_gui->update_batches();
994 RecordGUIStartBatches::RecordGUIStartBatches(MWindow *mwindow, Record *record, int x, int y)
995 : BC_GenericButton(x, y, _("Start"))
997 this->mwindow = mwindow;
998 this->record = record;
999 set_tooltip(_("Start batch recording\nfrom the current position."));
1001 int RecordGUIStartBatches::handle_event()
1004 record->start_recording(0, CONTEXT_BATCH);
1005 lock_window("RecordGUIStartBatches::handle_event");
1010 RecordGUIStopbatches::RecordGUIStopbatches(MWindow *mwindow, Record *record, int x, int y)
1011 : BC_GenericButton(x, y, _("Stop"))
1013 this->mwindow = mwindow;
1014 this->record = record;
1016 int RecordGUIStopbatches::handle_event()
1022 RecordGUIActivateBatch::RecordGUIActivateBatch(MWindow *mwindow, Record *record, int x, int y)
1023 : BC_GenericButton(x, y, _("Activate"))
1025 this->mwindow = mwindow;
1026 this->record = record;
1027 set_tooltip(_("Make the highlighted\nclip active."));
1029 int RecordGUIActivateBatch::handle_event()
1031 record->activate_batch(record->editing_batch, 1);
1036 RecordGUILabel::RecordGUILabel(MWindow *mwindow, Record *record, int x, int y)
1037 : BC_GenericButton(x, y, _("Label"))
1039 this->mwindow = mwindow;
1040 this->record = record;
1045 RecordGUILabel::~RecordGUILabel()
1049 int RecordGUILabel::handle_event()
1051 record->toggle_label();
1055 int RecordGUILabel::keypress_event()
1057 if(get_keypress() == 'l')
1081 RecordCancelThread::RecordCancelThread(Record *record, RecordGUI *record_gui)
1084 this->record = record;
1085 this->gui = record_gui;
1088 RecordCancelThread::~RecordCancelThread()
1090 if(Thread::running())
1092 window->lock_window("RecordCancelThread::~RecordCancelThread");
1093 window->set_done(1);
1094 window->unlock_window();
1100 void RecordCancelThread::run()
1102 if(record->prompt_cancel)
1104 window = new QuestionWindow(record->mwindow);
1105 window->create_objects(_("Quit without pasting into project?"), 0);
1106 int result = window->run_window();
1107 if(result == 2) gui->set_done(1);
1117 RecordStartoverThread::RecordStartoverThread(Record *record, RecordGUI *record_gui)
1120 this->record = record;
1121 this->gui = record_gui;
1123 RecordStartoverThread::~RecordStartoverThread()
1125 if(Thread::running())
1127 window->lock_window("RecordStartoverThread::~RecordStartoverThread");
1128 window->set_done(1);
1129 window->unlock_window();
1134 void RecordStartoverThread::run()
1136 window = new QuestionWindow(record->mwindow);
1137 window->create_objects(_("Rewind batch and overwrite?"), 0);
1138 int result = window->run_window();
1139 if(result == 2) record->start_over();
1176 int RecordGUI::set_translation(int x, int y, float z)
1178 record->video_x = x;
1179 record->video_y = y;
1180 record->video_zoom = z;
1183 int RecordGUI::update_dropped_frames(long new_dropped)
1185 status_thread->update_dropped_frames(new_dropped);
1189 int RecordGUI::update_position(double new_position)
1191 status_thread->update_position(new_position);
1195 int RecordGUI::update_clipped_samples(long new_clipped)
1197 status_thread->update_clipped_samples(new_clipped);
1201 int RecordGUI::keypress_event()
1203 return record_transport->keypress_event();
1206 void RecordGUI::update_labels(double new_position)
1208 RecordLabel *prev, *next;
1209 char string[BCTEXTLEN];
1211 for(prev = record->get_current_batch()->labels->last;
1213 prev = prev->previous)
1215 if(prev->position <= new_position) break;
1218 for(next = record->get_current_batch()->labels->first;
1222 if(next->position > new_position) break;
1226 update_title(prev_label_title,
1229 update_title(prev_label_title, -1);
1232 // update_title(next_label_title, (double)next->position / record->default_asset->sample_rate);
1234 // update_title(next_label_title, -1);
1239 int RecordGUI::update_prev_label(long new_position)
1241 update_title(prev_label_title, new_position);
1244 // int RecordGUI::update_next_label(long new_position)
1246 // update_title(next_label_title, new_position);
1249 int RecordGUI::update_title(BC_Title *title, double position)
1251 static char string[256];
1255 Units::totext(string,
1257 mwindow->edl->session->time_format,
1258 record->default_asset->sample_rate,
1259 record->default_asset->frame_rate,
1260 mwindow->edl->session->frames_per_foot);
1264 sprintf(string, "-");
1266 lock_window("RecordGUI::update_title");
1267 title->update(string);
1271 int RecordGUI::update_duration_boxes()
1274 // sprintf(string, "%d", engine->get_loop_hr());
1275 // loop_hr->update(string);
1276 // sprintf(string, "%d", engine->get_loop_min());
1277 // loop_min->update(string);
1278 // sprintf(string, "%d", engine->get_loop_sec());
1279 // loop_sec->update(string);
1287 // ===================================== GUI
1293 // ================================================== modes
1295 RecordGUIModeMenu::RecordGUIModeMenu(int x,
1299 : BC_PopupMenu(x, y, w, text)
1303 RecordGUIModeMenu::~RecordGUIModeMenu()
1310 int RecordGUIModeMenu::add_items()
1312 add_item(linear = new RecordGUIMode(_("Untimed")));
1313 add_item(timed = new RecordGUIMode(_("Timed")));
1314 // add_item(loop = new RecordGUIMode("_(Loop")));
1318 int RecordGUIModeMenu::handle_event()
1320 // engine->set_record_mode(get_text());
1323 RecordGUIMode::RecordGUIMode(char *text)
1328 RecordGUIMode::~RecordGUIMode()
1332 int RecordGUIMode::handle_event()
1334 get_popup_menu()->set_text(get_text());
1335 get_popup_menu()->handle_event();
1343 RecordStatusThread::RecordStatusThread(MWindow *mwindow, RecordGUI *gui)
1346 this->mwindow = mwindow;
1348 new_dropped_frames = -1;
1350 new_clipped_samples = -1;
1351 input_lock = new Condition(0, "RecordStatusThread::input_lock");
1355 RecordStatusThread::~RecordStatusThread()
1357 if(Thread::running())
1360 input_lock->unlock();
1365 void RecordStatusThread::update_dropped_frames(long value)
1367 new_dropped_frames = value;
1368 input_lock->unlock();
1371 void RecordStatusThread::update_position(double new_position)
1373 this->new_position = new_position;
1374 input_lock->unlock();
1377 void RecordStatusThread::update_clipped_samples(long new_clipped_samples)
1379 this->new_clipped_samples = new_clipped_samples;
1380 input_lock->unlock();
1383 void RecordStatusThread::run()
1387 input_lock->lock("RecordStatusThread::run");
1388 if(new_dropped_frames >= 0)
1391 if(gui->total_dropped_frames != new_dropped_frames)
1393 gui->total_dropped_frames = new_dropped_frames;
1394 sprintf(string, "%d\n", gui->total_dropped_frames);
1395 gui->lock_window("RecordStatusThread::run 1");
1396 gui->frames_dropped->update(string);
1397 gui->unlock_window();
1401 if(new_position >= 0)
1403 gui->update_title(gui->position_title, new_position);
1404 gui->update_labels(new_position);
1407 if(new_clipped_samples >= 0)
1409 if(gui->total_clipped_samples != new_clipped_samples)
1412 gui->total_clipped_samples = new_clipped_samples;
1413 sprintf(string, "%d\n", gui->total_clipped_samples);
1414 gui->lock_window("RecordStatusThread::run 2");
1415 gui->samples_clipped->update(string);
1416 gui->unlock_window();
1420 new_clipped_samples = -1;
1421 new_dropped_frames = -1;
1433 RecordGUIDCOffset::RecordGUIDCOffset(MWindow *mwindow, int y)
1434 : BC_Button(230, y, mwindow->theme->calibrate_data)
1438 RecordGUIDCOffset::~RecordGUIDCOffset() {}
1440 int RecordGUIDCOffset::handle_event()
1442 // engine->calibrate_dc_offset();
1446 int RecordGUIDCOffset::keypress_event() { return 0; }
1448 RecordGUIDCOffsetText::RecordGUIDCOffsetText(char *text, int y, int number)
1449 : BC_TextBox(30, y+1, 67, 1, text, 0)
1451 this->number = number;
1454 RecordGUIDCOffsetText::~RecordGUIDCOffsetText()
1458 int RecordGUIDCOffsetText::handle_event()
1460 // if(!engine->is_previewing)
1462 // engine->calibrate_dc_offset(atol(get_text()), number);
1467 RecordGUIReset::RecordGUIReset(MWindow *mwindow, RecordGUI *gui, int y)
1468 : BC_Button(400, y, mwindow->theme->over_button)
1469 { this->gui = gui; }
1471 RecordGUIReset::~RecordGUIReset()
1475 int RecordGUIReset::handle_event()
1477 // for(int i = 0; i < gui->engine->get_input_channels(); i++)
1479 // gui->meter[i]->reset_over();
1484 RecordGUIResetTranslation::RecordGUIResetTranslation(MWindow *mwindow, RecordGUI *gui, int y)
1485 : BC_Button(250, y, mwindow->theme->reset_data)
1486 { this->gui = gui; }
1488 RecordGUIResetTranslation::~RecordGUIResetTranslation()
1492 int RecordGUIResetTranslation::handle_event()
1494 gui->set_translation(0, 0, 1);
1502 RecordGUIOK::RecordGUIOK(MWindow *mwindow, int y)
1503 : BC_OKButton(50, y)
1507 RecordGUIOK::~RecordGUIOK()
1511 int RecordGUIOK::handle_event()
1514 // engine->set_done(0);