From 0b5fb555b6a3878926bac0844fd8b3db1b1e99c7 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Thu, 15 Jan 2009 18:54:13 +0000 Subject: [PATCH] Added dragging of whole branches --- .../timeline/timeline-layout-helper.cpp | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/gui/widgets/timeline/timeline-layout-helper.cpp b/src/gui/widgets/timeline/timeline-layout-helper.cpp index 4efb2cf2a..2d5f1d22b 100644 --- a/src/gui/widgets/timeline/timeline-layout-helper.cpp +++ b/src/gui/widgets/timeline/timeline-layout-helper.cpp @@ -243,24 +243,28 @@ TimelineLayoutHelper::layout_headers_recursive( REQUIRE(depth >= 0); int child_offset = 0; - + TrackTree::sibling_iterator iterator; for(iterator = layoutTree.begin(parent_iterator); iterator != layoutTree.end(parent_iterator); iterator++) { Gdk::Rectangle rect; + int track_height = 0; + const shared_ptr &model_track = *iterator; REQUIRE(model_track); - shared_ptr timeline_track = lookup_timeline_track(model_track); + + const bool being_dragged = (timeline_track == draggingTrack); // Is the track going to be shown? if(parent_expanded) { // Calculate and store the box of the header - const int track_height = timeline_track->get_height(); + track_height = timeline_track->get_height() + + TimelineWidget::TrackPadding; const int indent = depth * indent_width; rect = Gdk::Rectangle( @@ -270,19 +274,15 @@ TimelineLayoutHelper::layout_headers_recursive( track_height); // height // Offset for the next header - child_offset += track_height + TimelineWidget::TrackPadding; + child_offset += track_height; // Is this header being dragged? - if(timeline_track == draggingTrack) - { - rect.set_y(dragPoint.get_y() - dragStartOffset.get_y()); - } + if(being_dragged) + rect.set_y(dragPoint.get_y() - dragStartOffset.get_y()); headerBoxes[timeline_track] = rect; } - - // Is the track animating? const bool is_track_animating = timeline_track->is_expand_animating(); @@ -292,10 +292,11 @@ TimelineLayoutHelper::layout_headers_recursive( const bool expand_child = (animating || timeline_track->get_expanded()) && parent_expanded; - + int child_branch_height = layout_headers_recursive( - iterator, branch_offset + child_offset, - header_width, indent_width, depth + 1, expand_child); + iterator, rect.get_y() + track_height, + header_width, indent_width, depth + 1, + expand_child); // Do collapse animation as necessary if(is_track_animating)