fix a few things related to fit-to-tracks and toggle-visual-state (from 2.0)
git-svn-id: svn://localhost/ardour2/branches/3.0@3967 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a8baa20be8
commit
085056ae03
|
@ -4522,12 +4522,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;
|
||||
|
||||
|
@ -4538,10 +4539,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -6108,16 +6108,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);
|
||||
|
||||
|
|
|
@ -242,9 +242,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;
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +263,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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,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
|
||||
|
|
|
@ -355,6 +355,10 @@ TimeAxisView::hide ()
|
|||
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
|
||||
(*i)->hide ();
|
||||
}
|
||||
|
||||
/* if its hidden, it cannot be selected */
|
||||
|
||||
editor.get_selection().remove (this);
|
||||
|
||||
Hiding ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue