6 #include "recordtransport.h"
11 #define _(String) gettext(String)
12 #define gettext_noop(String) String
13 #define N_(String) gettext_noop (String)
16 RecordTransport::RecordTransport(MWindow *mwindow,
18 BC_WindowBase *window,
22 this->mwindow = mwindow;
23 this->record = record;
24 this->window = window;
29 int RecordTransport::create_objects()
31 int x = this->x, y = this->y;
33 window->add_subwindow(rewind_button = new RecordGUIRewind(mwindow, record, x, y));
34 x += rewind_button->get_w();
35 // window->add_subwindow(back_button = new RecordGUIBack(mwindow, record, x, y));
36 // x += back_button->get_w();
37 // window->add_subwindow(duplex_button = new RecordGUIDuplex(mwindow, x, y));
38 // x += duplex_button->get_w();
39 window->add_subwindow(record_button = new RecordGUIRec(mwindow, record, x, y));
40 x += record_button->get_w();
42 if(record->default_asset->video_data)
44 window->add_subwindow(
45 record_frame = new RecordGUIRecFrame(mwindow,
49 x += record_frame->get_w();
52 // window->add_subwindow(play_button = new RecordGUIPlay(mwindow, x, y));
53 // x += play_button->get_w();
54 window->add_subwindow(stop_button = new RecordGUIStop(mwindow, record, x, y));
55 x += stop_button->get_w();
56 // window->add_subwindow(fwd_button = new RecordGUIFwd(mwindow, record, x, y));
57 // x += fwd_button->get_w();
58 // window->add_subwindow(end_button = new RecordGUIEnd(mwindow, record, x, y));
59 // x += end_button->get_w();
64 void RecordTransport::reposition_window(int x, int y)
68 rewind_button->reposition_window(x, y);
69 x += rewind_button->get_w();
70 // duplex_button->reposition_window(x, y);
71 // x += duplex_button->get_w();
72 record_button->reposition_window(x, y);
73 x += record_button->get_w();
75 if(record->default_asset->video_data)
77 record_frame->reposition_window(x, y);
78 x += record_frame->get_w();
81 stop_button->reposition_window(x, y);
82 x += stop_button->get_w();
92 RecordTransport::~RecordTransport()
96 int RecordTransport::keypress_event()
98 if(window->get_keypress() == ' ')
100 //printf("RecordTransport::keypress_event 1\n");
101 switch(record->capture_state)
105 window->unlock_window();
106 record->stop_operation(1);
107 window->lock_window();
111 window->unlock_window();
112 record->start_recording(0, CONTEXT_INTERACTIVE);
113 window->lock_window();
116 //printf("RecordTransport::keypress_event 2\n");
123 RecordGUIRec::RecordGUIRec(MWindow *mwindow, Record *record, int x, int y)
124 : BC_Button(x, y, mwindow->theme->rec_data)
126 this->mwindow = mwindow;
127 this->record = record;
128 set_tooltip(_("Start interactive recording\nfrom current position"));
131 RecordGUIRec::~RecordGUIRec()
135 int RecordGUIRec::handle_event()
138 record->start_recording(0, CONTEXT_INTERACTIVE);
143 int RecordGUIRec::keypress_event()
148 RecordGUIRecFrame::RecordGUIRecFrame(MWindow *mwindow, Record *record, int x, int y)
149 : BC_Button(x, y, mwindow->theme->recframe_data)
151 this->record = record;
152 set_tooltip(_("Record single frame"));
155 RecordGUIRecFrame::~RecordGUIRecFrame()
159 int RecordGUIRecFrame::handle_event()
162 record->start_recording(0, CONTEXT_SINGLEFRAME);
167 int RecordGUIRecFrame::keypress_event()
172 RecordGUIPlay::RecordGUIPlay(MWindow *mwindow, int x, int y)
173 : BC_Button(x, y, mwindow->theme->forward_data)
175 // this->engine = engine;
176 set_tooltip(_("Preview recording"));
179 RecordGUIPlay::~RecordGUIPlay()
183 int RecordGUIPlay::handle_event()
186 // engine->start_preview();
191 int RecordGUIPlay::keypress_event()
197 RecordGUIStop::RecordGUIStop(MWindow *mwindow, Record *record, int x, int y)
198 : BC_Button(x, y, mwindow->theme->stoprec_data)
200 this->record = record;
201 set_tooltip(_("Stop operation"));
204 RecordGUIStop::~RecordGUIStop()
208 int RecordGUIStop::handle_event()
211 record->stop_operation(1);
216 int RecordGUIStop::keypress_event()
223 RecordGUIRewind::RecordGUIRewind(MWindow *mwindow, Record *record, int x, int y)
224 : BC_Button(x, y, mwindow->theme->rewind_data)
226 this->record = record;
229 RecordGUIRewind::~RecordGUIRewind()
233 int RecordGUIRewind::handle_event()
235 if(!record->record_gui->startover_thread->running())
236 record->record_gui->startover_thread->start();
240 int RecordGUIRewind::keypress_event()
247 RecordGUIBack::RecordGUIBack(MWindow *mwindow, Record *record, int x, int y)
248 : BC_Button(x, y, mwindow->theme->fastrev_data)
250 this->record = record;
251 set_tooltip(_("Fast rewind"));
254 RecordGUIBack::~RecordGUIBack()
258 int RecordGUIBack::handle_event()
263 int RecordGUIBack::button_press()
266 // engine->stop_operation(1);
269 // engine->reset_current_delay();
270 // set_repeat(engine->get_current_delay());
275 int RecordGUIBack::button_release()
277 unset_repeat(repeat_id);
278 // if(!count) engine->goto_prev_label();
282 int RecordGUIBack::repeat_event()
288 // set_repeat(record->get_current_delay());
290 // jump = engine->current_position - record->get_samplerate();
292 // if(jump < 0) jump = 0;
293 // engine->update_position(jump);
294 // if(record->do_audio) engine->file->set_audio_position(engine->current_position, record->);
295 // if(record->do_video) engine->file->set_video_position((long)(Units::toframes(engine->current_position,
296 // record->get_samplerate(),
297 // record->get_framerate())),
298 // record->get_framerate());
302 int RecordGUIBack::keypress_event()
309 RecordGUIFwd::RecordGUIFwd(MWindow *mwindow, Record *record, int x, int y)
310 : BC_Button(x, y, mwindow->theme->fastfwd_data)
312 this->engine = engine;
313 this->record = record;
314 set_tooltip(_("Fast forward"));
317 RecordGUIFwd::~RecordGUIFwd()
321 int RecordGUIFwd::handle_event()
326 int RecordGUIFwd::button_press()
329 // engine->stop_operation(1);
332 // engine->reset_current_delay();
333 // set_repeat(engine->get_current_delay());
338 int RecordGUIFwd::button_release()
340 unset_repeat(repeat_id);
341 // if(!count) engine->goto_next_label();
345 int RecordGUIFwd::repeat_event()
352 // set_repeat(engine->get_current_delay());
354 // jump = engine->current_position + engine->get_samplerate();
355 // if(jump > engine->total_length) jump = engine->total_length;
356 // engine->update_position(jump);
357 // if(record->do_audio) engine->file->set_audio_position((long)engine->current_position);
358 // if(record->do_video) engine->file->set_video_position((long)Units::toframes(engine->current_position, record->get_samplerate(), record->get_framerate()), record->get_framerate());
359 // return 1; // trap it
362 int RecordGUIFwd::keypress_event()
369 RecordGUIEnd::RecordGUIEnd(MWindow *mwindow, Record *record, int x, int y)
370 : BC_Button(x, y, mwindow->theme->end_data)
372 this->engine = engine;
373 this->record = record;
374 set_tooltip(_("Seek to end of recording"));
377 RecordGUIEnd::~RecordGUIEnd()
381 int RecordGUIEnd::handle_event()
383 // if((record->do_audio && engine->file->get_audio_length() > 0) ||
384 // (record->do_video && engine->file->get_video_length(record->get_frame_rate()) > 0))
387 // engine->stop_operation(1);
390 // engine->file->seek_end();
391 // engine->update_position(engine->total_length);
396 int RecordGUIEnd::keypress_event()
402 // RecordGUIDuplex::RecordGUIDuplex(MWindow *mwindow, int x, int y)
403 // : BC_Button(x, y, mwindow->theme->duplex_data)
405 // this->engine = engine;
406 // set_tooltip(_("Start full duplex recording"));
409 // RecordGUIDuplex::~RecordGUIDuplex()
413 // int RecordGUIDuplex::handle_event()
416 // // engine->start_saving(1);