gif rework, C41 booby fix, add ext+s for list seq, features5
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / trackcanvas.C
index ab93d6234d03897e8586978a2ac8de3cc60dc66a..27eede528e536bc2a324936ac4fb7d943a3dac89 100644 (file)
@@ -2227,10 +2227,9 @@ int TrackCanvas::do_keyframes(int cursor_x,
 
                                                if( !result && buttonpress && i == AUTOMATION_SPEED )
                                                        mwindow->speed_after(-1);
-                                               int current_grouptype = mwindow->edl->local_session->zoombar_showautotype;
-                                               if( result && buttonpress && grouptype != current_grouptype ) {
-                                                       mwindow->edl->local_session->zoombar_showautotype = grouptype;
-                                                       mwindow->gui->zoombar->update_autozoom();
+                                               if( result && buttonpress ) {
+                                                       int color = GWindowGUI::auto_colors[i];
+                                                       mwindow->gui->zoombar->update_autozoom(grouptype, color);
                                                }
                                                break; }
 
@@ -2337,7 +2336,6 @@ int TrackCanvas::do_keyframes(int cursor_x,
                new_cursor = UPRIGHT_ARROW_CURSOR;
        }
 
-
        return result;
 }
 
@@ -3817,23 +3815,28 @@ void TrackCanvas::update_drag_handle()
                        !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:
-               case MOVE_EDGE:
                        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();
        }
 }
@@ -3857,8 +3860,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) &&
@@ -3884,12 +3885,12 @@ 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);
-               mwindow->cwindow->playback_engine->refresh_frame(CHANGE_NONE, edl, 0);
+               edl->local_session->set_selectionstart(position);
+               edl->local_session->set_selectionend(position);
+               mwindow->cwindow->playback_engine->refresh_frame(CHANGE_EDL, edl, 0);
                break; }
        }
        return result;
@@ -3993,7 +3994,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;
@@ -4032,7 +4033,8 @@ int TrackCanvas::update_drag_floatauto(int cursor_x, int cursor_y)
                        float change = value - old_value;
                        current->adjust_to_new_coordinates(position, value);
                        update_ganged_autos(change, current->autos->track, current);
-                       show_message(current, 1,", %.2f", current->get_value());
+                       int color = GWindowGUI::auto_colors[current->autos->autoidx];
+                       show_message(current, color, ", %.2f", current->get_value());
                }
                break;
 
@@ -4051,7 +4053,8 @@ int TrackCanvas::update_drag_floatauto(int cursor_x, int cursor_y)
                                value * levered_position(position - current->position,
                                                         current->get_control_in_position()));
                        update_ganged_autos(0, current->autos->track, current);
-                       show_message(current, 1,", %.2f", current->get_control_in_value());
+                       int color = GWindowGUI::auto_colors[current->autos->autoidx];
+                       show_message(current, color, ", %.2f", current->get_control_in_value());
                }
                break; }
 
@@ -4065,7 +4068,8 @@ int TrackCanvas::update_drag_floatauto(int cursor_x, int cursor_y)
                                value * levered_position(position - current->position,
                                                         current->get_control_out_position()));
                        update_ganged_autos(0, current->autos->track, current);
-                       show_message(current, 1,", %.2f", current->get_control_out_value());
+                       int color = GWindowGUI::auto_colors[current->autos->autoidx];
+                       show_message(current, color, ", %.2f", current->get_control_out_value());
                }
                break; }
        }
@@ -4085,7 +4089,7 @@ int TrackCanvas::update_drag_toggleauto(int cursor_x, int cursor_y)
                result = 1;
                current->value = value;
                current->position = position;
-               show_message(current, 0,", %d", current->value);
+               show_message(current, -1, ", %d", current->value);
        }
 
        return result;
@@ -4102,7 +4106,7 @@ int TrackCanvas::update_drag_auto(int cursor_x, int cursor_y)
        {
                result = 1;
                current->position = position;
-               show_message(current, 0,"");
+               show_message(current, -1, "");
 
                double position_f = current->autos->track->from_units(current->position);
                double center_f = (mwindow->edl->local_session->get_selectionstart(1) +
@@ -4166,7 +4170,7 @@ int TrackCanvas::update_drag_pluginauto(int cursor_x, int cursor_y)
                mwindow->session->track_highlighted = track;
                result = 1;
                current->position = position;
-               show_message(current, 0,"");
+               show_message(current, -1, "");
 
                double position_f = current->autos->track->from_units(current->position);
                double center_f = (mwindow->edl->local_session->get_selectionstart(1) +
@@ -4677,6 +4681,9 @@ int TrackCanvas::button_release_event()
                }
        }
 
+       if( mwindow->edl->local_session->zoombar_showautocolor >= 0 )
+               mwindow->gui->zoombar->update_autozoom(-1);
+
        if (result)
                cursor_update(0);
 
@@ -5272,7 +5279,7 @@ int TrackCanvas::button_press_event()
                        gui->stop_transport("TrackCanvas::button_press_event");
                }
 
-               int update_overlay = 0, update_cursor = 0, rerender = 0;
+               int update_overlay = 0, update_cursor = 0, rerender = 0, update_message = 0;
 
                if(get_buttonpress() == WHEEL_UP) {
                        if(shift_down())
@@ -5315,6 +5322,7 @@ int TrackCanvas::button_press_event()
                                if( do_keyframes(cursor_x, cursor_y,
                                        0, get_buttonpress(), new_cursor,
                                        update_cursor, rerender) ) break;
+                               update_message = 1;
 // Test edit boundaries
                                if( do_edit_handles(cursor_x, cursor_y,
                                        1, rerender, update_overlay, new_cursor,
@@ -5350,6 +5358,7 @@ int TrackCanvas::button_press_event()
                                        update_overlay = 1;
                                        break;
                                }
+                               update_message = 1;
 // Test edit boundaries
                                if( do_edit_handles(cursor_x, cursor_y,
                                        1, rerender, update_overlay, new_cursor, update_cursor) ) break;
@@ -5380,9 +5389,12 @@ int TrackCanvas::button_press_event()
                        gui->update_patchbay();
                }
 
-               if( update_overlay ) {
+               if( update_message )
+                       gui->default_message();
+
+               if( update_overlay )
                        gui->draw_overlays(1);
-               }
+
                if( update_cursor < 0 ) {
 // double_click edit
                        gui->swindow->update_selection();
@@ -5459,11 +5471,11 @@ double TrackCanvas::time_visible()
 }
 
 
-void TrackCanvas::show_message(Auto *current, int show_curve_type, const char *fmt, ...)
+void TrackCanvas::show_message(Auto *current, int box_color, const char *fmt, ...)
 {
        char string[BCTEXTLEN];
        char *cp = string, *ep = cp + sizeof(string)-1;
-       if( show_curve_type ) {
+       if( box_color >= 0 ) {
                cp += snprintf(string, ep-cp, "%-8s ",
                        FloatAuto::curve_name(((FloatAuto*)current)->curve_mode));
        }
@@ -5479,7 +5491,7 @@ void TrackCanvas::show_message(Auto *current, int show_curve_type, const char *f
        va_start(ap, fmt);
        vsnprintf(cp, ep-cp, fmt, ap);
        va_end(ap);
-       gui->show_message(string);
+       gui->show_message(string, -1, box_color);
 }
 
 // Patchbay* TrackCanvas::get_patchbay()