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
00032
00033
00034
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
00050
00051 window->add_subwindow(stop_button = new RecordGUIStop(mwindow, record, x, y));
00052 x += stop_button->get_w();
00053
00054
00055
00056
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
00068
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
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
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
00183 set_tooltip(_("Preview recording"));
00184 }
00185
00186 RecordGUIPlay::~RecordGUIPlay()
00187 {
00188 }
00189
00190 int RecordGUIPlay::handle_event()
00191 {
00192 unlock_window();
00193
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
00274
00275
00276
00277
00278
00279
00280 return 1;
00281 }
00282
00283 int RecordGUIBack::button_release()
00284 {
00285 unset_repeat(repeat_id);
00286
00287 return 1;
00288 }
00289
00290 int RecordGUIBack::repeat_event()
00291 {
00292 return 0;
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307 return 1;
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
00337
00338
00339
00340
00341
00342
00343 return 1;
00344 }
00345
00346 int RecordGUIFwd::button_release()
00347 {
00348 unset_repeat(repeat_id);
00349
00350 return 1;
00351 }
00352
00353 int RecordGUIFwd::repeat_event()
00354 {
00355 return 0;
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
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
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401 return 1;
00402 }
00403
00404 int RecordGUIEnd::keypress_event()
00405 {
00406 return 0;
00407 }
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427