re-apply sams ladspa icons, drop gtk from ydiff, gradient reset btn
[goodguy/history.git] / cinelerra-5.1 / cinelerra / mwindowmove.C
index cffc71df0ea33bcda33bc7d5e57999726bd766fe..0cd6e455d6778dc11389dcd7206f8776cbe90194 100644 (file)
@@ -178,10 +178,17 @@ void MWindow::fit_autos(int doall)
                switch (i)
                {
                case AUTOGROUPTYPE_AUDIO_FADE:
+                       if (range < 1) {
+                               min = MIN(min, edl->local_session->automation_mins[i]);
+                               max = MAX(max, edl->local_session->automation_maxs[i]);
+                               if( min >= max-0.1 ) { min = -80.0; min = 6.0; }
+                       }
+                       break;
                case AUTOGROUPTYPE_VIDEO_FADE:
-                       if (range < 0.1) {
+                       if (range < 1) {
                                min = MIN(min, edl->local_session->automation_mins[i]);
                                max = MAX(max, edl->local_session->automation_maxs[i]);
+                               if( min >= max-0.1 ) { min = 0.0; min = 100.0; }
                        }
                        break;
                case AUTOGROUPTYPE_ZOOM:
@@ -198,9 +205,10 @@ void MWindow::fit_autos(int doall)
                        break;
                case AUTOGROUPTYPE_X:
                case AUTOGROUPTYPE_Y:
-                       if (range < 5) {
-                               min = floor((min+max)/2) - 50;
-                               max = floor((min+max)/2) + 50;
+                       if (range < 1) {
+                               float scale = bmin(edl->session->output_w, edl->session->output_h);
+                               min = floor((min+max)/2) - 0.5*scale;
+                               max = floor((min+max)/2) + 0.5*scale;
                        }
                        break;
                }
@@ -595,13 +603,10 @@ int MWindow::next_label(int shift_down)
                TimelinePane *pane = gui->get_focused_pane();
                if(edl->local_session->get_selectionend(1) >=
                        (double)edl->local_session->view_start[pane->number] *
-                               edl->local_session->zoom_sample /
-                               edl->session->sample_rate +
+                               edl->local_session->zoom_sample / edl->session->sample_rate +
                                pane->canvas->time_visible() ||
                        edl->local_session->get_selectionend(1) < (double)edl->local_session->view_start[pane->number] *
-                               edl->local_session->zoom_sample /
-                               edl->session->sample_rate)
-               {
+                               edl->local_session->zoom_sample / edl->session->sample_rate) {
                        samplemovement((int64_t)(edl->local_session->get_selectionend(1) *
                                edl->session->sample_rate /
                                edl->local_session->zoom_sample -
@@ -650,14 +655,10 @@ int MWindow::prev_label(int shift_down)
                update_plugin_guis();
                TimelinePane *pane = gui->get_focused_pane();
                if(edl->local_session->get_selectionstart(1) >= edl->local_session->view_start[pane->number] *
-                       edl->local_session->zoom_sample /
-                       edl->session->sample_rate +
-                       pane->canvas->time_visible()
-               ||
+                       edl->local_session->zoom_sample / edl->session->sample_rate +
+                       pane->canvas->time_visible() ||
                        edl->local_session->get_selectionstart(1) < edl->local_session->view_start[pane->number] *
-                       edl->local_session->zoom_sample /
-                       edl->session->sample_rate)
-               {
+                       edl->local_session->zoom_sample / edl->session->sample_rate ) {
                        samplemovement((int64_t)(edl->local_session->get_selectionstart(1) *
                                edl->session->sample_rate /
                                edl->local_session->zoom_sample -
@@ -686,33 +687,11 @@ int MWindow::prev_label(int shift_down)
 }
 
 
-
-
-
-
 int MWindow::next_edit_handle(int shift_down)
 {
        double position = edl->local_session->get_selectionend(1);
-       Units::fix_double(&position);
-       double new_position = INFINITY;
-// Test for edit handles after cursor position
-       for (Track *track = edl->tracks->first; track; track = track->next)
-       {
-               if (track->record)
-               {
-                       for (Edit *edit = track->edits->first; edit; edit = edit->next)
-                       {
-                               double edit_end = track->from_units(edit->startproject + edit->length);
-                               Units::fix_double(&edit_end);
-                               if (edit_end > position && edit_end < new_position)
-                                       new_position = edit_end;
-                       }
-               }
-       }
-
-       if(new_position != INFINITY)
-       {
-
+       double new_position = edl->next_edit(position);
+       if( new_position < edl->tracks->total_length() ) {
                edl->local_session->set_selectionend(new_position);
 //printf("MWindow::next_edit_handle %d\n", shift_down);
                if(!shift_down)
@@ -759,26 +738,9 @@ int MWindow::next_edit_handle(int shift_down)
 int MWindow::prev_edit_handle(int shift_down)
 {
        double position = edl->local_session->get_selectionstart(1);
-       double new_position = -1;
-       Units::fix_double(&position);
-// Test for edit handles before cursor position
-       for (Track *track = edl->tracks->first; track; track = track->next)
-       {
-               if (track->record)
-               {
-                       for (Edit *edit = track->edits->first; edit; edit = edit->next)
-                       {
-                               double edit_end = track->from_units(edit->startproject);
-                               Units::fix_double(&edit_end);
-                               if (edit_end < position && edit_end > new_position)
-                                       new_position = edit_end;
-                       }
-               }
-       }
-
-       if(new_position != -1)
-       {
+       double new_position = edl->prev_edit(position);
 
+       if(new_position != -1) {
                edl->local_session->set_selectionstart(new_position);
 //printf("MWindow::next_edit_handle %d\n", shift_down);
                if(!shift_down)