diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index e49c92666e..0c7e32f909 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -76,7 +76,7 @@ #include "ardour/types.h" #include "ardour/utils.h" #include "ardour/plugin.h" -#include "ardour/session_handle.h" +#include "ardour/session_controller_handle.h" #include "ardour/system_exec.h" #include "video_timeline.h" @@ -187,7 +187,7 @@ namespace ArdourWidgets { #define MAX_LUA_ACTION_SCRIPTS 32 #define MAX_LUA_ACTION_BUTTONS 12 -class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr, public TransportControlProvider +class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionControllerHandlePtr, public TransportControlProvider { public: ARDOUR_UI (int *argcp, char **argvp[], const char* localedir); diff --git a/libs/ardour/ardour/session_controller_handle.h b/libs/ardour/ardour/session_controller_handle.h new file mode 100644 index 0000000000..2443eda388 --- /dev/null +++ b/libs/ardour/ardour/session_controller_handle.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009-2017 Paul Davis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __libardour_session_controller_handle_h__ +#define __libardour_session_controller_handle_h__ + +#include "ardour/libardour_visibility.h" +#include "ardour/session_controller.h" +#include "ardour/session_handle.h" + +namespace ARDOUR { + +class Session; +class SessionController; + +class LIBARDOUR_API SessionControllerHandleRef : public SessionHandleRef +{ + public: + SessionControllerHandleRef (Session& s); + + virtual ~SessionControllerHandleRef (); + + protected: + SessionController _controller; +}; + +class LIBARDOUR_API SessionControllerHandlePtr : public SessionHandlePtr +{ + public: + SessionControllerHandlePtr (Session* s); + SessionControllerHandlePtr (); + + virtual ~SessionControllerHandlePtr (); + + virtual void set_session (Session *); + + protected: + SessionController _controller; +}; + +} /* namespace */ + +#endif /* __libardour_session_controller_handle_h__ */ diff --git a/libs/ardour/session_controller_handle.cc b/libs/ardour/session_controller_handle.cc new file mode 100644 index 0000000000..284483f3a5 --- /dev/null +++ b/libs/ardour/session_controller_handle.cc @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2009-2016 Paul Davis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "pbd/demangle.h" +#include "pbd/error.h" + +#include "ardour/boost_debug.h" +#include "ardour/session.h" +#include "ardour/session_controller.h" +#include "ardour/session_controller_handle.h" + +#include "pbd/i18n.h" + +using namespace std; +using namespace ARDOUR; +using namespace PBD; + +SessionControllerHandleRef::SessionControllerHandleRef (Session& s) + : SessionHandleRef (s) + , _controller (&s) +{ + _session.DropReferences.connect_same_thread (*this, boost::bind (&SessionControllerHandleRef::session_going_away, this)); + _session.Destroyed.connect_same_thread (*this, boost::bind (&SessionControllerHandleRef::insanity_check, this)); +} + +SessionControllerHandleRef::~SessionControllerHandleRef () +{ +} + +/*-------------------------*/ + +SessionControllerHandlePtr::SessionControllerHandlePtr (Session* s) + : SessionHandlePtr (s) + , _controller (s) +{ +} + +SessionControllerHandlePtr::SessionControllerHandlePtr () + : SessionHandlePtr () + , _controller (NULL) +{ +} + +SessionControllerHandlePtr::~SessionControllerHandlePtr () +{ +} + +void +SessionControllerHandlePtr::set_session (Session* s) +{ + SessionHandlePtr::set_session (s); + + _controller = SessionController (s); +} diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 57e47b9145..f9dd2d9d4b 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -214,6 +214,7 @@ libardour_sources = [ 'session_command.cc', 'session_configuration.cc', 'session_controller.cc', + 'session_controller_handle.cc', 'session_directory.cc', 'session_events.cc', 'session_export.cc',