void VTimeBar::update_cursor() { int rx = get_relative_cursor_x(); double position = pixel_to_position(rx); gui->vwindow->update_position(position); update(1); }
void TimeBar::update(int flush) { draw_time(); // Need to redo these when range is drawn to get the background updated. update_labels(); update_points(); EDL *edl = get_edl(); int64_t pixel = -1; // Draw highlight position if(edl && (highlighted || current_operation == TIMEBAR_DRAG) && get_cursor_x() >= 0 && get_cursor_y() < get_w()) { //printf("TimeBar::update %d %d\n", __LINE__, get_cursor_x()); double position = pixel_to_position(get_cursor_x()); position = get_edl()->align_to_frame(position, 0); pixel = position_to_pixel(position); update_clock(position); } if(pixel < 0) { double position = test_highlight(); if(position >= 0) pixel = position_to_pixel(position); } if(pixel >= 0 && pixel < get_w()) { set_color(mwindow->theme->timebar_cursor_color); set_line_dashes(1); //printf("TimeBar::update %d pane=%d pixel=%jd\n", __LINE__, pane->number, pixel); draw_line(pixel, 0, pixel, get_h()); set_line_dashes(0); } if(edl) { int64_t pixel = position_to_pixel( edl->local_session->get_selectionstart(1)); // Draw insertion point position. set_color(mwindow->theme->timebar_cursor_color); draw_line(pixel, 0, pixel, get_h()); } update_highlights(); // Get the labels to show show_window(0); flash(flush); //printf("TimeBar::update %d this=%p %d\n", __LINE__, this, current_operation); }
int TimeBar::button_press_event() { if(is_event_win() && cursor_inside() && get_buttonpress() == 1) { // Change time format if(ctrl_down()) { if(get_buttonpress() == 1) mwindow->next_time_format(); else if(get_buttonpress() == 2) mwindow->prev_time_format(); return 1; } else // if(test_preview(1)) // { // } // else { stop_playback(); // Select region between two labels if(get_double_click()) { double position = pixel_to_position(get_cursor_x()); // Test labels select_region(position); return 1; } else // Reposition highlight cursor if(is_event_win() && cursor_inside()) { update_cursor(); current_operation = TIMEBAR_DRAG; activate_timeline(); return 1; } } } return 0; }