summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-12-29 22:14:15 +0000
committerCarl Hetherington <carl@carlh.net>2011-12-29 22:14:15 +0000
commitb1775149307a157444c516693ad6b98a404ef1b2 (patch)
treeffdf04d8396cf53d5378c073a8d249150d5282eb /gtk2_ardour
parentcabb76cce6203d34299136371078bd20b6abe1e3 (diff)
Revert internals of the last layering-related commit, and go back a slightly-cleaned-up version of how it was before. Remove all layering modes; only option now is add-is-higher. Move-add-higher could easily be re-added if anyone uses it.
git-svn-id: svn://localhost/ardour2/branches/3.0@11111 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/audio_streamview.cc6
-rw-r--r--gtk2_ardour/crossfade_view.cc21
-rw-r--r--gtk2_ardour/crossfade_view.h3
-rw-r--r--gtk2_ardour/editor.cc2
-rw-r--r--gtk2_ardour/editor_drag.cc70
-rw-r--r--gtk2_ardour/editor_drag.h2
-rw-r--r--gtk2_ardour/session_option_editor.cc23
-rw-r--r--gtk2_ardour/streamview.cc6
-rw-r--r--gtk2_ardour/time_axis_view.cc6
9 files changed, 51 insertions, 88 deletions
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc
index 6dbef4484d..c7afa6e3bf 100644
--- a/gtk2_ardour/audio_streamview.cc
+++ b/gtk2_ardour/audio_streamview.cc
@@ -812,7 +812,7 @@ AudioStreamView::update_content_height (CrossfadeView* cv)
switch (_layer_display) {
case Overlaid:
cv->set_y (0);
- cv->set_height (height);
+ cv->set_heights (height, height);
break;
case Stacked:
@@ -827,10 +827,10 @@ AudioStreamView::update_content_height (CrossfadeView* cv)
if (_layer_display == Stacked) {
cv->set_y ((_layers - high - 1) * h);
- cv->set_height ((high - low + 1) * h);
+ cv->set_heights ((high - low + 1) * h, h);
} else {
cv->set_y (((_layers - high) * 2 - 1) * h);
- cv->set_height (((high - low) * 2 + 1) * h);
+ cv->set_heights (((high - low) * 2 + 1) * h, h);
}
}
}
diff --git a/gtk2_ardour/crossfade_view.cc b/gtk2_ardour/crossfade_view.cc
index 6db53e9440..10792e0a93 100644
--- a/gtk2_ardour/crossfade_view.cc
+++ b/gtk2_ardour/crossfade_view.cc
@@ -57,7 +57,8 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
crossfade (xf),
left_view (lview),
right_view (rview),
- _all_in_view (false)
+ _all_in_view (false),
+ _child_height (0)
{
_valid = true;
_visible = true;
@@ -109,13 +110,15 @@ CrossfadeView::reset_width_dependent_items (double pixel_width)
}
void
-CrossfadeView::set_height (double h)
+CrossfadeView::set_heights (double fade_height, double child_height)
{
- if (h > TimeAxisView::preset_height (HeightSmall)) {
- h -= NAME_HIGHLIGHT_SIZE;
+ if (child_height > TimeAxisViewItem::NAME_HIGHLIGHT_THRESH) {
+ fade_height -= NAME_HIGHLIGHT_SIZE;
+ child_height -= NAME_HIGHLIGHT_SIZE;
}
- TimeAxisViewItem::set_height (h);
+ TimeAxisViewItem::set_height (fade_height);
+ _child_height = child_height;
redraw_curves ();
}
@@ -203,7 +206,9 @@ CrossfadeView::redraw_curves ()
for (int i = 0, pci = 0; i < npoints; ++i) {
Art::Point &p = (*points)[pci++];
p.set_x (xoff + i + 1);
- p.set_y (_height - ((_height - 2) * vec[i]));
+
+ double const ho = crossfade->in()->layer() > crossfade->out()->layer() ? _child_height : _height;
+ p.set_y (ho - ((_child_height - 2) * vec[i]));
}
fade_in->property_points() = *points;
@@ -213,7 +218,9 @@ CrossfadeView::redraw_curves ()
for (int i = 0, pci = 0; i < npoints; ++i) {
Art::Point &p = (*points)[pci++];
p.set_x (xoff + i + 1);
- p.set_y (_height - ((_height - 2) * vec[i]));
+
+ double const ho = crossfade->in()->layer() < crossfade->out()->layer() ? _child_height : _height;
+ p.set_y (ho - ((_child_height - 2) * vec[i]));
}
fade_out->property_points() = *points;
diff --git a/gtk2_ardour/crossfade_view.h b/gtk2_ardour/crossfade_view.h
index d984f5d295..af33cb7296 100644
--- a/gtk2_ardour/crossfade_view.h
+++ b/gtk2_ardour/crossfade_view.h
@@ -48,7 +48,7 @@ public:
AudioRegionView& left_view; // and these too
AudioRegionView& right_view;
- void set_height (double);
+ void set_heights (double, double);
bool valid() const { return _valid; }
bool visible() const { return _visible; }
@@ -68,6 +68,7 @@ private:
bool _valid;
bool _visible;
bool _all_in_view;
+ double _child_height;
ArdourCanvas::Line *fade_in;
ArdourCanvas::Line *fade_out;
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 30bde56a68..ea8cc07209 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -2475,7 +2475,7 @@ Editor::get_state ()
/** @param y y offset from the top of all trackviews.
* @return pair: TimeAxisView that y is over, layer index.
* TimeAxisView may be 0. Layer index is the layer number if the TimeAxisView is valid and is
- * in stacked region display mode, otherwise 0.
+ * in stacked or expanded region display mode, otherwise 0.
*/
std::pair<TimeAxisView *, double>
Editor::trackview_by_y_position (double y)
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index f37d6e2556..d03084e2d0 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -488,10 +488,6 @@ RegionMotionDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
pair<TimeAxisView*, double> const tv = _editor->trackview_by_y_position (_drags->current_pointer_y ());
_last_pointer_time_axis_view = find_time_axis_view (tv.first);
_last_pointer_layer = tv.first->layer_display() == Overlaid ? 0 : tv.second;
-
- if (tv.first->view()->layer_display() == Stacked) {
- tv.first->view()->set_layer_display (Expanded);
- }
}
double
@@ -578,7 +574,6 @@ RegionMotionDrag::y_movement_allowed (int delta_track, double delta_layer) const
/* Note that we allow layer to be up to 0.5 below zero, as this is used by `Expanded'
mode to allow the user to place a region below another on layer 0.
*/
-
if (delta_track == 0 && (l < -0.5 || l >= int (to->view()->layers()))) {
/* Off the top or bottom layer; note that we only refuse if the track hasn't changed.
If it has, the layers will be munged later anyway, so it's ok.
@@ -599,6 +594,10 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
/* Find the TimeAxisView that the pointer is now over */
pair<TimeAxisView*, double> const tv = _editor->trackview_by_y_position (_drags->current_pointer_y ());
+ if (first_move && tv.first->view()->layer_display() == Stacked) {
+ tv.first->view()->set_layer_display (Expanded);
+ }
+
/* Bail early if we're not over a track */
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv.first);
if (!rtv || !rtv->is_track()) {
@@ -646,21 +645,21 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
if (first_move) {
rv->get_time_axis_view().hide_dependent_views (*rv);
-
+
+ /* Absolutely no idea why this is necessary, but it is; without
+ it, the region view disappears after the reparent.
+ */
+ _editor->update_canvas_now ();
+
/* Reparent to a non scrolling group so that we can keep the
region selection above all time axis views.
Reparenting means that we will have to move the region view
later, as the two parent groups have different coordinates.
*/
-
+
rv->get_canvas_group()->reparent (*(_editor->_region_motion_group));
rv->fake_set_opaque (true);
-
- if (!rv->get_time_axis_view().hidden()) {
- /* the track that this region view is on is hidden, so hide the region too */
- rv->get_canvas_group()->hide ();
- }
}
/* If we have moved tracks, we'll fudge the layer delta so that the
@@ -680,12 +679,12 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
if (tv->view()->layer_display() == Stacked) {
tv->view()->set_layer_display (Expanded);
}
-
+
/* We're only allowed to go -ve in layer on Expanded views */
if (tv->view()->layer_display() != Expanded && (i->layer + this_delta_layer) < 0) {
this_delta_layer = - i->layer;
}
-
+
/* Set height */
rv->set_height (tv->view()->child_height ());
@@ -826,12 +825,13 @@ RegionMotionDrag::finished (GdkEvent *, bool)
(*i)->view()->set_layer_display (Stacked);
}
}
-}
+}
void
RegionMoveDrag::finished (GdkEvent* ev, bool movement_occurred)
{
RegionMotionDrag::finished (ev, movement_occurred);
+
if (!movement_occurred) {
/* just a click */
return;
@@ -965,9 +965,6 @@ RegionMoveDrag::finished_no_copy (
RegionSelection new_views;
PlaylistSet modified_playlists;
PlaylistSet frozen_playlists;
-
- list<pair<boost::shared_ptr<Region>, double> > pending_explicit_relayers;
- Playlist::RegionList pending_implicit_relayers;
set<RouteTimeAxisView*> views_to_update;
if (_brushing) {
@@ -1049,12 +1046,8 @@ RegionMoveDrag::finished_no_copy (
boost::shared_ptr<Playlist> playlist = dest_rtv->playlist();
- bool const explicit_relayer = dest_rtv->view()->layer_display() == Stacked || dest_rtv->view()->layer_display() == Expanded;
-
- if (explicit_relayer) {
- pending_explicit_relayers.push_back (make_pair (rv->region (), dest_layer));
- } else {
- pending_implicit_relayers.push_back (rv->region ());
+ if (dest_rtv->view()->layer_display() == Stacked || dest_rtv->view()->layer_display() == Expanded) {
+ rv->region()->set_pending_layer (dest_layer);
}
/* freeze playlist to avoid lots of relayering in the case of a multi-region drag */
@@ -1063,7 +1056,6 @@ RegionMoveDrag::finished_no_copy (
if (r.second) {
playlist->freeze ();
- playlist->suspend_relayer ();
}
/* this movement may result in a crossfade being modified, so we need to get undo
@@ -1119,24 +1111,10 @@ RegionMoveDrag::finished_no_copy (
_editor->selection->set (new_views);
}
- /* We can't use the normal mechanism for relayering, as some regions may require an explicit relayer
- rather than an implicit one. So we thaw before resuming relayering, then do the relayers
- that we require.
- */
-
- for (PlaylistSet::iterator p = frozen_playlists.begin(); p != frozen_playlists.end(); ++p) {
+ for (set<boost::shared_ptr<Playlist> >::iterator p = frozen_playlists.begin(); p != frozen_playlists.end(); ++p) {
(*p)->thaw();
- (*p)->resume_relayer ();
}
- for (list<pair<boost::shared_ptr<Region>, double> >::iterator i = pending_explicit_relayers.begin(); i != pending_explicit_relayers.end(); ++i) {
- i->first->playlist()->relayer (i->first, i->second);
- }
-
- for (Playlist::RegionList::iterator i = pending_implicit_relayers.begin(); i != pending_implicit_relayers.end(); ++i) {
- (*i)->playlist()->relayer (*i);
- }
-
/* write commands for the accumulated diffs for all our modified playlists */
add_stateful_diff_commands_for_playlists (modified_playlists);
@@ -1144,11 +1122,11 @@ RegionMoveDrag::finished_no_copy (
/* We have futzed with the layering of canvas items on our streamviews.
If any region changed layer, this will have resulted in the stream
- views being asked to set up their region views, and all will be
- well. If not, we might now have badly-ordered region views. Ask
- the Streamviews involved to sort themselves out, just in case.
+ views being asked to set up their region views, and all will be well.
+ If not, we might now have badly-ordered region views. Ask the StreamViews
+ involved to sort themselves out, just in case.
*/
-
+
for (set<RouteTimeAxisView*>::iterator i = views_to_update.begin(); i != views_to_update.end(); ++i) {
(*i)->view()->playlist_layered ((*i)->track ());
}
@@ -1214,7 +1192,7 @@ RegionMoveDrag::insert_region_into_playlist (
dest_playlist->add_region (region, where);
if (dest_rtv->view()->layer_display() == Stacked || dest_rtv->view()->layer_display() == Expanded) {
- dest_playlist->relayer (region, dest_layer);
+ region->set_pending_layer (dest_layer);
}
c.disconnect ();
@@ -1268,7 +1246,7 @@ RegionMotionDrag::aborted (bool)
(*i)->view()->set_layer_display (Stacked);
}
}
-
+
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
RegionView* rv = i->view;
TimeAxisView* tv = &(rv->get_time_axis_view ());
diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h
index a6f5088d43..4170315294 100644
--- a/gtk2_ardour/editor_drag.h
+++ b/gtk2_ardour/editor_drag.h
@@ -249,7 +249,7 @@ struct DraggingView
* or -1 if it is not visible.
*/
int time_axis_view;
- /** Layer that this region is currently being displayed on. This is a double
+ /** layer that this region is currently being displayed on. This is a double
rather than a layer_t as we use fractional layers during drags to allow the user
to indicate a new layer to put a region on.
*/
diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc
index 6ffb95b464..dc72e6a045 100644
--- a/gtk2_ardour/session_option_editor.cc
+++ b/gtk2_ardour/session_option_editor.cc
@@ -262,29 +262,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
/* Misc */
- add_option (_("Misc"), new OptionEditorHeading (_("Layering (in overlaid mode)")));
-
- ComboOption<LayerModel>* lm = new ComboOption<LayerModel> (
- "layer-model",
- _("Layering model"),
- sigc::mem_fun (*_session_config, &SessionConfiguration::get_layer_model),
- sigc::mem_fun (*_session_config, &SessionConfiguration::set_layer_model)
- );
-
- lm->add (LaterHigher, _("later is higher"));
- lm->add (AddOrBoundsChangeHigher, _("most recently edited or added is higher"));
- lm->add (AddHigher, _("most recently added is higher"));
-
- add_option (_("Misc"), new BoolOption (
- "relayer-on-all-edits",
- _("Relayer regions after every edit"),
- sigc::mem_fun (*_session_config, &SessionConfiguration::get_relayer_on_all_edits),
- sigc::mem_fun (*_session_config, &SessionConfiguration::set_relayer_on_all_edits)
- ));
-
-
- add_option (_("Misc"), lm);
-
add_option (_("Misc"), new OptionEditorHeading (_("MIDI Options")));
add_option (_("Misc"), new BoolOption (
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index 06a9d77957..2fce87fa80 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -181,7 +181,7 @@ StreamView::add_region_view (boost::weak_ptr<Region> wr)
add_region_view_internal (r, true);
- if (_layer_display == Stacked) {
+ if (_layer_display == Stacked || _layer_display == Expanded) {
update_contents_height ();
}
}
@@ -301,7 +301,7 @@ StreamView::playlist_layered (boost::weak_ptr<Track> wtr)
_layers = tr->playlist()->top_layer() + 1;
}
- if (_layer_display == Stacked || _layer_display == Expanded) {
+ if (_layer_display == Stacked) {
update_contents_height ();
update_coverage_frames ();
} else {
@@ -574,7 +574,7 @@ StreamView::child_height () const
case Expanded:
return height / (_layers * 2 + 1);
}
-
+
/* NOTREACHED */
return height;
}
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index fe02a8bc15..79f425f32f 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -1196,7 +1196,7 @@ TimeAxisView::color_handler ()
* If the covering object is a child axis, then the child is returned.
* TimeAxisView is 0 otherwise.
* Layer index is the layer number (possibly fractional) if the TimeAxisView is valid
- * and is in stacked or expanded region display mode, otherwise 0.
+ * and is in stacked or expanded * region display mode, otherwise 0.
*/
std::pair<TimeAxisView*, double>
TimeAxisView::covers_y_position (double y)
@@ -1215,7 +1215,7 @@ TimeAxisView::covers_y_position (double y)
case Stacked:
if (view ()) {
/* compute layer */
- l = floor ((_y_position + height - y) / (view()->child_height ()));
+ l = layer_t ((_y_position + height - y) / (view()->child_height ()));
/* clamp to max layers to be on the safe side; sometimes the above calculation
returns a too-high value */
if (l >= view()->layers ()) {
@@ -1225,7 +1225,7 @@ TimeAxisView::covers_y_position (double y)
break;
case Expanded:
if (view ()) {
- int n = floor ((_y_position + height - y) / (view()->child_height ()));
+ int const n = floor ((_y_position + height - y) / (view()->child_height ()));
l = n * 0.5 - 0.5;
if (l >= (view()->layers() - 0.5)) {
l = view()->layers() - 0.5;