From 8ad308e6797e68e8020136dca977fb3b4fefbf10 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Fri, 2 Jan 2009 15:25:45 +0000 Subject: [PATCH] Fixed the find functions so they're offset by the scroll position, not absolute --- src/gui/widgets/timeline/timeline-layout-helper.cpp | 12 ++++++++++-- src/gui/widgets/timeline/timeline-layout-helper.hpp | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/timeline/timeline-layout-helper.cpp b/src/gui/widgets/timeline/timeline-layout-helper.cpp index 85864b4ea..2116641fc 100644 --- a/src/gui/widgets/timeline/timeline-layout-helper.cpp +++ b/src/gui/widgets/timeline/timeline-layout-helper.cpp @@ -88,8 +88,12 @@ TimelineLayoutHelper::get_track_header_rect( } shared_ptr -TimelineLayoutHelper::header_from_point(const Gdk::Point &point) +TimelineLayoutHelper::header_from_point(Gdk::Point point) { + // Apply the scroll offset + point.set_y(point.get_y() + timelineWidget.get_y_scroll_offset()); + + // Search the headers std::pair, Gdk::Rectangle> pair; BOOST_FOREACH( pair, headerBoxes ) { @@ -108,8 +112,12 @@ TimelineLayoutHelper::header_from_point(const Gdk::Point &point) } boost::shared_ptr -TimelineLayoutHelper::track_from_y(const int y) +TimelineLayoutHelper::track_from_y(int y) { + // Apply the scroll offset + y += timelineWidget.get_y_scroll_offset(); + + // Search the tracks std::pair, Gdk::Rectangle> pair; BOOST_FOREACH( pair, headerBoxes ) { diff --git a/src/gui/widgets/timeline/timeline-layout-helper.hpp b/src/gui/widgets/timeline/timeline-layout-helper.hpp index 39c01ea4b..0960afd10 100644 --- a/src/gui/widgets/timeline/timeline-layout-helper.hpp +++ b/src/gui/widgets/timeline/timeline-layout-helper.hpp @@ -70,9 +70,9 @@ public: boost::weak_ptr track); boost::shared_ptr header_from_point( - const Gdk::Point &point); + Gdk::Point point); - boost::shared_ptr track_from_y(const int y); + boost::shared_ptr track_from_y(int y); int get_total_height() const;