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);
}
}
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;
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;
}