diff --git a/src/gui/lumiera_ui.rc b/src/gui/lumiera_ui.rc index 5bf018013..428b7bed4 100644 --- a/src/gui/lumiera_ui.rc +++ b/src/gui/lumiera_ui.rc @@ -136,6 +136,7 @@ style "timeline_ruler" = "default_base" gtkmm__CustomObject_TimelineRuler::annotation_horz_margin = 3 gtkmm__CustomObject_TimelineRuler::annotation_vert_margin = 0 gtkmm__CustomObject_TimelineRuler::min_division_width = 100 + gtkmm__CustomObject_TimelineRuler::mouse_chevron_size = 5 } style "timeline_header_base" = "default_base" diff --git a/src/gui/widgets/timeline-widget.cpp b/src/gui/widgets/timeline-widget.cpp index 151b50183..38210a29d 100644 --- a/src/gui/widgets/timeline-widget.cpp +++ b/src/gui/widgets/timeline-widget.cpp @@ -207,6 +207,12 @@ TimelineWidget::zoom_view(int point, int zoom_size) set_time_scale(new_time_scale); } +void +TimelineWidget::on_mouse_move_in_body(int x, int y) +{ + ruler.set_mouse_chevron_time(x * timeScale + timeOffset); +} + } // namespace widgets } // namespace gui } // namespace lumiera diff --git a/src/gui/widgets/timeline-widget.hpp b/src/gui/widgets/timeline-widget.hpp index 35c11aa3d..fbe12e751 100644 --- a/src/gui/widgets/timeline-widget.hpp +++ b/src/gui/widgets/timeline-widget.hpp @@ -96,6 +96,8 @@ protected: void shift_view(int shift_size); void zoom_view(int point, int zoom_size); + + void on_mouse_move_in_body(int x, int y); protected: gavl_time_t timeOffset; diff --git a/src/gui/widgets/timeline/timeline-body.cpp b/src/gui/widgets/timeline/timeline-body.cpp index 76870424a..d7ec9b4b4 100644 --- a/src/gui/widgets/timeline/timeline-body.cpp +++ b/src/gui/widgets/timeline/timeline-body.cpp @@ -60,6 +60,15 @@ TimelineBody::TimelineBody(lumiera::gui::widgets::TimelineWidget *timeline_widge } +void +TimelineBody::on_realize() +{ + Widget::on_realize(); + + // We wish to receive all event notifications + add_events(Gdk::POINTER_MOTION_MASK); +} + void TimelineBody::on_scroll() { @@ -69,6 +78,7 @@ TimelineBody::on_scroll() bool TimelineBody::on_scroll_event (GdkEventScroll* event) { + REQUIRE(event != NULL); REQUIRE(timelineWidget != NULL); if(event->state & GDK_CONTROL_MASK) @@ -102,19 +112,24 @@ TimelineBody::on_scroll_event (GdkEventScroll* event) } } } - -void -TimelineBody::on_realize() + +bool +TimelineBody::on_motion_notify_event(GdkEventMotion *event) { - Widget::on_realize(); + REQUIRE(event != NULL); + REQUIRE(timelineWidget != NULL); - // We wish to receive all event notifications - add_events(Gdk::ALL_EVENTS_MASK); + timelineWidget->on_mouse_move_in_body(event->x, event->y); + + return true; } bool TimelineBody::on_expose_event(GdkEventExpose* event) { + REQUIRE(event != NULL); + REQUIRE(timelineWidget != NULL); + // This is where we draw on the window Glib::RefPtr window = get_window(); if(!window) @@ -124,10 +139,13 @@ TimelineBody::on_expose_event(GdkEventExpose* event) read_styles(); // Prepare to render via cairo - Glib::RefPtr