summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-03-21 16:04:56 +0100
committerRobin Gareus <robin@gareus.org>2015-03-21 16:09:35 +0100
commitf121d04d6d2eb668edbf7076602d196257bd21c9 (patch)
tree4c5feffe8eb57e19cacbd6b085401e8a4c1f2e45 /gtk2_ardour/editor_ops.cc
parent85587c19a421ed032e57dc91fcc2e051cad7b4ce (diff)
vertical fit: hide tracks in-between
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc38
1 files changed, 19 insertions, 19 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 266a6b585e..8d73e5e56c 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -7092,36 +7092,36 @@ Editor::fit_tracks (TrackViewList & tracks)
}
}
- bool prev_was_selected = false;
- bool is_selected = tracks.contains (all.front());
- bool next_is_selected;
- for (TrackViewList::iterator t = all.begin(); t != all.end(); ++t) {
-
- TrackViewList::iterator next;
-
- next = t;
- ++next;
-
- if (next != all.end()) {
- next_is_selected = tracks.contains (*next);
- } else {
- next_is_selected = false;
+ // find selection range.
+ // if someone knows how to user TrackViewList::iterator for this
+ // I'm all ears.
+ int selected_top = -1;
+ int selected_bottom = -1;
+ int i = 0;
+ for (TrackViewList::iterator t = all.begin(); t != all.end(); ++t, ++i) {
+ if ((*t)->marked_for_display ()) {
+ if (tracks.contains(*t)) {
+ if (selected_top == -1) {
+ selected_top = i;
+ }
+ selected_bottom = i;
+ }
}
+ }
+ i = 0;
+ for (TrackViewList::iterator t = all.begin(); t != all.end(); ++t, ++i) {
if ((*t)->marked_for_display ()) {
- if (is_selected) {
+ if (tracks.contains(*t)) {
(*t)->set_height (h);
first_y_pos = std::min ((*t)->y_position (), first_y_pos);
} else {
- if (prev_was_selected && next_is_selected) {
+ if (i > selected_top && i < selected_bottom) {
hide_track_in_display (*t);
}
}
}
-
- prev_was_selected = is_selected;
- is_selected = next_is_selected;
}
/*