+
+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;
+ }
+}
+
+void
+StreamView::enter_internal_edit_mode ()
+{
+ for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
+ (*i)->hide_rect ();
+ }
+}
+
+void
+StreamView::leave_internal_edit_mode ()
+{
+ for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
+ (*i)->show_rect ();
+ }
+}