+int TrackCanvas::render_handle_frame(EDL *edl, int64_t pos, int mode)
+{
+ int result = 0;
+ int64_t left = pos-1;
+ if( left < 0 ) left = 0;
+ switch( mode ) {
+ case 0: {
+ VFrame vlt(edl->get_w(), edl->get_h(), edl->session->color_model);
+ VFrame vrt(edl->get_w(), edl->get_h(), edl->session->color_model);
+ TransportCommand command;
+ command.command = CURRENT_FRAME;
+ command.get_edl()->copy_all((EDL *)edl);
+ command.change_type = CHANGE_ALL;
+ command.realtime = 0;
+ Preferences *preferences = mwindow->preferences;
+ RenderEngine *render_engine = new RenderEngine(0, preferences, 0, 0);
+ CICache *video_cache = new CICache(preferences);
+ render_engine->set_vcache(video_cache);
+ render_engine->arm_command(&command);
+ int64_t left = pos-1;
+ if( left < 0 ) left = 0;
+ VRender *vrender = render_engine->vrender;
+ result = vrender &&
+ !vrender->process_buffer(&vlt, left, 0) &&
+ !vrender->process_buffer(&vrt, pos , 0) ? 0 : 1;
+ delete render_engine;
+ delete video_cache;
+ mwindow->cwindow->gui->lock_window("TrackCanvas::render_handle_frame 0");
+ Canvas *canvas = mwindow->cwindow->gui->canvas;
+ canvas->lock_canvas("TrackCanvas::render_handle_frame 1");
+ int w = canvas->w, h = canvas->h, w2 = w/2, h2 = h/2;
+ int lx = 0, ly = h2/2, rx = w2, ry = h2/2;
+ BC_WindowBase *window = canvas->get_canvas();
+ window->set_color(BLACK);
+ window->clear_box(0,0, window->get_w(),window->get_h());
+ window->draw_vframe(&vlt, lx,ly, w2,h2, 0,0,vlt.get_w(),vlt.get_h());
+ window->draw_vframe(&vrt, rx,ry, w2,h2, 0,0,vrt.get_w(),vrt.get_h());
+ window->flash(1);
+ canvas->unlock_canvas();
+ mwindow->cwindow->gui->unlock_window();
+ break; }
+ case 1:
+ case 2: {
+ Track *track = mwindow->session->drag_handle_track();
+ double position = track->from_units(mode == 1 ? left : pos);
+ if( position < 0 ) position = 0;
+ edl->local_session->set_selectionstart(position);
+ edl->local_session->set_selectionend(position);
+ PlaybackEngine *playback_engine = mwindow->cwindow->playback_engine;
+ if( playback_engine->is_playing_back )
+ playback_engine->stop_playback(1);
+ mwindow->cwindow->playback_engine->refresh_frame(CHANGE_EDL, edl, 0);
+ break; }
+ }
+ return result;
+}
+