splashgui text clr, faders/speed keyframe popup slider rework, reticle rework
[goodguy/history.git] / cinelerra-5.1 / cinelerra / trackcanvas.C
index cbc62e1f1a7f4b3055594077b68ae5486e538fe9..5b283ff6eca69caabc5cc83683b183663c1efef3 100644 (file)
@@ -2177,34 +2177,37 @@ void TrackCanvas::draw_keyframe_reticle()
        int current_op = mwindow->session->current_operation, dragging = 0;
        for( int i=0; !dragging && i<AUTOMATION_TOTAL; ++i )
                if( current_op == auto_operations[i] ) dragging = 1;
+       if( dragging && !mwindow->session->drag_auto ) dragging = 0;
 
-       if( keyframe_hairline == HAIRLINE_DRAGGING && dragging ) {
-               if( mwindow->session->drag_auto && get_buttonpress() == 1 ) {
-                       draw_hairline(mwindow->session->drag_auto, RED);
-                       return;
-               }
+       int autoidx = dragging && keyframe_hairline != HAIRLINE_ALWAYS ?
+               mwindow->session->drag_auto->autos->autoidx : -1;
+
+       if( get_buttonpress() == 1 && dragging &&
+            keyframe_hairline == HAIRLINE_DRAGGING ) {
+               draw_hairline(mwindow->session->drag_auto, RED, 1);
+               return;
        }
 
        if( keyframe_hairline == HAIRLINE_ALWAYS || ( get_buttonpress() == 2 &&
            keyframe_hairline == HAIRLINE_DRAGGING && dragging ) ) {
-               for( Track *track = mwindow->edl->tracks->first; track;
-                    track=track->next ) {
+               int show = dragging || keyframe_hairline == HAIRLINE_ALWAYS ? 1 : 0;
+               for( Track *track = mwindow->edl->tracks->first; track; track=track->next ) {
                        Automation *automation = track->automation;
                        for( int i=0; i<AUTOMATION_TOTAL; ++i ) {
                                if( !mwindow->edl->session->auto_conf->autos[i] ) continue;
                                // automation visible
                                Autos *autos = automation->autos[i];
                                if( !autos ) continue;
+                               if( autoidx >= 0 && autos->autoidx != autoidx ) continue;
                                for( Auto *auto_keyframe=autos->first; auto_keyframe;
                                     auto_keyframe = auto_keyframe->next ) {
-                                       draw_hairline(auto_keyframe, BLUE);
+                                       draw_hairline(auto_keyframe, BLUE, show);
                                }
                        }
-
-                       if( dragging && mwindow->session->drag_auto ) {
-                               draw_hairline(mwindow->session->drag_auto, RED);
-                       }
                }
+
+               if( dragging )
+                       draw_hairline(mwindow->session->drag_auto, RED, 1);
        }
 }
 
@@ -3458,10 +3461,10 @@ int TrackCanvas::do_plugin_autos(Track *track, int cursor_x, int cursor_y,
        return result;
 }
 
-int TrackCanvas::draw_hairline(Auto *auto_keyframe, int color)
+int TrackCanvas::draw_hairline(Auto *auto_keyframe, int color, int show)
 {
        Track *track = auto_keyframe->autos->track;
-       int autogrouptype = auto_keyframe->autos->get_type();
+       int autogrouptype = auto_keyframe->autos->autogrouptype;
 
        int center_pixel;
        double view_start, unit_start;
@@ -3477,6 +3480,31 @@ int TrackCanvas::draw_hairline(Auto *auto_keyframe, int color)
 
        set_color(color);
        draw_line(ax, 0, ax, get_h());
+
+       if( show ) {
+               char text[BCSTRLEN];
+               if( auto_keyframe->is_floatauto() ) {
+                       FloatAuto *float_auto = (FloatAuto *)auto_keyframe;
+                       sprintf(text, "%0.2f", float_auto->get_value());
+               }
+               else {
+                       IntAuto *int_auto = (IntAuto *)auto_keyframe;
+                       sprintf(text, "%d", int_auto->value);
+               }
+               int font = MEDIUMFONT;
+               int tw = get_text_width(font, text)  + TOOLTIP_MARGIN * 2;
+               int th = get_text_height(font, text) + TOOLTIP_MARGIN * 2;
+               set_color(get_resources()->tooltip_bg_color);
+               ax += HANDLE_W/2;
+               ay += center_pixel + HANDLE_W/2;
+               draw_box(ax, ay, tw, th);
+               set_color(BLACK);
+               draw_rectangle(ax, ay, tw, th);
+               set_font(font);
+               ax += TOOLTIP_MARGIN;
+               ay += TOOLTIP_MARGIN + get_text_ascent(font);
+               draw_text(ax, ay, text);
+       }
        return 0;
 }
 
@@ -3619,7 +3647,7 @@ void TrackCanvas::update_drag_handle()
                double position = edit_mode != MOVE_NO_EDITS &&
                        ( session->drag_handle || edit_mode == MOVE_ONE_EDIT ) ?
                                session->drag_position : session->drag_start;
-               Track *track = session->drag_edit->edits->track;
+               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);
@@ -3660,6 +3688,8 @@ int TrackCanvas::render_handle_frame(EDL *edl, int64_t pos, int mode)
                int w = canvas->w, h = canvas->h, w2 = w/2, h2 = h/2;
                int lx = 0, ly = h2/2, rx = w2, ry = h2/2;
                BC_WindowBase *window = canvas->get_canvas();
+               window->set_color(BLACK);
+               window->clear_box(0,0, window->get_w(),window->get_h());
                window->draw_vframe(&vlt, lx,ly, w2,h2, 0,0,vlt.get_w(),vlt.get_h());
                window->draw_vframe(&vrt, rx,ry, w2,h2, 0,0,vrt.get_w(),vrt.get_h());
                window->flash(1);
@@ -3668,7 +3698,7 @@ int TrackCanvas::render_handle_frame(EDL *edl, int64_t pos, int mode)
                break; }
        case 1:
        case 2: {
-               Track *track = mwindow->session->drag_edit->edits->track;
+               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);
@@ -4451,8 +4481,6 @@ int TrackCanvas::do_edit_handles(int cursor_x, int cursor_y, int button_press,
        int result = 0;
 
        for( Track *track=mwindow->edl->tracks->first; track && !result; track=track->next) {
-               if( !track->show_assets() ) continue;
-
                for( Edit *edit=track->edits->first; edit && !result; edit=edit->next ) {
                        int64_t edit_x, edit_y, edit_w, edit_h;
                        edit_dimensions(edit, edit_x, edit_y, edit_w, edit_h);
@@ -4462,7 +4490,8 @@ int TrackCanvas::do_edit_handles(int cursor_x, int cursor_y, int button_press,
                                if( cursor_x < edit_x + HANDLE_W ) {
                                        edit_result = edit;
                                        handle_result = 0;
-                                       if( cursor_y >= edit_y+edit_h - HANDLE_W ) {
+                                       if( cursor_y >= edit_y+edit_h - HANDLE_W &&
+                                           track->show_assets() ) {
                                                new_cursor = DOWNLEFT_RESIZE;
                                                if( button_press == LEFT_BUTTON )
                                                        result = -1;
@@ -4473,7 +4502,8 @@ int TrackCanvas::do_edit_handles(int cursor_x, int cursor_y, int button_press,
                                else if( cursor_x >= edit_x + edit_w - HANDLE_W ) {
                                        edit_result = edit;
                                        handle_result = 1;
-                                       if( cursor_y >= edit_y+edit_h - HANDLE_W ) {
+                                       if( cursor_y >= edit_y+edit_h - HANDLE_W &&
+                                           track->show_assets() ) {
                                                new_cursor = DOWNRIGHT_RESIZE;
                                                if( button_press == LEFT_BUTTON )
                                                        result = -1;
@@ -4512,7 +4542,7 @@ int TrackCanvas::do_edit_handles(int cursor_x, int cursor_y, int button_press,
                        update_overlay = 1;
                }
        }
-       else if( result <  0) {
+       else if( result < ) {
                mwindow->undo->update_undo_before();
                if( !shift_down() ) {
                        if( handle_result == 0 )
@@ -4662,8 +4692,6 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
        int result = 0;
 
        for(Track *track = mwindow->edl->tracks->first; track && !result; track = track->next) {
-               if( !track->show_assets() ) continue;
-
                for(Edit *edit = track->edits->first; edit && !result; edit = edit->next) {
                        int64_t edit_x, edit_y, edit_w, edit_h;
                        edit_dimensions(edit, edit_x, edit_y, edit_w, edit_h);