fix yscale range, fix ffmpeg plugin param scroll pos, add shft lmb to overlay window
[goodguy/history.git] / cinelerra-5.1 / cinelerra / trackcanvas.C
index ab558a5c705a8ed44cf705ad44fa6afc2fec3ca4..700e10cd7bb1dbca088779c89b00c701f209c8e7 100644 (file)
@@ -1394,16 +1394,15 @@ void TrackCanvas::get_transition_coords(Edit *edit,
        int transition_w = 30, transition_h = 30;
        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;
+       double title_bg_h = mwindow->theme->get_image("title_bg_data")->get_h();
+       double asset_h = resource_h();
+       double ys = has_assets ? asset_h : has_titles ? title_bg_h : 0;
+       double dy = has_titles ?
+               ( has_assets ? title_bg_h + asset_h/2 : title_bg_h/2 ) :
+               ( has_assets ? asset_h/2 : 0) ;
+       double title_h = mwindow->theme->title_h;
+       if( dy < title_h / 2 ) { ys = title_h;  dy = ys / 2; }
+       y += dy;
 
        x -= transition_w / 2;
        y -= transition_h / 2;
@@ -1844,12 +1843,10 @@ 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;
+                       int strip_x = x, edit_y = y;
                        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_y = y - mwindow->theme->get_image("plugin_bg_data")->get_h();
+                       if( strip_y < edit_y ) strip_y = edit_y;
 
                        int strip_w = Units::round(edit->track->from_units(edit->transition->length) *
                                mwindow->edl->session->sample_rate / mwindow->edl->local_session->zoom_sample);
@@ -2859,6 +2856,7 @@ void TrackCanvas::calculate_viewport(Track *track,
        double &zoom_sample,
        double &zoom_units)
 {
+
        view_start = (double)mwindow->edl->local_session->view_start[pane->number] *
                mwindow->edl->local_session->zoom_sample /
                mwindow->edl->session->sample_rate;
@@ -2868,15 +2866,23 @@ void TrackCanvas::calculate_viewport(Track *track,
                mwindow->edl->local_session->zoom_sample /
                mwindow->edl->session->sample_rate;
        unit_end = track->to_doubleunits(view_end);
-       yscale = resource_h();
-       center_pixel = track->y_pixel
+
+       int y = track->y_pixel
                        - mwindow->edl->local_session->track_start[pane->number];
-       if( track->show_assets() )
-               center_pixel += yscale / 2;
-       if( track->show_titles() )
-               center_pixel += mwindow->theme->get_image("title_bg_data")->get_h();
-       zoom_sample = mwindow->edl->local_session->zoom_sample;
+       int has_titles = track->show_titles();
+       int has_assets = track->show_assets();
+       double title_bg_h = mwindow->theme->get_image("title_bg_data")->get_h();
+       double asset_h = resource_h();
+       double title_h = mwindow->theme->title_h;
+       double ys = has_assets ? asset_h : has_titles ? title_bg_h : 0;
+       double dy = has_titles ?
+               ( has_assets ? title_bg_h + asset_h/2 : title_bg_h/2) :
+               ( has_assets ? asset_h/2 : 0) ;
+       if( dy < title_h/2 ) { ys = title_h;  dy = ys / 2; }
+       yscale = ys;
+       center_pixel = y + dy;
 
+       zoom_sample = mwindow->edl->local_session->zoom_sample;
        zoom_units = track->to_doubleunits(zoom_sample / mwindow->edl->session->sample_rate);
 }