summaryrefslogtreecommitdiff
path: root/gtk2_ardour/streamview.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-11-14 15:01:53 +0000
committerCarl Hetherington <carl@carlh.net>2010-11-14 15:01:53 +0000
commita46af0460b0fdcc145c4dd282fa4fe071d4971fc (patch)
tree81a1a2f4c779958df0f19d976e6cfd003afea5eb /gtk2_ardour/streamview.cc
parent7a25fa1beb76b7148d4f96de5629d8b639aac9e7 (diff)
Create a new layer if required on record to a track in stacked mode. Fixes #3391.
git-svn-id: svn://localhost/ardour2/branches/3.0@8026 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/streamview.cc')
-rw-r--r--gtk2_ardour/streamview.cc49
1 files changed, 48 insertions, 1 deletions
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index 5201cf295c..9f56f8c692 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -578,7 +578,16 @@ StreamView::update_contents_height ()
}
for (vector<RecBoxInfo>::iterator i = rec_rects.begin(); i != rec_rects.end(); ++i) {
- i->rectangle->property_y2() = height;
+ switch (_layer_display) {
+ case Overlaid:
+ i->rectangle->property_y2() = height;
+ break;
+ case Stacked:
+ /* In stacked displays, the recregion is always at the top */
+ i->rectangle->property_y1() = 0;
+ i->rectangle->property_y2() = h;
+ break;
+ }
}
}
@@ -598,3 +607,41 @@ StreamView::update_coverage_frames ()
(*i)->update_coverage_frames (_layer_display);
}
}
+
+void
+StreamView::check_record_layers (boost::shared_ptr<Region> region, framepos_t to)
+{
+ if (_new_rec_layer_time < to) {
+ /* The region being recorded has overlapped the start of a top-layered region, so
+ `fake' a new visual layer for the recording. This is only a visual thing for now,
+ as the proper layering will get sorted out when the recorded region is added to
+ its playlist.
+ */
+
+ /* Stop this happening again */
+ _new_rec_layer_time = max_framepos;
+
+ /* Make space in the view for the new layer */
+ ++_layers;
+
+ /* Set the temporary region to the correct layer so that it gets drawn correctly */
+ region->set_layer (_layers - 1);
+
+ /* and reset the view */
+ update_contents_height ();
+ }
+}
+
+void
+StreamView::setup_new_rec_layer_time (boost::shared_ptr<Region> region)
+{
+ /* If we are in Stacked mode, we may need to (visually) create a new layer to put the
+ recorded region in. To work out where this needs to happen, find the start of the next
+ top-layered region after the start of the region we are recording and make a note of it.
+ */
+ if (_layer_display == Stacked) {
+ _new_rec_layer_time = _trackview.track()->playlist()->find_next_top_layer_position (region->start());
+ } else {
+ _new_rec_layer_time = max_framepos;
+ }
+}