From 3087be2c8a43bcfda69b83fabaf9df69553e96c2 Mon Sep 17 00:00:00 2001 From: GZharun Date: Tue, 20 Jan 2015 13:58:23 +0200 Subject: [PATCH] [Summary] Marker changes will make session dirty --- gtk2_ardour/marker.cc | 2 + gtk2_ardour/marker_inspector_dialog.logic.cc | 5 +- libs/ardour/ardour/session.h | 7 +- libs/ardour/session.cc | 70 ++++++++++++++------ libs/ardour/session_transport.cc | 2 + 5 files changed, 61 insertions(+), 25 deletions(-) diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 4c6b26e808..baaa2a51fe 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -482,6 +482,8 @@ Marker::set_selected (bool yn) reset_color (); } } + + ARDOUR_UI::instance()->set_session_dirty (); } void diff --git a/gtk2_ardour/marker_inspector_dialog.logic.cc b/gtk2_ardour/marker_inspector_dialog.logic.cc index c2c76e1dea..a149880cbc 100644 --- a/gtk2_ardour/marker_inspector_dialog.logic.cc +++ b/gtk2_ardour/marker_inspector_dialog.logic.cc @@ -115,9 +115,7 @@ MarkerInspectorDialog::_enable_program_change (bool yn) void MarkerInspectorDialog::_set_session_dirty () { - if (ARDOUR_UI::instance ()->the_editor ().session ()) { - ARDOUR_UI::instance ()->the_editor ().session ()->set_dirty (); - } + ARDOUR_UI::instance()->set_session_dirty (); } @@ -130,7 +128,6 @@ MarkerInspectorDialog::_lock_button_clicked (WavesButton *button) } else { _marker->location()->lock (); } - _set_session_dirty (); } } diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 04c2636f49..8301d40928 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1236,9 +1236,14 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void _locations_changed (const Locations::LocationList&); void update_skips (Location*, bool consolidate); + void update_marks (Location* loc); + void update_loop (Location* loc); Locations::LocationList consolidate_skips (Location*); void sync_locations_to_skips (const Locations::LocationList&); - PBD::ScopedConnectionList skip_connections; + + PBD::ScopedConnectionList loop_update_connections; + PBD::ScopedConnectionList mark_update_connections; + PBD::ScopedConnectionList skip_update_connections; PBD::ScopedConnectionList punch_connections; void auto_punch_start_changed (Location *); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index c76d435f05..27208ae9cf 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1397,6 +1397,18 @@ Session::set_auto_loop_location (Location* location) auto_loop_location_changed (location); } +void +Session::update_loop (Location* loc) +{ + set_dirty (); +} + +void +Session::update_marks (Location* loc) +{ + set_dirty (); +} + void Session::update_skips (Location* loc, bool consolidate) { @@ -1417,6 +1429,8 @@ Session::update_skips (Location* loc, bool consolidate) } sync_locations_to_skips (skips); + + set_dirty (); } Locations::LocationList @@ -1486,31 +1500,47 @@ Session::sync_locations_to_skips (const Locations::LocationList& locations) void Session::location_added (Location *location) { - if (location->is_auto_punch()) { - set_auto_punch_location (location); - } + if (location->is_auto_punch()) { + set_auto_punch_location (location); + } - if (location->is_auto_loop()) { - set_auto_loop_location (location); - } + if (location->is_auto_loop()) { + location->StartChanged.connect_same_thread (loop_update_connections, boost::bind (&Session::update_loop, this, location)); + location->EndChanged.connect_same_thread (loop_update_connections, boost::bind (&Session::update_loop, this, location)); + location->Changed.connect_same_thread (loop_update_connections, boost::bind (&Session::update_loop, this, location)); + location->FlagsChanged.connect_same_thread (loop_update_connections, boost::bind (&Session::update_loop, this, location)); - if (location->is_session_range()) { - /* no need for any signal handling or event setting with the session range, - because we keep a direct reference to it and use its start/end directly. - */ - _session_range_location = location; - } + set_auto_loop_location (location); + } + + if (location->is_session_range()) { + /* no need for any signal handling or event setting with the session range, + because we keep a direct reference to it and use its start/end directly. + */ + _session_range_location = location; + } - if (location->is_skip()) { - /* listen for per-location signals that require us to update skip-locate events */ + if (location->is_mark()) { + /* listen for per-location signals that require us to update skip-locate events */ + + location->StartChanged.connect_same_thread (mark_update_connections, boost::bind (&Session::update_marks, this, location)); + location->Changed.connect_same_thread (mark_update_connections, boost::bind (&Session::update_marks, this, location)); + location->FlagsChanged.connect_same_thread (mark_update_connections, boost::bind (&Session::update_marks, this, location)); + location->LockChanged.connect_same_thread (mark_update_connections, boost::bind (&Session::update_marks, this, location)); + location->NameChanged.connect_same_thread (mark_update_connections, boost::bind (&Session::update_marks, this, location)); + } - location->StartChanged.connect_same_thread (skip_connections, boost::bind (&Session::update_skips, this, location, true)); - location->EndChanged.connect_same_thread (skip_connections, boost::bind (&Session::update_skips, this, location, true)); - location->Changed.connect_same_thread (skip_connections, boost::bind (&Session::update_skips, this, location, true)); - location->FlagsChanged.connect_same_thread (skip_connections, boost::bind (&Session::update_skips, this, location, false)); + + if (location->is_skip()) { + /* listen for per-location signals that require us to update skip-locate events */ - update_skips (location, true); - } + location->StartChanged.connect_same_thread (skip_update_connections, boost::bind (&Session::update_skips, this, location, true)); + location->EndChanged.connect_same_thread (skip_update_connections, boost::bind (&Session::update_skips, this, location, true)); + location->Changed.connect_same_thread (skip_update_connections, boost::bind (&Session::update_skips, this, location, true)); + location->FlagsChanged.connect_same_thread (skip_update_connections, boost::bind (&Session::update_skips, this, location, false)); + + update_skips (location, true); + } set_dirty (); } diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index de495b8155..a37c810234 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -877,6 +877,8 @@ Session::set_play_loop (bool yn, double speed) } DEBUG_TRACE (DEBUG::Transport, string_compose ("send TSC2 with speed = %1\n", _transport_speed)); + + set_dirty (); TransportStateChange (); } void