diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index ed585a91e1..2824cff68f 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -155,6 +155,7 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr r, bool wai region_view->init (region_color, wait_for_waves); region_view->set_amplitude_above_axis(_amplitude_above_axis); + region_view->set_height (child_height ()); region_views.push_front (region_view); /* if its the special single-sample length that we use for rec-regions, make it @@ -534,7 +535,6 @@ AudioStreamView::setup_rec_box () (RegionFactory::create (sources, start, 1 , "", 0, (Region::Flag)(Region::DefaultFlags | Region::DoNotSaveState), false))); assert(region); region->set_position (_trackview.session().transport_frame(), this); - rec_regions.push_back (make_pair(region, (RegionView*)0)); } @@ -569,7 +569,7 @@ AudioStreamView::setup_rec_box () rec_rect->property_x1() = xstart; rec_rect->property_y1() = 1.0; rec_rect->property_x2() = xend; - rec_rect->property_y2() = (double) _trackview.current_height() - 1; + rec_rect->property_y2() = child_height (); rec_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get(); rec_rect->property_outline_what() = 0x1 | 0x2 | 0x4 | 0x8; rec_rect->property_fill_color_rgba() = fill_color; diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 0d868ac645..d77681b6d5 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -424,24 +424,35 @@ StreamView::get_inverted_selectables (Selection& sel, list& results } } +/** @return height of a child region view, depending on stacked / overlaid mode */ +double +StreamView::child_height () const +{ + if (layer_display == Stacked) { + return height / layers; + } + + return height; +} + void StreamView::update_contents_height () { canvas_rect->property_y2() = height; - const double lh = height / layers; + const double h = child_height (); for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) { switch (layer_display) { case Overlaid: (*i)->set_y (0); - (*i)->set_height (height); break; case Stacked: - (*i)->set_y (height - ((*i)->region()->layer() + 1) * lh); - (*i)->set_height (lh); + (*i)->set_y (height - ((*i)->region()->layer() + 1) * h); break; } + + (*i)->set_height (h); } for (vector::iterator i = rec_rects.begin(); i != rec_rects.end(); ++i) { diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index 10bbe8da36..47c6277578 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -126,6 +126,7 @@ protected: virtual void playlist_modified (boost::shared_ptr); virtual void color_handler () = 0; + double child_height () const; RouteTimeAxisView& _trackview; bool owns_canvas_group;