From 52c715cbb159b61590b95182eedbadac84bbdfe6 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Thu, 27 Sep 2018 18:39:09 -0600 Subject: [PATCH] rework transition picon drawing --- cinelerra-5.1/cinelerra/trackcanvas.C | 45 ++++++++++++++++----------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index 061545ba..ab558a5c 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -1392,11 +1392,18 @@ void TrackCanvas::get_transition_coords(Edit *edit, int64_t &x, int64_t &y, int64_t &w, int64_t &h) { int transition_w = 30, transition_h = 30; - - if( edit->track->show_titles() ) - y += mwindow->theme->get_image("title_bg_data")->get_h(); - if( edit->track->show_assets() ) - y += resource_h() / 2; + int has_titles = edit->track->show_titles(); + int has_assets = edit->track->show_assets(); + int title_bg_h = mwindow->theme->get_image("title_bg_data")->get_h(); + int asset_h2 = resource_h() / 2; + + int iy = has_titles ? + ( has_assets ? title_bg_h + asset_h2 : title_bg_h/2 ) : + ( has_assets ? asset_h2 : 0) ; + int title_h2 = mwindow->theme->title_h / 2; + if( iy < title_h2 ) + iy = title_h2; + y += iy; x -= transition_w / 2; y -= transition_h / 2; @@ -1837,32 +1844,32 @@ void TrackCanvas::draw_transitions() for(Edit *edit = track->edits->first; edit; edit = edit->next) { if(!edit->transition) continue; edit_dimensions(edit, x, y, w, h); - int strip_x = x, strip_y = y; - if( track->show_titles() ) - strip_y += mwindow->theme->get_image("title_bg_data")->get_h(); + int strip_x = x; get_transition_coords(edit, x, y, w, h); + int strip_h = mwindow->theme->get_image("plugin_bg_data")->get_h(); + int track_y = edit->edits->track->y_pixel; + int strip_y = y - strip_h; + if( strip_y < track_y ) strip_y = track_y; + int strip_w = Units::round(edit->track->from_units(edit->transition->length) * mwindow->edl->session->sample_rate / mwindow->edl->local_session->zoom_sample); if( MWindowGUI::visible(x, x + w, 0, get_w()) && - MWindowGUI::visible(y, y + h, 0, get_h()) ) - { + MWindowGUI::visible(y, y + h, 0, get_h()) ) { PluginServer *server = mwindow->scan_plugindb(edit->transition->title, track->data_type); if( !server ) continue; VFrame *picon = server->get_picon(); if( !picon ) continue; - draw_vframe(picon, x, y, w, h, 0, 0, picon->get_w(), picon->get_h()); + int picon_w = picon->get_w(), picon_h = picon->get_h(); + int track_h = edit->track->vertical_span(mwindow->theme); + if( picon_h > track_h ) picon_h = track_h; + draw_vframe(picon, x, y, w, h, 0, 0, picon_w, picon_h); } if(MWindowGUI::visible(strip_x, strip_x + strip_w, 0, get_w()) && - MWindowGUI::visible(strip_y, strip_y + h, 0, get_h())) - { + MWindowGUI::visible(strip_y, strip_y + h, 0, get_h())) { int x = strip_x, w = strip_w; - if(x < 0) - { - w -= -x; - x = 0; - } - if(w + x > get_w()) w -= (w + x) - get_w(); + if( x < 0 ) { w -= -x; x = 0; } + if( w + x > get_w() ) w -= (w + x) - get_w(); draw_3segmenth( x, strip_y, w, strip_x, strip_w, mwindow->theme->get_image("plugin_bg_data"), 0); -- 2.26.2