3 #include "browsebutton.h"
4 #include "channelpicker.h"
7 #include "edlsession.h"
10 #include "filesystem.h"
14 #include "mwindowgui.h"
15 #include "preferences.h"
17 #include "recconfirmdelete.h"
18 #include "recordgui.h"
20 #include "recordlabel.h"
21 #include "recordmonitor.h"
22 #include "recordtransport.h"
23 #include "recordvideo.h"
24 #include "mainsession.h"
27 #include "videodevice.h"
33 #define _(String) gettext(String)
34 #define gettext_noop(String) String
35 #define N_(String) gettext_noop (String)
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 // delete batch_number;
57 //printf("RecordGUI::~RecordGUI 1\n");
59 //printf("RecordGUI::~RecordGUI 1\n");
61 //printf("RecordGUI::~RecordGUI 1\n");
63 //printf("RecordGUI::~RecordGUI 1\n");
64 delete startover_thread;
65 //printf("RecordGUI::~RecordGUI 1\n");
67 //printf("RecordGUI::~RecordGUI 1\n");
69 //printf("RecordGUI::~RecordGUI 1\n");
70 delete batch_duration;
71 //printf("RecordGUI::~RecordGUI 1\n");
73 //printf("RecordGUI::~RecordGUI 2\n");
77 char* RecordGUI::batch_titles[] =
88 void RecordGUI::load_defaults()
90 static int default_columnwidth[] =
101 char string[BCTEXTLEN];
102 for(int i = 0; i < BATCH_COLUMNS; i++)
104 sprintf(string, "BATCH_COLUMNWIDTH_%d", i);
105 column_widths[i] = mwindow->defaults->get(string, default_columnwidth[i]);
109 void RecordGUI::save_defaults()
111 char string[BCTEXTLEN];
112 for(int i = 0; i < BATCH_COLUMNS; i++)
114 sprintf(string, "BATCH_COLUMNWIDTH_%d", i);
115 mwindow->defaults->update(string, column_widths[i]);
120 int RecordGUI::create_objects()
122 char string[BCTEXTLEN];
125 status_thread = new RecordStatusThread(mwindow, this);
126 status_thread->start();
127 set_icon(mwindow->theme->record_icon);
129 mwindow->theme->get_recordgui_sizes(this, get_w(), get_h());
130 //printf("RecordGUI::create_objects 1\n");
131 mwindow->theme->draw_rwindow_bg(this);
136 total_dropped_frames = 0;
139 modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_INFINITE)));
140 modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_TIMED)));
141 // modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_LOOP)));
142 // modes.append(new BC_ListBoxItem(Batch::mode_to_text(RECORD_SCENETOSCENE)));
146 int x = mwindow->theme->recordgui_status_x;
147 int y = mwindow->theme->recordgui_status_y;
148 int x1 = mwindow->theme->recordgui_status_x2;
150 add_subwindow(new BC_Title(x, y, _("Format:")));
151 add_subwindow(new BC_Title(x1,
153 File::formattostr(mwindow->plugindb,
154 record->default_asset->format),
156 mwindow->theme->recordgui_fixed_color));
158 if(record->default_asset->audio_data)
161 add_subwindow(new BC_Title(x, y, _("Audio compression:")));
162 add_subwindow(new BC_Title(x1,
164 File::bitstostr(record->default_asset->bits),
166 mwindow->theme->recordgui_fixed_color));
169 add_subwindow(new BC_Title(x, y, _("Samplerate:")));
170 sprintf(string, "%d", record->default_asset->sample_rate);
171 add_subwindow(new BC_Title(x1,
175 mwindow->theme->recordgui_fixed_color));
178 add_subwindow(new BC_Title(x, y, _("Clipped samples:")));
179 add_subwindow(samples_clipped = new BC_Title(x1,
183 mwindow->theme->recordgui_variable_color));
186 if(record->default_asset->video_data)
189 add_subwindow(new BC_Title(x, y, _("Video compression:")));
190 add_subwindow(new BC_Title(x1,
192 FileMOV::compressiontostr(record->default_asset->vcodec),
194 mwindow->theme->recordgui_fixed_color));
197 add_subwindow(new BC_Title(x, y, _("Framerate:")));
198 sprintf(string, "%0.2f", record->default_asset->frame_rate);
199 add_subwindow(new BC_Title(x1,
203 mwindow->theme->recordgui_fixed_color));
206 add_subwindow(new BC_Title(x, y, _("Frames behind:")));
207 add_subwindow(frames_dropped = new BC_Title(x1,
211 mwindow->theme->recordgui_variable_color));
215 add_subwindow(new BC_Title(x, y, _("Position:")));
216 add_subwindow(position_title = new BC_Title(x1,
220 mwindow->theme->recordgui_variable_color));
223 add_subwindow(new BC_Title(x, y, _("End:")));
224 add_subwindow(total_length_title = new BC_Title(x1,
228 mwindow->theme->recordgui_variable_color));
231 add_subwindow(new BC_Title(x, y, _("Prev label:")));
232 add_subwindow(prev_label_title = new BC_Title(x1,
236 mwindow->theme->recordgui_variable_color));
239 // add_subwindow(new BC_Title(x, y, _("Next label:")));
240 // add_subwindow(next_label_title = new BC_Title(x1,
244 // mwindow->theme->recordgui_variable_color));
247 x = mwindow->theme->recordgui_batch_x;
248 y = mwindow->theme->recordgui_batch_y;
249 x1 = mwindow->theme->recordgui_batchcaption_x;
251 add_subwindow(batch_path_title = new BC_Title(x, y, _("Path:")));
252 add_subwindow(batch_path = new RecordPath(mwindow, record, x1, y));
253 add_subwindow(batch_browse = new BrowseButton(mwindow,
256 batch_path->get_x() + batch_path->get_w(),
258 record->default_asset->path,
259 PROGRAM_NAME ": Record path",
260 _("Select a file to record to:"),
264 add_subwindow(batch_start_title = new BC_Title(x, y, _("Start time:")));
265 batch_start = new RecordStart(mwindow, record, x1, y);
266 batch_start->create_objects();
269 add_subwindow(batch_duration_title = new BC_Title(x, y, _("Duration time:")));
270 batch_duration = new RecordDuration(mwindow, record, x1, y);
271 batch_duration->create_objects();
274 add_subwindow(batch_source_title = new BC_Title(x, y, _("Source:")));
275 batch_source = new RecordSource(mwindow, record, this, x1, y);
276 batch_source->create_objects();
278 add_subwindow(batch_mode_title = new BC_Title(x, y, _("Mode:")));
279 batch_mode = new RecordMode(mwindow, record, this, x1, y);
280 batch_mode->create_objects();
283 add_subwindow(transport_title =
284 new BC_Title(mwindow->theme->recordgui_transport_x,
285 mwindow->theme->recordgui_transport_y, _("Transport:")));
286 record_transport = new RecordTransport(mwindow,
290 mwindow->theme->recordgui_transport_y + 5);
291 record_transport->create_objects();
293 x = mwindow->theme->recordgui_buttons_x;
294 y = mwindow->theme->recordgui_buttons_y;
295 add_subwindow(new_batch = new RecordGUINewBatch(mwindow, record, x, y));
296 x += new_batch->get_w() + 5;
297 add_subwindow(delete_batch = new RecordGUIDeleteBatch(mwindow, record, x, y));
298 x += delete_batch->get_w() + 5;
299 add_subwindow(start_batches = new RecordGUIStartBatches(mwindow, record, x, y));
300 x += start_batches->get_w() + 5;
301 add_subwindow(activate_batch = new RecordGUIActivateBatch(mwindow, record, x, y));
302 x += activate_batch->get_w() + 5;
303 add_subwindow(label_button = new RecordGUILabel(mwindow, record, x, y));
305 x = mwindow->theme->recordgui_options_x;
306 y = mwindow->theme->recordgui_options_y;
308 if(record->default_asset->video_data)
310 add_subwindow(fill_frames = new RecordGUIFillFrames(mwindow, record, x, y));
311 x += fill_frames->get_w() + 5;
312 add_subwindow(monitor_video = new RecordGUIMonitorVideo(mwindow, record, x, y));
313 x += monitor_video->get_w() + 5;
316 if(record->default_asset->audio_data)
317 add_subwindow(monitor_audio = new RecordGUIMonitorAudio(mwindow, record, x, y));
320 add_subwindow(batch_list = new RecordGUIBatches(record,
322 mwindow->theme->recordgui_batches_x,
323 mwindow->theme->recordgui_batches_y,
324 mwindow->theme->recordgui_batches_w,
325 mwindow->theme->recordgui_batches_h));
328 load_mode = new LoadMode(mwindow,
330 mwindow->theme->recordgui_loadmode_x,
331 mwindow->theme->recordgui_loadmode_y,
334 load_mode->create_objects();
336 y = mwindow->theme->recordgui_controls_y;
337 x = mwindow->theme->recordgui_controls_x;
338 add_subwindow(save = new RecordGUISave(record, this, x, y));
341 cancel_thread = new RecordCancelThread(record, this);
342 add_subwindow(cancel = new RecordGUICancel(record, this, x, y));
344 startover_thread = new RecordStartoverThread(record, this);
346 //printf("RecordGUI::create_objects 2\n");
350 void RecordGUI::flash_batch()
352 if(record->current_batch < batches[0].total)
354 if(flash_color == GREEN)
359 //printf("RecordGUI::flash_batch %x\n", flash_color);
361 for(int i = 0; i < BATCH_COLUMNS; i++)
363 BC_ListBoxItem *batch = batches[i].values[record->current_batch];
364 batch->set_color(flash_color);
366 batch_list->update(batches,
370 batch_list->get_yposition(),
371 batch_list->get_xposition(),
372 batch_list->get_highlighted_item());
378 void RecordGUI::update_batches()
380 char string[BCTEXTLEN], string2[BCTEXTLEN];
383 int selection_number = batch_list ? batch_list->get_selection_number(0, 0) : -1;
384 for(int j = 0; j < BATCH_COLUMNS; j++)
386 batches[j].remove_all_objects();
389 for(int i = 0; i < record->batches.total; i++)
391 Batch *batch = record->batches.values[i];
392 int color = (i == record->current_batch) ? RED : BLACK;
393 if(batch->waiting && time(0) & 0x1) color = GREEN;
395 batches[0].append(new BC_ListBoxItem((char*)(batch->enabled ? "X" : " "), color));
396 batches[1].append(new BC_ListBoxItem(batch->get_current_asset()->path, color));
397 sprintf(string, "%s", batch->news);
398 batches[2].append(new BC_ListBoxItem(string, RED));
399 Units::totext(string2,
402 record->default_asset->sample_rate,
403 record->default_asset->frame_rate,
404 mwindow->edl->session->frames_per_foot);
405 sprintf(string, "%s %s", TimeEntry::day_table[batch->start_day], string2);
407 batches[3].append(new BC_ListBoxItem(string, color));
408 Units::totext(string,
411 record->default_asset->sample_rate,
412 record->default_asset->frame_rate,
413 mwindow->edl->session->frames_per_foot);
414 batches[4].append(new BC_ListBoxItem(string, color));
415 record->source_to_text(string, batch);
416 batches[5].append(new BC_ListBoxItem(string, color));
417 sprintf(string, "%s", Batch::mode_to_text(batch->record_mode));
418 batches[6].append(new BC_ListBoxItem(string, color));
420 if(i == selection_number)
422 for(int j = 0; j < BATCH_COLUMNS; j++)
424 batches[j].values[i]->set_selected(1);
431 batch_list->update(batches,
435 batch_list->get_yposition(),
436 batch_list->get_xposition(),
437 record->editing_batch,
443 void RecordGUI::update_batch_sources()
445 //printf("RecordGUI::update_batch_sources 1\n");
446 if(record->record_monitor->window->channel_picker)
447 batch_source->update_list(&record->record_monitor->window->channel_picker->channel_listitems);
448 //printf("RecordGUI::update_batch_sources 2\n");
451 int RecordGUI::translation_event()
453 mwindow->session->rwindow_x = get_x();
454 mwindow->session->rwindow_y = get_y();
459 int RecordGUI::resize_event(int w, int h)
463 mwindow->session->rwindow_x = get_x();
464 mwindow->session->rwindow_y = get_y();
465 mwindow->session->rwindow_w = w;
466 mwindow->session->rwindow_h = h;
467 mwindow->theme->get_recordgui_sizes(this, w, h);
468 mwindow->theme->draw_rwindow_bg(this);
472 x = mwindow->theme->recordgui_batch_x;
473 y = mwindow->theme->recordgui_batch_y;
474 x1 = mwindow->theme->recordgui_batchcaption_x;
476 batch_path_title->reposition_window(x, y);
477 batch_path->reposition_window(x1, y);
478 batch_browse->reposition_window(batch_path->get_x() + batch_path->get_w(),
481 batch_start_title->reposition_window(x, y);
482 batch_start->reposition_window(x1, y);
484 batch_duration_title->reposition_window(x, y);
485 batch_duration->reposition_window(x1, y);
487 batch_source_title->reposition_window(x, y);
488 batch_source->reposition_window(x1, y);
490 batch_mode_title->reposition_window(x, y);
491 batch_mode->reposition_window(x1, y);
493 transport_title->reposition_window(mwindow->theme->recordgui_transport_x,
494 mwindow->theme->recordgui_transport_y);
495 record_transport->reposition_window(mwindow->theme->recordgui_batchcaption_x,
496 mwindow->theme->recordgui_transport_y + 5);
498 x = mwindow->theme->recordgui_buttons_x;
499 y = mwindow->theme->recordgui_buttons_y;
500 new_batch->reposition_window(x, y);
501 x += new_batch->get_w() + 5;
502 delete_batch->reposition_window(x, y);
503 x += delete_batch->get_w() + 5;
504 start_batches->reposition_window(x, y);
505 x += start_batches->get_w() + 5;
506 activate_batch->reposition_window(x, y);
507 x += activate_batch->get_w() + 5;
508 label_button->reposition_window(x, y);
511 batch_list->reposition_window(mwindow->theme->recordgui_batches_x,
512 mwindow->theme->recordgui_batches_y,
513 mwindow->theme->recordgui_batches_w,
514 mwindow->theme->recordgui_batches_h);
516 load_mode->reposition_window(mwindow->theme->recordgui_loadmode_x,
517 mwindow->theme->recordgui_loadmode_y);
519 x = mwindow->theme->recordgui_controls_x;
520 y = mwindow->theme->recordgui_controls_y;
522 save->reposition_window(x, y);
525 cancel->reposition_window(x, y);
531 void RecordGUI::update_batch_tools()
533 //printf("RecordGUI::update_batch_tools 1\n");
534 char string[BCTEXTLEN];
535 Batch *batch = record->get_editing_batch();
536 batch_path->update(batch->get_current_asset()->path);
538 // File is open in editing batch
539 // if(record->current_batch == record->editing_batch && record->file)
540 // batch_path->disable();
542 // batch_path->enable();
544 batch_start->update(&batch->start_day, &batch->start_time);
545 batch_duration->update(0, &batch->duration);
546 batch_source->update(batch->get_source_text());
547 batch_mode->update(Batch::mode_to_text(batch->record_mode));
552 RecordGUIBatches::RecordGUIBatches(Record *record, RecordGUI *gui, int x, int y, int w, int h)
557 LISTBOX_TEXT, // Display text list or icons
558 gui->batches, // Each column has an ArrayList of BC_ListBoxItems.
559 gui->batch_titles, // Titles for columns. Set to 0 for no titles
560 gui->column_widths, // width of each column
561 BATCH_COLUMNS, // Total columns.
562 0, // Pixel of top of window.
563 0, // If this listbox is a popup window
564 LISTBOX_SINGLE, // Select one item or multiple items
565 ICON_LEFT, // Position of icon relative to text of each item
568 this->record = record;
573 // Do nothing for double clicks to protect active batch
574 int RecordGUIBatches::handle_event()
579 int RecordGUIBatches::selection_changed()
581 if(get_selection_number(0, 0) >= 0)
583 int i = get_selection_number(0, 0);
584 record->change_editing_batch(get_selection_number(0, 0));
585 if(get_cursor_x() < gui->column_widths[0])
587 record->batches.values[i]->enabled =
588 !record->batches.values[i]->enabled;
589 gui->update_batches();
595 int RecordGUIBatches::column_resize_event()
597 for(int i = 0; i < BATCH_COLUMNS; i++)
599 gui->column_widths[i] = get_column_width(i);
604 int RecordGUIBatches::drag_start_event()
606 if(BC_ListBox::drag_start_event())
615 int RecordGUIBatches::drag_motion_event()
617 if(BC_ListBox::drag_motion_event())
624 int RecordGUIBatches::drag_stop_event()
628 int src = record->editing_batch;
629 int dst = get_highlighted_item();
630 Batch *src_item = record->batches.values[src];
631 if(dst < 0) dst = record->batches.total;
633 for(int i = src; i < record->batches.total - 1; i++)
635 record->batches.values[i] = record->batches.values[i + 1];
639 for(int i = record->batches.total - 1; i > dst; i--)
641 record->batches.values[i] = record->batches.values[i - 1];
643 record->batches.values[dst] = src_item;
645 BC_ListBox::drag_stop_event();
648 gui->update_batches();
662 RecordGUISave::RecordGUISave(Record *record, RecordGUI *record_gui, int x, int y)
663 : BC_GenericButton(x, y, _("Close"))
665 set_tooltip(_("Save the recording and quit."));
666 this->record = record;
667 this->gui = record_gui;
670 int RecordGUISave::handle_event()
676 int RecordGUISave::keypress_event()
678 // if(get_keypress() == RETURN)
687 RecordGUICancel::RecordGUICancel(Record *record, RecordGUI *record_gui, int x, int y)
688 : BC_GenericButton(x, y, _("Cancel"))
690 set_tooltip(_("Quit without pasting into project."));
691 this->record = record;
692 this->gui = record_gui;
695 int RecordGUICancel::handle_event()
697 if(!gui->cancel_thread->running())
698 gui->cancel_thread->start();
702 int RecordGUICancel::keypress_event()
704 if(get_keypress() == ESC)
713 RecordGUIStartOver::RecordGUIStartOver(Record *record, RecordGUI *record_gui, int x, int y)
714 : BC_GenericButton(x, y, _("Start Over"))
716 set_tooltip(_("Rewind the current file and erase."));
717 this->record = record;
718 this->gui = record_gui;
720 RecordGUIStartOver::~RecordGUIStartOver()
724 int RecordGUIStartOver::handle_event()
726 if(!gui->startover_thread->running())
727 gui->startover_thread->start();
731 RecordGUIFillFrames::RecordGUIFillFrames(MWindow *mwindow, Record *record, int x, int y)
732 : BC_CheckBox(x, y, record->fill_frames, _("Fill frames"))
734 this->mwindow = mwindow;
735 this->record = record;
736 set_tooltip(_("Write extra frames when behind."));
739 int RecordGUIFillFrames::handle_event()
741 // Video capture constitutively, just like audio, but only flash on screen if 1
742 record->fill_frames = get_value();
746 RecordGUIMonitorVideo::RecordGUIMonitorVideo(MWindow *mwindow, Record *record, int x, int y)
747 : BC_CheckBox(x, y, record->monitor_video, _("Monitor video"))
749 this->mwindow = mwindow;
750 this->record = record;
753 int RecordGUIMonitorVideo::handle_event()
755 // Video capture constitutively, just like audio, but only flash on screen if 1
756 record->monitor_video = get_value();
757 if(record->monitor_video)
759 record->record_monitor->window->lock_window();
760 record->record_monitor->window->show_window();
761 record->record_monitor->window->raise_window();
762 record->record_monitor->window->flush();
763 record->record_monitor->window->unlock_window();
764 record->video_window_open = 1;
770 RecordGUIMonitorAudio::RecordGUIMonitorAudio(MWindow *mwindow, Record *record, int x, int y)
771 : BC_CheckBox(x, y, record->monitor_audio, _("Monitor audio"))
773 this->mwindow = mwindow;
774 this->record = record;
777 int RecordGUIMonitorAudio::handle_event()
779 record->monitor_audio = get_value();
780 if(record->monitor_audio)
782 record->record_monitor->window->lock_window();
783 record->record_monitor->window->show_window();
784 record->record_monitor->window->raise_window();
785 record->record_monitor->window->flush();
786 record->record_monitor->window->unlock_window();
787 record->video_window_open = 1;
792 RecordBatch::RecordBatch(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
793 : BC_PopupTextBox(gui,
795 gui->batch_numbers.values[record->editing_batch]->get_text(),
802 this->mwindow = mwindow;
803 this->record = record;
805 int RecordBatch::handle_event()
810 RecordPath::RecordPath(MWindow *mwindow, Record *record, int x, int y)
811 : BC_TextBox(x, y, 200, 1, record->get_editing_batch()->get_current_asset()->path)
813 this->mwindow = mwindow;
814 this->record = record;
816 int RecordPath::handle_event()
818 strcpy(record->get_editing_batch()->assets.values[0]->path, get_text());
819 record->get_editing_batch()->calculate_news();
820 record->record_gui->update_batches();
824 RecordStartType::RecordStartType(MWindow *mwindow, Record *record, int x, int y)
825 : BC_CheckBox(x, y, record->get_editing_batch()->start_type, _("Offset"))
827 this->mwindow = mwindow;
828 this->record = record;
830 int RecordStartType::handle_event()
836 RecordStart::RecordStart(MWindow *mwindow, Record *record, int x, int y)
837 : TimeEntry(record->record_gui,
840 &(record->get_editing_batch()->start_day),
841 &(record->get_editing_batch()->start_time))
843 this->mwindow = mwindow;
844 this->record = record;
846 int RecordStart::handle_event()
848 record->record_gui->update_batches();
852 RecordDuration::RecordDuration(MWindow *mwindow, Record *record, int x, int y)
853 : TimeEntry(record->record_gui,
857 &(record->get_editing_batch()->duration))
859 this->mwindow = mwindow;
860 this->record = record;
862 int RecordDuration::handle_event()
864 record->record_gui->update_batches();
868 RecordSource::RecordSource(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
869 : BC_PopupTextBox(gui,
871 record->get_editing_batch()->get_source_text(),
877 this->mwindow = mwindow;
878 this->record = record;
881 int RecordSource::handle_event()
883 record->set_channel(get_number());
887 RecordMode::RecordMode(MWindow *mwindow, Record *record, RecordGUI *gui, int x, int y)
888 : BC_PopupTextBox(gui,
890 Batch::mode_to_text(record->get_editing_batch()->record_mode),
896 this->mwindow = mwindow;
897 this->record = record;
899 int RecordMode::handle_event()
901 record->get_editing_batch()->record_mode = Batch::text_to_mode(get_text());
902 record->record_gui->update_batches();
906 RecordNews::RecordNews(MWindow *mwindow, Record *record, int x, int y)
907 : BC_TextBox(x, y, 200, 1, record->get_editing_batch()->news)
909 this->mwindow = mwindow;
910 this->record = record;
912 int RecordNews::handle_event()
918 RecordGUINewBatch::RecordGUINewBatch(MWindow *mwindow, Record *record, int x, int y)
919 : BC_GenericButton(x, y, _("New"))
921 this->mwindow = mwindow;
922 this->record = record;
923 set_tooltip(_("Create new clip."));
925 int RecordGUINewBatch::handle_event()
928 record->record_gui->update_batches();
933 RecordGUIDeleteBatch::RecordGUIDeleteBatch(MWindow *mwindow, Record *record, int x, int y)
934 : BC_GenericButton(x, y, _("Delete"))
936 this->mwindow = mwindow;
937 this->record = record;
938 set_tooltip(_("Delete clip."));
940 int RecordGUIDeleteBatch::handle_event()
942 record->delete_batch();
943 record->record_gui->update_batches();
948 RecordGUIStartBatches::RecordGUIStartBatches(MWindow *mwindow, Record *record, int x, int y)
949 : BC_GenericButton(x, y, _("Start"))
951 this->mwindow = mwindow;
952 this->record = record;
953 set_tooltip(_("Start batch recording\nfrom the current position."));
955 int RecordGUIStartBatches::handle_event()
958 record->start_recording(0, CONTEXT_BATCH);
964 RecordGUIStopbatches::RecordGUIStopbatches(MWindow *mwindow, Record *record, int x, int y)
965 : BC_GenericButton(x, y, _("Stop"))
967 this->mwindow = mwindow;
968 this->record = record;
970 int RecordGUIStopbatches::handle_event()
976 RecordGUIActivateBatch::RecordGUIActivateBatch(MWindow *mwindow, Record *record, int x, int y)
977 : BC_GenericButton(x, y, _("Activate"))
979 this->mwindow = mwindow;
980 this->record = record;
981 set_tooltip(_("Make the highlighted\nclip active."));
983 int RecordGUIActivateBatch::handle_event()
985 record->activate_batch(record->editing_batch, 1);
990 RecordGUILabel::RecordGUILabel(MWindow *mwindow, Record *record, int x, int y)
991 : BC_GenericButton(x, y, _("Label"))
993 this->mwindow = mwindow;
994 this->record = record;
999 RecordGUILabel::~RecordGUILabel()
1003 int RecordGUILabel::handle_event()
1005 record->toggle_label();
1009 int RecordGUILabel::keypress_event()
1011 if(get_keypress() == 'l')
1035 RecordCancelThread::RecordCancelThread(Record *record, RecordGUI *record_gui)
1038 this->record = record;
1039 this->gui = record_gui;
1042 RecordCancelThread::~RecordCancelThread()
1044 if(Thread::running())
1046 window->lock_window();
1047 window->set_done(1);
1048 window->unlock_window();
1050 completion_lock.lock();
1051 completion_lock.unlock();
1055 void RecordCancelThread::run()
1057 //printf("RecordCancelThread::run 1\n");
1058 completion_lock.lock();
1059 //printf("RecordCancelThread::run 1\n");
1060 if(record->prompt_cancel)
1062 window = new QuestionWindow(record->mwindow);
1063 window->create_objects(_("Quit without pasting into project?"), 0);
1064 int result = window->run_window();
1065 if(result == 2) gui->set_done(1);
1072 //printf("RecordCancelThread::run 2\n");
1074 completion_lock.unlock();
1078 RecordStartoverThread::RecordStartoverThread(Record *record, RecordGUI *record_gui)
1081 this->record = record;
1082 this->gui = record_gui;
1084 RecordStartoverThread::~RecordStartoverThread()
1086 if(Thread::running())
1088 window->lock_window();
1089 window->set_done(1);
1090 window->unlock_window();
1092 completion_lock.lock();
1093 completion_lock.unlock();
1096 void RecordStartoverThread::run()
1098 completion_lock.lock();
1099 window = new QuestionWindow(record->mwindow);
1100 window->create_objects(_("Rewind batch and overwrite?"), 0);
1101 int result = window->run_window();
1102 if(result == 2) record->start_over();
1104 completion_lock.unlock();
1140 int RecordGUI::set_translation(int x, int y, float z)
1142 record->video_x = x;
1143 record->video_y = y;
1144 record->video_zoom = z;
1146 //record->video_lock.lock();
1147 // engine->vdevice->set_translation(x, y, z);
1148 // engine->vdevice->set_latency_counter(record->get_video_buffersize() * 2);
1149 //record->video_lock.unlock();
1152 int RecordGUI::update_dropped_frames(long new_dropped)
1154 status_thread->update_dropped_frames(new_dropped);
1158 int RecordGUI::update_position(double new_position, double new_length)
1160 status_thread->update_position(new_position, new_length);
1164 int RecordGUI::update_clipped_samples(long new_clipped)
1166 status_thread->update_clipped_samples(new_clipped);
1170 int RecordGUI::keypress_event()
1172 return record_transport->keypress_event();
1175 void RecordGUI::update_labels(double new_position)
1177 RecordLabel *prev, *next;
1178 char string[BCTEXTLEN];
1180 for(prev = record->get_current_batch()->labels->last;
1182 prev = prev->previous)
1184 if(prev->position <= new_position) break;
1187 for(next = record->get_current_batch()->labels->first;
1191 if(next->position > new_position) break;
1195 update_title(prev_label_title,
1198 update_title(prev_label_title, -1);
1201 // update_title(next_label_title, (double)next->position / record->default_asset->sample_rate);
1203 // update_title(next_label_title, -1);
1208 int RecordGUI::update_total_length(double new_position)
1210 total_length = new_position;
1211 update_title(total_length_title, new_position);
1215 int RecordGUI::update_prev_label(long new_position)
1217 update_title(prev_label_title, new_position);
1220 // int RecordGUI::update_next_label(long new_position)
1222 // update_title(next_label_title, new_position);
1225 int RecordGUI::update_title(BC_Title *title, double position)
1227 static char string[256];
1231 Units::totext(string,
1233 mwindow->edl->session->time_format,
1234 record->default_asset->sample_rate,
1235 record->default_asset->frame_rate,
1236 mwindow->edl->session->frames_per_foot);
1240 sprintf(string, "-");
1243 title->update(string);
1247 int RecordGUI::update_duration_boxes()
1250 // sprintf(string, "%d", engine->get_loop_hr());
1251 // loop_hr->update(string);
1252 // sprintf(string, "%d", engine->get_loop_min());
1253 // loop_min->update(string);
1254 // sprintf(string, "%d", engine->get_loop_sec());
1255 // loop_sec->update(string);
1263 // ===================================== GUI
1269 // ================================================== modes
1271 RecordGUIModeMenu::RecordGUIModeMenu(int x,
1275 : BC_PopupMenu(x, y, w, text)
1279 RecordGUIModeMenu::~RecordGUIModeMenu()
1286 int RecordGUIModeMenu::add_items()
1288 add_item(linear = new RecordGUIMode(_("Untimed")));
1289 add_item(timed = new RecordGUIMode(_("Timed")));
1290 // add_item(loop = new RecordGUIMode("_(Loop")));
1294 int RecordGUIModeMenu::handle_event()
1296 // engine->set_record_mode(get_text());
1299 RecordGUIMode::RecordGUIMode(char *text)
1304 RecordGUIMode::~RecordGUIMode()
1308 int RecordGUIMode::handle_event()
1310 get_popup_menu()->set_text(get_text());
1311 get_popup_menu()->handle_event();
1319 RecordStatusThread::RecordStatusThread(MWindow *mwindow, RecordGUI *gui)
1323 this->mwindow = mwindow;
1325 new_dropped_frames = -1;
1328 new_clipped_samples = -1;
1333 RecordStatusThread::~RecordStatusThread()
1335 if(Thread::running())
1338 input_lock.unlock();
1343 void RecordStatusThread::update_dropped_frames(long value)
1345 new_dropped_frames = value;
1346 input_lock.unlock();
1349 void RecordStatusThread::update_position(double new_position, double total_length)
1351 this->new_position = new_position;
1352 this->new_length = total_length;
1353 input_lock.unlock();
1356 void RecordStatusThread::update_clipped_samples(long new_clipped_samples)
1358 this->new_clipped_samples = new_clipped_samples;
1359 input_lock.unlock();
1362 void RecordStatusThread::run()
1366 //printf("RecordStatusThread::run 1\n");
1368 //printf("RecordStatusThread::run 2\n");
1369 if(new_dropped_frames >= 0)
1372 if(gui->total_dropped_frames != new_dropped_frames)
1374 gui->total_dropped_frames = new_dropped_frames;
1375 sprintf(string, "%d\n", gui->total_dropped_frames);
1377 gui->frames_dropped->update(string);
1378 gui->unlock_window();
1382 if(new_position >= 0 || new_length >= 0)
1384 gui->update_title(gui->position_title, new_position);
1385 gui->update_title(gui->total_length_title, new_length);
1386 gui->update_labels(new_position);
1389 if(new_clipped_samples >= 0)
1391 if(gui->total_clipped_samples != new_clipped_samples)
1394 gui->total_clipped_samples = new_clipped_samples;
1395 sprintf(string, "%d\n", gui->total_clipped_samples);
1397 gui->samples_clipped->update(string);
1398 gui->unlock_window();
1402 new_clipped_samples = -1;
1403 new_dropped_frames = -1;
1416 RecordGUIDCOffset::RecordGUIDCOffset(MWindow *mwindow, int y)
1417 : BC_Button(230, y, mwindow->theme->calibrate_data)
1421 RecordGUIDCOffset::~RecordGUIDCOffset() {}
1423 int RecordGUIDCOffset::handle_event()
1425 // engine->calibrate_dc_offset();
1429 int RecordGUIDCOffset::keypress_event() { return 0; }
1431 RecordGUIDCOffsetText::RecordGUIDCOffsetText(char *text, int y, int number)
1432 : BC_TextBox(30, y+1, 67, 1, text, 0)
1434 this->number = number;
1437 RecordGUIDCOffsetText::~RecordGUIDCOffsetText()
1441 int RecordGUIDCOffsetText::handle_event()
1443 // if(!engine->is_previewing)
1445 // engine->calibrate_dc_offset(atol(get_text()), number);
1450 RecordGUIReset::RecordGUIReset(MWindow *mwindow, RecordGUI *gui, int y)
1451 : BC_Button(400, y, mwindow->theme->over_button)
1452 { this->gui = gui; }
1454 RecordGUIReset::~RecordGUIReset()
1458 int RecordGUIReset::handle_event()
1460 // for(int i = 0; i < gui->engine->get_input_channels(); i++)
1462 // gui->meter[i]->reset_over();
1467 RecordGUIResetTranslation::RecordGUIResetTranslation(MWindow *mwindow, RecordGUI *gui, int y)
1468 : BC_Button(250, y, mwindow->theme->reset_data)
1469 { this->gui = gui; }
1471 RecordGUIResetTranslation::~RecordGUIResetTranslation()
1475 int RecordGUIResetTranslation::handle_event()
1477 gui->set_translation(0, 0, 1);
1485 RecordGUIOK::RecordGUIOK(MWindow *mwindow, int y)
1486 : BC_OKButton(50, y)
1490 RecordGUIOK::~RecordGUIOK()
1494 int RecordGUIOK::handle_event()
1497 // engine->set_done(0);