Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

recordtransport.C

Go to the documentation of this file.
00001 #include "asset.h"
00002 #include "file.h"
00003 #include "language.h"
00004 #include "mwindow.h"
00005 #include "record.h"
00006 #include "recordgui.h"
00007 #include "recordtransport.h"
00008 #include "theme.h"
00009 #include "units.h"
00010 
00011 
00012 RecordTransport::RecordTransport(MWindow *mwindow, 
00013                 Record *record, 
00014                 BC_WindowBase *window,
00015                 int x,
00016                 int y)
00017 {
00018         this->mwindow = mwindow;
00019         this->record = record;
00020         this->window = window;
00021         this->x = x;
00022         this->y = y;
00023 }
00024 
00025 int RecordTransport::create_objects()
00026 {
00027         int x = this->x, y = this->y;
00028 
00029         window->add_subwindow(rewind_button = new RecordGUIRewind(mwindow, record, x, y));
00030         x += rewind_button->get_w();
00031 //      window->add_subwindow(back_button = new RecordGUIBack(mwindow, record, x, y));
00032 //      x += back_button->get_w();
00033 //      window->add_subwindow(duplex_button = new RecordGUIDuplex(mwindow, x, y));
00034 //      x += duplex_button->get_w();
00035         window->add_subwindow(record_button = new RecordGUIRec(mwindow, record, x, y));
00036         x += record_button->get_w();
00037 
00038         record_frame = 0;
00039         if(record->default_asset->video_data)
00040         {
00041                 window->add_subwindow(
00042                         record_frame = new RecordGUIRecFrame(mwindow, 
00043                                 record, 
00044                                 x, 
00045                                 y));
00046                 x += record_frame->get_w();
00047         }
00048 
00049 //      window->add_subwindow(play_button = new RecordGUIPlay(mwindow, x, y));
00050 //      x += play_button->get_w();
00051         window->add_subwindow(stop_button = new RecordGUIStop(mwindow, record, x, y));
00052         x += stop_button->get_w();
00053 //      window->add_subwindow(fwd_button = new RecordGUIFwd(mwindow, record, x, y));
00054 //      x += fwd_button->get_w();
00055 //      window->add_subwindow(end_button = new RecordGUIEnd(mwindow, record, x, y));
00056 //      x += end_button->get_w();
00057         x_end = x + 10;
00058         return 0;
00059 }
00060 
00061 void RecordTransport::reposition_window(int x, int y)
00062 {
00063         this->x = x;
00064         this->y = y;
00065         rewind_button->reposition_window(x, y);
00066         x += rewind_button->get_w();
00067 //      duplex_button->reposition_window(x, y);
00068 //      x += duplex_button->get_w();
00069         record_button->reposition_window(x, y);
00070         x += record_button->get_w();
00071 
00072         if(record->default_asset->video_data)
00073         {
00074                 record_frame->reposition_window(x, y);
00075                 x += record_frame->get_w();
00076         }
00077 
00078         stop_button->reposition_window(x, y);
00079         x += stop_button->get_w();
00080         x_end = x + 10;
00081 }
00082 
00083 int RecordTransport::get_h()
00084 {
00085         return rewind_button->get_h();
00086 }
00087 
00088 int RecordTransport::get_w()
00089 {
00090         return rewind_button->get_w() + 
00091                 record_button->get_w() +
00092                 (record_frame ? record_frame->get_w() : 0) +
00093                 stop_button->get_w();
00094 }
00095 
00096 
00097 
00098 
00099 RecordTransport::~RecordTransport()
00100 {
00101 }
00102 
00103 int RecordTransport::keypress_event()
00104 {
00105         if(window->get_keypress() == ' ')
00106         {
00107 //printf("RecordTransport::keypress_event 1\n");
00108                 switch(record->capture_state)
00109                 {
00110                         case IS_RECORDING:
00111                         case IS_PREVIEWING:
00112                                 window->unlock_window();
00113                                 record->stop_operation(1);
00114                                 window->lock_window("RecordTransport::keypress_event 1");
00115                                 break;
00116 
00117                         default:
00118                                 window->unlock_window();
00119                                 record->start_recording(0, CONTEXT_INTERACTIVE);
00120                                 window->lock_window("RecordTransport::keypress_event 2");
00121                                 break;
00122                 }
00123 //printf("RecordTransport::keypress_event 2\n");
00124                 return 1;
00125         }
00126         return 0;
00127 }
00128 
00129 
00130 RecordGUIRec::RecordGUIRec(MWindow *mwindow, Record *record, int x, int y)
00131  : BC_Button(x, y, mwindow->theme->get_image_set("record"))
00132 {
00133         this->mwindow = mwindow;
00134         this->record = record;
00135         set_tooltip(_("Start interactive recording\nfrom current position"));
00136 }
00137 
00138 RecordGUIRec::~RecordGUIRec()
00139 {
00140 }
00141 
00142 int RecordGUIRec::handle_event()
00143 {
00144         unlock_window();
00145         record->start_recording(0, CONTEXT_INTERACTIVE);
00146         lock_window("RecordGUIRec::handle_event");
00147         return 1;
00148 }
00149 
00150 int RecordGUIRec::keypress_event()
00151 {
00152         return 0;
00153 }
00154 
00155 RecordGUIRecFrame::RecordGUIRecFrame(MWindow *mwindow, Record *record, int x, int y)
00156  : BC_Button(x, y, mwindow->theme->get_image_set("recframe"))
00157 { 
00158         this->record = record; 
00159         set_tooltip(_("Record single frame"));
00160 }
00161 
00162 RecordGUIRecFrame::~RecordGUIRecFrame()
00163 {
00164 }
00165 
00166 int RecordGUIRecFrame::handle_event()
00167 {
00168         unlock_window();
00169         record->start_recording(0, CONTEXT_SINGLEFRAME);
00170         lock_window("RecordGUIRecFrame::handle_event");
00171         return 1;
00172 }
00173 
00174 int RecordGUIRecFrame::keypress_event()
00175 {
00176         return 0;
00177 }
00178 
00179 RecordGUIPlay::RecordGUIPlay(MWindow *mwindow, int x, int y)
00180  : BC_Button(x, y, mwindow->theme->get_image_set("play"))
00181 { 
00182 //      this->engine = engine; 
00183         set_tooltip(_("Preview recording"));
00184 }
00185 
00186 RecordGUIPlay::~RecordGUIPlay()
00187 {
00188 }
00189 
00190 int RecordGUIPlay::handle_event()
00191 {
00192         unlock_window();
00193 //      engine->start_preview();
00194         lock_window();
00195         return 1;
00196 }
00197 
00198 int RecordGUIPlay::keypress_event()
00199 {
00200         return 0;
00201 }
00202 
00203 
00204 RecordGUIStop::RecordGUIStop(MWindow *mwindow, Record *record, int x, int y)
00205  : BC_Button(x, y, mwindow->theme->get_image_set("stoprec"))
00206 { 
00207         this->record = record; 
00208         set_tooltip(_("Stop operation"));
00209 }
00210 
00211 RecordGUIStop::~RecordGUIStop()
00212 {
00213 }
00214 
00215 int RecordGUIStop::handle_event()
00216 {
00217         unlock_window();
00218         record->stop_operation(1);
00219         lock_window("RecordGUIStop::handle_event");
00220         return 1;
00221 }
00222 
00223 int RecordGUIStop::keypress_event()
00224 {
00225         return 0;
00226 }
00227 
00228 
00229 
00230 RecordGUIRewind::RecordGUIRewind(MWindow *mwindow, Record *record, int x, int y)
00231  : BC_Button(x, y, mwindow->theme->get_image_set("rewind"))
00232 { 
00233         this->record = record; 
00234         set_tooltip(_("Start over"));
00235 }
00236 
00237 RecordGUIRewind::~RecordGUIRewind()
00238 {
00239 }
00240 
00241 int RecordGUIRewind::handle_event()
00242 {
00243         if(!record->record_gui->startover_thread->running())
00244                 record->record_gui->startover_thread->start();
00245         return 1;
00246 }
00247 
00248 int RecordGUIRewind::keypress_event()
00249 {
00250         return 0;
00251 }
00252 
00253 
00254 
00255 RecordGUIBack::RecordGUIBack(MWindow *mwindow, Record *record, int x, int y)
00256  : BC_Button(x, y, mwindow->theme->get_image_set("fastrev"))
00257 { 
00258         this->record = record; 
00259         set_tooltip(_("Fast rewind"));
00260 }
00261 
00262 RecordGUIBack::~RecordGUIBack()
00263 {
00264 }
00265 
00266 int RecordGUIBack::handle_event()
00267 {
00268         return 1;
00269 }
00270 
00271 int RecordGUIBack::button_press()
00272 {
00273 //      unlock_window();
00274 //      engine->stop_operation(1);
00275 //      lock_window();
00276 // 
00277 //      engine->reset_current_delay();
00278 //      set_repeat(engine->get_current_delay());
00279 //      count = 0;
00280         return 1;
00281 }
00282 
00283 int RecordGUIBack::button_release()
00284 {
00285         unset_repeat(repeat_id);
00286 //      if(!count) engine->goto_prev_label();
00287         return 1;
00288 }
00289 
00290 int RecordGUIBack::repeat_event()
00291 {
00292 return 0;
00293 //      long jump;
00294 //      count++;
00295 // 
00296 //      set_repeat(record->get_current_delay());
00297 // 
00298 //      jump = engine->current_position - record->get_samplerate();
00299 // 
00300 //      if(jump < 0) jump = 0;
00301 //      engine->update_position(jump);
00302 //      if(record->do_audio) engine->file->set_audio_position(engine->current_position, record->);
00303 //      if(record->do_video) engine->file->set_video_position((long)(Units::toframes(engine->current_position, 
00304 //              record->get_samplerate(), 
00305 //              record->get_framerate())), 
00306 //              record->get_framerate());
00307         return 1;        // trap it
00308 }
00309 
00310 int RecordGUIBack::keypress_event()
00311 {
00312         return 0;
00313 }
00314 
00315 
00316 
00317 RecordGUIFwd::RecordGUIFwd(MWindow *mwindow, Record *record, int x, int y)
00318  : BC_Button(x, y, mwindow->theme->get_image_set("fastfwd"))
00319 { 
00320         this->engine = engine; 
00321         this->record = record; 
00322         set_tooltip(_("Fast forward"));
00323 }
00324 
00325 RecordGUIFwd::~RecordGUIFwd()
00326 {
00327 }
00328 
00329 int RecordGUIFwd::handle_event()
00330 {
00331         return 1;
00332 }
00333 
00334 int RecordGUIFwd::button_press()
00335 {
00336 //      unlock_window();
00337 //      engine->stop_operation(1);
00338 //      lock_window();
00339 // 
00340 //      engine->reset_current_delay();
00341 //      set_repeat(engine->get_current_delay());
00342 //      count = 0;
00343         return 1;
00344 }
00345 
00346 int RecordGUIFwd::button_release()
00347 {
00348         unset_repeat(repeat_id);
00349 //      if(!count) engine->goto_next_label();
00350         return 1;
00351 }
00352 
00353 int RecordGUIFwd::repeat_event()
00354 {
00355 return 0;
00356 //      long jump;
00357 //      
00358 //      count++;
00359 //      
00360 //      set_repeat(engine->get_current_delay());
00361 // 
00362 //      jump = engine->current_position + engine->get_samplerate();
00363 //      if(jump > engine->total_length) jump = engine->total_length;
00364 //      engine->update_position(jump);
00365 //      if(record->do_audio) engine->file->set_audio_position((long)engine->current_position);
00366 //      if(record->do_video) engine->file->set_video_position((long)Units::toframes(engine->current_position, record->get_samplerate(), record->get_framerate()), record->get_framerate());
00367 //      return 1;         // trap it
00368 }
00369 
00370 int RecordGUIFwd::keypress_event()
00371 {
00372         return 0;
00373 }
00374 
00375 
00376 
00377 RecordGUIEnd::RecordGUIEnd(MWindow *mwindow, Record *record, int x, int y)
00378  : BC_Button(x, y, mwindow->theme->get_image_set("end"))
00379 { 
00380         this->engine = engine; 
00381         this->record = record; 
00382         set_tooltip(_("Seek to end of recording"));
00383 }
00384 
00385 RecordGUIEnd::~RecordGUIEnd()
00386 {
00387 }
00388 
00389 int RecordGUIEnd::handle_event()
00390 {
00391 //      if((record->do_audio && engine->file->get_audio_length() > 0) ||
00392 //              (record->do_video && engine->file->get_video_length(record->get_frame_rate()) > 0))
00393 //      {
00394 //              unlock_window();
00395 //              engine->stop_operation(1);
00396 //              lock_window();
00397 // 
00398 //              engine->file->seek_end();
00399 //              engine->update_position(engine->total_length);
00400 //      }
00401         return 1;
00402 }
00403 
00404 int RecordGUIEnd::keypress_event()
00405 {
00406         return 0;
00407 }
00408 
00409 // 
00410 // RecordGUIDuplex::RecordGUIDuplex(MWindow *mwindow, int x, int y)
00411 //  : BC_Button(x, y, mwindow->theme->duplex_data)
00412 // { 
00413 //      this->engine = engine; 
00414 //      set_tooltip(_("Start full duplex recording"));
00415 // }
00416 // 
00417 // RecordGUIDuplex::~RecordGUIDuplex()
00418 // {
00419 // }
00420 //      
00421 // int RecordGUIDuplex::handle_event()
00422 // {
00423 //      unlock_window();
00424 // //   engine->start_saving(1);
00425 //      lock_window();
00426 //      return 1;
00427 // }

Generated on Sun Jan 8 13:38:59 2006 for Cinelerra-svn by  doxygen 1.4.4