Make editor independent of EditorRoutes
This commit is contained in:
parent
a274c1473a
commit
5b3eacd421
|
@ -353,6 +353,8 @@ Editor::Editor ()
|
||||||
, edit_controls_left_menu (0)
|
, edit_controls_left_menu (0)
|
||||||
, edit_controls_right_menu (0)
|
, edit_controls_right_menu (0)
|
||||||
, visual_change_queued(false)
|
, visual_change_queued(false)
|
||||||
|
, _tvl_no_redisplay(false)
|
||||||
|
, _tvl_redisplay_on_resume(false)
|
||||||
, _last_update_time (0)
|
, _last_update_time (0)
|
||||||
, _err_screen_engine (0)
|
, _err_screen_engine (0)
|
||||||
, cut_buffer_start (0)
|
, cut_buffer_start (0)
|
||||||
|
@ -1337,7 +1339,7 @@ Editor::set_session (Session *t)
|
||||||
_regions->set_session (_session);
|
_regions->set_session (_session);
|
||||||
_sources->set_session (_session);
|
_sources->set_session (_session);
|
||||||
_snapshots->set_session (_session);
|
_snapshots->set_session (_session);
|
||||||
_routes->set_session (_session);
|
//_routes->set_session (_session); // temp disabled for EditorRoutes update
|
||||||
_locations->set_session (_session);
|
_locations->set_session (_session);
|
||||||
_properties_box->set_session (_session);
|
_properties_box->set_session (_session);
|
||||||
|
|
||||||
|
@ -1353,6 +1355,7 @@ Editor::set_session (Session *t)
|
||||||
sfbrowser->set_session (_session);
|
sfbrowser->set_session (_session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initial_display ();
|
||||||
compute_fixed_ruler_scale ();
|
compute_fixed_ruler_scale ();
|
||||||
|
|
||||||
/* Make sure we have auto loop and auto punch ranges */
|
/* Make sure we have auto loop and auto punch ranges */
|
||||||
|
@ -4762,7 +4765,7 @@ Editor::use_visual_state (VisualState& vs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_routes->update_visibility ();
|
// TODO push state to PresentationInfo, force update ?
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This is the core function that controls the zoom level of the canvas. It is called
|
/** This is the core function that controls the zoom level of the canvas. It is called
|
||||||
|
@ -5410,7 +5413,7 @@ Editor::first_idle ()
|
||||||
selection->set (rs);
|
selection->set (rs);
|
||||||
|
|
||||||
/* first idle adds route children (automation tracks), so we need to redisplay here */
|
/* first idle adds route children (automation tracks), so we need to redisplay here */
|
||||||
_routes->redisplay ();
|
redisplay_track_views ();
|
||||||
|
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
|
||||||
|
@ -5586,20 +5589,35 @@ Editor::axis_views_from_routes (boost::shared_ptr<RouteList> r) const
|
||||||
void
|
void
|
||||||
Editor::suspend_route_redisplay ()
|
Editor::suspend_route_redisplay ()
|
||||||
{
|
{
|
||||||
if (_routes) {
|
_tvl_no_redisplay = true;
|
||||||
_routes->suspend_redisplay();
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Editor::queue_redisplay_track_views ()
|
||||||
|
{
|
||||||
|
if (!_tvl_redisplay_connection.connected ()) {
|
||||||
|
_tvl_redisplay_connection = Glib::signal_idle().connect (sigc::mem_fun (*this, &Editor::redisplay_track_views));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::resume_route_redisplay ()
|
Editor::resume_route_redisplay ()
|
||||||
{
|
{
|
||||||
if (_routes) {
|
_tvl_no_redisplay = false;
|
||||||
_routes->redisplay(); // queue redisplay
|
if (_tvl_redisplay_on_resume) {
|
||||||
_routes->resume_redisplay();
|
queue_redisplay_track_views ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Editor::initial_display ()
|
||||||
|
{
|
||||||
|
DisplaySuspender ds;
|
||||||
|
StripableList s;
|
||||||
|
_session->get_stripables (s);
|
||||||
|
add_stripables (s);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::add_vcas (VCAList& vlist)
|
Editor::add_vcas (VCAList& vlist)
|
||||||
{
|
{
|
||||||
|
@ -5627,10 +5645,10 @@ Editor::add_routes (RouteList& rlist)
|
||||||
void
|
void
|
||||||
Editor::add_stripables (StripableList& sl)
|
Editor::add_stripables (StripableList& sl)
|
||||||
{
|
{
|
||||||
list<TimeAxisView*> new_views;
|
|
||||||
boost::shared_ptr<VCA> v;
|
boost::shared_ptr<VCA> v;
|
||||||
boost::shared_ptr<Route> r;
|
boost::shared_ptr<Route> r;
|
||||||
TrackViewList new_selection;
|
TrackViewList new_selection;
|
||||||
|
bool changed = false;
|
||||||
bool from_scratch = (track_views.size() == 0);
|
bool from_scratch = (track_views.size() == 0);
|
||||||
|
|
||||||
sl.sort (Stripable::Sorter());
|
sl.sort (Stripable::Sorter());
|
||||||
|
@ -5645,7 +5663,10 @@ Editor::add_stripables (StripableList& sl)
|
||||||
|
|
||||||
VCATimeAxisView* vtv = new VCATimeAxisView (*this, _session, *_track_canvas);
|
VCATimeAxisView* vtv = new VCATimeAxisView (*this, _session, *_track_canvas);
|
||||||
vtv->set_vca (v);
|
vtv->set_vca (v);
|
||||||
new_views.push_back (vtv);
|
track_views.push_back (vtv);
|
||||||
|
|
||||||
|
(*s)->gui_changed.connect (*this, invalidator (*this), boost::bind (&Editor::handle_gui_changes, this, _1, _2), gui_context());
|
||||||
|
changed = true;
|
||||||
|
|
||||||
} else if ((r = boost::dynamic_pointer_cast<Route> (*s)) != 0) {
|
} else if ((r = boost::dynamic_pointer_cast<Route> (*s)) != 0) {
|
||||||
|
|
||||||
|
@ -5666,7 +5687,6 @@ Editor::add_stripables (StripableList& sl)
|
||||||
throw unknown_type();
|
throw unknown_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
new_views.push_back (rtv);
|
|
||||||
track_views.push_back (rtv);
|
track_views.push_back (rtv);
|
||||||
new_selection.push_back (rtv);
|
new_selection.push_back (rtv);
|
||||||
|
|
||||||
|
@ -5674,12 +5694,13 @@ Editor::add_stripables (StripableList& sl)
|
||||||
|
|
||||||
rtv->view()->RegionViewAdded.connect (sigc::mem_fun (*this, &Editor::region_view_added));
|
rtv->view()->RegionViewAdded.connect (sigc::mem_fun (*this, &Editor::region_view_added));
|
||||||
rtv->view()->RegionViewRemoved.connect (sigc::mem_fun (*this, &Editor::region_view_removed));
|
rtv->view()->RegionViewRemoved.connect (sigc::mem_fun (*this, &Editor::region_view_removed));
|
||||||
|
(*s)->gui_changed.connect (*this, invalidator (*this), boost::bind (&Editor::handle_gui_changes, this, _1, _2), gui_context());
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_views.size() > 0) {
|
if (changed) {
|
||||||
_routes->time_axis_views_added (new_views);
|
queue_redisplay_track_views ();
|
||||||
//_summary->routes_added (new_selection); /* XXX requires RouteTimeAxisViewList */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* note: !new_selection.empty() means that we got some routes rather
|
/* note: !new_selection.empty() means that we got some routes rather
|
||||||
|
@ -5719,8 +5740,6 @@ Editor::timeaxisview_deleted (TimeAxisView *tv)
|
||||||
|
|
||||||
RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (tv);
|
RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (tv);
|
||||||
|
|
||||||
_routes->route_removed (tv);
|
|
||||||
|
|
||||||
TimeAxisView::Children c = tv->get_child_list ();
|
TimeAxisView::Children c = tv->get_child_list ();
|
||||||
for (TimeAxisView::Children::const_iterator i = c.begin(); i != c.end(); ++i) {
|
for (TimeAxisView::Children::const_iterator i = c.begin(); i != c.end(); ++i) {
|
||||||
if (entered_track == i->get()) {
|
if (entered_track == i->get()) {
|
||||||
|
@ -5806,6 +5825,9 @@ Editor::hide_track_in_display (TimeAxisView* tv, bool apply_to_selection)
|
||||||
}
|
}
|
||||||
if (rtv) {
|
if (rtv) {
|
||||||
rtv->route()->presentation_info().set_hidden (true);
|
rtv->route()->presentation_info().set_hidden (true);
|
||||||
|
/* TODO also handle Routegroups IFF (rg->is_hidden() && !rg->is_selection())
|
||||||
|
* selection currently unconditionally hides due to above if() clause :(
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5819,21 +5841,92 @@ Editor::show_track_in_display (TimeAxisView* tv, bool move_into_view)
|
||||||
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
|
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
|
||||||
if (rtv) {
|
if (rtv) {
|
||||||
rtv->route()->presentation_info().set_hidden (false);
|
rtv->route()->presentation_info().set_hidden (false);
|
||||||
|
#if 0 // TODO see above
|
||||||
|
RouteGroup* rg = rtv->route ()->route_group ();
|
||||||
|
if (rg && rg->is_active () && rg->is_hidden () && !rg->is_select ()) {
|
||||||
|
boost::shared_ptr<RouteList> rl (rg->route_list ());
|
||||||
|
for (RouteList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
|
||||||
|
(*i)->presentation_info().set_hidden (false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (move_into_view) {
|
if (move_into_view) {
|
||||||
ensure_time_axis_view_is_visible (*tv, false);
|
ensure_time_axis_view_is_visible (*tv, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
struct TrackViewStripableSorter
|
||||||
Editor::sync_track_view_list_and_routes ()
|
|
||||||
{
|
{
|
||||||
track_views = TrackViewList (_routes->views ());
|
bool operator() (const TimeAxisView* tav_a, const TimeAxisView *tav_b)
|
||||||
|
{
|
||||||
|
StripableTimeAxisView const* stav_a = dynamic_cast<StripableTimeAxisView const*>(tav_a);
|
||||||
|
StripableTimeAxisView const* stav_b = dynamic_cast<StripableTimeAxisView const*>(tav_b);
|
||||||
|
assert (stav_a && stav_b);
|
||||||
|
|
||||||
|
boost::shared_ptr<ARDOUR::Stripable> const& a = stav_a->stripable ();
|
||||||
|
boost::shared_ptr<ARDOUR::Stripable> const& b = stav_b->stripable ();
|
||||||
|
return ARDOUR::Stripable::Sorter () (a, b);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
bool
|
||||||
|
Editor::redisplay_track_views ()
|
||||||
|
{
|
||||||
|
if (!_session || _session->deletion_in_progress()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_tvl_no_redisplay) {
|
||||||
|
_tvl_redisplay_on_resume = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TrackViewStripableSorter cmp;
|
||||||
|
track_views.sort (cmp);
|
||||||
|
|
||||||
|
uint32_t position;
|
||||||
|
TrackViewList::const_iterator i;
|
||||||
|
|
||||||
|
/* n will be the count of tracks plus children (updated by TimeAxisView::show_at),
|
||||||
|
* so we will use that to know where to put things.
|
||||||
|
*/
|
||||||
|
int n;
|
||||||
|
for (n = 0, position = 0, i = track_views.begin(); i != track_views.end(); ++i) {
|
||||||
|
TimeAxisView *tv = (*i);
|
||||||
|
|
||||||
|
if (tv->marked_for_display ()) {
|
||||||
|
position += tv->show_at (position, n, &edit_controls_vbox);
|
||||||
|
} else {
|
||||||
|
tv->hide ();
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_controls_layout_height (position);
|
||||||
|
reset_controls_layout_width ();
|
||||||
|
_full_canvas_height = position;
|
||||||
|
|
||||||
|
if ((vertical_adjustment.get_value() + _visible_canvas_height) > vertical_adjustment.get_upper()) {
|
||||||
|
/*
|
||||||
|
* We're increasing the size of the canvas while the bottom is visible.
|
||||||
|
* We scroll down to keep in step with the controls layout.
|
||||||
|
*/
|
||||||
|
vertical_adjustment.set_value (_full_canvas_height - _visible_canvas_height);
|
||||||
|
}
|
||||||
|
|
||||||
_summary->set_background_dirty();
|
_summary->set_background_dirty();
|
||||||
_group_tabs->set_dirty ();
|
_group_tabs->set_dirty ();
|
||||||
|
|
||||||
return false; // do not call again (until needed)
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Editor::handle_gui_changes (string const & what, void*)
|
||||||
|
{
|
||||||
|
if (what == "track_height" || what == "visible_tracks") {
|
||||||
|
queue_redisplay_track_views ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -868,6 +868,7 @@ private:
|
||||||
void popup_note_context_menu (ArdourCanvas::Item*, GdkEvent*);
|
void popup_note_context_menu (ArdourCanvas::Item*, GdkEvent*);
|
||||||
Gtk::Menu _note_context_menu;
|
Gtk::Menu _note_context_menu;
|
||||||
|
|
||||||
|
void initial_display ();
|
||||||
void add_stripables (ARDOUR::StripableList&);
|
void add_stripables (ARDOUR::StripableList&);
|
||||||
void add_routes (ARDOUR::RouteList&);
|
void add_routes (ARDOUR::RouteList&);
|
||||||
void timeaxisview_deleted (TimeAxisView*);
|
void timeaxisview_deleted (TimeAxisView*);
|
||||||
|
@ -1222,6 +1223,7 @@ private:
|
||||||
|
|
||||||
/* track views */
|
/* track views */
|
||||||
TrackViewList track_views;
|
TrackViewList track_views;
|
||||||
|
|
||||||
std::pair<TimeAxisView*, double> trackview_by_y_position (double, bool trackview_relative_offset = true) const;
|
std::pair<TimeAxisView*, double> trackview_by_y_position (double, bool trackview_relative_offset = true) const;
|
||||||
|
|
||||||
AxisView* axis_view_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
|
AxisView* axis_view_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
|
||||||
|
@ -1233,6 +1235,14 @@ private:
|
||||||
|
|
||||||
TrackViewList get_tracks_for_range_action () const;
|
TrackViewList get_tracks_for_range_action () const;
|
||||||
|
|
||||||
|
Gtk::VBox list_vpacker;
|
||||||
|
void queue_redisplay_track_views ();
|
||||||
|
bool redisplay_track_views ();
|
||||||
|
|
||||||
|
bool _tvl_no_redisplay;
|
||||||
|
bool _tvl_redisplay_on_resume;
|
||||||
|
sigc::connection _tvl_redisplay_connection;
|
||||||
|
|
||||||
sigc::connection super_rapid_screen_update_connection;
|
sigc::connection super_rapid_screen_update_connection;
|
||||||
void center_screen_internal (samplepos_t, float);
|
void center_screen_internal (samplepos_t, float);
|
||||||
|
|
||||||
|
@ -1533,6 +1543,7 @@ private:
|
||||||
void scroll_forward (float pages=0.8f);
|
void scroll_forward (float pages=0.8f);
|
||||||
void scroll_tracks_down ();
|
void scroll_tracks_down ();
|
||||||
void scroll_tracks_up ();
|
void scroll_tracks_up ();
|
||||||
|
void move_selected_tracks (bool);
|
||||||
void set_mark ();
|
void set_mark ();
|
||||||
void clear_markers ();
|
void clear_markers ();
|
||||||
void clear_xrun_markers ();
|
void clear_xrun_markers ();
|
||||||
|
@ -1995,6 +2006,7 @@ private:
|
||||||
void track_selection_changed ();
|
void track_selection_changed ();
|
||||||
void update_time_selection_display ();
|
void update_time_selection_display ();
|
||||||
void presentation_info_changed (PBD::PropertyChange const &);
|
void presentation_info_changed (PBD::PropertyChange const &);
|
||||||
|
void handle_gui_changes (std::string const&, void*);
|
||||||
void region_selection_changed ();
|
void region_selection_changed ();
|
||||||
void catch_up_on_midi_selection ();
|
void catch_up_on_midi_selection ();
|
||||||
sigc::connection editor_regions_selection_changed_connection;
|
sigc::connection editor_regions_selection_changed_connection;
|
||||||
|
@ -2065,10 +2077,6 @@ private:
|
||||||
|
|
||||||
Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
|
Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
|
||||||
|
|
||||||
bool sync_track_view_list_and_routes ();
|
|
||||||
|
|
||||||
Gtk::VBox list_vpacker;
|
|
||||||
|
|
||||||
/* autoscrolling */
|
/* autoscrolling */
|
||||||
|
|
||||||
sigc::connection autoscroll_connection;
|
sigc::connection autoscroll_connection;
|
||||||
|
|
|
@ -327,9 +327,9 @@ Editor::register_actions ()
|
||||||
reg_sens (editor_actions, "zoom_5_min", _("Zoom to 5 min"), sigc::bind (sigc::mem_fun(*this, &Editor::set_zoom_preset), 5 * 60 * 1000));
|
reg_sens (editor_actions, "zoom_5_min", _("Zoom to 5 min"), sigc::bind (sigc::mem_fun(*this, &Editor::set_zoom_preset), 5 * 60 * 1000));
|
||||||
reg_sens (editor_actions, "zoom_10_min", _("Zoom to 10 min"), sigc::bind (sigc::mem_fun(*this, &Editor::set_zoom_preset), 10 * 60 * 1000));
|
reg_sens (editor_actions, "zoom_10_min", _("Zoom to 10 min"), sigc::bind (sigc::mem_fun(*this, &Editor::set_zoom_preset), 10 * 60 * 1000));
|
||||||
|
|
||||||
act = reg_sens (editor_actions, "move-selected-tracks-up", _("Move Selected Tracks Up"), sigc::bind (sigc::mem_fun(*_routes, &EditorRoutes::move_selected_tracks), true));
|
act = reg_sens (editor_actions, "move-selected-tracks-up", _("Move Selected Tracks Up"), sigc::bind (sigc::mem_fun(*this, &Editor::move_selected_tracks), true));
|
||||||
ActionManager::stripable_selection_sensitive_actions.push_back (act);
|
ActionManager::stripable_selection_sensitive_actions.push_back (act);
|
||||||
act = reg_sens (editor_actions, "move-selected-tracks-down", _("Move Selected Tracks Down"), sigc::bind (sigc::mem_fun(*_routes, &EditorRoutes::move_selected_tracks), false));
|
act = reg_sens (editor_actions, "move-selected-tracks-down", _("Move Selected Tracks Down"), sigc::bind (sigc::mem_fun(*this, &Editor::move_selected_tracks), false));
|
||||||
ActionManager::stripable_selection_sensitive_actions.push_back (act);
|
ActionManager::stripable_selection_sensitive_actions.push_back (act);
|
||||||
|
|
||||||
act = reg_sens (editor_actions, "scroll-tracks-up", _("Scroll Tracks Up"), sigc::mem_fun(*this, &Editor::scroll_tracks_up));
|
act = reg_sens (editor_actions, "scroll-tracks-up", _("Scroll Tracks Up"), sigc::mem_fun(*this, &Editor::scroll_tracks_up));
|
||||||
|
|
|
@ -618,7 +618,7 @@ EditorRoutes::redisplay_real ()
|
||||||
* we can't do this here, because we could mess up something that is traversing
|
* we can't do this here, because we could mess up something that is traversing
|
||||||
* the track order and has caused a redisplay of the list.
|
* the track order and has caused a redisplay of the list.
|
||||||
*/
|
*/
|
||||||
Glib::signal_idle().connect (sigc::mem_fun (*_editor, &Editor::sync_track_view_list_and_routes));
|
//Glib::signal_idle().connect (sigc::mem_fun (*_editor, &Editor::sync_track_view_list_and_routes));
|
||||||
|
|
||||||
_editor->reset_controls_layout_height (position);
|
_editor->reset_controls_layout_height (position);
|
||||||
_editor->reset_controls_layout_width ();
|
_editor->reset_controls_layout_width ();
|
||||||
|
|
|
@ -1234,16 +1234,15 @@ Editor::presentation_info_changed (PropertyChange const & what_changed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STEP 4: update EditorRoutes treeview */
|
/* STEP 4: update Editor::track_views */
|
||||||
|
|
||||||
PropertyChange soh;
|
PropertyChange soh;
|
||||||
|
|
||||||
soh.add (Properties::selected);
|
|
||||||
soh.add (Properties::order);
|
soh.add (Properties::order);
|
||||||
soh.add (Properties::hidden);
|
soh.add (Properties::hidden);
|
||||||
|
|
||||||
if (what_changed.contains (soh)) {
|
if (what_changed.contains (soh)) {
|
||||||
_routes->sync_treeview_from_presentation_info (what_changed);
|
queue_redisplay_track_views ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2349,3 +2348,118 @@ Editor::catch_up_on_midi_selection ()
|
||||||
selection->set (regions);
|
selection->set (regions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ViewStripable {
|
||||||
|
TimeAxisView* tav;
|
||||||
|
boost::shared_ptr<Stripable> stripable;
|
||||||
|
|
||||||
|
ViewStripable (TimeAxisView* t, boost::shared_ptr<Stripable> s)
|
||||||
|
: tav (t), stripable (s) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
Editor::move_selected_tracks (bool up)
|
||||||
|
{
|
||||||
|
TimeAxisView* scroll_to = 0;
|
||||||
|
StripableList sl;
|
||||||
|
_session->get_stripables (sl);
|
||||||
|
|
||||||
|
if (sl.size() < 2) {
|
||||||
|
/* nope */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sl.sort (Stripable::Sorter());
|
||||||
|
|
||||||
|
std::list<ViewStripable> view_stripables;
|
||||||
|
|
||||||
|
/* build a list that includes time axis view information */
|
||||||
|
|
||||||
|
for (StripableList::const_iterator sli = sl.begin(); sli != sl.end(); ++sli) {
|
||||||
|
TimeAxisView* tv = time_axis_view_from_stripable (*sli);
|
||||||
|
view_stripables.push_back (ViewStripable (tv, *sli));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for each selected stripable, move it above or below the adjacent
|
||||||
|
* stripable that has a time-axis view representation here. If there's
|
||||||
|
* no such representation, then
|
||||||
|
*/
|
||||||
|
|
||||||
|
list<ViewStripable>::iterator unselected_neighbour;
|
||||||
|
list<ViewStripable>::iterator vsi;
|
||||||
|
|
||||||
|
{
|
||||||
|
PresentationInfo::ChangeSuspender cs;
|
||||||
|
|
||||||
|
if (up) {
|
||||||
|
unselected_neighbour = view_stripables.end ();
|
||||||
|
vsi = view_stripables.begin();
|
||||||
|
|
||||||
|
while (vsi != view_stripables.end()) {
|
||||||
|
|
||||||
|
if (vsi->stripable->is_selected()) {
|
||||||
|
|
||||||
|
if (unselected_neighbour != view_stripables.end()) {
|
||||||
|
|
||||||
|
PresentationInfo::order_t unselected_neighbour_order = unselected_neighbour->stripable->presentation_info().order();
|
||||||
|
PresentationInfo::order_t my_order = vsi->stripable->presentation_info().order();
|
||||||
|
|
||||||
|
unselected_neighbour->stripable->set_presentation_order (my_order);
|
||||||
|
vsi->stripable->set_presentation_order (unselected_neighbour_order);
|
||||||
|
|
||||||
|
if (!scroll_to) {
|
||||||
|
scroll_to = vsi->tav;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (vsi->tav) {
|
||||||
|
unselected_neighbour = vsi;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
++vsi;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
unselected_neighbour = view_stripables.end();
|
||||||
|
vsi = unselected_neighbour;
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
--vsi;
|
||||||
|
|
||||||
|
if (vsi->stripable->is_selected()) {
|
||||||
|
|
||||||
|
if (unselected_neighbour != view_stripables.end()) {
|
||||||
|
|
||||||
|
PresentationInfo::order_t unselected_neighbour_order = unselected_neighbour->stripable->presentation_info().order();
|
||||||
|
PresentationInfo::order_t my_order = vsi->stripable->presentation_info().order();
|
||||||
|
|
||||||
|
unselected_neighbour->stripable->set_presentation_order (my_order);
|
||||||
|
vsi->stripable->set_presentation_order (unselected_neighbour_order);
|
||||||
|
|
||||||
|
if (!scroll_to) {
|
||||||
|
scroll_to = vsi->tav;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (vsi->tav) {
|
||||||
|
unselected_neighbour = vsi;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (vsi != view_stripables.begin());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scroll_to) {
|
||||||
|
ensure_time_axis_view_is_visible (*scroll_to, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user