X-Git-Url: https://cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Ftrackcanvas.C;h=bc34475653aef2daed0a3e791f1fdd2df24097d6;hb=b4184445f396e16260ed90e645a280149aeda8c0;hp=03fac258d3f459ccec30823b099ef1083c29ea29;hpb=15b020d5c21b2cc5545227f7c092f06086666b4a;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index 03fac258..bc344756 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -1943,8 +1943,12 @@ void TrackCanvas::draw_drag_handle() if( !mwindow->session->drag_edit ) return; int group_id = mwindow->session->drag_edit->group_id; if( !group_id ) return; + int64_t dx, dy, dw, dh; + edit_dimensions(mwindow->session->drag_edit, dx, dy, dw, dh); int drag_handle = mwindow->session->drag_handle; - set_color(RED); + int64_t pixel0 = !drag_handle ? dx : dx + dw; + int delta = pixel1 - pixel0; + set_color(LTPURPLE); set_line_width(3); for( Track *track=mwindow->edl->tracks->first; track; track=track->next ) { @@ -1975,10 +1979,10 @@ void TrackCanvas::draw_drag_handle() can_drag = 0; int64_t x, y, w, h; edit_dimensions(edit, x, y, w, h); + if( y+h < 0 || y >= get_h() ) continue; int edge_x = !drag_handle ? x : x + w; int edge_y = y + h/2, k = 10; - if( edge_x >= 0 && edge_x < get_w() && - edge_y >= 0 && edge_y < get_h() ) { + if( edge_x >= 0 && edge_x < get_w() ) { if( !can_drag ) { draw_line(edge_x-k,edge_y-k, edge_x+k,edge_y+k); draw_line(edge_x-k,edge_y+k, edge_x+k,edge_y-k); @@ -1992,6 +1996,10 @@ void TrackCanvas::draw_drag_handle() draw_line(edge_x,edge_y, edge_x-k,edge_y+k); } } + edge_x += delta; + if( edge_x >= 0 && edge_x < get_w() ) { + draw_line(edge_x, y, edge_x, y+h); + } } set_line_width(1); } @@ -3800,22 +3808,37 @@ void TrackCanvas::update_drag_handle() edl->create_objects(); edl->copy_all(mwindow->edl); MainSession *session = mwindow->session; - int edit_mode = mwindow->edl->session->edit_handle_mode[session->drag_button]; + int handle_mode = mwindow->edl->session->edit_handle_mode[session->drag_button]; edl->modify_edithandles(session->drag_start, - session->drag_position, - session->drag_handle, - edit_mode, + session->drag_position, session->drag_handle, handle_mode, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits, - session->drag_edit->group_id); - double position = edit_mode != MOVE_NO_EDITS && - ( session->drag_handle || edit_mode == MOVE_ONE_EDIT ) ? + !session->drag_edit ? 0 : session->drag_edit->group_id); + + double position = -1; + int show_edge = !session->drag_handle ? 1 : 2; + switch( handle_mode ) { + case MOVE_RIPPLE: + case MOVE_EDGE: + position = session->drag_handle ? session->drag_position : session->drag_start; + show_edge = 3 - show_edge; + break; + case MOVE_ROLL: + case MOVE_SLIDE: + position = session->drag_position; + break; + case MOVE_SLIP: + position = session->drag_start; + show_edge = 3 - show_edge; + break; + } + + if( position < 0 ) position = 0; Track *track = session->drag_handle_track(); int64_t pos = track->to_units(position, 0); - render_handle_frame(edl, pos, shift_down() ? 0 : - session->drag_handle ? 1 : 2); + render_handle_frame(edl, pos, shift_down() ? 0 : show_edge); edl->remove_user(); } } @@ -3839,8 +3862,6 @@ int TrackCanvas::render_handle_frame(EDL *edl, int64_t pos, int mode) 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) && @@ -3866,11 +3887,11 @@ int TrackCanvas::render_handle_frame(EDL *edl, int64_t pos, int mode) 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); + edl->local_session->set_selectionstart(position); + edl->local_session->set_selectionend(position); mwindow->cwindow->playback_engine->refresh_frame(CHANGE_EDL, edl, 0); break; } } @@ -3975,7 +3996,7 @@ int TrackCanvas::update_drag_floatauto(int cursor_x, int cursor_y) // Snap to nearby values old_value = current->get_value(); if(shift_down()) { - double value1, value2, distance1, distance2; + double value1, value2, distance1=-1, distance2=-1; if(current->previous) { int autogrouptype = current->previous->autos->autogrouptype;