From c25e35f2d4ca970c6e7ed12f6dcffecf3513a074 Mon Sep 17 00:00:00 2001 From: GZharun Date: Tue, 20 Jan 2015 16:25:26 +0200 Subject: [PATCH] [Summary] Fixed several issues which made session dirty when it's just loaded or created from scratch --- gtk2_ardour/ardour_ui.cc | 11 +++++++---- gtk2_ardour/ardour_ui_dialogs.cc | 3 +-- libs/ardour/ardour/session.h | 2 ++ libs/ardour/session.cc | 2 +- libs/ardour/session_state.cc | 34 +++++++++++++++++++++----------- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 75f3e76e6d..673fa1135d 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -3042,6 +3042,8 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri */ ARDOUR_COMMAND_LINE::session_name = ""; + + return ret; } } @@ -3165,10 +3167,6 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, goto_editor_window (); - if (_session) { - _session->set_clean (); - } - #ifdef WINDOWS_VST_SUPPORT fst_stop_threading(); #endif @@ -3176,6 +3174,11 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, #ifdef WINDOWS_VST_SUPPORT fst_start_threading(); #endif + + if (_session) { + _session->set_clean (); + } + retval = 0; out: diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 5a3fb9645f..000df5943c 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -395,6 +395,7 @@ void ARDOUR_UI::toggle_meterbridge () { show_meterbridge_view (); + set_session_dirty (); } void @@ -423,8 +424,6 @@ ARDOUR_UI::show_meterbridge_view () editor->get_container ("edit_pane").show (); editor->get_container ("compact_meter_bridge_home").show (); } - - set_session_dirty (); } void diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 8301d40928..823c41169a 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1260,6 +1260,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop int immediately_post_engine (); void remove_empty_sounds (); + void session_loaded (); + void setup_midi_control (); int midi_read (MIDI::Port *); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 27208ae9cf..212f257141 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -430,7 +430,7 @@ Session::Session (AudioEngine &eng, _is_new = false; - SessionLoaded(); + session_loaded (); BootMessage (_("Session loading complete")); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 6bfbb770c1..9025a12f8f 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -344,23 +344,31 @@ Session::post_engine_init () ltc_tx_initialize(); /* initial program change will be delivered later; see ::config_changed() */ - _state_of_the_state = Clean; + Port::set_connecting_blocked (false); - DirtyChanged (); /* EMIT SIGNAL */ - - if (_is_new) { - save_state (""); - } else if (state_was_pending) { - save_state (""); - remove_pending_capture_state (); - state_was_pending = false; - } - return 0; } +void +Session::session_loaded () +{ + SessionLoaded(); + + _state_of_the_state = Clean; + + DirtyChanged (); /* EMIT SIGNAL */ + + if (_is_new) { + save_state (""); + } else if (state_was_pending) { + save_state (""); + remove_pending_capture_state (); + state_was_pending = false; + } +} + string Session::raid_path () const { @@ -2995,6 +3003,10 @@ Session::set_dirty () if (_state_of_the_state & Loading) { return; } + + if (_state_of_the_state & Deletion) { + return; + } bool was_dirty = dirty();