7 #include "recordtransport.h"
12 RecordTransport::RecordTransport(MWindow *mwindow,
14 BC_WindowBase *window,
18 this->mwindow = mwindow;
19 this->record = record;
20 this->window = window;
25 int RecordTransport::create_objects()
27 int x = this->x, y = this->y;
29 window->add_subwindow(rewind_button = new RecordGUIRewind(mwindow, record, x, y));
30 x += rewind_button->get_w();
31 // window->add_subwindow(back_button = new RecordGUIBack(mwindow, record, x, y));
32 // x += back_button->get_w();
33 // window->add_subwindow(duplex_button = new RecordGUIDuplex(mwindow, x, y));
34 // x += duplex_button->get_w();
35 window->add_subwindow(record_button = new RecordGUIRec(mwindow, record, x, y));
36 x += record_button->get_w();
39 if(record->default_asset->video_data)
41 window->add_subwindow(
42 record_frame = new RecordGUIRecFrame(mwindow,
46 x += record_frame->get_w();
49 // window->add_subwindow(play_button = new RecordGUIPlay(mwindow, x, y));
50 // x += play_button->get_w();
51 window->add_subwindow(stop_button = new RecordGUIStop(mwindow, record, x, y));
52 x += stop_button->get_w();
53 // window->add_subwindow(fwd_button = new RecordGUIFwd(mwindow, record, x, y));
54 // x += fwd_button->get_w();
55 // window->add_subwindow(end_button = new RecordGUIEnd(mwindow, record, x, y));
56 // x += end_button->get_w();
61 void RecordTransport::reposition_window(int x, int y)
65 rewind_button->reposition_window(x, y);
66 x += rewind_button->get_w();
67 // duplex_button->reposition_window(x, y);
68 // x += duplex_button->get_w();
69 record_button->reposition_window(x, y);
70 x += record_button->get_w();
72 if(record->default_asset->video_data)
74 record_frame->reposition_window(x, y);
75 x += record_frame->get_w();
78 stop_button->reposition_window(x, y);
79 x += stop_button->get_w();
83 int RecordTransport::get_h()
85 return rewind_button->get_h();
88 int RecordTransport::get_w()
90 return rewind_button->get_w() +
91 record_button->get_w() +
92 (record_frame ? record_frame->get_w() : 0) +
99 RecordTransport::~RecordTransport()
103 int RecordTransport::keypress_event()
105 if(window->get_keypress() == ' ')
107 //printf("RecordTransport::keypress_event 1\n");
108 switch(record->capture_state)
112 window->unlock_window();
113 record->stop_operation(1);
114 window->lock_window("RecordTransport::keypress_event 1");
118 window->unlock_window();
119 record->start_recording(0, CONTEXT_INTERACTIVE);
120 window->lock_window("RecordTransport::keypress_event 2");
123 //printf("RecordTransport::keypress_event 2\n");
130 RecordGUIRec::RecordGUIRec(MWindow *mwindow, Record *record, int x, int y)
131 : BC_Button(x, y, mwindow->theme->get_image_set("record"))
133 this->mwindow = mwindow;
134 this->record = record;
135 set_tooltip(_("Start interactive recording\nfrom current position"));
138 RecordGUIRec::~RecordGUIRec()
142 int RecordGUIRec::handle_event()
145 record->start_recording(0, CONTEXT_INTERACTIVE);
146 lock_window("RecordGUIRec::handle_event");
150 int RecordGUIRec::keypress_event()
155 RecordGUIRecFrame::RecordGUIRecFrame(MWindow *mwindow, Record *record, int x, int y)
156 : BC_Button(x, y, mwindow->theme->get_image_set("recframe"))
158 this->record = record;
159 set_tooltip(_("Record single frame"));
162 RecordGUIRecFrame::~RecordGUIRecFrame()
166 int RecordGUIRecFrame::handle_event()
169 record->start_recording(0, CONTEXT_SINGLEFRAME);
170 lock_window("RecordGUIRecFrame::handle_event");
174 int RecordGUIRecFrame::keypress_event()
179 RecordGUIPlay::RecordGUIPlay(MWindow *mwindow, int x, int y)
180 : BC_Button(x, y, mwindow->theme->get_image_set("play"))
182 // this->engine = engine;
183 set_tooltip(_("Preview recording"));
186 RecordGUIPlay::~RecordGUIPlay()
190 int RecordGUIPlay::handle_event()
193 // engine->start_preview();
198 int RecordGUIPlay::keypress_event()
204 RecordGUIStop::RecordGUIStop(MWindow *mwindow, Record *record, int x, int y)
205 : BC_Button(x, y, mwindow->theme->get_image_set("stoprec"))
207 this->record = record;
208 set_tooltip(_("Stop operation"));
211 RecordGUIStop::~RecordGUIStop()
215 int RecordGUIStop::handle_event()
218 record->stop_operation(1);
219 lock_window("RecordGUIStop::handle_event");
223 int RecordGUIStop::keypress_event()
230 RecordGUIRewind::RecordGUIRewind(MWindow *mwindow, Record *record, int x, int y)
231 : BC_Button(x, y, mwindow->theme->get_image_set("rewind"))
233 this->record = record;
234 set_tooltip(_("Start over"));
237 RecordGUIRewind::~RecordGUIRewind()
241 int RecordGUIRewind::handle_event()
243 if(!record->record_gui->startover_thread->running())
244 record->record_gui->startover_thread->start();
248 int RecordGUIRewind::keypress_event()
255 RecordGUIBack::RecordGUIBack(MWindow *mwindow, Record *record, int x, int y)
256 : BC_Button(x, y, mwindow->theme->get_image_set("fastrev"))
258 this->record = record;
259 set_tooltip(_("Fast rewind"));
262 RecordGUIBack::~RecordGUIBack()
266 int RecordGUIBack::handle_event()
271 int RecordGUIBack::button_press()
274 // engine->stop_operation(1);
277 // engine->reset_current_delay();
278 // set_repeat(engine->get_current_delay());
283 int RecordGUIBack::button_release()
285 unset_repeat(repeat_id);
286 // if(!count) engine->goto_prev_label();
290 int RecordGUIBack::repeat_event()
296 // set_repeat(record->get_current_delay());
298 // jump = engine->current_position - record->get_samplerate();
300 // if(jump < 0) jump = 0;
301 // engine->update_position(jump);
302 // if(record->do_audio) engine->file->set_audio_position(engine->current_position, record->);
303 // if(record->do_video) engine->file->set_video_position((long)(Units::toframes(engine->current_position,
304 // record->get_samplerate(),
305 // record->get_framerate())),
306 // record->get_framerate());
310 int RecordGUIBack::keypress_event()
317 RecordGUIFwd::RecordGUIFwd(MWindow *mwindow, Record *record, int x, int y)
318 : BC_Button(x, y, mwindow->theme->get_image_set("fastfwd"))
320 this->engine = engine;
321 this->record = record;
322 set_tooltip(_("Fast forward"));
325 RecordGUIFwd::~RecordGUIFwd()
329 int RecordGUIFwd::handle_event()
334 int RecordGUIFwd::button_press()
337 // engine->stop_operation(1);
340 // engine->reset_current_delay();
341 // set_repeat(engine->get_current_delay());
346 int RecordGUIFwd::button_release()
348 unset_repeat(repeat_id);
349 // if(!count) engine->goto_next_label();
353 int RecordGUIFwd::repeat_event()
360 // set_repeat(engine->get_current_delay());
362 // jump = engine->current_position + engine->get_samplerate();
363 // if(jump > engine->total_length) jump = engine->total_length;
364 // engine->update_position(jump);
365 // if(record->do_audio) engine->file->set_audio_position((long)engine->current_position);
366 // if(record->do_video) engine->file->set_video_position((long)Units::toframes(engine->current_position, record->get_samplerate(), record->get_framerate()), record->get_framerate());
367 // return 1; // trap it
370 int RecordGUIFwd::keypress_event()
377 RecordGUIEnd::RecordGUIEnd(MWindow *mwindow, Record *record, int x, int y)
378 : BC_Button(x, y, mwindow->theme->get_image_set("end"))
380 this->engine = engine;
381 this->record = record;
382 set_tooltip(_("Seek to end of recording"));
385 RecordGUIEnd::~RecordGUIEnd()
389 int RecordGUIEnd::handle_event()
391 // if((record->do_audio && engine->file->get_audio_length() > 0) ||
392 // (record->do_video && engine->file->get_video_length(record->get_frame_rate()) > 0))
395 // engine->stop_operation(1);
398 // engine->file->seek_end();
399 // engine->update_position(engine->total_length);
404 int RecordGUIEnd::keypress_event()
410 // RecordGUIDuplex::RecordGUIDuplex(MWindow *mwindow, int x, int y)
411 // : BC_Button(x, y, mwindow->theme->duplex_data)
413 // this->engine = engine;
414 // set_tooltip(_("Start full duplex recording"));
417 // RecordGUIDuplex::~RecordGUIDuplex()
421 // int RecordGUIDuplex::handle_event()
424 // // engine->start_saving(1);