diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-14 14:14:49 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-14 14:14:49 +0000 |
commit | 71fecfd751dc556d49c3c376b7f1e9666b007332 (patch) | |
tree | 98623a03b4509a0129875f9af1ea674cfdf167a4 | |
parent | ef3a32c65b5c85bcb6b370d16126bc4153da9369 (diff) |
fix a few things related to fit-to-tracks and toggle-visual-state
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3966 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 43 | ||||
-rw-r--r-- | gtk2_ardour/editor_route_list.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_selection.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 4 |
5 files changed, 58 insertions, 10 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 28156cdca4..aaf478713f 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4256,12 +4256,13 @@ void Editor::use_visual_state (VisualState& vs) { no_save_visual = true; + no_route_list_redisplay = true; vertical_adjustment.set_value (vs.y_position); set_zoom_focus (vs.zoom_focus); reposition_and_zoom (vs.leftmost_frame, vs.frames_per_unit); - + for (list<TAVState>::iterator i = vs.track_states.begin(); i != vs.track_states.end(); ++i) { TrackViewList::iterator t; @@ -4272,10 +4273,14 @@ Editor::use_visual_state (VisualState& vs) } } + if (!vs.track_states.empty()) { update_route_visibility (); } - + + no_route_list_redisplay = false; + redisplay_route_list (); + no_save_visual = false; } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index c04bb792cf..c47f33e17b 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6023,16 +6023,53 @@ Editor::fit_tracks () uint32_t h = (uint32_t) floor ((canvas_height - child_heights - canvas_timebars_vsize)/selection->tracks.size()); double first_y_pos = DBL_MAX; + if (h < TimeAxisView::hSmall) { + MessageDialog msg (*this, _("There are too many selected tracks to fit in the current window")); + /* too small to be displayed */ + return; + } + undo_visual_stack.push_back (current_visual_state()); - for (TrackSelection::iterator t = selection->tracks.begin(); t != selection->tracks.end(); ++t) { - (*t)->set_height (h); - first_y_pos = std::min ((*t)->y_position, first_y_pos); + /* operate on all tracks, hide unselected ones that are in the middle of selected ones */ + + bool prev_was_selected = false; + bool is_selected = selection->selected (track_views.front()); + bool next_is_selected; + + for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) { + + bool pws; + + TrackViewList::iterator next; + + next = t; + ++next; + + if (next != track_views.end()) { + next_is_selected = selection->selected (*next); + } else { + next_is_selected = false; + } + + if (is_selected) { + (*t)->set_height (h); + first_y_pos = std::min ((*t)->y_position, first_y_pos); + } else { + if (prev_was_selected && next_is_selected) { + hide_track_in_display (**t); + } + } + + prev_was_selected = is_selected; + is_selected = next_is_selected; } + /* set the controls_layout height now, because waiting for its size request signal handler will cause the vertical adjustment setting to fail */ + controls_layout.property_height () = full_canvas_height - canvas_timebars_vsize; vertical_adjustment.set_value (first_y_pos); diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index 2055091953..3a1140b004 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -195,9 +195,6 @@ Editor::hide_track_in_display (TimeAxisView& tv, bool temponly) for (i = rows.begin(); i != rows.end(); ++i) { if ((*i)[route_display_columns.tv] == &tv) { (*i)[route_display_columns.visible] = false; - // if (temponly) { - tv.set_marked_for_display (false); - // } break; } } @@ -219,7 +216,6 @@ Editor::show_track_in_display (TimeAxisView& tv) for (i = rows.begin(); i != rows.end(); ++i) { if ((*i)[route_display_columns.tv] == &tv) { (*i)[route_display_columns.visible] = true; - tv.set_marked_for_display (true); break; } } diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 8a1220cdcd..5771edd72b 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -160,7 +160,13 @@ Editor::extend_selection_to_track (TimeAxisView& view) void Editor::select_all_tracks () { - selection->set (track_views); + TrackViewList visible_views; + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + if ((*i)->marked_for_display()) { + visible_views.push_back (*i); + } + } + selection->set (visible_views); } void diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 88d585ddc2..6c5bb2aef5 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -343,6 +343,10 @@ TimeAxisView::hide () for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) { (*i)->hide (); } + + /* if its hidden, it cannot be selected */ + + editor.get_selection().remove (this); Hiding (); } |