switch to using boost::signals2 instead of sigc++, at least for libardour. not finish...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 17 Dec 2009 18:24:23 +0000 (18:24 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 17 Dec 2009 18:24:23 +0000 (18:24 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6372 d708f5d6-7413-0410-9779-e7cbd77b26cf

352 files changed:
gtk2_ardour/add_route_dialog.cc
gtk2_ardour/add_route_dialog.h
gtk2_ardour/analysis_window.cc
gtk2_ardour/analysis_window.h
gtk2_ardour/ardour_dialog.cc
gtk2_ardour/ardour_dialog.h
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_dependents.cc
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/audio_clock.h
gtk2_ardour/audio_region_editor.cc
gtk2_ardour/audio_region_editor.h
gtk2_ardour/audio_region_view.cc
gtk2_ardour/audio_streamview.cc
gtk2_ardour/audio_time_axis.cc
gtk2_ardour/audio_time_axis.h
gtk2_ardour/automation_line.cc
gtk2_ardour/automation_line.h
gtk2_ardour/automation_region_view.cc
gtk2_ardour/automation_selectable.h
gtk2_ardour/automation_streamview.cc
gtk2_ardour/automation_time_axis.cc
gtk2_ardour/automation_time_axis.h
gtk2_ardour/axis_view.cc
gtk2_ardour/axis_view.h
gtk2_ardour/bundle_manager.cc
gtk2_ardour/bundle_manager.h
gtk2_ardour/crossfade_edit.cc
gtk2_ardour/crossfade_edit.h
gtk2_ardour/crossfade_view.cc
gtk2_ardour/crossfade_view.h
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_audio_import.cc
gtk2_ardour/editor_audiotrack.cc
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_component.cc
gtk2_ardour/editor_component.h
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_drag.h
gtk2_ardour/editor_export_audio.cc
gtk2_ardour/editor_imageframe.cc
gtk2_ardour/editor_keyboard.cc
gtk2_ardour/editor_keys.cc
gtk2_ardour/editor_locations.cc
gtk2_ardour/editor_locations.h
gtk2_ardour/editor_markers.cc
gtk2_ardour/editor_mixer.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_regions.cc
gtk2_ardour/editor_regions.h
gtk2_ardour/editor_route_groups.cc
gtk2_ardour/editor_route_groups.h
gtk2_ardour/editor_routes.cc
gtk2_ardour/editor_routes.h
gtk2_ardour/editor_rulers.cc
gtk2_ardour/editor_selection.cc
gtk2_ardour/editor_snapshots.cc
gtk2_ardour/editor_snapshots.h
gtk2_ardour/editor_summary.cc
gtk2_ardour/editor_summary.h
gtk2_ardour/editor_tempodisplay.cc
gtk2_ardour/editor_timefx.cc
gtk2_ardour/export_channel_selector.cc
gtk2_ardour/export_channel_selector.h
gtk2_ardour/export_dialog.cc
gtk2_ardour/export_file_notebook.cc
gtk2_ardour/export_file_notebook.h
gtk2_ardour/export_filename_selector.cc
gtk2_ardour/export_filename_selector.h
gtk2_ardour/export_format_dialog.cc
gtk2_ardour/export_format_selector.cc
gtk2_ardour/export_format_selector.h
gtk2_ardour/export_timespan_selector.cc
gtk2_ardour/export_timespan_selector.h
gtk2_ardour/gain_meter.cc
gtk2_ardour/gain_meter.h
gtk2_ardour/ghostregion.cc
gtk2_ardour/ghostregion.h
gtk2_ardour/group_tabs.cc
gtk2_ardour/group_tabs.h
gtk2_ardour/imageframe_socket_handler.cc
gtk2_ardour/imageframe_time_axis.cc
gtk2_ardour/imageframe_time_axis.h
gtk2_ardour/imageframe_time_axis_group.cc
gtk2_ardour/imageframe_time_axis_view.cc
gtk2_ardour/imageframe_view.cc
gtk2_ardour/io_selector.h
gtk2_ardour/level_meter.cc
gtk2_ardour/level_meter.h
gtk2_ardour/location_ui.cc
gtk2_ardour/location_ui.h
gtk2_ardour/marker_time_axis.cc
gtk2_ardour/marker_time_axis.h
gtk2_ardour/marker_time_axis_view.cc
gtk2_ardour/midi_cut_buffer.cc
gtk2_ardour/midi_cut_buffer.h
gtk2_ardour/midi_list_editor.cc
gtk2_ardour/midi_list_editor.h
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h
gtk2_ardour/midi_streamview.cc
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/midi_time_axis.h
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h
gtk2_ardour/panner_ui.cc
gtk2_ardour/panner_ui.h
gtk2_ardour/playlist_selector.cc
gtk2_ardour/playlist_selector.h
gtk2_ardour/plugin_selector.cc
gtk2_ardour/plugin_selector.h
gtk2_ardour/plugin_ui.cc
gtk2_ardour/plugin_ui.h
gtk2_ardour/point_selection.h
gtk2_ardour/port_group.cc
gtk2_ardour/port_group.h
gtk2_ardour/port_matrix.cc
gtk2_ardour/port_matrix.h
gtk2_ardour/port_matrix_body.cc
gtk2_ardour/port_matrix_body.h
gtk2_ardour/port_matrix_column_labels.cc
gtk2_ardour/port_matrix_component.cc
gtk2_ardour/port_matrix_grid.cc
gtk2_ardour/port_matrix_row_labels.cc
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h
gtk2_ardour/public_editor.h
gtk2_ardour/region_editor.h
gtk2_ardour/region_gain_line.cc
gtk2_ardour/region_gain_line.h
gtk2_ardour/region_selection.cc
gtk2_ardour/region_selection.h
gtk2_ardour/region_view.cc
gtk2_ardour/region_view.h
gtk2_ardour/return_ui.cc
gtk2_ardour/return_ui.h
gtk2_ardour/rhythm_ferret.cc
gtk2_ardour/route_group_menu.cc
gtk2_ardour/route_group_menu.h
gtk2_ardour/route_params_ui.cc
gtk2_ardour/route_params_ui.h
gtk2_ardour/route_processor_selection.cc
gtk2_ardour/route_processor_selection.h
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
gtk2_ardour/route_ui.cc
gtk2_ardour/route_ui.h
gtk2_ardour/selection.cc
gtk2_ardour/selection.h
gtk2_ardour/send_ui.cc
gtk2_ardour/send_ui.h
gtk2_ardour/session_import_dialog.cc
gtk2_ardour/session_import_dialog.h
gtk2_ardour/session_metadata_dialog.cc
gtk2_ardour/session_metadata_dialog.h
gtk2_ardour/sfdb_ui.cc
gtk2_ardour/sfdb_ui.h
gtk2_ardour/streamview.cc
gtk2_ardour/streamview.h
gtk2_ardour/strip_silence_dialog.cc
gtk2_ardour/strip_silence_dialog.h
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h
gtk2_ardour/time_axis_view_item.h
gtk2_ardour/visual_time_axis.cc
gtk2_ardour/visual_time_axis.h
libs/ardour/ardour/ardour.h
libs/ardour/ardour/audio_diskstream.h
libs/ardour/ardour/audioengine.h
libs/ardour/ardour/audiofilesource.h
libs/ardour/ardour/audioplaylist.h
libs/ardour/ardour/audiosource.h
libs/ardour/ardour/automation_list.h
libs/ardour/ardour/bundle.h
libs/ardour/ardour/butler.h
libs/ardour/ardour/configuration.h
libs/ardour/ardour/control_protocol_manager.h
libs/ardour/ardour/crossfade.h
libs/ardour/ardour/delivery.h
libs/ardour/ardour/diskstream.h
libs/ardour/ardour/element_importer.h
libs/ardour/ardour/export.h
libs/ardour/ardour/export_channel.h
libs/ardour/ardour/export_channel_configuration.h
libs/ardour/ardour/export_format_base.h
libs/ardour/ardour/export_format_manager.h
libs/ardour/ardour/export_formats.h
libs/ardour/ardour/export_handler.h
libs/ardour/ardour/export_multiplication.h
libs/ardour/ardour/export_processor.h
libs/ardour/ardour/export_profile_manager.h
libs/ardour/ardour/export_status.h
libs/ardour/ardour/export_timespan.h
libs/ardour/ardour/import_status.h
libs/ardour/ardour/internal_return.h
libs/ardour/ardour/internal_send.h
libs/ardour/ardour/io.h
libs/ardour/ardour/io_processor.h
libs/ardour/ardour/jack_port.h
libs/ardour/ardour/ladspa_plugin.h
libs/ardour/ardour/location.h
libs/ardour/ardour/lv2_plugin.h
libs/ardour/ardour/meter.h
libs/ardour/ardour/midi_diskstream.h
libs/ardour/ardour/midi_model.h
libs/ardour/ardour/midi_patch_manager.h
libs/ardour/ardour/midi_source.h
libs/ardour/ardour/midi_ui.h
libs/ardour/ardour/mute_master.h
libs/ardour/ardour/named_selection.h
libs/ardour/ardour/panner.h
libs/ardour/ardour/playlist.h
libs/ardour/ardour/playlist_factory.h
libs/ardour/ardour/plugin.h
libs/ardour/ardour/plugin_insert.h
libs/ardour/ardour/plugin_manager.h
libs/ardour/ardour/port.h
libs/ardour/ardour/port_insert.h
libs/ardour/ardour/processor.h
libs/ardour/ardour/region.h
libs/ardour/ardour/region_factory.h
libs/ardour/ardour/return.h
libs/ardour/ardour/route.h
libs/ardour/ardour/route_group.h
libs/ardour/ardour/route_group_member.h
libs/ardour/ardour/send.h
libs/ardour/ardour/session.h
libs/ardour/ardour/session_event.h
libs/ardour/ardour/session_handle.h [new file with mode: 0644]
libs/ardour/ardour/session_object.h
libs/ardour/ardour/session_playlists.h
libs/ardour/ardour/slave.h
libs/ardour/ardour/source.h
libs/ardour/ardour/source_factory.h
libs/ardour/ardour/tempo.h
libs/ardour/ardour/ticker.h
libs/ardour/ardour/track.h
libs/ardour/ardour/vst_plugin.h
libs/ardour/audio_diskstream.cc
libs/ardour/audio_playlist.cc
libs/ardour/audio_playlist_importer.cc
libs/ardour/audio_track.cc
libs/ardour/audio_track_importer.cc
libs/ardour/audioengine.cc
libs/ardour/audiofilesource.cc
libs/ardour/audioregion.cc
libs/ardour/audiosource.cc
libs/ardour/auditioner.cc
libs/ardour/automation_list.cc
libs/ardour/butler.cc
libs/ardour/control_protocol_manager.cc
libs/ardour/coreaudiosource.cc
libs/ardour/crossfade.cc
libs/ardour/delivery.cc
libs/ardour/diskstream.cc
libs/ardour/element_importer.cc
libs/ardour/export_channel.cc
libs/ardour/export_format_manager.cc
libs/ardour/export_formats.cc
libs/ardour/export_handler.cc
libs/ardour/export_processor.cc
libs/ardour/globals.cc
libs/ardour/internal_return.cc
libs/ardour/internal_send.cc
libs/ardour/io.cc
libs/ardour/io_processor.cc
libs/ardour/ladspa_plugin.cc
libs/ardour/location.cc
libs/ardour/location_importer.cc
libs/ardour/lv2_plugin.cc
libs/ardour/meter.cc
libs/ardour/midi_clock_slave.cc
libs/ardour/midi_diskstream.cc
libs/ardour/midi_model.cc
libs/ardour/midi_patch_manager.cc
libs/ardour/midi_playlist.cc
libs/ardour/midi_region.cc
libs/ardour/midi_source.cc
libs/ardour/midi_track.cc
libs/ardour/midi_ui.cc
libs/ardour/mtc_slave.cc
libs/ardour/named_selection.cc
libs/ardour/playlist.cc
libs/ardour/playlist_factory.cc
libs/ardour/plugin_insert.cc
libs/ardour/port_insert.cc
libs/ardour/processor.cc
libs/ardour/region.cc
libs/ardour/region_factory.cc
libs/ardour/return.cc
libs/ardour/route.cc
libs/ardour/route_group.cc
libs/ardour/send.cc
libs/ardour/session.cc
libs/ardour/session_command.cc
libs/ardour/session_export.cc
libs/ardour/session_handle.cc [new file with mode: 0644]
libs/ardour/session_midi.cc
libs/ardour/session_playlists.cc
libs/ardour/session_state.cc
libs/ardour/session_transport.cc
libs/ardour/sndfilesource.cc
libs/ardour/source.cc
libs/ardour/source_factory.cc
libs/ardour/tempo.cc
libs/ardour/ticker.cc
libs/ardour/track.cc
libs/ardour/vst_plugin.cc
libs/ardour/wscript
libs/gtkmm2ext/binding_proxy.cc
libs/gtkmm2ext/gtkmm2ext/binding_proxy.h
libs/gtkmm2ext/gtkmm2ext/gtk_ui.h
libs/midi++2/channel.cc
libs/midi++2/midi++/channel.h
libs/midi++2/midi++/manager.h
libs/midi++2/midi++/mmc.h
libs/midi++2/midi++/parser.h
libs/midi++2/midi++/port.h
libs/midi++2/mmc.cc
libs/midi++2/parser.cc
libs/pbd/controllable.cc
libs/pbd/pbd/command.h
libs/pbd/pbd/controllable.h
libs/pbd/pbd/destructible.h
libs/pbd/pbd/memento_command.h
libs/pbd/pbd/statefuldestructible.h
libs/pbd/pbd/undo.h
libs/pbd/stateful.cc
libs/pbd/undo.cc
libs/pbd/wscript
libs/surfaces/generic_midi/generic_midi_control_protocol.cc
libs/surfaces/generic_midi/midicontrollable.cc
libs/surfaces/generic_midi/midicontrollable.h
libs/surfaces/mackie/controls.h
libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/mackie_control_protocol.h
libs/surfaces/mackie/mackie_port.cc
libs/surfaces/mackie/mackie_port.h
libs/surfaces/mackie/route_signal.cc
libs/surfaces/mackie/route_signal.h
libs/surfaces/mackie/surface_port.h
libs/surfaces/osc/osc.cc
libs/surfaces/osc/osc.h

index a828caeb92b8c58ee5d0c07d1b73e173432c68ba..a3d3deaea5bd801d3c12e795f488450ff95a1ef1 100644 (file)
@@ -61,13 +61,14 @@ std::vector<std::string> AddRouteDialog::channel_combo_strings;
 std::vector<std::string> AddRouteDialog::track_mode_strings;
 std::vector<std::string> AddRouteDialog::bus_mode_strings;
 
-AddRouteDialog::AddRouteDialog (Session & s)
+AddRouteDialog::AddRouteDialog (Session* s)
        : ArdourDialog (X_("add route dialog"))
-       , _session (s)
        , routes_adjustment (1, 1, 128, 1, 4)
        , routes_spinner (routes_adjustment)
        , mode_label (_("Track mode:"))
 {
+       set_session (s);
+
        if (track_mode_strings.empty()) {
                track_mode_strings = I18N (track_mode_names);
 
@@ -391,7 +392,7 @@ AddRouteDialog::route_group ()
                return 0;
        }
 
-       return _session.route_group_by_name (route_group_combo.get_active_text());
+       return _session->route_group_by_name (route_group_combo.get_active_text());
 }
 
 void
@@ -404,7 +405,7 @@ AddRouteDialog::refill_route_groups ()
 
        route_group_combo.append_text (_("No group"));
 
-       _session.foreach_route_group (sigc::mem_fun (*this, &AddRouteDialog::add_route_group));
+       _session->foreach_route_group (sigc::mem_fun (*this, &AddRouteDialog::add_route_group));
 
        route_group_combo.set_active (2);
 }
@@ -412,14 +413,14 @@ AddRouteDialog::refill_route_groups ()
 void
 AddRouteDialog::group_changed ()
 {
-       if (route_group_combo.get_active_text () == _("New group...")) {
-               RouteGroup* g = new RouteGroup (_session, "", RouteGroup::Active);
+       if (_session && route_group_combo.get_active_text () == _("New group...")) {
+               RouteGroup* g = new RouteGroup (*_session, "", RouteGroup::Active);
 
                RouteGroupDialog d (g, Gtk::Stock::NEW);
                int const r = d.do_run ();
 
                if (r == Gtk::RESPONSE_OK) {
-                       _session.add_route_group (g);
+                       _session->add_route_group (g);
                        add_route_group (g);
                        route_group_combo.set_active (3);
                } else {
index 7af8b47d8d3a9f47a81216e24477d4cc0c2eecd5..14222703317004f34e7a59064a1898d1433203d3 100644 (file)
@@ -42,7 +42,7 @@ class Editor;
 class AddRouteDialog : public ArdourDialog
 {
   public:
-       AddRouteDialog (ARDOUR::Session &);
+       AddRouteDialog (ARDOUR::Session*);
        ~AddRouteDialog ();
 
        bool track ();
@@ -58,7 +58,6 @@ class AddRouteDialog : public ArdourDialog
        ARDOUR::RouteGroup* route_group ();
 
   private:
-       ARDOUR::Session& _session;
        Gtk::Entry name_template_entry;
        Gtk::ComboBoxText track_bus_combo;
        Gtk::Adjustment routes_adjustment;
index c916678646ddef86ad97b4f50a84ddcd205f4ef2..6d858732ff91e4574d0bac284a5ee7683f466dbc 100644 (file)
@@ -250,7 +250,7 @@ AnalysisWindow::analyze_data (Gtk::Button */*button*/)
                Sample *mixbuf = (Sample *) malloc(sizeof(Sample) * fft_graph.windowSize());
                float  *gain   = (float *)  malloc(sizeof(float) * fft_graph.windowSize());
 
-               Selection s = PublicEditor::instance().get_selection();
+               Selection& s (PublicEditor::instance().get_selection());
                TimeSelection ts = s.time;
                RegionSelection ars = s.regions;
 
index 05b983fb20bf7be3d8e1473e0aa3d176d9d2b346..19ef84069af7a0f819406cce0593d74dbcdc5cc9 100644 (file)
@@ -37,6 +37,8 @@
 
 #include <glibmm/thread.h>
 
+#include "ardour/session_handle.h"
+
 #include "fft_graph.h"
 #include "fft_result.h"
 
@@ -44,7 +46,8 @@ namespace ARDOUR {
        class Session;
 }
 
-class AnalysisWindow : public Gtk::Window
+
+class AnalysisWindow : public Gtk::Window, public ARDOUR::SessionHandlePtr
 {
 public:
        AnalysisWindow  ();
@@ -57,12 +60,7 @@ public:
 
        void analyze ();
 
-       void set_session(ARDOUR::Session *session) { _session = session; };
-
 private:
-
-       ARDOUR::Session *_session;
-
        void clear_tracklist();
 
        void source_selection_changed (Gtk::RadioButton *);
index cafb356d60d4e16378dcb0ffb5c75cb49985e2b0..cd95666b16f120b3fd85fa2c5b12cc12b4ce68cc 100644 (file)
@@ -90,7 +90,6 @@ ArdourDialog::on_show ()
 void
 ArdourDialog::init ()
 {
-       session = 0;
        set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
        set_border_width (10);
        CloseAllDialogs.connect (sigc::bind (sigc::mem_fun (*this, &ArdourDialog::response), RESPONSE_CANCEL));
index cd0fce41625faced5eee71a10dffc8542b4bd33e..bd74afc47d21a6e013834b69a0ec5e18c4a20e96 100644 (file)
 #ifndef __ardour_dialog_h__
 #define __ardour_dialog_h__
 
-#include "ardour/ardour.h"
 #include <gtkmm/window.h>
 #include <gtkmm/dialog.h>
 
+#include "ardour/ardour.h"
+#include "ardour/session_handle.h"
+
 namespace ARDOUR {
        class Session;
 }
 
 /*
  * This virtual parent class is so that each dialog box uses the
- * same mechanism to declare its closing, and to have a common
- * method of connecting and disconnecting from a Session.
+ * same mechanism to declare its closing. It shares a common
+ * method of connecting and disconnecting from a Session with
+ * all other objects that have a handle on a Session.
  */
-class ArdourDialog : public Gtk::Dialog
+class ArdourDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr
 {
   public:
        ArdourDialog (std::string title, bool modal = false, bool use_separator = false);
@@ -48,16 +51,6 @@ class ArdourDialog : public Gtk::Dialog
        void on_unmap ();
        void on_show ();
 
-       ARDOUR::Session *session;
-
-       virtual void set_session (ARDOUR::Session* s) {
-               session = s;
-       }
-
-       virtual void session_gone () {
-               set_session (0);
-       }
-
        static void close_all_dialogs () { CloseAllDialogs(); }
 
   private:
index 9086bde940c67f40a5dd232e27a1821f683cfc2a..f97d892c4ceee1744c28ad8b466285e7f71c2499 100644 (file)
@@ -193,7 +193,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
 
        editor = 0;
        mixer = 0;
-       session = 0;
        editor = 0;
        engine = 0;
        _session_is_new = false;
@@ -415,11 +414,11 @@ ARDOUR_UI::post_engine ()
        /* now start and maybe save state */
 
        if (do_engine_start () == 0) {
-               if (session && _session_is_new) {
+               if (_session && _session_is_new) {
                        /* we need to retain initial visual
                           settings for a new session
                        */
-                       session->save_state ("");
+                       _session->save_state ("");
                }
        }
 }
@@ -556,9 +555,9 @@ ARDOUR_UI::save_ardour_state ()
        XMLNode enode(static_cast<Stateful*>(editor)->get_state());
        XMLNode mnode(mixer->get_state());
 
-       if (session) {
-               session->add_instant_xml (enode);
-               session->add_instant_xml (mnode);
+       if (_session) {
+               _session->add_instant_xml (enode);
+               _session->add_instant_xml (mnode);
        } else {
                Config->add_instant_xml (enode);
                Config->add_instant_xml (mnode);
@@ -582,8 +581,8 @@ ARDOUR_UI::autosave_session ()
                 return 1;
        }
 
-        if (session) {
-                session->maybe_write_autosave();
+        if (_session) {
+                _session->maybe_write_autosave();
         }
 
        return 1;
@@ -594,7 +593,7 @@ ARDOUR_UI::update_autosave ()
 {
        ENSURE_GUI_THREAD (*this, &ARDOUR_UI::update_autosave)
 
-       if (session && session->dirty()) {
+       if (_session && _session->dirty()) {
                if (_autosave_connection.connected()) {
                        _autosave_connection.disconnect();
                }
@@ -753,14 +752,14 @@ ARDOUR_UI::check_memory_locking ()
 void
 ARDOUR_UI::finish()
 {
-       if (session) {
+       if (_session) {
 
-               if (session->transport_rolling()) {
-                       session->request_stop ();
+               if (_session->transport_rolling()) {
+                       _session->request_stop ();
                        usleep (250000);
                }
 
-               if (session->dirty()) {
+               if (_session->dirty()) {
                        switch (ask_about_saving_session(_("quit"))) {
                        case -1:
                                return;
@@ -789,10 +788,10 @@ If you still wish to quit, please use the\n\n\
                point_oh_five_second_connection.disconnect ();
                point_zero_one_second_connection.disconnect();
                
-               // session->set_deletion_in_progress ();
-               session->remove_pending_capture_state ();
-               delete session;
-               session = 0;
+               // _session->set_deletion_in_progress ();
+               _session->remove_pending_capture_state ();
+               delete _session;
+               _session = 0;
        }
 
        ArdourDialog::close_all_dialogs ();
@@ -826,13 +825,13 @@ ARDOUR_UI::ask_about_saving_session (const string & what)
        string prompt;
        string type;
 
-       if (session->snap_name() == session->name()) {
+       if (_session->snap_name() == _session->name()) {
                type = _("session");
        } else {
                type = _("snapshot");
        }
        prompt = string_compose(_("The %1 \"%2\"\nhas not been saved.\n\nAny changes made this time\nwill be lost unless you save it.\n\nWhat do you want to do?"),
-                        type, session->snap_name());
+                        type, _session->snap_name());
 
        prompt_label.set_text (prompt);
        prompt_label.set_name (X_("PrompterLabel"));
@@ -941,14 +940,14 @@ ARDOUR_UI::update_buffer_load ()
        char buf[64];
        uint32_t c, p;
 
-       if (session) {
-               c = session->capture_load ();
-               p = session->playback_load ();
+       if (_session) {
+               c = _session->capture_load ();
+               p = _session->playback_load ();
 
                push_buffer_stats (c, p);
 
                snprintf (buf, sizeof (buf), _("Buffers p:%" PRIu32 "%% c:%" PRIu32 "%%"),
-                         session->playback_load(), session->capture_load());
+                         _session->playback_load(), _session->capture_load());
                buffer_load_label.set_text (buf);
        } else {
                buffer_load_label.set_text ("");
@@ -967,19 +966,19 @@ ARDOUR_UI::count_recenabled_streams (Route& route)
 void
 ARDOUR_UI::update_disk_space()
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
-       nframes_t frames = session->available_capture_duration();
+       nframes_t frames = _session->available_capture_duration();
        char buf[64];
-       nframes_t fr = session->frame_rate();
+       nframes_t fr = _session->frame_rate();
 
        if (frames == max_frames) {
                strcpy (buf, _("Disk: 24hrs+"));
        } else {
                rec_enabled_streams = 0;
-               session->foreach_route (this, &ARDOUR_UI::count_recenabled_streams);
+               _session->foreach_route (this, &ARDOUR_UI::count_recenabled_streams);
 
                if (rec_enabled_streams) {
                        frames /= rec_enabled_streams;
@@ -1154,7 +1153,7 @@ ARDOUR_UI::recent_session_row_activated (const TreePath& /*path*/, TreeViewColum
 void
 ARDOUR_UI::open_recent_session ()
 {
-       bool can_return = (session != 0);
+       bool can_return = (_session != 0);
 
        if (session_selector_window == 0) {
                build_session_selector ();
@@ -1278,7 +1277,7 @@ ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t
 {
        list<boost::shared_ptr<MidiTrack> > tracks;
 
-       if (session == 0) {
+       if (_session == 0) {
                warning << _("You cannot add a track without a session already loaded.") << endmsg;
                return;
        }
@@ -1286,7 +1285,7 @@ ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t
        try {
                if (disk) {
 
-                       tracks = session->new_midi_track (ARDOUR::Normal, route_group, how_many);
+                       tracks = _session->new_midi_track (ARDOUR::Normal, route_group, how_many);
 
                        if (tracks.size() != how_many) {
                                if (how_many == 1) {
@@ -1296,7 +1295,7 @@ ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t
                                }
                        }
                } /*else {
-                       if ((route = session->new_midi_route ()) == 0) {
+                       if ((route = _session->new_midi_route ()) == 0) {
                                error << _("could not create new midi bus") << endmsg;
                        }
                }*/
@@ -1319,14 +1318,14 @@ ARDOUR_UI::session_add_audio_route (bool track, bool aux, int32_t input_channels
        list<boost::shared_ptr<AudioTrack> > tracks;
        RouteList routes;
 
-       if (session == 0) {
+       if (_session == 0) {
                warning << _("You cannot add a track or bus without a session already loaded.") << endmsg;
                return;
        }
 
        try {
                if (track) {
-                       tracks = session->new_audio_track (input_channels, output_channels, mode, route_group, how_many);
+                       tracks = _session->new_audio_track (input_channels, output_channels, mode, route_group, how_many);
 
                        if (tracks.size() != how_many) {
                                if (how_many == 1) {
@@ -1339,7 +1338,7 @@ ARDOUR_UI::session_add_audio_route (bool track, bool aux, int32_t input_channels
 
                } else {
 
-                       routes = session->new_audio_route (aux, input_channels, output_channels, route_group, how_many);
+                       routes = _session->new_audio_route (aux, input_channels, output_channels, route_group, how_many);
 
                        if (routes.size() != how_many) {
                                if (how_many == 1) {
@@ -1379,9 +1378,9 @@ ARDOUR_UI::do_transport_locate (nframes_t new_position)
 {
        nframes_t _preroll = 0;
 
-       if (session) {
+       if (_session) {
                // XXX CONFIG_CHANGE FIX - requires AnyTime handling
-               // _preroll = session->convert_to_frames_at (new_position, Config->get_preroll());
+               // _preroll = _session->convert_to_frames_at (new_position, Config->get_preroll());
 
                if (new_position > _preroll) {
                        new_position -= _preroll;
@@ -1389,22 +1388,22 @@ ARDOUR_UI::do_transport_locate (nframes_t new_position)
                        new_position = 0;
                }
 
-               session->request_locate (new_position);
+               _session->request_locate (new_position);
        }
 }
 
 void
 ARDOUR_UI::transport_goto_start ()
 {
-       if (session) {
-               session->goto_start();
+       if (_session) {
+               _session->goto_start();
 
                /* force displayed area in editor to start no matter
                   what "follow playhead" setting is.
                */
 
                if (editor) {
-                       editor->center_screen (session->current_start_frame ());
+                       editor->center_screen (_session->current_start_frame ());
                }
        }
 }
@@ -1412,8 +1411,8 @@ ARDOUR_UI::transport_goto_start ()
 void
 ARDOUR_UI::transport_goto_zero ()
 {
-       if (session) {
-               session->request_locate (0);
+       if (_session) {
+               _session->request_locate (0);
 
 
                /* force displayed area in editor to start no matter
@@ -1429,7 +1428,7 @@ ARDOUR_UI::transport_goto_zero ()
 void
 ARDOUR_UI::transport_goto_wallclock ()
 {
-       if (session && editor) {
+       if (_session && editor) {
 
                time_t now;
                struct tm tmnow;
@@ -1438,11 +1437,11 @@ ARDOUR_UI::transport_goto_wallclock ()
                time (&now);
                localtime_r (&now, &tmnow);
 
-               frames = tmnow.tm_hour * (60 * 60 * session->frame_rate());
-               frames += tmnow.tm_min * (60 * session->frame_rate());
-               frames += tmnow.tm_sec * session->frame_rate();
+               frames = tmnow.tm_hour * (60 * 60 * _session->frame_rate());
+               frames += tmnow.tm_min * (60 * _session->frame_rate());
+               frames += tmnow.tm_sec * _session->frame_rate();
 
-               session->request_locate (frames);
+               _session->request_locate (frames);
 
                /* force displayed area in editor to start no matter
                   what "follow playhead" setting is.
@@ -1457,9 +1456,9 @@ ARDOUR_UI::transport_goto_wallclock ()
 void
 ARDOUR_UI::transport_goto_end ()
 {
-       if (session) {
-               nframes_t const frame = session->current_end_frame();
-               session->request_locate (frame);
+       if (_session) {
+               nframes_t const frame = _session->current_end_frame();
+               _session->request_locate (frame);
 
                /* force displayed area in editor to start no matter
                   what "follow playhead" setting is.
@@ -1474,23 +1473,23 @@ ARDOUR_UI::transport_goto_end ()
 void
 ARDOUR_UI::transport_stop ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
-       if (session->is_auditioning()) {
-               session->cancel_audition ();
+       if (_session->is_auditioning()) {
+               _session->cancel_audition ();
                return;
        }
 
-       session->request_stop ();
+       _session->request_stop ();
 }
 
 void
 ARDOUR_UI::transport_stop_and_forget_capture ()
 {
-       if (session) {
-               session->request_stop (true);
+       if (_session) {
+               _session->request_stop (true);
        }
 }
 
@@ -1506,47 +1505,47 @@ void
 ARDOUR_UI::transport_record (bool roll)
 {
 
-       if (session) {
-               switch (session->record_status()) {
+       if (_session) {
+               switch (_session->record_status()) {
                case Session::Disabled:
-                       if (session->ntracks() == 0) {
+                       if (_session->ntracks() == 0) {
                                MessageDialog msg (*editor, _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu."));
                                msg.run ();
                                return;
                        }
-                       session->maybe_enable_record ();
+                       _session->maybe_enable_record ();
                        if (roll) {
                                transport_roll ();
                        }
                        break;
                case Session::Recording:
                        if (roll) {
-                               session->request_stop();
+                               _session->request_stop();
                        } else {
-                               session->disable_record (false, true);
+                               _session->disable_record (false, true);
                        }
                        break;
 
                case Session::Enabled:
-                       session->disable_record (false, true);
+                       _session->disable_record (false, true);
                }
        }
-       //cerr << "ARDOUR_UI::transport_record () called roll = " << roll << " session->record_status() = " << session->record_status() << endl;
+       //cerr << "ARDOUR_UI::transport_record () called roll = " << roll << " _session->record_status() = " << _session->record_status() << endl;
 }
 
 void 
 ARDOUR_UI::transport_roll ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
-       if (session->is_auditioning()) {
+       if (_session->is_auditioning()) {
                return;
        }
        
-       if (session->config.get_external_sync()) {
-               switch (session->config.get_sync_source()) {
+       if (_session->config.get_external_sync()) {
+               switch (_session->config.get_sync_source()) {
                case JACK:
                        break;
                default:
@@ -1555,16 +1554,16 @@ ARDOUR_UI::transport_roll ()
                }
        }
 
-       bool rolling = session->transport_rolling();
+       bool rolling = _session->transport_rolling();
 
-       if (session->get_play_loop()) {
-               session->request_play_loop (false, true);
-       } else if (session->get_play_range ()) {
-               session->request_play_range (false, true);
+       if (_session->get_play_loop()) {
+               _session->request_play_loop (false, true);
+       } else if (_session->get_play_range ()) {
+               _session->request_play_range (false, true);
        } 
 
        if (!rolling) {
-               session->request_transport_speed (1.0f);
+               _session->request_transport_speed (1.0f);
        }
 
        map_transport_state ();
@@ -1574,17 +1573,17 @@ void
 ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
 {
        
-       if (!session) {
+       if (!_session) {
                return;
        }
 
-       if (session->is_auditioning()) {
-               session->cancel_audition ();
+       if (_session->is_auditioning()) {
+               _session->cancel_audition ();
                return;
        }
        
-       if (session->config.get_external_sync()) {
-               switch (session->config.get_sync_source()) {
+       if (_session->config.get_external_sync()) {
+               switch (_session->config.get_sync_source()) {
                case JACK:
                        break;
                default:
@@ -1593,12 +1592,12 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
                }
        }
 
-       bool rolling = session->transport_rolling();
+       bool rolling = _session->transport_rolling();
        bool affect_transport = true;
 
        if (rolling && roll_out_of_bounded_mode) {
                /* drop out of loop/range playback but leave transport rolling */
-               if (session->get_play_loop()) {
+               if (_session->get_play_loop()) {
                        if (Config->get_seamless_loop()) {
                                /* the disk buffers contain copies of the loop - we can't 
                                   just keep playing, so stop the transport. the user
@@ -1609,18 +1608,18 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
                                /* disk buffers are normal, so we can keep playing */
                                affect_transport = false;
                        }
-                       session->request_play_loop (false, true);
-               } else if (session->get_play_range ()) {
+                       _session->request_play_loop (false, true);
+               } else if (_session->get_play_range ()) {
                        affect_transport = false;
-                       session->request_play_range (0, true);
+                       _session->request_play_range (0, true);
                } 
        } 
 
        if (affect_transport) {
                if (rolling) {
-                       session->request_stop (with_abort, true);
+                       _session->request_stop (with_abort, true);
                } else {
-                       session->request_transport_speed (1.0f);
+                       _session->request_transport_speed (1.0f);
                }
        }
 
@@ -1630,20 +1629,20 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
 void
 ARDOUR_UI::toggle_session_auto_loop ()
 {
-       if (session) {
-               if (session->get_play_loop()) {
-                       if (session->transport_rolling()) {
-                               Location * looploc = session->locations()->auto_loop_location();
+       if (_session) {
+               if (_session->get_play_loop()) {
+                       if (_session->transport_rolling()) {
+                               Location * looploc = _session->locations()->auto_loop_location();
                                if (looploc) {
-                                       session->request_locate (looploc->start(), true);
+                                       _session->request_locate (looploc->start(), true);
                                }
                        } else {
-                               session->request_play_loop (false);
+                               _session->request_play_loop (false);
                        }
                } else {
-                       Location * looploc = session->locations()->auto_loop_location();
+                       Location * looploc = _session->locations()->auto_loop_location();
                        if (looploc) {
-                               session->request_play_loop (true);
+                               _session->request_play_loop (true);
                        }
                }
        }
@@ -1652,7 +1651,7 @@ ARDOUR_UI::toggle_session_auto_loop ()
 void
 ARDOUR_UI::transport_play_selection ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -1664,24 +1663,24 @@ ARDOUR_UI::transport_rewind (int option)
 {
        float current_transport_speed;
 
-               if (session) {
-               current_transport_speed = session->transport_speed();
+               if (_session) {
+               current_transport_speed = _session->transport_speed();
 
                if (current_transport_speed >= 0.0f) {
                        switch (option) {
                        case 0:
-                               session->request_transport_speed (-1.0f);
+                               _session->request_transport_speed (-1.0f);
                                break;
                        case 1:
-                               session->request_transport_speed (-4.0f);
+                               _session->request_transport_speed (-4.0f);
                                break;
                        case -1:
-                               session->request_transport_speed (-0.5f);
+                               _session->request_transport_speed (-0.5f);
                                break;
                        }
                } else {
                        /* speed up */
-                       session->request_transport_speed (current_transport_speed * 1.5f);
+                       _session->request_transport_speed (current_transport_speed * 1.5f);
                }
        }
 }
@@ -1691,24 +1690,24 @@ ARDOUR_UI::transport_forward (int option)
 {
        float current_transport_speed;
 
-       if (session) {
-               current_transport_speed = session->transport_speed();
+       if (_session) {
+               current_transport_speed = _session->transport_speed();
 
                if (current_transport_speed <= 0.0f) {
                        switch (option) {
                        case 0:
-                               session->request_transport_speed (1.0f);
+                               _session->request_transport_speed (1.0f);
                                break;
                        case 1:
-                               session->request_transport_speed (4.0f);
+                               _session->request_transport_speed (4.0f);
                                break;
                        case -1:
-                               session->request_transport_speed (0.5f);
+                               _session->request_transport_speed (0.5f);
                                break;
                        }
                } else {
                        /* speed up */
-                       session->request_transport_speed (current_transport_speed * 1.5f);
+                       _session->request_transport_speed (current_transport_speed * 1.5f);
                }
 
        }
@@ -1717,13 +1716,13 @@ ARDOUR_UI::transport_forward (int option)
 void
 ARDOUR_UI::toggle_record_enable (uint32_t dstream)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
        boost::shared_ptr<Route> r;
 
-       if ((r = session->route_by_remote_id (dstream)) != 0) {
+       if ((r = _session->route_by_remote_id (dstream)) != 0) {
 
                Track* t;
 
@@ -1731,7 +1730,7 @@ ARDOUR_UI::toggle_record_enable (uint32_t dstream)
                        t->diskstream()->set_record_enabled (!t->diskstream()->record_enabled());
                }
        }
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 }
@@ -1741,7 +1740,7 @@ ARDOUR_UI::map_transport_state ()
 {
        ENSURE_GUI_THREAD (*this, &ARDOUR_UI::map_transport_state)
 
-       if (!session) {
+       if (!_session) {
                auto_loop_button.set_visual_state (0);
                play_selection_button.set_visual_state (0);
                roll_button.set_visual_state (0);
@@ -1749,7 +1748,7 @@ ARDOUR_UI::map_transport_state ()
                return;
        }
 
-       float sp = session->transport_speed();
+       float sp = _session->transport_speed();
 
        if (sp == 1.0f) {
                shuttle_fract = SHUTTLE_FRACT_SPEED1;  /* speed = 1.0, believe it or not */
@@ -1762,13 +1761,13 @@ ARDOUR_UI::map_transport_state ()
 
        if (sp != 0.0) {
 
-               if (session->get_play_range()) {
+               if (_session->get_play_range()) {
 
                        play_selection_button.set_visual_state (1);
                        roll_button.set_visual_state (0);
                        auto_loop_button.set_visual_state (0);
                        
-               } else if (session->get_play_loop ()) {
+               } else if (_session->get_play_loop ()) {
                        
                        auto_loop_button.set_visual_state (1);
                        play_selection_button.set_visual_state (0);
@@ -1900,7 +1899,7 @@ void
 ARDOUR_UI::update_clocks ()
 {
        if (!editor || !editor->dragging_playhead()) {
-               Clock (session->audible_frame(), false, editor->get_preferred_edit_position()); /* EMIT_SIGNAL */
+               Clock (_session->audible_frame(), false, editor->get_preferred_edit_position()); /* EMIT_SIGNAL */
        }
 }
 
@@ -1994,7 +1993,7 @@ ARDOUR_UI::snapshot_session ()
                bool do_save = (snapname.length() != 0);
 
                vector<sys::path> p;
-               get_state_files_in_directory (session->session_directory().root_path(), p);
+               get_state_files_in_directory (_session->session_directory().root_path(), p);
                vector<string> n = get_file_names_no_extension (p);
                if (find (n.begin(), n.end(), snapname) != n.end()) {
 
@@ -2030,14 +2029,14 @@ ARDOUR_UI::save_state (const string & name)
 int
 ARDOUR_UI::save_state_canfail (string name)
 {
-       if (session) {
+       if (_session) {
                int ret;
 
                if (name.length() == 0) {
-                       name = session->snap_name();
+                       name = _session->snap_name();
                }
 
-               if ((ret = session->save_state (name)) != 0) {
+               if ((ret = _session->save_state (name)) != 0) {
                        return ret;
                }
        }
@@ -2048,36 +2047,36 @@ ARDOUR_UI::save_state_canfail (string name)
 void
 ARDOUR_UI::primary_clock_value_changed ()
 {
-       if (session) {
-               session->request_locate (primary_clock.current_time ());
+       if (_session) {
+               _session->request_locate (primary_clock.current_time ());
        }
 }
 
 void
 ARDOUR_UI::big_clock_value_changed ()
 {
-       if (session) {
-               session->request_locate (big_clock.current_time ());
+       if (_session) {
+               _session->request_locate (big_clock.current_time ());
        }
 }
 
 void
 ARDOUR_UI::secondary_clock_value_changed ()
 {
-       if (session) {
-               session->request_locate (secondary_clock.current_time ());
+       if (_session) {
+               _session->request_locate (secondary_clock.current_time ());
        }
 }
 
 void
 ARDOUR_UI::transport_rec_enable_blink (bool onoff)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
-       Session::RecordState const r = session->record_status ();
-       bool const h = session->have_rec_enabled_diskstream ();
+       Session::RecordState const r = _session->record_status ();
+       bool const h = _session->have_rec_enabled_diskstream ();
 
        if (r == Session::Enabled || (r == Session::Recording && !h)) {
                if (onoff) {
@@ -2105,7 +2104,7 @@ ARDOUR_UI::save_template ()
        prompter.set_name (X_("Prompter"));
        prompter.set_title (_("Save Mix Template"));
        prompter.set_prompt (_("Name for mix template:"));
-       prompter.set_initial_text(session->name() + _("-template"));
+       prompter.set_initial_text(_session->name() + _("-template"));
        prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
 
        switch (prompter.run()) {
@@ -2113,7 +2112,7 @@ ARDOUR_UI::save_template ()
                prompter.get_result (name);
 
                if (name.length()) {
-                       session->save_template (name);
+                       _session->save_template (name);
                }
                break;
 
@@ -2126,7 +2125,7 @@ void
 ARDOUR_UI::edit_metadata ()
 {
        SessionMetadataEditor dialog;
-       dialog.set_session (session);
+       dialog.set_session (_session);
        editor->ensure_float (dialog);
        dialog.run ();
 }
@@ -2135,7 +2134,7 @@ void
 ARDOUR_UI::import_metadata ()
 {
        SessionMetadataImporter dialog;
-       dialog.set_session (session);
+       dialog.set_session (_session);
        editor->ensure_float (dialog);
        dialog.run ();
 }
@@ -2339,7 +2338,7 @@ ARDOUR_UI::build_session_from_nsd (const Glib::ustring& session_path, const Glib
 void
 ARDOUR_UI::idle_load (const Glib::ustring& path)
 {
-       if (session) {
+       if (_session) {
                if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
                        /* /path/to/foo => /path/to/foo, foo */
                        load_session (path, basename_nosuffix (path));
@@ -2490,7 +2489,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new)
 
                        ret = load_session (session_path, session_name, template_name);
                        if (!ARDOUR_COMMAND_LINE::immediate_save.empty()) {
-                               session->save_state (ARDOUR_COMMAND_LINE::immediate_save, false);
+                               _session->save_state (ARDOUR_COMMAND_LINE::immediate_save, false);
                                exit (1);
                        }
                }
@@ -2594,14 +2593,14 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na
                goto out;
        }
 
-       connect_to_session (new_session);
+       set_session (new_session);
 
        session_loaded = true;
 
        goto_editor_window ();
 
-       if (session) {
-               session->set_clean ();
+       if (_session) {
+               _session->set_clean ();
        }
 
        flush_pending ();
@@ -2653,7 +2652,7 @@ ARDOUR_UI::build_session (const Glib::ustring& path, const Glib::ustring& snap_n
                return -1;
        }
 
-       connect_to_session (new_session);
+       set_session (new_session);
 
        session_loaded = true;
 
@@ -2785,7 +2784,7 @@ require some unused files to continue to exist."));
 
        dimage->set_alignment(ALIGN_LEFT, ALIGN_TOP);
 
-       const string dead_sound_directory = session->session_directory().dead_sound_path().to_string();
+       const string dead_sound_directory = _session->session_directory().dead_sound_path().to_string();
 
 
 
@@ -2853,7 +2852,7 @@ require some unused files to continue to exist."));
 void
 ARDOUR_UI::cleanup ()
 {
-       if (session == 0) {
+       if (_session == 0) {
                /* shouldn't happen: menu item is insensitive */
                return;
        }
@@ -2895,7 +2894,7 @@ After cleanup, unused audio files will be moved to a \
                act->set_sensitive (false);
        }
 
-       if (session->cleanup_sources (rep)) {
+       if (_session->cleanup_sources (rep)) {
                editor->finish_cleanup ();
                return;
        }
@@ -2926,14 +2925,14 @@ release an additional\n\
 void
 ARDOUR_UI::flush_trash ()
 {
-       if (session == 0) {
+       if (_session == 0) {
                /* shouldn't happen: menu item is insensitive */
                return;
        }
 
        ARDOUR::CleanupReport rep;
 
-       if (session->cleanup_trash_sources (rep)) {
+       if (_session->cleanup_trash_sources (rep)) {
                return;
        }
 
@@ -2952,12 +2951,12 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
 {
        int count;
 
-       if (!session) {
+       if (!_session) {
                return;
        }
 
        if (add_route_dialog == 0) {
-               add_route_dialog = new AddRouteDialog (*session);
+               add_route_dialog = new AddRouteDialog (_session);
                if (float_window) {
                        add_route_dialog->set_transient_for (*float_window);
                }
@@ -2987,7 +2986,7 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
        string template_path = add_route_dialog->track_template();
 
        if (!template_path.empty()) {
-               session->new_route_from_template (count, template_path);
+               _session->new_route_from_template (count, template_path);
                return;
        }
 
@@ -3001,7 +3000,7 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
        AutoConnectOption oac = Config->get_output_auto_connect();
 
        if (oac & AutoConnectMaster) {
-               output_chan = (session->master_out() ? session->master_out()->n_inputs().n_audio() : input_chan);
+               output_chan = (_session->master_out() ? _session->master_out()->n_inputs().n_audio() : input_chan);
        } else {
                output_chan = input_chan;
        }
@@ -3031,8 +3030,8 @@ ARDOUR_UI::mixer_settings () const
 {
        XMLNode* node = 0;
 
-       if (session) {
-               node = session->instant_xml(X_("Mixer"));
+       if (_session) {
+               node = _session->instant_xml(X_("Mixer"));
        } else {
                node = Config->instant_xml(X_("Mixer"));
        }
@@ -3049,8 +3048,8 @@ ARDOUR_UI::editor_settings () const
 {
        XMLNode* node = 0;
 
-       if (session) {
-               node = session->instant_xml(X_("Editor"));
+       if (_session) {
+               node = _session->instant_xml(X_("Editor"));
        } else {
                node = Config->instant_xml(X_("Editor"));
        }
@@ -3098,17 +3097,17 @@ ARDOUR_UI::halt_on_xrun_message ()
 void
 ARDOUR_UI::xrun_handler(nframes_t where)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
        ENSURE_GUI_THREAD (*this, &ARDOUR_UI::xrun_handler, where)
 
-       if (session && Config->get_create_xrun_marker() && session->actively_recording()) {
+       if (_session && Config->get_create_xrun_marker() && _session->actively_recording()) {
                create_xrun_marker(where);
        }
 
-       if (session && Config->get_stop_recording_on_xrun() && session->actively_recording()) {
+       if (_session && Config->get_stop_recording_on_xrun() && _session->actively_recording()) {
                halt_on_xrun_message ();
        }
 }
@@ -3353,15 +3352,15 @@ ARDOUR_UI::update_transport_clocks (nframes_t pos)
 void
 ARDOUR_UI::record_state_changed ()
 {
-       ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed)
+       ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed);
 
-       if (!session || !big_clock_window) {
+       if (!_session || !big_clock_window) {
                /* why bother - the clock isn't visible */
                return;
        }
 
-       Session::RecordState const r = session->record_status ();
-       bool const h = session->have_rec_enabled_diskstream ();
+       Session::RecordState const r = _session->record_status ();
+       bool const h = _session->have_rec_enabled_diskstream ();
 
        if (r == Session::Recording && h)  {
                big_clock.set_widget_name ("BigClockRecording");
@@ -3373,8 +3372,8 @@ ARDOUR_UI::record_state_changed ()
 bool
 ARDOUR_UI::first_idle ()
 {
-       if (session) {
-               session->allow_auto_play (true);
+       if (_session) {
+               _session->allow_auto_play (true);
        }
 
        if (editor) {
@@ -3394,8 +3393,8 @@ ARDOUR_UI::store_clock_modes ()
                node->add_property ((*x)->name().c_str(), enum_2_string ((*x)->mode()));
        }
 
-       session->add_extra_xml (*node);
-       session->set_dirty ();
+       _session->add_extra_xml (*node);
+       _session->set_dirty ();
 }
 
 
index f356db6c0a1c3f2c4658c3acd930b82607ed3090..d14aa7ce0c82c2b9011f73ad1a82d5ff2d1d2702 100644 (file)
@@ -61,6 +61,7 @@
 #include "ardour/ardour.h"
 #include "ardour/types.h"
 #include "ardour/utils.h"
+#include "ardour/session_handle.h"
 
 #include "audio_clock.h"
 #include "ardour_dialog.h"
@@ -100,7 +101,7 @@ namespace ARDOUR {
 extern sigc::signal<void>  ColorsChanged;
 extern sigc::signal<void>  DPIReset;
 
-class ARDOUR_UI : public Gtkmm2ext::UI
+class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
 {
   public:
        ARDOUR_UI (int *argcp, char **argvp[]);
@@ -132,7 +133,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
                           nframes_t initial_length);
        bool session_is_new() const { return _session_is_new; }
 
-       ARDOUR::Session* the_session() { return session; }
+       ARDOUR::Session* the_session() { return _session; }
 
        bool will_create_new_session_automatically() const {
                return _will_create_new_session_automatically;
@@ -255,7 +256,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
   private:
        ArdourStartup*      _startup;
        ARDOUR::AudioEngine *engine;
-       ARDOUR::Session      *session;
        Gtk::Tooltips        _tooltips;
 
        void                goto_editor_window ();
@@ -551,7 +551,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void toggle_roll (bool with_abort, bool roll_out_of_bounded_mode);
 
        bool _session_is_new;
-       void connect_to_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
        void connect_dependents_to_session (ARDOUR::Session *);
        void we_have_dependents ();
 
index 97fb9c742a2077f0e92fc8a77a701eb403c32a0a..ab772389a78843d3ae159b40bf1e668a84e0315c 100644 (file)
@@ -468,27 +468,27 @@ ARDOUR_UI::auditioning_changed (bool onoff)
 void
 ARDOUR_UI::audition_alert_toggle ()
 {
-       if (session) {
-               session->cancel_audition();
+       if (_session) {
+               _session->cancel_audition();
        }
 }
 
 void
 ARDOUR_UI::solo_alert_toggle ()
 {
-       if (session) {
-               session->set_solo (session->get_routes(), !session->soloing());
+       if (_session) {
+               _session->set_solo (_session->get_routes(), !_session->soloing());
        }
 }
 
 void
 ARDOUR_UI::solo_blink (bool onoff)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
-       if (session->soloing()) {
+       if (_session->soloing()) {
                if (onoff) {
                        solo_alert_button.set_state (STATE_ACTIVE);
                } else {
@@ -503,13 +503,13 @@ ARDOUR_UI::solo_blink (bool onoff)
 void
 ARDOUR_UI::sync_blink (bool onoff)
 {
-       if (session == 0 || !session->config.get_external_sync()) {
+       if (_session == 0 || !_session->config.get_external_sync()) {
                /* internal sync */
                sync_button.set_visual_state (0);
                return;
        }
 
-       if (!session->transport_locked()) {
+       if (!_session->transport_locked()) {
                /* not locked, so blink on and off according to the onoff argument */
 
                if (onoff) {
@@ -526,11 +526,11 @@ ARDOUR_UI::sync_blink (bool onoff)
 void
 ARDOUR_UI::audition_blink (bool onoff)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
-       if (session->is_auditioning()) {
+       if (_session->is_auditioning()) {
                if (onoff) {
                        auditioning_alert_button.set_state (STATE_ACTIVE);
                } else {
@@ -602,7 +602,7 @@ ARDOUR_UI::set_shuttle_max_speed (float speed)
 gint
 ARDOUR_UI::shuttle_box_button_press (GdkEventButton* ev)
 {
-       if (!session) {
+       if (!_session) {
                return true;
        }
 
@@ -634,7 +634,7 @@ ARDOUR_UI::shuttle_box_button_press (GdkEventButton* ev)
 gint
 ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
 {
-       if (!session) {
+       if (!_session) {
                return true;
        }
 
@@ -644,23 +644,23 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
                shuttle_grabbed = false;
                shuttle_box.remove_modal_grab ();
                if (Config->get_shuttle_behaviour() == Sprung) {
-                       if (session->config.get_auto_play() || roll_button.get_visual_state()) {
+                       if (_session->config.get_auto_play() || roll_button.get_visual_state()) {
                                shuttle_fract = SHUTTLE_FRACT_SPEED1;
-                               session->request_transport_speed (1.0);
+                               _session->request_transport_speed (1.0);
                                stop_button.set_visual_state (0);
                                roll_button.set_visual_state (1);
                        } else {
                                shuttle_fract = 0;
-                               session->request_transport_speed (0.0);
+                               _session->request_transport_speed (0.0);
                        }
                        shuttle_box.queue_draw ();
                }
                return true;
 
        case 2:
-               if (session->transport_rolling()) {
+               if (_session->transport_rolling()) {
                        shuttle_fract = SHUTTLE_FRACT_SPEED1;
-                       session->request_transport_speed (1.0);
+                       _session->request_transport_speed (1.0);
                        stop_button.set_visual_state (0);
                        roll_button.set_visual_state (1);
                } else {
@@ -683,7 +683,7 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
 gint
 ARDOUR_UI::shuttle_box_scroll (GdkEventScroll* ev)
 {
-       if (!session) {
+       if (!_session) {
                return true;
        }
 
@@ -708,7 +708,7 @@ ARDOUR_UI::shuttle_box_scroll (GdkEventScroll* ev)
 gint
 ARDOUR_UI::shuttle_box_motion (GdkEventMotion* ev)
 {
-       if (!session || !shuttle_grabbed) {
+       if (!_session || !shuttle_grabbed) {
                return true;
        }
 
@@ -763,7 +763,7 @@ ARDOUR_UI::use_shuttle_fract (bool force)
                semitones = round (shuttle_fract / step);
                speed = pow (2.0, (semitones / 12.0));
 
-               session->request_transport_speed (speed);
+               _session->request_transport_speed (speed);
 
        } else {
 
@@ -778,7 +778,7 @@ ARDOUR_UI::use_shuttle_fract (bool force)
                        fract = -fract;
                }
 
-               session->request_transport_speed (shuttle_max_speed * fract);
+               _session->request_transport_speed (shuttle_max_speed * fract);
        }
 
        shuttle_box.queue_draw ();
@@ -834,7 +834,7 @@ ARDOUR_UI::shuttle_style_changed ()
 void
 ARDOUR_UI::update_speed_display ()
 {
-       if (!session) {
+       if (!_session) {
                if (last_speed_displayed != 0) {
                        speed_display_label.set_text (_("stop"));
                        last_speed_displayed = 0;
@@ -843,7 +843,7 @@ ARDOUR_UI::update_speed_display ()
        }
 
        char buf[32];
-       float x = session->transport_speed ();
+       float x = _session->transport_speed ();
 
        if (x != last_speed_displayed) {
 
index d02fd41defca0c66abcd7596eea1a3b10a3009f6..e1d00548914b21754a08a1dae1d6f9e73cde052e 100644 (file)
@@ -65,9 +65,9 @@ void
 ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
 {
        BootMessage (_("Setup Editor"));
-       editor->connect_to_session (s);
+       editor->set_session (s);
        BootMessage (_("Setup Mixer"));
-       mixer->connect_to_session (s);
+       mixer->set_session (s);
 
        /* its safe to do this now */
 
index 9b9bc3c1e2f360d011946767c17751d4ab995347..9db664199ca65e8e249bf3bd4b0865a4afda19a6 100644 (file)
@@ -47,25 +47,40 @@ using namespace Gtk;
 using namespace Gtkmm2ext;
 
 void
-ARDOUR_UI::connect_to_session (Session *s)
+ARDOUR_UI::set_session (Session *s)
 {
-       session = s;
+       SessionHandlePtr::set_session (s);
 
-       session->Xrun.connect (sigc::mem_fun(*this, &ARDOUR_UI::xrun_handler));
-       session->RecordStateChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::record_state_changed));
+       if (location_ui) {
+               location_ui->set_session(s);
+       }
+
+       if (route_params) {
+               route_params->set_session (s);
+       }
+
+       primary_clock.set_session (s);
+       secondary_clock.set_session (s);
+       big_clock.set_session (s);
+       preroll_clock.set_session (s);
+       postroll_clock.set_session (s);
+       
+       if (!_session) {
+               return;
+       }
 
        /* sensitize menu bar options that are now valid */
 
        ActionManager::set_sensitive (ActionManager::session_sensitive_actions, true);
-       ActionManager::set_sensitive (ActionManager::write_sensitive_actions, session->writable());
+       ActionManager::set_sensitive (ActionManager::write_sensitive_actions, _session->writable());
 
-       if (session->locations()->num_range_markers()) {
+       if (_session->locations()->num_range_markers()) {
                ActionManager::set_sensitive (ActionManager::range_sensitive_actions, true);
        } else {
                ActionManager::set_sensitive (ActionManager::range_sensitive_actions, false);
        }
 
-       if (!session->control_out()) {
+       if (!_session->control_out()) {
                Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), X_("SoloViaBus"));
                if (act) {
                        act->set_sensitive (false);
@@ -87,19 +102,9 @@ ARDOUR_UI::connect_to_session (Session *s)
        ActionManager::set_sensitive (ActionManager::point_selection_sensitive_actions, false);
        ActionManager::set_sensitive (ActionManager::playlist_selection_sensitive_actions, false);
 
-       session->locations()->added.connect (sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change));
-       session->locations()->removed.connect (sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change));
-
        rec_button.set_sensitive (true);
        shuttle_box.set_sensitive (true);
-
-       if (location_ui) {
-               location_ui->set_session(s);
-       }
-
-       if (route_params) {
-               route_params->set_session (s);
-       }
+       solo_alert_button.set_active (_session->soloing());
 
        setup_session_options ();
 
@@ -108,30 +113,15 @@ ARDOUR_UI::connect_to_session (Session *s)
        Blink.connect (sigc::mem_fun(*this, &ARDOUR_UI::sync_blink));
        Blink.connect (sigc::mem_fun(*this, &ARDOUR_UI::audition_blink));
 
-       /* these are all need to be handled in an RT-safe and MT way, so don't
-          do any GUI work, just queue it for handling by the GUI thread.
-       */
-
-       session->TransportStateChange.connect (sigc::mem_fun(*this, &ARDOUR_UI::map_transport_state));
-
-       /* alert the user to these things happening */
-
-       session->AuditionActive.connect (sigc::mem_fun(*this, &ARDOUR_UI::auditioning_changed));
-       session->SoloActive.connect (sigc::mem_fun(*this, &ARDOUR_UI::soloing_changed));
-
-       solo_alert_button.set_active (session->soloing());
+       _session_connections.add_connection (_session->Xrun.connect (sigc::mem_fun(*this, &ARDOUR_UI::xrun_handler)));
+       _session_connections.add_connection (_session->RecordStateChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::record_state_changed)));
+       _session_connections.add_connection (_session->locations()->added.connect (sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change)));
+       _session_connections.add_connection (_session->locations()->removed.connect (sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change)));
+       _session_connections.add_connection (_session->TransportStateChange.connect (sigc::mem_fun(*this, &ARDOUR_UI::map_transport_state)));
+       _session_connections.add_connection (_session->AuditionActive.connect (sigc::mem_fun(*this, &ARDOUR_UI::auditioning_changed)));
+       _session_connections.add_connection (_session->SoloActive.connect (sigc::mem_fun(*this, &ARDOUR_UI::soloing_changed)));
+       _session_connections.add_connection (_session->DirtyChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::update_autosave)));
 
-       /* update autochange callback on dirty state changing */
-
-       session->DirtyChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::update_autosave));
-
-       /* can't be auditioning here */
-
-       primary_clock.set_session (s);
-       secondary_clock.set_session (s);
-       big_clock.set_session (s);
-       preroll_clock.set_session (s);
-       postroll_clock.set_session (s);
 
        /* Clocks are on by default after we are connected to a session, so show that here.
        */
@@ -160,14 +150,14 @@ ARDOUR_UI::connect_to_session (Session *s)
 int
 ARDOUR_UI::unload_session (bool hide_stuff)
 {
-       if (session && session->dirty()) {
+       if (_session && _session->dirty()) {
                switch (ask_about_saving_session (_("close"))) {
                case -1:
                        // cancel
                        return 1;
 
                case 1:
-                       session->save_state ("");
+                       _session->save_state ("");
                        break;
                }
        }
@@ -195,14 +185,7 @@ ARDOUR_UI::unload_session (bool hide_stuff)
 
        Blink.clear ();
 
-       primary_clock.set_session (0);
-       secondary_clock.set_session (0);
-       big_clock.set_session (0);
-       preroll_clock.set_session (0);
-       postroll_clock.set_session (0);
-
-       delete session;
-       session = 0;
+       delete _session;
 
        update_buffer_load ();
 
@@ -231,7 +214,7 @@ ARDOUR_UI::toggle_rc_options_window ()
        if (rc_option_editor == 0) {
                rc_option_editor = new RCOptionEditor;
                rc_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleRCOptionsEditor")));
-               rc_option_editor->set_session (session);
+               rc_option_editor->set_session (_session);
        }
 
        RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleRCOptionsEditor"));
@@ -251,7 +234,7 @@ void
 ARDOUR_UI::toggle_session_options_window ()
 {
        if (session_option_editor == 0) {
-               session_option_editor = new SessionOptionEditor (session);
+               session_option_editor = new SessionOptionEditor (_session);
                session_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleSessionOptionsEditor")));
        }
 
@@ -273,7 +256,7 @@ ARDOUR_UI::create_location_ui ()
 {
        if (location_ui == 0) {
                location_ui = new LocationUIWindow ();
-               location_ui->set_session (session);
+               location_ui->set_session (_session);
                location_ui->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleLocations")));
        }
        return 0;
@@ -340,7 +323,7 @@ void
 ARDOUR_UI::create_bundle_manager ()
 {
        if (bundle_manager == 0) {
-               bundle_manager = new BundleManager (session);
+               bundle_manager = new BundleManager (_session);
                bundle_manager->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBundleManager")));
        }
 }
@@ -368,7 +351,7 @@ ARDOUR_UI::create_route_params ()
 {
        if (route_params == 0) {
                route_params = new RouteParams_UI ();
-               route_params->set_session (session);
+               route_params->set_session (_session);
                route_params->signal_unmap().connect (sigc::bind(sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleInspector")));
        }
        return 0;
@@ -397,8 +380,8 @@ ARDOUR_UI::toggle_route_params_window ()
 void
 ARDOUR_UI::handle_locations_change (Location *)
 {
-       if (session) {
-               if (session->locations()->num_range_markers()) {
+       if (_session) {
+               if (_session->locations()->num_range_markers()) {
                        ActionManager::set_sensitive (ActionManager::range_sensitive_actions, true);
                } else {
                        ActionManager::set_sensitive (ActionManager::range_sensitive_actions, false);
index 592750a81b18cfe77052b6a583def9ae07d8e57b..20d492c71bfd0eb7bdd8f125d30bb6e2ecfd0d7f 100644 (file)
@@ -49,13 +49,13 @@ using namespace PBD;
 void
 ARDOUR_UI::toggle_external_sync()
 {
-       ActionManager::toggle_config_state_foo ("Transport", "ToggleExternalSync", sigc::mem_fun (session->config, &SessionConfiguration::set_external_sync), sigc::mem_fun (session->config, &SessionConfiguration::get_external_sync));
+       ActionManager::toggle_config_state_foo ("Transport", "ToggleExternalSync", sigc::mem_fun (_session->config, &SessionConfiguration::set_external_sync), sigc::mem_fun (_session->config, &SessionConfiguration::get_external_sync));
 }
 
 void
 ARDOUR_UI::toggle_time_master ()
 {
-       ActionManager::toggle_config_state_foo ("Transport", "ToggleTimeMaster", sigc::mem_fun (session->config, &SessionConfiguration::set_jack_time_master), sigc::mem_fun (session->config, &SessionConfiguration::get_jack_time_master));
+       ActionManager::toggle_config_state_foo ("Transport", "ToggleTimeMaster", sigc::mem_fun (_session->config, &SessionConfiguration::set_jack_time_master), sigc::mem_fun (_session->config, &SessionConfiguration::get_jack_time_master));
 }
 
 void
@@ -91,19 +91,19 @@ ARDOUR_UI::toggle_send_midi_feedback ()
 void
 ARDOUR_UI::toggle_auto_input ()
 {
-       ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoInput", sigc::mem_fun (session->config, &SessionConfiguration::set_auto_input), sigc::mem_fun (session->config, &SessionConfiguration::get_auto_input));
+       ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoInput", sigc::mem_fun (_session->config, &SessionConfiguration::set_auto_input), sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_input));
 }
 
 void
 ARDOUR_UI::toggle_auto_play ()
 {
-       ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoPlay", sigc::mem_fun (session->config, &SessionConfiguration::set_auto_play), sigc::mem_fun (session->config, &SessionConfiguration::get_auto_play));
+       ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoPlay", sigc::mem_fun (_session->config, &SessionConfiguration::set_auto_play), sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_play));
 }
 
 void
 ARDOUR_UI::toggle_auto_return ()
 {
-       ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoReturn", sigc::mem_fun (session->config, &SessionConfiguration::set_auto_return), sigc::mem_fun (session->config, &SessionConfiguration::get_auto_return));
+       ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoReturn", sigc::mem_fun (_session->config, &SessionConfiguration::set_auto_return), sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_return));
 }
 
 void
@@ -171,8 +171,8 @@ ARDOUR_UI::toggle_punch_in ()
                return;
        }
 
-       if (tact->get_active() != session->config.get_punch_in()) {
-               session->config.set_punch_in (tact->get_active ());
+       if (tact->get_active() != _session->config.get_punch_in()) {
+               _session->config.set_punch_in (tact->get_active ());
        }
 
        if (tact->get_active()) {
@@ -197,8 +197,8 @@ ARDOUR_UI::toggle_punch_out ()
                return;
        }
 
-       if (tact->get_active() != session->config.get_punch_out()) {
-               session->config.set_punch_out (tact->get_active ());
+       if (tact->get_active() != _session->config.get_punch_out()) {
+               _session->config.set_punch_out (tact->get_active ());
        }
 
        if (tact->get_active()) {
@@ -234,7 +234,7 @@ ARDOUR_UI::show_loop_punch_ruler_and_disallow_hide ()
 void
 ARDOUR_UI::reenable_hide_loop_punch_ruler_if_appropriate ()
 {
-       if (!session->config.get_punch_in() && !session->config.get_punch_out()) {
+       if (!_session->config.get_punch_in() && !_session->config.get_punch_out()) {
                /* if punch in/out are now both off, reallow hiding of the loop/punch ruler */
                Glib::RefPtr<Action> act = ActionManager::get_action (X_("Rulers"), "toggle-loop-punch-ruler");
                if (act) {
@@ -249,7 +249,7 @@ ARDOUR_UI::toggle_video_sync()
        Glib::RefPtr<Action> act = ActionManager::get_action ("Transport", "ToggleVideoSync");
        if (act) {
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-               session->config.set_use_video_sync (tact->get_active());
+               _session->config.set_use_video_sync (tact->get_active());
        }
 }
 
@@ -270,19 +270,19 @@ ARDOUR_UI::toggle_editing_space()
 void
 ARDOUR_UI::setup_session_options ()
 {
-       session->config.ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
+       _session->config.ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
        boost::function<void (std::string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
-       session->config.map_parameters (pc);
+       _session->config.map_parameters (pc);
 }
 
 #if 0
 void
 ARDOUR_UI::handle_sync_change ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
-       if (!session->config.get_external_sync()) {
+       if (!_session->config.get_external_sync()) {
                sync_button.set_label (_("Internal"));
                ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true);
                ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true);
@@ -303,14 +303,14 @@ ARDOUR_UI::parameter_changed (std::string p)
 
        if (p == "external-sync") {
 
-               ActionManager::map_some_state ("Transport", "ToggleExternalSync", sigc::mem_fun (session->config, &SessionConfiguration::get_external_sync));
+               ActionManager::map_some_state ("Transport", "ToggleExternalSync", sigc::mem_fun (_session->config, &SessionConfiguration::get_external_sync));
 
-               if (!session->config.get_external_sync()) {
+               if (!_session->config.get_external_sync()) {
                        sync_button.set_label (_("Internal"));
                        ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true);
                        ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true);
                } else {
-                       sync_button.set_label (sync_source_to_string (session->config.get_sync_source()));
+                       sync_button.set_label (sync_source_to_string (_session->config.get_sync_source()));
                        /* XXX need to make auto-play is off as well as insensitive */
                        ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (false);
                        ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (false);
@@ -339,27 +339,27 @@ ARDOUR_UI::parameter_changed (std::string p)
        } else if (p == "midi-feedback") {
                ActionManager::map_some_state ("options", "SendMIDIfeedback", &RCConfiguration::get_midi_feedback);
        } else if (p == "auto-play") {
-               ActionManager::map_some_state ("Transport", "ToggleAutoPlay", sigc::mem_fun (session->config, &SessionConfiguration::get_auto_play));
+               ActionManager::map_some_state ("Transport", "ToggleAutoPlay", sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_play));
        } else if (p == "auto-return") {
-               ActionManager::map_some_state ("Transport", "ToggleAutoReturn", sigc::mem_fun (session->config, &SessionConfiguration::get_auto_return));
+               ActionManager::map_some_state ("Transport", "ToggleAutoReturn", sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_return));
        } else if (p == "auto-input") {
-               ActionManager::map_some_state ("Transport", "ToggleAutoInput", sigc::mem_fun (session->config, &SessionConfiguration::get_auto_input));
+               ActionManager::map_some_state ("Transport", "ToggleAutoInput", sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_input));
        } else if (p == "punch-out") {
-               ActionManager::map_some_state ("Transport", "TogglePunchOut", sigc::mem_fun (session->config, &SessionConfiguration::get_punch_out));
-               if (!session->config.get_punch_out()) {
+               ActionManager::map_some_state ("Transport", "TogglePunchOut", sigc::mem_fun (_session->config, &SessionConfiguration::get_punch_out));
+               if (!_session->config.get_punch_out()) {
                        unset_dual_punch ();
                }
        } else if (p == "punch-in") {
-               ActionManager::map_some_state ("Transport", "TogglePunchIn", sigc::mem_fun (session->config, &SessionConfiguration::get_punch_in));
-               if (!session->config.get_punch_in()) {
+               ActionManager::map_some_state ("Transport", "TogglePunchIn", sigc::mem_fun (_session->config, &SessionConfiguration::get_punch_in));
+               if (!_session->config.get_punch_in()) {
                        unset_dual_punch ();
                }
        } else if (p == "clicking") {
                ActionManager::map_some_state ("Transport", "ToggleClick", &RCConfiguration::get_clicking);
        } else if (p == "jack-time-master") {
-               ActionManager::map_some_state ("Transport",  "ToggleTimeMaster", sigc::mem_fun (session->config, &SessionConfiguration::get_jack_time_master));
+               ActionManager::map_some_state ("Transport",  "ToggleTimeMaster", sigc::mem_fun (_session->config, &SessionConfiguration::get_jack_time_master));
        } else if (p == "use-video-sync") {
-               ActionManager::map_some_state ("Transport",  "ToggleVideoSync", sigc::mem_fun (session->config, &SessionConfiguration::get_use_video_sync));
+               ActionManager::map_some_state ("Transport",  "ToggleVideoSync", sigc::mem_fun (_session->config, &SessionConfiguration::get_use_video_sync));
        } else if (p == "shuttle-behaviour") {
 
                switch (Config->get_shuttle_behaviour ()) {
@@ -367,10 +367,10 @@ ARDOUR_UI::parameter_changed (std::string p)
                        shuttle_style_button.set_active_text (_("sprung"));
                        shuttle_fract = 0.0;
                        shuttle_box.queue_draw ();
-                       if (session) {
-                               if (session->transport_rolling()) {
+                       if (_session) {
+                               if (_session->transport_rolling()) {
                                        shuttle_fract = SHUTTLE_FRACT_SPEED1;
-                                       session->request_transport_speed (1.0);
+                                       _session->request_transport_speed (1.0);
                                }
                        }
                        break;
@@ -401,9 +401,9 @@ ARDOUR_UI::reset_main_clocks ()
 {
        ENSURE_GUI_THREAD (*this, &ARDOUR_UI::reset_main_clocks)
 
-       if (session) {
-               primary_clock.set (session->audible_frame(), true);
-               secondary_clock.set (session->audible_frame(), true);
+       if (_session) {
+               primary_clock.set (_session->audible_frame(), true);
+               secondary_clock.set (_session->audible_frame(), true);
        } else {
                primary_clock.set (0, true);
                secondary_clock.set (0, true);
index 68df057b953ed903779c35a373e236f01b92b3df..c37c6cab9c5391c988c9f08712240988f44827f5 100644 (file)
@@ -64,9 +64,8 @@ const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
        10   /* Audio Frame */
 };
 
-AudioClock::AudioClock (
-       std::string clock_name, bool transient, std::string widget_name, bool allow_edit, bool follows_playhead, bool duration, bool with_info
-       )
+AudioClock::AudioClock (std::string clock_name, bool transient, std::string widget_name, 
+                       bool allow_edit, bool follows_playhead, bool duration, bool with_info)
        : _name (clock_name),
          is_transient (transient),
          is_duration (duration),
@@ -81,7 +80,6 @@ AudioClock::AudioClock (
          b2 ("|"),
          last_when(0)
 {
-       session = 0;
        last_when = 0;
        last_pdelta = 0;
        last_sdelta = 0;
@@ -419,7 +417,7 @@ void
 AudioClock::set (nframes_t when, bool force, nframes_t offset, char which)
 {
 
-       if ((!force && !is_visible()) || session == 0) {
+       if ((!force && !is_visible()) || _session == 0) {
                return;
        }
 
@@ -501,7 +499,7 @@ AudioClock::set_frames (nframes_t when, bool /*force*/)
        audio_frames_label.set_text (buf);
 
        if (frames_upper_info_label) {
-               nframes_t rate = session->frame_rate();
+               nframes_t rate = _session->frame_rate();
 
                if (fmod (rate, 1000.0) == 0.000) {
                        sprintf (buf, "%uK", rate/1000);
@@ -513,7 +511,7 @@ AudioClock::set_frames (nframes_t when, bool /*force*/)
                        frames_upper_info_label->set_text (buf);
                }
 
-               float vid_pullup = session->config.get_video_pullup();
+               float vid_pullup = _session->config.get_video_pullup();
 
                if (vid_pullup == 0.0) {
                        if (frames_lower_info_label->get_text () != _("none")) {
@@ -538,11 +536,11 @@ AudioClock::set_minsec (nframes_t when, bool force)
        float secs;
 
        left = when;
-       hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
-       left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
-       mins = (int) floor (left / (session->frame_rate() * 60.0f));
-       left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
-       secs = left / (float) session->frame_rate();
+       hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
+       left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
+       mins = (int) floor (left / (_session->frame_rate() * 60.0f));
+       left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f);
+       secs = left / (float) _session->frame_rate();
 
        if (force || hrs != ms_last_hrs) {
                sprintf (buf, "%02d", hrs);
@@ -570,9 +568,9 @@ AudioClock::set_timecode (nframes_t when, bool force)
        Timecode::Time timecode;
 
        if (is_duration) {
-               session->timecode_duration (when, timecode);
+               _session->timecode_duration (when, timecode);
        } else {
-               session->timecode_time (when, timecode);
+               _session->timecode_time (when, timecode);
        }
 
        if (force || timecode.hours != last_hrs || timecode.negative != last_negative) {
@@ -605,7 +603,7 @@ AudioClock::set_timecode (nframes_t when, bool force)
        }
 
        if (timecode_upper_info_label) {
-               double timecode_frames = session->timecode_frames_per_second();
+               double timecode_frames = _session->timecode_frames_per_second();
 
                if ( fmod(timecode_frames, 1.0) == 0.0) {
                        sprintf (buf, "%u", int (timecode_frames));
@@ -618,7 +616,7 @@ AudioClock::set_timecode (nframes_t when, bool force)
                }
 
                if ((fabs(timecode_frames - 29.97) < 0.0001) || timecode_frames == 30) {
-                       if (session->timecode_drop_frames()) {
+                       if (_session->timecode_drop_frames()) {
                                sprintf (buf, "DF");
                        } else {
                                sprintf (buf, "NDF");
@@ -647,12 +645,12 @@ AudioClock::set_bbt (nframes_t when, bool force)
                        bbt.beats = 0;
                        bbt.ticks = 0;
                } else {
-                       session->tempo_map().bbt_time (when, bbt);
+                       _session->tempo_map().bbt_time (when, bbt);
                        bbt.bars--;
                        bbt.beats--;
                }
        } else {
-               session->tempo_map().bbt_time (when, bbt);
+               _session->tempo_map().bbt_time (when, bbt);
        }
 
        sprintf (buf, "%03" PRIu32, bbt.bars);
@@ -677,7 +675,7 @@ AudioClock::set_bbt (nframes_t when, bool force)
                        pos = bbt_reference_time;
                }
 
-               TempoMetric m (session->tempo_map().metric_at (pos));
+               TempoMetric m (_session->tempo_map().metric_at (pos));
 
                sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
                if (bbt_lower_info_label->get_text() != buf) {
@@ -693,12 +691,12 @@ AudioClock::set_bbt (nframes_t when, bool force)
 void
 AudioClock::set_session (Session *s)
 {
-       session = s;
+       SessionHandlePtr::set_session (s);
 
-       if (s) {
+       if (_session) {
 
                XMLProperty* prop;
-               XMLNode* node = session->extra_xml (X_("ClockModes"));
+               XMLNode* node = _session->extra_xml (X_("ClockModes"));
                AudioClock::Mode amode;
 
                if (node) {
@@ -1190,7 +1188,7 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
 bool
 AudioClock::field_button_press_event (GdkEventButton *ev, Field /*field*/)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return false;
        }
 
@@ -1236,7 +1234,7 @@ AudioClock::field_button_press_event (GdkEventButton *ev, Field /*field*/)
 bool
 AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return false;
        }
 
@@ -1283,7 +1281,7 @@ AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
 bool
 AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field)
 {
-       if (session == 0 || !dragging) {
+       if (_session == 0 || !dragging) {
                return false;
        }
 
@@ -1342,16 +1340,16 @@ AudioClock::get_frames (Field field,nframes_t pos,int dir)
        BBT_Time bbt;
        switch (field) {
        case Timecode_Hours:
-               frames = (nframes_t) floor (3600.0 * session->frame_rate());
+               frames = (nframes_t) floor (3600.0 * _session->frame_rate());
                break;
        case Timecode_Minutes:
-               frames = (nframes_t) floor (60.0 * session->frame_rate());
+               frames = (nframes_t) floor (60.0 * _session->frame_rate());
                break;
        case Timecode_Seconds:
-               frames = session->frame_rate();
+               frames = _session->frame_rate();
                break;
        case Timecode_Frames:
-               frames = (nframes_t) floor (session->frame_rate() / session->timecode_frames_per_second());
+               frames = (nframes_t) floor (_session->frame_rate() / _session->timecode_frames_per_second());
                break;
 
        case AudioFrames:
@@ -1359,32 +1357,32 @@ AudioClock::get_frames (Field field,nframes_t pos,int dir)
                break;
 
        case MS_Hours:
-               frames = (nframes_t) floor (3600.0 * session->frame_rate());
+               frames = (nframes_t) floor (3600.0 * _session->frame_rate());
                break;
        case MS_Minutes:
-               frames = (nframes_t) floor (60.0 * session->frame_rate());
+               frames = (nframes_t) floor (60.0 * _session->frame_rate());
                break;
        case MS_Seconds:
-               frames = session->frame_rate();
+               frames = _session->frame_rate();
                break;
 
        case Bars:
                bbt.bars = 1;
                bbt.beats = 0;
                bbt.ticks = 0;
-               frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
+               frames = _session->tempo_map().bbt_duration_at(pos,bbt,dir);
                break;
        case Beats:
                bbt.bars = 0;
                bbt.beats = 1;
                bbt.ticks = 0;
-               frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
+               frames = _session->tempo_map().bbt_duration_at(pos,bbt,dir);
                break;
        case Ticks:
                bbt.bars = 0;
                bbt.beats = 0;
                bbt.ticks = 1;
-               frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
+               frames = _session->tempo_map().bbt_duration_at(pos,bbt,dir);
                break;
        }
 
@@ -1459,7 +1457,7 @@ AudioClock::timecode_sanitize_display()
                seconds_label.set_text("59");
        }
 
-       switch ((long)rint(session->timecode_frames_per_second())) {
+       switch ((long)rint(_session->timecode_frames_per_second())) {
        case 24:
                if (atoi(frames_label.get_text()) > 23) {
                        frames_label.set_text("23");
@@ -1479,7 +1477,7 @@ AudioClock::timecode_sanitize_display()
                break;
        }
 
-       if (session->timecode_drop_frames()) {
+       if (_session->timecode_drop_frames()) {
                if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) {
                        frames_label.set_text("02");
                }
@@ -1489,7 +1487,7 @@ AudioClock::timecode_sanitize_display()
 nframes_t
 AudioClock::timecode_frame_from_display () const
 {
-       if (session == 0) {
+       if (_session == 0) {
                return 0;
        }
 
@@ -1500,10 +1498,10 @@ AudioClock::timecode_frame_from_display () const
        timecode.minutes = atoi (minutes_label.get_text());
        timecode.seconds = atoi (seconds_label.get_text());
        timecode.frames = atoi (frames_label.get_text());
-       timecode.rate = session->timecode_frames_per_second();
-       timecode.drop= session->timecode_drop_frames();
+       timecode.rate = _session->timecode_frames_per_second();
+       timecode.drop= _session->timecode_drop_frames();
 
-       session->timecode_to_sample( timecode, sample, false /* use_offset */, false /* use_subframes */ );
+       _session->timecode_to_sample( timecode, sample, false /* use_offset */, false /* use_subframes */ );
 
 
 #if 0
@@ -1522,14 +1520,14 @@ AudioClock::timecode_frame_from_display () const
        Timecode::Time timecode2;
        nframes_t sample_increment;
 
-       sample_increment = (long)rint(session->frame_rate() / session->timecode_frames_per_second);
+       sample_increment = (long)rint(_session->frame_rate() / _session->timecode_frames_per_second);
 
 #ifdef Timecode_SAMPLE_TEST_1
        // Test 1: use_offset = false, use_subframes = false
        cout << "use_offset = false, use_subframes = false" << endl;
        for (int i = 0; i < 108003; i++) {
-               session->timecode_to_sample( timecode1, sample1, false /* use_offset */, false /* use_subframes */ );
-               session->sample_to_timecode( sample1, timecode2, false /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, false /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, false /* use_offset */, false /* use_subframes */ );
 
                if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
                        cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
@@ -1549,7 +1547,7 @@ AudioClock::timecode_frame_from_display () const
                        break;
                }
                oldsample = sample1;
-               session->timecode_increment( timecode1 );
+               _session->timecode_increment( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
@@ -1568,13 +1566,13 @@ AudioClock::timecode_frame_from_display () const
        timecode1.subframes = 0;
        sample1 = oldsample = 0;
 
-       session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
        cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 108003; i++) {
-               session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
 //     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
@@ -1599,7 +1597,7 @@ AudioClock::timecode_frame_from_display () const
                        break;
                }
                oldsample = sample1;
-               session->timecode_increment( timecode1 );
+               _session->timecode_increment( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
@@ -1611,13 +1609,13 @@ AudioClock::timecode_frame_from_display () const
        // Test 3: use_offset = true, use_subframes = false, decrement
        cout << "use_offset = true, use_subframes = false, decrement" << endl;
 
-       session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
        cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 108003; i++) {
-               session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
 //     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
@@ -1642,7 +1640,7 @@ AudioClock::timecode_frame_from_display () const
                        break;
                }
                oldsample = sample1;
-               session->timecode_decrement( timecode1 );
+               _session->timecode_decrement( timecode1 );
        }
 
        cout << "sample_decrement: " << sample_increment << endl;
@@ -1663,14 +1661,14 @@ AudioClock::timecode_frame_from_display () const
                timecode1.subframes = 0;
                sample1 = oldsample = (sample_increment * sub) / 80;
 
-               session->sample_to_timecode( sample1, timecode1, true /* use_offset */, true /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, true /* use_subframes */ );
 
                cout << "starting at sample: " << sample1 << " -> ";
                cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
                for (int i = 0; i < 108003; i++) {
-                       session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
-                       session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
+                       _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
+                       _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
 
                        if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
                                cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
@@ -1690,7 +1688,7 @@ AudioClock::timecode_frame_from_display () const
                                break;
                        }
                        oldsample = sample1;
-                       session->timecode_increment( timecode1 );
+                       _session->timecode_increment( timecode1 );
                }
 
                cout << "sample_increment: " << sample_increment << endl;
@@ -1698,8 +1696,8 @@ AudioClock::timecode_frame_from_display () const
                cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 
                for (int i = 0; i < 108003; i++) {
-                       session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
-                       session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
+                       _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
+                       _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
 
                        if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
                                cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
@@ -1719,7 +1717,7 @@ AudioClock::timecode_frame_from_display () const
                                break;
                        }
                        oldsample = sample1;
-                       session->timecode_decrement( timecode1 );
+                       _session->timecode_decrement( timecode1 );
                }
 
                cout << "sample_decrement: " << sample_increment << endl;
@@ -1739,15 +1737,15 @@ AudioClock::timecode_frame_from_display () const
        timecode1.frames = 0;
        timecode1.subframes = 0;
        sample1 = oldsample = 0;
-       sample_increment = session->frame_rate();
+       sample_increment = _session->frame_rate();
 
-       session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
        cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 3600; i++) {
-               session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
 //     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
@@ -1769,7 +1767,7 @@ AudioClock::timecode_frame_from_display () const
                        break;
                }
                oldsample = sample1;
-               session->timecode_increment_seconds( timecode1 );
+               _session->timecode_increment_seconds( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
@@ -1788,15 +1786,15 @@ AudioClock::timecode_frame_from_display () const
        timecode1.frames = 0;
        timecode1.subframes = 0;
        sample1 = oldsample = 0;
-       sample_increment = session->frame_rate() * 60;
+       sample_increment = _session->frame_rate() * 60;
 
-       session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
        cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 60; i++) {
-               session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
 //     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
@@ -1818,7 +1816,7 @@ AudioClock::timecode_frame_from_display () const
                        break;
                }
                oldsample = sample1;
-               session->timecode_increment_minutes( timecode1 );
+               _session->timecode_increment_minutes( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
@@ -1836,15 +1834,15 @@ AudioClock::timecode_frame_from_display () const
        timecode1.frames = 0;
        timecode1.subframes = 0;
        sample1 = oldsample = 0;
-       sample_increment = session->frame_rate() * 60 * 60;
+       sample_increment = _session->frame_rate() * 60 * 60;
 
-       session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
        cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 10; i++) {
-               session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
 //     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
@@ -1866,7 +1864,7 @@ AudioClock::timecode_frame_from_display () const
                        break;
                }
                oldsample = sample1;
-               session->timecode_increment_hours( timecode1 );
+               _session->timecode_increment_hours( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
@@ -1882,7 +1880,7 @@ AudioClock::timecode_frame_from_display () const
 nframes_t
 AudioClock::minsec_frame_from_display () const
 {
-       if (session == 0) {
+       if (_session == 0) {
                return 0;
        }
 
@@ -1890,7 +1888,7 @@ AudioClock::minsec_frame_from_display () const
        int mins = atoi (ms_minutes_label.get_text());
        float secs = atof (ms_seconds_label.get_text());
 
-       nframes_t sr = session->frame_rate();
+       nframes_t sr = _session->frame_rate();
 
        return (nframes_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr));
 }
@@ -1898,7 +1896,7 @@ AudioClock::minsec_frame_from_display () const
 nframes_t
 AudioClock::bbt_frame_from_display (nframes_t pos) const
 {
-       if (session == 0) {
+       if (_session == 0) {
                error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
                return 0;
        }
@@ -1915,7 +1913,7 @@ AudioClock::bbt_frame_from_display (nframes_t pos) const
                any.bbt.beats++;
        }
 
-       nframes_t ret = session->convert_to_frames_at (pos, any);
+       nframes_t ret = _session->convert_to_frames_at (pos, any);
 
        return ret;
 }
@@ -1924,7 +1922,7 @@ AudioClock::bbt_frame_from_display (nframes_t pos) const
 nframes_t
 AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
 {
-       if (session == 0) {
+       if (_session == 0) {
                error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
                return 0;
        }
@@ -1936,7 +1934,7 @@ AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
        bbt.beats = atoi (beats_label.get_text());
        bbt.ticks = atoi (ticks_label.get_text());
 
-       return session->tempo_map().bbt_duration_at(pos,bbt,1);
+       return _session->tempo_map().bbt_duration_at(pos,bbt,1);
 }
 
 nframes_t
@@ -1971,21 +1969,21 @@ AudioClock::build_ops_menu ()
 void
 AudioClock::set_from_playhead ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
        
-       set (session->transport_frame());
+       set (_session->transport_frame());
 }
 
 void
 AudioClock::locate ()
 {
-       if (!session || is_duration) {
+       if (!_session || is_duration) {
                return;
        }
        
-       session->request_locate (current_time(), false);
+       _session->request_locate (current_time(), false);
 }
 
 void
index 38bb3f13293cc0a5728e56cfa2c71f9ff1d7c066..1a15cecd7b15d24811193acada6f2698db5c5be8 100644 (file)
 #include <gtkmm/label.h>
 #include <gtkmm/frame.h>
 #include "ardour/ardour.h"
+#include "ardour/session_handle.h"
 
 namespace ARDOUR {
        class Session;
 }
 
-class AudioClock : public Gtk::HBox
+class AudioClock : public Gtk::HBox, public ARDOUR::SessionHandlePtr
 {
   public:
        enum Mode {
@@ -72,7 +73,6 @@ class AudioClock : public Gtk::HBox
        static bool has_focus() { return _has_focus; }
 
   private:
-       ARDOUR::Session  *session;
        Mode             _mode;
        uint32_t          key_entry_state;
        std::string      _name;
index ade0b8edb935b611444d2c43c836fd28a0314b37..2c26f562ff165f92658b0e8c072a7cf69e7d5149 100644 (file)
@@ -41,7 +41,7 @@ using namespace PBD;
 using namespace std;
 using namespace Gtkmm2ext;
 
-AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion> r, AudioRegionView& rv)
+AudioRegionEditor::AudioRegionEditor (Session* s, boost::shared_ptr<AudioRegion> r, AudioRegionView& rv)
        : RegionEditor (s),
          _region (r),
          _region_view (rv),
@@ -58,12 +58,12 @@ AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion>
          gain_adjustment(accurate_coefficient_to_dB(_region->scale_amplitude()), -40.0, +40.0, 0.1, 1.0, 0)      
 
 {
-       position_clock.set_session (&_session);
-       end_clock.set_session (&_session);
-       length_clock.set_session (&_session);
-       sync_offset_relative_clock.set_session (&_session);
-       sync_offset_absolute_clock.set_session (&_session);
-       start_clock.set_session (&_session);
+       position_clock.set_session (_session);
+       end_clock.set_session (_session);
+       length_clock.set_session (_session);
+       sync_offset_relative_clock.set_session (_session);
+       sync_offset_absolute_clock.set_session (_session);
+       start_clock.set_session (_session);
 
        name_entry.set_name ("AudioRegionEditorEntry");
        name_label.set_name ("AudioRegionEditorLabel");
@@ -228,13 +228,13 @@ AudioRegionEditor::connect_editor_events ()
        gain_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &AudioRegionEditor::gain_adjustment_changed));
 
        audition_button.signal_toggled().connect (sigc::mem_fun(*this, &AudioRegionEditor::audition_button_toggled));
-       _session.AuditionActive.connect (sigc::mem_fun(*this, &AudioRegionEditor::audition_state_changed));
+       _session->AuditionActive.connect (sigc::mem_fun(*this, &AudioRegionEditor::audition_state_changed));
 }
 
 void
 AudioRegionEditor::position_clock_changed ()
 {
-       _session.begin_reversible_command (_("change region start position"));
+       _session->begin_reversible_command (_("change region start position"));
 
        boost::shared_ptr<Playlist> pl = _region->playlist();
 
@@ -242,16 +242,16 @@ AudioRegionEditor::position_clock_changed ()
                XMLNode &before = pl->get_state();
                _region->set_position (position_clock.current_time(), this);
                XMLNode &after = pl->get_state();
-               _session.add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+               _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
        }
 
-       _session.commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
 AudioRegionEditor::end_clock_changed ()
 {
-       _session.begin_reversible_command (_("change region end position"));
+       _session->begin_reversible_command (_("change region end position"));
 
        boost::shared_ptr<Playlist> pl = _region->playlist();
 
@@ -259,10 +259,10 @@ AudioRegionEditor::end_clock_changed ()
                XMLNode &before = pl->get_state();
                _region->trim_end (end_clock.current_time(), this);
                XMLNode &after = pl->get_state();
-               _session.add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+               _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
        }
 
-       _session.commit_reversible_command ();
+       _session->commit_reversible_command ();
 
        end_clock.set (_region->position() + _region->length() - 1, true);
 }
@@ -272,7 +272,7 @@ AudioRegionEditor::length_clock_changed ()
 {
        nframes_t frames = length_clock.current_time();
 
-       _session.begin_reversible_command (_("change region length"));
+       _session->begin_reversible_command (_("change region length"));
 
        boost::shared_ptr<Playlist> pl = _region->playlist();
 
@@ -280,10 +280,10 @@ AudioRegionEditor::length_clock_changed ()
                XMLNode &before = pl->get_state();
                _region->trim_end (_region->position() + frames - 1, this);
                XMLNode &after = pl->get_state();
-               _session.add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+               _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
        }
 
-       _session.commit_reversible_command ();
+       _session->commit_reversible_command ();
 
        length_clock.set (_region->length());
 }
@@ -310,9 +310,9 @@ void
 AudioRegionEditor::audition_button_toggled ()
 {
        if (audition_button.get_active()) {
-               _session.audition_region (_region);
+               _session->audition_region (_region);
        } else {
-               _session.cancel_audition ();
+               _session->cancel_audition ();
        }
 }
 
@@ -385,27 +385,27 @@ AudioRegionEditor::audition_state_changed (bool yn)
 void
 AudioRegionEditor::sync_offset_absolute_clock_changed ()
 {
-       _session.begin_reversible_command (_("change region sync point"));
+       _session->begin_reversible_command (_("change region sync point"));
 
        XMLNode& before = _region->get_state ();
        _region->set_sync_position (sync_offset_absolute_clock.current_time());
        XMLNode& after = _region->get_state ();
-       _session.add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
+       _session->add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
        
-       _session.commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
 AudioRegionEditor::sync_offset_relative_clock_changed ()
 {
-       _session.begin_reversible_command (_("change region sync point"));
+       _session->begin_reversible_command (_("change region sync point"));
 
        XMLNode& before = _region->get_state ();
        _region->set_sync_position (sync_offset_relative_clock.current_time() + _region->position ());
        XMLNode& after = _region->get_state ();
-       _session.add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
+       _session->add_command (new MementoCommand<AudioRegion> (*_region.get(), &before, &after));
        
-       _session.commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 bool
index 3de1522734eafcf50fcbec6dd92d6d53196176a5..f4c99917d8606c4ca13985fefad0b894a7bec5c8 100644 (file)
@@ -51,7 +51,7 @@ class AudioRegionView;
 class AudioRegionEditor : public RegionEditor
 {
   public:
-       AudioRegionEditor (ARDOUR::Session&, boost::shared_ptr<ARDOUR::AudioRegion>, AudioRegionView& rv);
+       AudioRegionEditor (ARDOUR::Session*, boost::shared_ptr<ARDOUR::AudioRegion>, AudioRegionView& rv);
        ~AudioRegionEditor ();
 
   private:
index 682287bf596c87198259c6a117724bb96ed865a8..30c426567f9a55d9125dd6aa5bc1c70764246d7d 100644 (file)
@@ -200,15 +200,14 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
 
        setup_fade_handle_positions ();
 
-       if (!trackview.session().config.get_show_region_fades()) {
+       if (!trackview.session()->config.get_show_region_fades()) {
                set_fade_visibility (false);
        }
 
        const string line_name = _region->name() + ":gain";
 
        if (!Profile->get_sae()) {
-               gain_line = new AudioRegionGainLine (line_name, trackview.session(), *this, *group,
-                               audio_region()->envelope());
+               gain_line = new AudioRegionGainLine (line_name, *this, *group, audio_region()->envelope());
        }
 
        if (!(_flags & EnvelopeVisible)) {
@@ -360,7 +359,7 @@ AudioRegionView::region_renamed ()
 {
        Glib::ustring str = RegionView::make_name ();
 
-       if (audio_region()->speed_mismatch (trackview.session().frame_rate())) {
+       if (audio_region()->speed_mismatch (trackview.session()->frame_rate())) {
                str = string ("*") + str;
        }
 
@@ -415,7 +414,7 @@ AudioRegionView::reset_width_dependent_items (double pixel_width)
                                fade_in_handle->hide();
                                fade_out_handle->hide();
                        } else {
-                               if (trackview.session().config.get_show_region_fades()) {
+                               if (trackview.session()->config.get_show_region_fades()) {
                                        fade_in_handle->show();
                                        fade_out_handle->show();
                                }
@@ -575,7 +574,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width)
                return;
        }
 
-       if (trackview.session().config.get_show_region_fades()) {
+       if (trackview.session()->config.get_show_region_fades()) {
                fade_in_shape->show();
        }
 
@@ -666,7 +665,7 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width)
                return;
        }
 
-       if (trackview.session().config.get_show_region_fades()) {
+       if (trackview.session()->config.get_show_region_fades()) {
                fade_out_shape->show();
        }
 
@@ -869,7 +868,7 @@ AudioRegionView::create_waves ()
                // cerr << "\tchannel " << n << endl;
 
                if (wait_for_data) {
-                       if (audio_region()->audio_source(n)->peaks_ready (sigc::bind (sigc::mem_fun(*this, &AudioRegionView::peaks_ready_handler), n), data_ready_connection)) {
+                       if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), data_ready_connection)) {
                                // cerr << "\tData is ready\n";
                                create_one_wave (n, true);
                        } else {
@@ -1018,21 +1017,21 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev)
 
        gain_line->view_to_model_coord (x, y);
 
-       trackview.session().begin_reversible_command (_("add gain control point"));
+       trackview.session()->begin_reversible_command (_("add gain control point"));
        XMLNode &before = audio_region()->envelope()->get_state();
 
        if (!audio_region()->envelope_active()) {
                XMLNode &region_before = audio_region()->get_state();
                audio_region()->set_envelope_active(true);
                XMLNode &region_after = audio_region()->get_state();
-               trackview.session().add_command (new MementoCommand<AudioRegion>(*(audio_region().get()), &region_before, &region_after));
+               trackview.session()->add_command (new MementoCommand<AudioRegion>(*(audio_region().get()), &region_before, &region_after));
        }
 
        audio_region()->envelope()->add (fx, y);
 
        XMLNode &after = audio_region()->envelope()->get_state();
-       trackview.session().add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after));
-       trackview.session().commit_reversible_command ();
+       trackview.session()->add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after));
+       trackview.session()->commit_reversible_command ();
 }
 
 void
@@ -1187,7 +1186,7 @@ AudioRegionView::add_ghost (TimeAxisView& tv)
        ghost->set_colors();
        ghosts.push_back (ghost);
 
-       ghost->GoingAway.connect (sigc::mem_fun(*this, &AudioRegionView::remove_ghost));
+       ghost->GoingAway.connect (boost::bind (&RegionView::remove_ghost, this, _1));
 
        return ghost;
 }
index 289035d9bf9e017bd2eff2752a5f9dd96527daa9..85ea02a197ad0c72471500c61b615087976864ed 100644 (file)
@@ -188,9 +188,9 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai
 
        region_views.push_front (region_view);
 
-       /* catch regionview going away */
-       cerr << this << " connected to region " << r << endl;
-       r->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &AudioStreamView::remove_region_view), boost::weak_ptr<Region> (r)));
+       /* catch region going away */
+
+       scoped_connect (r->GoingAway, boost::bind (&AudioStreamView::remove_region_view, this, boost::weak_ptr<Region> (r)));
 
        RegionViewAdded (region_view);
 
@@ -200,9 +200,9 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai
 void
 AudioStreamView::remove_region_view (boost::weak_ptr<Region> weak_r)
 {
-       cerr << this << " RRV entry\n";
+       ENSURE_GUI_THREAD (*this, &AudioStreamView::remove_region_view, weak_r);
 
-       ENSURE_GUI_THREAD (*this, &AudioStreamView::remove_region_view, weak_r)
+       cerr << "a region went way, it appears to be ours (" << this << ")\n";
 
        boost::shared_ptr<Region> r (weak_r.lock());
 
@@ -210,9 +210,7 @@ AudioStreamView::remove_region_view (boost::weak_ptr<Region> weak_r)
                return;
        }
 
-       cerr << this << " RRV action for  " << r << endl;
-
-       if (!_trackview.session().deletion_in_progress()) {
+       if (!_trackview.session()->deletion_in_progress()) {
 
                for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end();) {
                        CrossfadeViewList::iterator tmp;
@@ -286,9 +284,9 @@ AudioStreamView::playlist_changed (boost::shared_ptr<Diskstream> ds)
        StreamView::playlist_changed(ds);
 
        boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(ds->playlist());
+
        if (apl) {
-               playlist_connections.push_back (apl->NewCrossfade.connect (
-                               sigc::mem_fun (*this, &AudioStreamView::add_crossfade)));
+               playlist_connections.add_connection (apl->NewCrossfade.connect (boost::bind (&AudioStreamView::add_crossfade, this, _1)));
        }
 }
 
@@ -349,7 +347,7 @@ AudioStreamView::add_crossfade (boost::shared_ptr<Crossfade> crossfade)
        cv->set_valid (true);
        crossfade->Invalidated.connect (sigc::mem_fun (*this, &AudioStreamView::remove_crossfade));
        crossfade_views[cv->crossfade] = cv;
-       if (!_trackview.session().config.get_xfades_visible() || !crossfades_visible) {
+       if (!_trackview.session()->config.get_xfades_visible() || !crossfades_visible) {
                cv->hide ();
        }
 
@@ -462,12 +460,12 @@ AudioStreamView::setup_rec_box ()
 {
        //cerr << _trackview.name() << " streamview SRB region_views.size() = " << region_views.size() << endl;
 
-       if (_trackview.session().transport_rolling()) {
+       if (_trackview.session()->transport_rolling()) {
 
                // cerr << "\trolling\n";
 
                if (!rec_active &&
-                   _trackview.session().record_status() == Session::Recording &&
+                   _trackview.session()->record_status() == Session::Recording &&
                    _trackview.get_diskstream()->record_enabled()) {
                        if (_trackview.audio_track()->mode() == Normal && use_rec_regions && rec_regions.size() == rec_rects.size()) {
 
@@ -475,12 +473,7 @@ AudioStreamView::setup_rec_box ()
 
                                SourceList sources;
 
-                               for (list<sigc::connection>::iterator prc = rec_data_ready_connections.begin();
-                                               prc != rec_data_ready_connections.end(); ++prc) {
-                                       (*prc).disconnect();
-                               }
-                               rec_data_ready_connections.clear();
-
+                               rec_data_ready_connections.drop_connections ();
                                boost::shared_ptr<AudioDiskstream> ads = _trackview.audio_track()->audio_diskstream();
 
                                for (uint32_t n=0; n < ads->n_channels().n_audio(); ++n) {
@@ -488,9 +481,9 @@ AudioStreamView::setup_rec_box ()
                                        if (src) {
                                                sources.push_back (src);
 
-                                               rec_data_ready_connections.push_back (src->PeakRangeReady.connect (sigc::bind
-                                                       (sigc::mem_fun (*this, &AudioStreamView::rec_peak_range_ready),
-                                                        boost::weak_ptr<Source>(src))));
+                                               rec_data_ready_connections.add_connection 
+                                                       (src->PeakRangeReady.connect 
+                                                        (boost::bind (&AudioStreamView::rec_peak_range_ready, this, _1, _2, boost::weak_ptr<Source>(src))));
                                        }
                                }
 
@@ -506,7 +499,7 @@ AudioStreamView::setup_rec_box ()
                                                RegionFactory::create (sources, start, 1, "", 0, Region::DefaultFlags, false)));
                                assert(region);
                                region->block_property_changes ();
-                               region->set_position (_trackview.session().transport_frame(), this);
+                               region->set_position (_trackview.session()->transport_frame(), this);
                                rec_regions.push_back (make_pair(region, (RegionView*)0));
                        }
 
@@ -550,7 +543,7 @@ AudioStreamView::setup_rec_box ()
 
                        RecBoxInfo recbox;
                        recbox.rectangle = rec_rect;
-                       recbox.start = _trackview.session().transport_frame();
+                       recbox.start = _trackview.session()->transport_frame();
                        recbox.length = 0;
 
                        rec_rects.push_back (recbox);
@@ -562,7 +555,7 @@ AudioStreamView::setup_rec_box ()
                        rec_active = true;
 
                } else if (rec_active &&
-                          (_trackview.session().record_status() != Session::Recording ||
+                          (_trackview.session()->record_status() != Session::Recording ||
                            !_trackview.get_diskstream()->record_enabled())) {
                        screen_update_connection.disconnect();
                        rec_active = false;
@@ -577,13 +570,7 @@ AudioStreamView::setup_rec_box ()
 
                        /* disconnect rapid update */
                        screen_update_connection.disconnect();
-
-                       for (list<sigc::connection>::iterator prc = rec_data_ready_connections.begin();
-                                       prc != rec_data_ready_connections.end(); ++prc) {
-                               (*prc).disconnect();
-                       }
-                       rec_data_ready_connections.clear();
-
+                       rec_data_ready_connections.drop_connections ();
                        rec_updating = false;
                        rec_active = false;
 
index f9c10a389408771d52736c07f845a684007aaac8..040e56a3232d90e1bfe6d25e90c6b4f883c142c2 100644 (file)
@@ -76,7 +76,7 @@ using namespace PBD;
 using namespace Gtk;
 using namespace Editing;
 
-AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
+AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session* sess, boost::shared_ptr<Route> rt, Canvas& canvas)
        : AxisView(sess)
        , RouteTimeAxisView(ed, sess, rt, canvas)
 {
index 02c7ed4f198a209db09ef19fb7813b9739d220d1..80450e9f61aa38e44342f1f1260b538c5dee33d4 100644 (file)
@@ -66,7 +66,7 @@ class AutomationTimeAxisView;
 class AudioTimeAxisView : public RouteTimeAxisView
 {
   public:
-       AudioTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
+       AudioTimeAxisView (PublicEditor&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
        virtual ~AudioTimeAxisView ();
 
        AudioStreamView* audio_view();
index f56ca898ce2750f2d739e5b5c64716a1856e0d66..7f9bd6b45551666bd2f68417ea561bd3cacd608b 100644 (file)
@@ -87,7 +87,7 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv
 
        alist->StateChanged.connect (sigc::mem_fun(*this, &AutomationLine::list_changed));
 
-       trackview.session().register_with_memento_command_factory(alist->id(), this);
+       trackview.session()->register_with_memento_command_factory(alist->id(), this);
 
        if (alist->parameter().type() == GainAutomation ||
            alist->parameter().type() == EnvelopeAutomation) {
@@ -215,8 +215,8 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
 
        double const x = trackview.editor().frame_to_unit (_time_converter.to((*cp.model())->when));
 
-       trackview.editor().current_session()->begin_reversible_command (_("automation event move"));
-       trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
+       trackview.editor().session()->begin_reversible_command (_("automation event move"));
+       trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
 
        cp.move_to (x, y, ControlPoint::Full);
        reset_line_coords (cp);
@@ -231,9 +231,9 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
 
        update_pending = false;
 
-       trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
-       trackview.editor().current_session()->commit_reversible_command ();
-       trackview.editor().current_session()->set_dirty ();
+       trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
+       trackview.editor().session()->commit_reversible_command ();
+       trackview.editor().session()->set_dirty ();
 }
 
 
@@ -723,7 +723,7 @@ AutomationLine::invalidate_point (ALPoints& p, uint32_t index)
 void
 AutomationLine::start_drag (ControlPoint* cp, nframes_t x, float fraction)
 {
-       if (trackview.editor().current_session() == 0) { /* how? */
+       if (trackview.editor().session() == 0) { /* how? */
                return;
        }
 
@@ -735,8 +735,8 @@ AutomationLine::start_drag (ControlPoint* cp, nframes_t x, float fraction)
                str = _("automation range drag");
        }
 
-       trackview.editor().current_session()->begin_reversible_command (str);
-       trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
+       trackview.editor().session()->begin_reversible_command (str);
+       trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0));
 
        drag_x = x;
        drag_distance = 0;
@@ -830,9 +830,9 @@ AutomationLine::end_drag (ControlPoint* cp)
 
        update_pending = false;
 
-       trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
-       trackview.editor().current_session()->commit_reversible_command ();
-       trackview.editor().current_session()->set_dirty ();
+       trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state()));
+       trackview.editor().session()->commit_reversible_command ();
+       trackview.editor().session()->set_dirty ();
 }
 
 
@@ -973,15 +973,15 @@ AutomationLine::remove_point (ControlPoint& cp)
 
        model_representation (cp, mr);
 
-       trackview.editor().current_session()->begin_reversible_command (_("remove control point"));
+       trackview.editor().session()->begin_reversible_command (_("remove control point"));
        XMLNode &before = alist->get_state();
 
        alist->erase (mr.start, mr.end);
 
-       trackview.editor().current_session()->add_command(new MementoCommand<AutomationList>(
+       trackview.editor().session()->add_command(new MementoCommand<AutomationList>(
                        *alist.get(), &before, &alist->get_state()));
-       trackview.editor().current_session()->commit_reversible_command ();
-       trackview.editor().current_session()->set_dirty ();
+       trackview.editor().session()->commit_reversible_command ();
+       trackview.editor().session()->set_dirty ();
 }
 
 void
@@ -1020,7 +1020,7 @@ AutomationLine::get_selectables (nframes_t& start, nframes_t& end,
 
                                if (collecting) {
 
-                                       results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, trackview));
+                                       results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, &trackview));
                                        collecting = false;
                                        nstart = max_frames;
                                        nend = 0;
@@ -1030,7 +1030,7 @@ AutomationLine::get_selectables (nframes_t& start, nframes_t& end,
        }
 
        if (collecting) {
-               results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, trackview));
+               results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, &trackview));
        }
 
 }
@@ -1057,7 +1057,7 @@ AutomationLine::set_selected_points (PointSelection& points)
 
        for (PointSelection::iterator r = points.begin(); r != points.end(); ++r) {
 
-               if (&(*r).track != &trackview) {
+               if ((*r).track != &trackview) {
                        continue;
                }
 
@@ -1190,10 +1190,10 @@ AutomationLine::clear ()
        /* parent must create command */
        XMLNode &before = get_state();
        alist->clear();
-       trackview.editor().current_session()->add_command (
+       trackview.editor().session()->add_command (
                        new MementoCommand<AutomationLine>(*this, &before, &get_state()));
-       trackview.editor().current_session()->commit_reversible_command ();
-       trackview.editor().current_session()->set_dirty ();
+       trackview.editor().session()->commit_reversible_command ();
+       trackview.editor().session()->set_dirty ();
 }
 
 void
index c8c265c30715ea843b4122e1526fe3a24a07d0b8..c16bf60008b5939823cc189ca370ce83f8d86d0e 100644 (file)
@@ -52,7 +52,7 @@ namespace Gnome {
        }
 }
 
-class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoingAway
+class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
 {
   public:
        AutomationLine (const std::string& name, TimeAxisView&, ArdourCanvas::Group&,
index a891feb2e194d162adedf7b43b13dc159547505c..9056adc6932eb938156b4c6debc0b32c5fed1915 100644 (file)
@@ -117,16 +117,16 @@ AutomationRegionView::add_automation_event (GdkEvent* /*event*/, nframes_t when,
 
        _line->view_to_model_coord (x, y);
 
-       view->session().begin_reversible_command (_("add automation event"));
+       view->session()->begin_reversible_command (_("add automation event"));
        XMLNode& before = _line->the_list()->get_state();
 
        _line->the_list()->add (x, y);
 
        XMLNode& after = _line->the_list()->get_state();
-       view->session().commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(
+       view->session()->commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(
                        *_line->the_list(), &before, &after));
 
-       view->session().set_dirty ();
+       view->session()->set_dirty ();
 }
 
 void
index 851da8bf7900b0c25d7fd0a8b3c1f1a11a6b5c14..92e73a3c33e8a3ce81187549a30512fc0d8a0d9c 100644 (file)
@@ -31,17 +31,17 @@ struct AutomationSelectable : public Selectable
     nframes_t end;
     double low_fract;
     double high_fract;
-    TimeAxisView& track;
+    TimeAxisView* track; // ref would be better, but ARDOUR::SessionHandlePtr is non-assignable
 
-    AutomationSelectable (nframes_t s, nframes_t e, double l, double h, TimeAxisView& atv)
+    AutomationSelectable (nframes_t s, nframes_t e, double l, double h, TimeAxisView* atv)
            : start (s), end (e), low_fract (l), high_fract (h), track (atv) {}
 
     bool operator== (const AutomationSelectable& other) {
            return start == other.start &&
-                   end == other.end &&
-                   low_fract == other.low_fract &&
-                   high_fract == other.high_fract &&
-                   &track == &other.track;
+           end == other.end &&
+           low_fract == other.low_fract &&
+           high_fract == other.high_fract &&
+           track == other.track;
     }
 };
 
index a22b2644d0358adbb5e8b615e00940e1f6e75bd2..9c7cf50ac7b1f6a9d16cf238ab12316eb461de0a 100644 (file)
@@ -129,7 +129,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
        display_region(region_view);
 
        /* catch regionview going away */
-       region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &AutomationStreamView::remove_region_view), region));
+       scoped_connect (region->GoingAway, boost::bind (&AutomationStreamView::remove_region_view, this, boost::weak_ptr<Region>(region)));
 
        RegionViewAdded (region_view);
 
index 3184033dca88cb662cc3eccbd51924feab832893..aee9b70726ff9f78aa3b5e391047b8ad8ce2343d 100644 (file)
@@ -58,7 +58,7 @@ const string AutomationTimeAxisView::state_node_name = "AutomationChild";
  * For route child (e.g. plugin) automation, pass the child for \a.
  * For region automation (e.g. MIDI CC), pass null for \a.
  */
-AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r,
+AutomationTimeAxisView::AutomationTimeAxisView (Session* s, boost::shared_ptr<Route> r,
                boost::shared_ptr<Automatable> a, boost::shared_ptr<AutomationControl> c,
                PublicEditor& e, TimeAxisView& parent, bool show_regions,
                ArdourCanvas::Canvas& canvas, const string & nom, const string & nomparent)
@@ -370,11 +370,11 @@ AutomationTimeAxisView::set_interpolation (AutomationList::InterpolationStyle st
 void
 AutomationTimeAxisView::clear_clicked ()
 {
-       _session.begin_reversible_command (_("clear automation"));
+       _session->begin_reversible_command (_("clear automation"));
        if (_line) {
                _line->clear ();
        }
-       _session.commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
@@ -587,15 +587,15 @@ AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* /*item*/, GdkE
 
        _line->view_to_model_coord (x, y);
 
-       _session.begin_reversible_command (_("add automation event"));
+       _session->begin_reversible_command (_("add automation event"));
        XMLNode& before = _control->alist()->get_state();
 
        _control->alist()->add (when, y);
 
        XMLNode& after = _control->alist()->get_state();
-       _session.commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(*_control->alist(), &before, &after));
+       _session->commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(*_control->alist(), &before, &after));
 
-       _session.set_dirty ();
+       _session->set_dirty ();
 }
 
 bool
@@ -617,7 +617,7 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel
        case Cut:
                if ((what_we_got = alist->cut (selection.time.front().start, selection.time.front().end)) != 0) {
                        _editor.get_cut_buffer().add (what_we_got);
-                       _session.add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
+                       _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
                        ret = true;
                }
                break;
@@ -629,7 +629,7 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel
 
        case Clear:
                if ((what_we_got = alist->cut (selection.time.front().start, selection.time.front().end)) != 0) {
-                       _session.add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
+                       _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
                        ret = true;
                }
                break;
@@ -659,11 +659,11 @@ AutomationTimeAxisView::reset_objects_one (AutomationLine& line, PointSelection&
 {
        boost::shared_ptr<AutomationList> alist(line.the_list());
 
-       _session.add_command (new MementoCommand<AutomationList>(*alist.get(), &alist->get_state(), 0));
+       _session->add_command (new MementoCommand<AutomationList>(*alist.get(), &alist->get_state(), 0));
 
        for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) {
 
-               if (&(*i).track != this) {
+               if ((*i).track != this) {
                        continue;
                }
 
@@ -688,7 +688,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS
 
        for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) {
 
-               if (&(*i).track != this) {
+               if ((*i).track != this) {
                        continue;
                }
 
@@ -696,7 +696,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS
                case Cut:
                        if ((what_we_got = alist->cut ((*i).start, (*i).end)) != 0) {
                                _editor.get_cut_buffer().add (what_we_got);
-                               _session.add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state()));
+                               _session->add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state()));
                                ret = true;
                        }
                        break;
@@ -708,7 +708,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS
 
                case Clear:
                        if ((what_we_got = alist->cut ((*i).start, (*i).end)) != 0) {
-                               _session.add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state()));
+                               _session->add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state()));
                                ret = true;
                        }
                        break;
@@ -765,7 +765,7 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, nframes_t pos, float ti
 
        XMLNode &before = alist->get_state();
        alist->paste (copy, pos, times);
-       _session.add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
+       _session->add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
 
        return true;
 }
@@ -834,7 +834,7 @@ AutomationTimeAxisView::add_line (boost::shared_ptr<AutomationLine> line)
        assert(line->the_list() == _control->list());
 
        automation_connection = _control->alist()->automation_state_changed.connect
-               (sigc::mem_fun(*this, &AutomationTimeAxisView::automation_state_changed));
+               (boost::bind (&AutomationTimeAxisView::automation_state_changed, this));
 
        _line = line;
        //_controller = AutomationController::create(_session, line->the_list(), _control);
index f4d71f93c22e96a42dc2a439e816d402321e6603..f00d0a24fe9816059a1110f0c22fc991664b0e0d 100644 (file)
@@ -54,7 +54,7 @@ class AutomationController;
 
 class AutomationTimeAxisView : public TimeAxisView {
   public:
-       AutomationTimeAxisView (ARDOUR::Session&,
+       AutomationTimeAxisView (ARDOUR::Session*,
                                boost::shared_ptr<ARDOUR::Route>,
                                boost::shared_ptr<ARDOUR::Automatable>,
                                boost::shared_ptr<ARDOUR::AutomationControl>,
@@ -151,7 +151,7 @@ class AutomationTimeAxisView : public TimeAxisView {
        void set_interpolation (ARDOUR::AutomationList::InterpolationStyle);
        void interpolation_changed ();
 
-       sigc::connection automation_connection;
+       boost::signals2::scoped_connection automation_connection;
 
        void update_extra_xml_shown (bool editor_shown);
 
index bed5e098b0ae4bccdf774d2f88f217577a32d26b..d645a518735c51a0fb54b1df8a815a750b615c2a 100644 (file)
 using namespace std;
 using namespace Gtk;
 using namespace Gtkmm2ext;
+using namespace ARDOUR;
 
 list<Gdk::Color> AxisView::used_colors;
 
-AxisView::AxisView (ARDOUR::Session& sess) : _session(sess)
+AxisView::AxisView (ARDOUR::Session* sess) 
+       : SessionHandlePtr (sess)
 {
        _selected = false;
        _marked_for_display = false;
index 21220d54396336632a9e416a24e36c9380831e87..3d2591a9774c67d3174307febab474f3b5a8851f 100644 (file)
 #include <gdkmm/color.h>
 
 #include "pbd/xml++.h"
+#include "pbd/destructible.h"
+
+#include "ardour/session_handle.h"
+
 #include "prompter.h"
 #include "selectable.h"
 
@@ -37,7 +41,7 @@ namespace ARDOUR {
  * AxisView defines the abstract base class for time-axis trackviews and routes.
  *
  */
-class AxisView : public virtual Selectable
+class AxisView : public virtual Selectable, public PBD::Destructible, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
 {
   public:
        /**
@@ -47,7 +51,7 @@ class AxisView : public virtual Selectable
         */
        Gdk::Color color() const { return _color; }
 
-       ARDOUR::Session& session() const { return _session; }
+       ARDOUR::Session* session() const { return _session; }
 
        virtual std::string name() const = 0;
 
@@ -57,17 +61,15 @@ class AxisView : public virtual Selectable
        }
 
        sigc::signal<void> Hiding;
-       sigc::signal<void> GoingAway;
 
        void set_old_order_key (uint32_t ok) { _old_order_key = ok; }
        uint32_t old_order_key() const { return _old_order_key; }
 
   protected:
 
-       AxisView (ARDOUR::Session& sess);
+       AxisView (ARDOUR::Session* sess);
        virtual ~AxisView();
 
-
        /**
         * Generate a new random TrackView color, unique from those colors already used.
         *
@@ -76,7 +78,6 @@ class AxisView : public virtual Selectable
        static Gdk::Color unique_random_color();
 
 
-       ARDOUR::Session& _session;
        Gdk::Color _color;
 
        static std::list<Gdk::Color> used_colors;
index b638544836d9d5645976d307be9783da9350b8e5..ca047ebea01bb64844069ddee2c7988e73a78cde 100644 (file)
 using namespace std;
 using namespace ARDOUR;
 
-BundleEditorMatrix::BundleEditorMatrix (
-       Gtk::Window* parent, Session* session, boost::shared_ptr<Bundle> bundle
-       )
-       : PortMatrix (parent, session, bundle->type()),
-         _bundle (bundle)
+BundleEditorMatrix::BundleEditorMatrix (Gtk::Window* parent, Session* session, boost::shared_ptr<Bundle> bundle)
+       : PortMatrix (parent, session, bundle->type())
+       , _bundle (bundle)
 {
        _port_group = boost::shared_ptr<PortGroup> (new PortGroup (""));
        _port_group->add_bundle (_bundle);
@@ -285,8 +283,12 @@ BundleEditor::on_map ()
 
 
 BundleManager::BundleManager (Session* session)
-       : ArdourDialog (_("Bundle Manager")), _session (session), edit_button (_("Edit")), delete_button (_("Delete"))
+       : ArdourDialog (_("Bundle Manager"))
+       , edit_button (_("Edit"))
+       , delete_button (_("Delete"))
 {
+       set_session (session);
+
        _list_model = Gtk::ListStore::create (_list_model_columns);
        _tree_view.set_model (_list_model);
        _tree_view.append_column (_("Name"), _list_model_columns.name);
index 3beb77e9525c61889ca20c7da4d3dc41a71344ba..d064e40bf65125b7dd0b3fa5d9793e5a42d002e6 100644 (file)
@@ -115,7 +115,6 @@ class BundleManager : public ArdourDialog
        Gtk::TreeView _tree_view;
        Glib::RefPtr<Gtk::ListStore> _list_model;
        ModelColumns _list_model_columns;
-       ARDOUR::Session* _session;
        Gtk::Button edit_button;
        Gtk::Button delete_button;
 };
index 4c9b8b7537db4fb3662866c47618292d2c7ec7b9..7a7b740a25059c200bec28a4877c49eea45e62c7 100644 (file)
@@ -72,10 +72,9 @@ CrossfadeEditor::Half::Half ()
 {
 }
 
-CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, double my, double mxy)
+CrossfadeEditor::CrossfadeEditor (Session* s, boost::shared_ptr<Crossfade> xf, double my, double mxy)
        : ArdourDialog (_("ardour: x-fade edit")),
          xfade (xf),
-         session (s),
          clear_button (_("Clear")),
          revert_button (_("Reset")),
          audition_both_button (_("Fade")),
@@ -96,6 +95,8 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d
          select_in_button (_("Fade In")),
          select_out_button (_("Fade Out"))
 {
+       set_session (s);
+
        set_wmclass (X_("ardour_automationedit"), "Ardour");
        set_name ("CrossfadeEditWindow");
        set_position (Gtk::WIN_POS_MOUSE);
@@ -292,7 +293,7 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d
 
        xfade->StateChanged.connect (sigc::mem_fun(*this, &CrossfadeEditor::xfade_changed));
 
-       session.AuditionActive.connect (sigc::mem_fun(*this, &CrossfadeEditor::audition_state_changed));
+       _session_connections.add_connection (_session->AuditionActive.connect (sigc::mem_fun(*this, &CrossfadeEditor::audition_state_changed)));
        show_all_children();
 }
 
@@ -1129,7 +1130,7 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh
 
                gdouble yoff = n * ht;
 
-               if (region->audio_source(n)->peaks_ready (sigc::bind (sigc::mem_fun(*this, &CrossfadeEditor::peaks_ready), region, which), peaks_ready_connection)) {
+               if (region->audio_source(n)->peaks_ready (boost::bind (&CrossfadeEditor::peaks_ready, this, boost::weak_ptr<AudioRegion>(region), which), peaks_ready_connection)) {
                        WaveView* waveview = new WaveView (*(canvas->root()));
 
                        waveview->property_data_src() = region.get();
@@ -1163,8 +1164,14 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh
 }
 
 void
-CrossfadeEditor::peaks_ready (boost::shared_ptr<AudioRegion> r, WhichFade which)
+CrossfadeEditor::peaks_ready (boost::weak_ptr<AudioRegion> wr, WhichFade which)
 {
+       boost::shared_ptr<AudioRegion> r (wr.lock());
+
+       if (!r) {
+               return;
+       }
+
        /* this should never be called, because the peak files for an xfade
           will be ready by the time we want them. but our API forces us
           to provide this, so ..
@@ -1176,7 +1183,7 @@ CrossfadeEditor::peaks_ready (boost::shared_ptr<AudioRegion> r, WhichFade which)
 void
 CrossfadeEditor::audition (Audition which)
 {
-       AudioPlaylist& pl (session.the_auditioner()->prepare_playlist());
+       AudioPlaylist& pl (_session->the_auditioner()->prepare_playlist());
        nframes_t preroll;
        nframes_t postroll;
        nframes_t left_start_offset;
@@ -1184,13 +1191,13 @@ CrossfadeEditor::audition (Audition which)
        nframes_t left_length;
 
        if (which != Right && preroll_button.get_active()) {
-               preroll = session.frame_rate() * 2;  //2 second hardcoded preroll for now
+               preroll = _session->frame_rate() * 2;  //2 second hardcoded preroll for now
        } else {
                preroll = 0;
        }
 
        if (which != Left && postroll_button.get_active()) {
-               postroll = session.frame_rate() * 2;  //2 second hardcoded postroll for now
+               postroll = _session->frame_rate() * 2;  //2 second hardcoded postroll for now
        } else {
                postroll = 0;
        }
@@ -1220,9 +1227,9 @@ CrossfadeEditor::audition (Audition which)
 
        //apply a 20ms declicking fade at the start and end of auditioning
        left->set_fade_in_active(true);
-       left->set_fade_in_length(session.frame_rate() / 50);
+       left->set_fade_in_length(_session->frame_rate() / 50);
        right->set_fade_out_active(true);
-       right->set_fade_out_length(session.frame_rate() / 50);
+       right->set_fade_out_length(_session->frame_rate() / 50);
 
        pl.add_region (left, 0);
        pl.add_region (right, 1 + preroll);
@@ -1236,7 +1243,7 @@ CrossfadeEditor::audition (Audition which)
        /* there is only one ... */
        pl.foreach_crossfade (sigc::mem_fun (*this, &CrossfadeEditor::setup));
 
-       session.audition_playlist ();
+       _session->audition_playlist ();
 }
 
 void
@@ -1251,7 +1258,7 @@ CrossfadeEditor::audition_left_dry ()
        boost::shared_ptr<AudioRegion> left (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), xfade->out()->length() - xfade->length(), xfade->length(), "xfade left",
                                                                                                              0, Region::DefaultFlags, false)));
 
-       session.audition_region (left);
+       _session->audition_region (left);
 }
 
 void
@@ -1265,7 +1272,7 @@ CrossfadeEditor::audition_right_dry ()
 {
        boost::shared_ptr<AudioRegion> right (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->in(), 0, xfade->length(), "xfade in",
                                                                                                               0, Region::DefaultFlags, false)));
-       session.audition_region (right);
+       _session->audition_region (right);
 }
 
 void
@@ -1277,7 +1284,7 @@ CrossfadeEditor::audition_right ()
 void
 CrossfadeEditor::cancel_audition ()
 {
-       session.cancel_audition ();
+       _session->cancel_audition ();
 }
 
 void
@@ -1285,7 +1292,7 @@ CrossfadeEditor::audition_toggled ()
 {
        bool x;
 
-       if ((x = audition_both_button.get_active ()) != session.is_auditioning()) {
+       if ((x = audition_both_button.get_active ()) != _session->is_auditioning()) {
 
                if (x) {
                        audition_both ();
@@ -1300,7 +1307,7 @@ CrossfadeEditor::audition_right_toggled ()
 {
        bool x;
 
-       if ((x = audition_right_button.get_active ()) != session.is_auditioning()) {
+       if ((x = audition_right_button.get_active ()) != _session->is_auditioning()) {
 
                if (x) {
                        audition_right ();
@@ -1315,7 +1322,7 @@ CrossfadeEditor::audition_right_dry_toggled ()
 {
        bool x;
 
-       if ((x = audition_right_dry_button.get_active ()) != session.is_auditioning()) {
+       if ((x = audition_right_dry_button.get_active ()) != _session->is_auditioning()) {
 
                if (x) {
                        audition_right_dry ();
@@ -1330,7 +1337,7 @@ CrossfadeEditor::audition_left_toggled ()
 {
        bool x;
 
-       if ((x = audition_left_button.get_active ()) != session.is_auditioning()) {
+       if ((x = audition_left_button.get_active ()) != _session->is_auditioning()) {
 
                if (x) {
                        audition_left ();
@@ -1345,7 +1352,7 @@ CrossfadeEditor::audition_left_dry_toggled ()
 {
        bool x;
 
-       if ((x = audition_left_dry_button.get_active ()) != session.is_auditioning()) {
+       if ((x = audition_left_dry_button.get_active ()) != _session->is_auditioning()) {
 
                if (x) {
                        audition_left_dry ();
@@ -1382,7 +1389,7 @@ CrossfadeEditor::on_key_release_event (GdkEventKey* ev)
                break;
 
        case GDK_space:
-               if (session.is_auditioning()) {
+               if (_session->is_auditioning()) {
                        cancel_audition ();
                } else {
                        audition_both_button.set_active (!audition_both_button.get_active());
index f2ec1a125bdd493d064bab253c1b6739833f4ac4..7334002abd8a677b7ad3681676e28d414bfd9088 100644 (file)
@@ -27,6 +27,8 @@
 #include <gtkmm/radiobutton.h>
 
 #include "evoral/Curve.hpp"
+#include "ardour/session_handle.h"
+
 #include "ardour_dialog.h"
 #include "canvas.h"
 
@@ -40,7 +42,7 @@ namespace ARDOUR
 class CrossfadeEditor : public ArdourDialog
 {
   public:
-       CrossfadeEditor (ARDOUR::Session&, boost::shared_ptr<ARDOUR::Crossfade>, double miny, double maxy);
+       CrossfadeEditor (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Crossfade>, double miny, double maxy);
        ~CrossfadeEditor ();
 
        void apply ();
@@ -79,7 +81,6 @@ class CrossfadeEditor : public ArdourDialog
 
   private:
        boost::shared_ptr<ARDOUR::Crossfade> xfade;
-       ARDOUR::Session& session;
 
        Gtk::VBox vpacker;
 
@@ -182,10 +183,10 @@ class CrossfadeEditor : public ArdourDialog
 
        void set (const ARDOUR::AutomationList& alist, WhichFade);
 
-       sigc::connection peaks_ready_connection;
+       boost::signals2::scoped_connection peaks_ready_connection;
 
        void make_waves (boost::shared_ptr<ARDOUR::AudioRegion>, WhichFade);
-       void peaks_ready (boost::shared_ptr<ARDOUR::AudioRegion> r, WhichFade);
+       void peaks_ready (boost::weak_ptr<ARDOUR::AudioRegion> r, WhichFade);
 
        void _apply_to (boost::shared_ptr<ARDOUR::Crossfade> xf);
        void setup (boost::shared_ptr<ARDOUR::Crossfade>);
index 2df4cd09829c4920c5836d21ddf495f28d0b886b..63868ca8955e83f847ab8f4996909c62a1741bd8 100644 (file)
@@ -39,7 +39,7 @@ using namespace Editing;
 using namespace Gnome;
 using namespace Canvas;
 
-sigc::signal<void,CrossfadeView*> CrossfadeView::GoingAway;
+boost::signals2::signal<void(CrossfadeView*)> CrossfadeView::GoingAway;
 
 CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
                              RouteTimeAxisView &tv,
index 3e4021742e0a391f93135fabbd5a9430ef9f257f..a82387393fcc13368456ec031268c6f6b632e548 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <vector>
 #include <libgnomecanvasmm.h>
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
 #include "ardour/crossfade.h"
 
 #include "time_axis_view_item.h"
@@ -52,7 +52,7 @@ struct CrossfadeView : public TimeAxisViewItem
     bool visible() const { return _visible; }
     void set_valid (bool yn);
 
-    static sigc::signal<void,CrossfadeView*> GoingAway;
+    static boost::signals2::signal<void(CrossfadeView*)> GoingAway;
 
     AudioRegionView& upper_regionview () const;
 
index dd9cdf9582bc35122d348b6dd2e2ed81a648a06f..bf0b2124bb193b99c2e376d79b2f65cdf32a410b 100644 (file)
@@ -268,7 +268,6 @@ Editor::Editor ()
 
        PublicEditor::_instance = this;
 
-       session = 0;
        _have_idled = false;
 
        selection = new Selection (this);
@@ -628,7 +627,7 @@ Editor::Editor ()
        _playlist_selector = new PlaylistSelector();
        _playlist_selector->signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), static_cast<Window *> (_playlist_selector)));
 
-       RegionView::RegionViewGoingAway.connect (sigc::mem_fun(*this, &Editor::catch_vanishing_regionview));
+       scoped_connect (RegionView::RegionViewGoingAway, boost::bind (&Editor::catch_vanishing_regionview, this, _1));
 
        /* nudge stuff */
 
@@ -805,8 +804,8 @@ Editor::instant_save ()
                return;
        }
 
-       if (session) {
-               session->add_instant_xml(get_state());
+       if (_session) {
+               _session->add_instant_xml(get_state());
        } else {
                Config->add_instant_xml(get_state());
        }
@@ -815,7 +814,7 @@ Editor::instant_save ()
 void
 Editor::zoom_adjustment_changed ()
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -824,8 +823,8 @@ Editor::zoom_adjustment_changed ()
        if (fpu < 1.0) {
                fpu = 1.0;
                zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
-       } else if (fpu > session->current_end_frame() / _canvas_width) {
-               fpu = session->current_end_frame() / _canvas_width;
+       } else if (fpu > _session->current_end_frame() / _canvas_width) {
+               fpu = _session->current_end_frame() / _canvas_width;
                zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
        }
 
@@ -837,7 +836,7 @@ Editor::control_scroll (float fraction)
 {
        ENSURE_GUI_THREAD (*this, &Editor::control_scroll, fraction)
 
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -855,7 +854,7 @@ Editor::control_scroll (float fraction)
        */
 
        if (!_control_scroll_target) {
-               _control_scroll_target = session->transport_frame();
+               _control_scroll_target = _session->transport_frame();
                _dragging_playhead = true;
        }
 
@@ -897,7 +896,7 @@ Editor::control_scroll (float fraction)
 bool
 Editor::deferred_control_scroll (nframes64_t /*target*/)
 {
-       session->request_locate (*_control_scroll_target, session->transport_rolling());
+       _session->request_locate (*_control_scroll_target, _session->transport_rolling());
        // reset for next stream
        _control_scroll_target = boost::none;
        _dragging_playhead = false;
@@ -907,7 +906,7 @@ Editor::deferred_control_scroll (nframes64_t /*target*/)
 void
 Editor::access_action (std::string action_group, std::string action_item)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -949,7 +948,7 @@ Editor::map_position_change (nframes64_t frame)
 {
        ENSURE_GUI_THREAD (*this, &Editor::map_position_change, frame)
 
-       if (session == 0 || !_follow_playhead) {
+       if (_session == 0 || !_follow_playhead) {
                return;
        }
 
@@ -987,12 +986,12 @@ Editor::center_screen_internal (nframes64_t frame, float page)
 void
 Editor::handle_new_duration ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
        ENSURE_GUI_THREAD (*this, &Editor::handle_new_duration)
-       nframes64_t new_end = session->current_end_frame() + (nframes64_t) floorf (current_page_frames() * 0.10f);
+       nframes64_t new_end = _session->current_end_frame() + (nframes64_t) floorf (current_page_frames() * 0.10f);
 
        horizontal_adjustment.set_upper (new_end / frames_per_unit);
        horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit);
@@ -1003,28 +1002,20 @@ Editor::handle_new_duration ()
        //cerr << "Editor::handle_new_duration () called ha v:l:u:ps:lcf = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << endl;//DEBUG
 }
 
-void
-Editor::update_title_s (const string & snap_name)
-{
-       ENSURE_GUI_THREAD (*this, &Editor::update_title_s, snap_name)
-
-       update_title ();
-}
-
 void
 Editor::update_title ()
 {
        ENSURE_GUI_THREAD (*this, &Editor::update_title)
 
-       if (session) {
-               bool dirty = session->dirty();
+       if (_session) {
+               bool dirty = _session->dirty();
 
                string session_name;
 
-               if (session->snap_name() != session->name()) {
-                       session_name = session->snap_name();
+               if (_session->snap_name() != _session->name()) {
+                       session_name = _session->snap_name();
                } else {
-                       session_name = session->name();
+                       session_name = _session->name();
                }
 
                if (dirty) {
@@ -1038,9 +1029,36 @@ Editor::update_title ()
 }
 
 void
-Editor::connect_to_session (Session *t)
+Editor::set_session (Session *t)
 {
-       session = t;
+       SessionHandlePtr::set_session (t);
+
+       zoom_range_clock.set_session (_session);
+       _playlist_selector->set_session (_session);
+       nudge_clock.set_session (_session);
+       _summary->set_session (_session);
+       _group_tabs->set_session (_session);
+       _route_groups->set_session (_session);
+       _regions->set_session (_session);
+       _snapshots->set_session (_session);
+       _routes->set_session (_session);
+       _locations->set_session (_session);
+
+       if (rhythm_ferret) {
+               rhythm_ferret->set_session (_session);
+       }
+
+       if (analysis_window) {
+               analysis_window->set_session (_session);
+       }
+
+       if (sfbrowser) {
+               sfbrowser->set_session (_session);
+       }
+
+       if (!_session) {
+               return;
+       }
 
        compute_fixed_ruler_scale ();
 
@@ -1053,79 +1071,65 @@ Editor::connect_to_session (Session *t)
 
        /* catch up with the playhead */
 
-       session->request_locate (playhead_cursor->current_frame);
+       _session->request_locate (playhead_cursor->current_frame);
 
        update_title ();
 
-       session->GoingAway.connect (sigc::mem_fun(*this, &Editor::session_going_away));
-       session->history().Changed.connect (sigc::mem_fun (*this, &Editor::history_changed));
+       _session_connections.add_connection (_session->history().Changed.connect (boost::bind (&Editor::history_changed, this)));
 
        /* These signals can all be emitted by a non-GUI thread. Therefore the
           handlers for them must not attempt to directly interact with the GUI,
           but use Gtkmm2ext::UI::instance()->call_slot();
        */
 
-       session_connections.push_back (session->TransportStateChange.connect (sigc::mem_fun(*this, &Editor::map_transport_state)));
-       session_connections.push_back (session->PositionChanged.connect (sigc::mem_fun(*this, &Editor::map_position_change)));
-       session_connections.push_back (session->RouteAdded.connect (sigc::mem_fun(*this, &Editor::handle_new_route)));
-       session_connections.push_back (session->DurationChanged.connect (sigc::mem_fun(*this, &Editor::handle_new_duration)));
-       session_connections.push_back (session->DirtyChanged.connect (sigc::mem_fun(*this, &Editor::update_title)));
-       session_connections.push_back (session->StateSaved.connect (sigc::mem_fun(*this, &Editor::update_title_s)));
-       session_connections.push_back (session->AskAboutPlaylistDeletion.connect (sigc::mem_fun(*this, &Editor::playlist_deletion_dialog)));
-
-       session_connections.push_back (session->TimecodeOffsetChanged.connect (sigc::mem_fun(*this, &Editor::update_just_timecode)));
+       _session_connections.add_connection (_session->TransportStateChange.connect (boost::bind (&Editor::map_transport_state, this)));
+       _session_connections.add_connection (_session->PositionChanged.connect (boost::bind (&Editor::map_position_change, this, _1)));
+       _session_connections.add_connection (_session->RouteAdded.connect (boost::bind (&Editor::handle_new_route, this, _1)));
+       _session_connections.add_connection (_session->DurationChanged.connect (boost::bind (&Editor::handle_new_duration, this)));
+       _session_connections.add_connection (_session->DirtyChanged.connect (boost::bind (&Editor::update_title, this)));
+       _session_connections.add_connection (_session->StateSaved.connect (boost::bind (&Editor::update_title, this)));
+       _session_connections.add_connection (_session->AskAboutPlaylistDeletion.connect (boost::bind (&Editor::playlist_deletion_dialog, this, _1)));
+       _session_connections.add_connection (_session->TimecodeOffsetChanged.connect (boost::bind (&Editor::update_just_timecode, this)));
+       _session_connections.add_connection (_session->tempo_map().StateChanged.connect (boost::bind (&Editor::tempo_map_changed, this, _1)));
+       _session_connections.add_connection (_session->Located.connect (boost::bind (&Editor::located, this)));
+       _session_connections.add_connection (_session->config.ParameterChanged.connect (boost::bind (&Editor::parameter_changed, this, _1)));
 
-       session_connections.push_back (session->tempo_map().StateChanged.connect (sigc::mem_fun(*this, &Editor::tempo_map_changed)));
-
-       session_connections.push_back (session->Located.connect (sigc::mem_fun (*this, &Editor::located)));
-       session_connections.push_back (session->config.ParameterChanged.connect (sigc::mem_fun (*this, &Editor::parameter_changed)));
-
-       zoom_range_clock.set_session (session);
-       _playlist_selector->set_session (session);
-       nudge_clock.set_session (session);
        if (Profile->get_sae()) {
                BBT_Time bbt;
                bbt.bars = 0;
                bbt.beats = 0;
                bbt.ticks = 120;
-               nframes_t pos = session->tempo_map().bbt_duration_at (0, bbt, 1);
+               nframes_t pos = _session->tempo_map().bbt_duration_at (0, bbt, 1);
                nudge_clock.set_mode(AudioClock::BBT);
                nudge_clock.set (pos, true, 0, AudioClock::BBT);
 
        } else {
-               nudge_clock.set (session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds
+               nudge_clock.set (_session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds
        }
 
        playhead_cursor->canvas_item.show ();
 
-       if (rhythm_ferret) {
-               rhythm_ferret->set_session (session);
-       }
-
-       if (analysis_window != 0)
-               analysis_window->set_session (session);
-
-       Location* loc = session->locations()->auto_loop_location();
+       Location* loc = _session->locations()->auto_loop_location();
        if (loc == 0) {
-               loc = new Location (0, session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden));
+               loc = new Location (0, _session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden));
                if (loc->start() == loc->end()) {
                        loc->set_end (loc->start() + 1);
                }
-               session->locations()->add (loc, false);
-               session->set_auto_loop_location (loc);
+               _session->locations()->add (loc, false);
+               _session->set_auto_loop_location (loc);
        } else {
                // force name
                loc->set_name (_("Loop"));
        }
 
-       loc = session->locations()->auto_punch_location();
+       loc = _session->locations()->auto_punch_location();
        if (loc == 0) {
-               loc = new Location (0, session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden));
+               loc = new Location (0, _session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden));
                if (loc->start() == loc->end()) {
                        loc->set_end (loc->start() + 1);
                }
-               session->locations()->add (loc, false);
-               session->set_auto_punch_location (loc);
+               _session->locations()->add (loc, false);
+               _session->set_auto_punch_location (loc);
        } else {
                // force name
                loc->set_name (_("Punch"));
@@ -1133,26 +1137,26 @@ Editor::connect_to_session (Session *t)
 
        boost::function<void (string)> pc (boost::bind (&Editor::parameter_changed, this, _1));
        Config->map_parameters (pc);
-       session->config.map_parameters (pc);
+       _session->config.map_parameters (pc);
 
-       session->StateSaved.connect (sigc::mem_fun(*this, &Editor::session_state_saved));
 
        refresh_location_display ();
-       session->locations()->added.connect (sigc::mem_fun(*this, &Editor::add_new_location));
-       session->locations()->removed.connect (sigc::mem_fun(*this, &Editor::location_gone));
-       session->locations()->changed.connect (sigc::mem_fun(*this, &Editor::refresh_location_display));
-       session->locations()->StateChanged.connect (sigc::mem_fun(*this, &Editor::refresh_location_display_s));
-       session->locations()->end_location()->changed.connect (sigc::mem_fun(*this, &Editor::end_location_changed));
 
-       if (sfbrowser) {
-               sfbrowser->set_session (session);
-       }
+       /* static signal - no need to drop connection when session is deleted (XXX or we are?)*/
+
+       _session->StateSaved.connect (sigc::mem_fun(*this, &Editor::session_state_saved));
+
+       _session_connections.add_connection (_session->locations()->added.connect (sigc::mem_fun(*this, &Editor::add_new_location)));
+       _session_connections.add_connection (_session->locations()->removed.connect (sigc::mem_fun(*this, &Editor::location_gone)));
+       _session_connections.add_connection (_session->locations()->changed.connect (sigc::mem_fun(*this, &Editor::refresh_location_display)));
+       _session_connections.add_connection (_session->locations()->StateChanged.connect (sigc::mem_fun(*this, &Editor::refresh_location_display_s)));
+       _session_connections.add_connection (_session->locations()->end_location()->changed.connect (sigc::mem_fun(*this, &Editor::end_location_changed)));
 
        handle_new_duration ();
 
        restore_ruler_visibility ();
        //tempo_map_changed (Change (0));
-       session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
+       _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
 
        for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
                (static_cast<TimeAxisView*>(*i))->set_samples_per_unit (frames_per_unit);
@@ -1173,15 +1177,7 @@ Editor::connect_to_session (Session *t)
        }
 
        /* register for undo history */
-       session->register_with_memento_command_factory(_id, this);
-
-       _summary->connect_to_session (session);
-       _group_tabs->connect_to_session (session);
-       _route_groups->connect_to_session (session);
-       _regions->connect_to_session (session);
-       _snapshots->connect_to_session (session);
-       _routes->connect_to_session (session);
-       _locations->connect_to_session (session);
+       _session->register_with_memento_command_factory(_id, this);
 
        start_updating ();
 }
@@ -1561,8 +1557,8 @@ Editor::analyze_region_selection()
        if (analysis_window == 0) {
                analysis_window = new AnalysisWindow();
 
-               if (session != 0)
-                       analysis_window->set_session(session);
+               if (_session != 0)
+                       analysis_window->set_session(_session);
 
                analysis_window->show_all();
        }
@@ -1579,8 +1575,8 @@ Editor::analyze_range_selection()
        if (analysis_window == 0) {
                analysis_window = new AnalysisWindow();
 
-               if (session != 0)
-                       analysis_window->set_session(session);
+               if (_session != 0)
+                       analysis_window->set_session(_session);
 
                analysis_window->show_all();
        }
@@ -2268,7 +2264,7 @@ Editor::set_state (const XMLNode& node, int /*version*/)
        set_default_size (g.base_width, g.base_height);
        move (x, y);
 
-       if (session && (prop = node.property ("playhead"))) {
+       if (_session && (prop = node.property ("playhead"))) {
                nframes64_t pos = atol (prop->value().c_str());
                playhead_cursor->set_position (pos);
        } else {
@@ -2515,7 +2511,7 @@ Editor::trackview_by_y_position (double y)
 void
 Editor::snap_to_with_modifier (nframes64_t& start, GdkEvent const * event, int32_t direction, bool for_mark)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -2533,7 +2529,7 @@ Editor::snap_to_with_modifier (nframes64_t& start, GdkEvent const * event, int32
 void
 Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark)
 {
-       if (!session || _snap_mode == SnapOff) {
+       if (!_session || _snap_mode == SnapOff) {
                return;
        }
 
@@ -2543,24 +2539,24 @@ Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark)
 void
 Editor::timecode_snap_to_internal (nframes64_t& start, int32_t direction, bool /*for_mark*/)
 {
-       const nframes64_t one_timecode_second = (nframes64_t)(rint(session->timecode_frames_per_second()) * session->frames_per_timecode_frame());
-       nframes64_t one_timecode_minute = (nframes64_t)(rint(session->timecode_frames_per_second()) * session->frames_per_timecode_frame() * 60);
+       const nframes64_t one_timecode_second = (nframes64_t)(rint(_session->timecode_frames_per_second()) * _session->frames_per_timecode_frame());
+       nframes64_t one_timecode_minute = (nframes64_t)(rint(_session->timecode_frames_per_second()) * _session->frames_per_timecode_frame() * 60);
 
        switch (_snap_type) {
        case SnapToTimecodeFrame:
-               if (((direction == 0) && (fmod((double)start, (double)session->frames_per_timecode_frame()) > (session->frames_per_timecode_frame() / 2))) || (direction > 0)) {
-                       start = (nframes64_t) (ceil ((double) start / session->frames_per_timecode_frame()) * session->frames_per_timecode_frame());
+               if (((direction == 0) && (fmod((double)start, (double)_session->frames_per_timecode_frame()) > (_session->frames_per_timecode_frame() / 2))) || (direction > 0)) {
+                       start = (nframes64_t) (ceil ((double) start / _session->frames_per_timecode_frame()) * _session->frames_per_timecode_frame());
                } else {
-                       start = (nframes64_t) (floor ((double) start / session->frames_per_timecode_frame()) *  session->frames_per_timecode_frame());
+                       start = (nframes64_t) (floor ((double) start / _session->frames_per_timecode_frame()) *  _session->frames_per_timecode_frame());
                }
                break;
 
        case SnapToTimecodeSeconds:
-               if (session->timecode_offset_negative())
+               if (_session->timecode_offset_negative())
                {
-                       start += session->timecode_offset ();
+                       start += _session->timecode_offset ();
                } else {
-                       start -= session->timecode_offset ();
+                       start -= _session->timecode_offset ();
                }
                if (((direction == 0) && (start % one_timecode_second > one_timecode_second / 2)) || direction > 0) {
                        start = (nframes64_t) ceil ((double) start / one_timecode_second) * one_timecode_second;
@@ -2568,31 +2564,31 @@ Editor::timecode_snap_to_internal (nframes64_t& start, int32_t direction, bool /
                        start = (nframes64_t) floor ((double) start / one_timecode_second) * one_timecode_second;
                }
 
-               if (session->timecode_offset_negative())
+               if (_session->timecode_offset_negative())
                {
-                       start -= session->timecode_offset ();
+                       start -= _session->timecode_offset ();
                } else {
-                       start += session->timecode_offset ();
+                       start += _session->timecode_offset ();
                }
                break;
 
        case SnapToTimecodeMinutes:
-               if (session->timecode_offset_negative())
+               if (_session->timecode_offset_negative())
                {
-                       start += session->timecode_offset ();
+                       start += _session->timecode_offset ();
                } else {
-                       start -= session->timecode_offset ();
+                       start -= _session->timecode_offset ();
                }
                if (((direction == 0) && (start % one_timecode_minute > one_timecode_minute / 2)) || direction > 0) {
                        start = (nframes64_t) ceil ((double) start / one_timecode_minute) * one_timecode_minute;
                } else {
                        start = (nframes64_t) floor ((double) start / one_timecode_minute) * one_timecode_minute;
                }
-               if (session->timecode_offset_negative())
+               if (_session->timecode_offset_negative())
                {
-                       start -= session->timecode_offset ();
+                       start -= _session->timecode_offset ();
                } else {
-                       start += session->timecode_offset ();
+                       start += _session->timecode_offset ();
                }
                break;
        default:
@@ -2604,8 +2600,8 @@ Editor::timecode_snap_to_internal (nframes64_t& start, int32_t direction, bool /
 void
 Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
 {
-       const nframes64_t one_second = session->frame_rate();
-       const nframes64_t one_minute = session->frame_rate() * 60;
+       const nframes64_t one_second = _session->frame_rate();
+       const nframes64_t one_minute = _session->frame_rate() * 60;
        nframes64_t presnap = start;
        nframes64_t before;
        nframes64_t after;
@@ -2641,31 +2637,31 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
                break;
 
        case SnapToBar:
-               start = session->tempo_map().round_to_bar (start, direction);
+               start = _session->tempo_map().round_to_bar (start, direction);
                break;
 
        case SnapToBeat:
-               start = session->tempo_map().round_to_beat (start, direction);
+               start = _session->tempo_map().round_to_beat (start, direction);
                break;
 
        case SnapToAThirtysecondBeat:
-               start = session->tempo_map().round_to_beat_subdivision (start, 32, direction);
+               start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction);
                break;
 
        case SnapToASixteenthBeat:
-               start = session->tempo_map().round_to_beat_subdivision (start, 16, direction);
+               start = _session->tempo_map().round_to_beat_subdivision (start, 16, direction);
                break;
 
        case SnapToAEighthBeat:
-               start = session->tempo_map().round_to_beat_subdivision (start, 8, direction);
+               start = _session->tempo_map().round_to_beat_subdivision (start, 8, direction);
                break;
 
        case SnapToAQuarterBeat:
-               start = session->tempo_map().round_to_beat_subdivision (start, 4, direction);
+               start = _session->tempo_map().round_to_beat_subdivision (start, 4, direction);
                break;
 
        case SnapToAThirdBeat:
-               start = session->tempo_map().round_to_beat_subdivision (start, 3, direction);
+               start = _session->tempo_map().round_to_beat_subdivision (start, 3, direction);
                break;
 
        case SnapToMark:
@@ -2673,7 +2669,7 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
                        return;
                }
 
-               session->locations()->marks_either_side (start, before, after);
+               _session->locations()->marks_either_side (start, before, after);
 
                if (before == max_frames) {
                        start = after;
@@ -2971,8 +2967,8 @@ Editor::midi_panic ()
 {
        cerr << "MIDI panic\n";
 
-       if (session) {
-               session->midi_panic();
+       if (_session) {
+               _session->midi_panic();
        }
 }
 
@@ -3008,7 +3004,7 @@ Editor::convert_drop_to_paths (
                guint                           /*info*/,
                guint                           /*time*/)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return -1;
        }
 
@@ -3120,7 +3116,7 @@ Editor::map_transport_state ()
 {
        ENSURE_GUI_THREAD (*this, &Editor::map_transport_state)
 
-       if (session->transport_stopped()) {
+       if (_session->transport_stopped()) {
                have_pending_keyboard_selection = false;
        }
 
@@ -3162,17 +3158,17 @@ Editor::restore_state (State *state)
 void
 Editor::begin_reversible_command (string name)
 {
-       if (session) {
+       if (_session) {
                before = &get_state();
-               session->begin_reversible_command (name);
+               _session->begin_reversible_command (name);
        }
 }
 
 void
 Editor::commit_reversible_command ()
 {
-       if (session) {
-               session->commit_reversible_command (new MementoCommand<Editor>(*this, before, &get_state()));
+       if (_session) {
+               _session->commit_reversible_command (new MementoCommand<Editor>(*this, before, &get_state()));
        }
 }
 
@@ -3205,20 +3201,20 @@ Editor::history_changed ()
 {
        string label;
 
-       if (undo_action && session) {
-               if (session->undo_depth() == 0) {
+       if (undo_action && _session) {
+               if (_session->undo_depth() == 0) {
                        label = _("Undo");
                } else {
-                       label = string_compose(_("Undo (%1)"), session->next_undo());
+                       label = string_compose(_("Undo (%1)"), _session->next_undo());
                }
                undo_action->property_label() = label;
        }
 
-       if (redo_action && session) {
-               if (session->redo_depth() == 0) {
+       if (redo_action && _session) {
+               if (_session->redo_depth() == 0) {
                        label = _("Redo");
                } else {
-                       label = string_compose(_("Redo (%1)"), session->next_redo());
+                       label = string_compose(_("Redo (%1)"), _session->next_redo());
                }
                redo_action->property_label() = label;
        }
@@ -3394,7 +3390,7 @@ Editor::cycle_edit_mode ()
 void
 Editor::edit_mode_selection_done ()
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -3735,7 +3731,7 @@ Editor::edit_xfade (boost::weak_ptr<Crossfade> wxfade)
                return;
        }
 
-       CrossfadeEditor cew (*session, xfade, xfade->fade_in().get_min_y(), 1.0);
+       CrossfadeEditor cew (_session, xfade, xfade->fade_in().get_min_y(), 1.0);
 
        ensure_float (cew);
 
@@ -3787,8 +3783,8 @@ Editor::get_grid_type_as_beats (bool& success, nframes64_t position)
                break;
 
        case SnapToBar:
-               if (session) {
-                       return session->tempo_map().meter_at (position).beats_per_bar();
+               if (_session) {
+                       return _session->tempo_map().meter_at (position).beats_per_bar();
                }
                break;
 
@@ -3899,8 +3895,8 @@ Editor::finish_cleanup ()
 Location*
 Editor::transport_loop_location()
 {
-       if (session) {
-               return session->locations()->auto_loop_location();
+       if (_session) {
+               return _session->locations()->auto_loop_location();
        } else {
                return 0;
        }
@@ -3909,8 +3905,8 @@ Editor::transport_loop_location()
 Location*
 Editor::transport_punch_location()
 {
-       if (session) {
-               return session->locations()->auto_punch_location();
+       if (_session) {
+               return _session->locations()->auto_punch_location();
        } else {
                return 0;
        }
@@ -4001,7 +3997,7 @@ Editor::new_playlists (TimeAxisView* v)
 {
        begin_reversible_command (_("new playlists"));
        vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
-       session->playlists->get (playlists);
+       _session->playlists->get (playlists);
        mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_use_new_playlist), playlists), v, RouteGroup::Edit);
        commit_reversible_command ();
 }
@@ -4017,7 +4013,7 @@ Editor::copy_playlists (TimeAxisView* v)
 {
        begin_reversible_command (_("copy playlists"));
        vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
-       session->playlists->get (playlists);
+       _session->playlists->get (playlists);
        mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_use_copy_playlist), playlists), v, RouteGroup::Edit);
        commit_reversible_command ();
 }
@@ -4032,7 +4028,7 @@ Editor::clear_playlists (TimeAxisView* v)
 {
        begin_reversible_command (_("clear playlists"));
        vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
-       session->playlists->get (playlists);
+       _session->playlists->get (playlists);
        mapover_tracks (sigc::mem_fun (*this, &Editor::mapped_clear_playlist), v, RouteGroup::Edit);
        commit_reversible_command ();
 }
@@ -4239,8 +4235,8 @@ Editor::post_zoom ()
 
        ZoomChanged (); /* EMIT_SIGNAL */
 
-       if (session) {
-               cef = session->current_end_frame() + (current_page_frames() / 10);// Add a little extra so we can see the end marker
+       if (_session) {
+               cef = _session->current_end_frame() + (current_page_frames() / 10);// Add a little extra so we can see the end marker
        }
        horizontal_adjustment.set_upper (cef / frames_per_unit);
 
@@ -4265,7 +4261,7 @@ Editor::queue_visual_change (nframes64_t where)
           can reach.
        */
 
-       if (session && (where > session->current_end_frame())) {
+       if (_session && (where > _session->current_end_frame())) {
                horizontal_adjustment.set_upper ((where + current_page_frames()) / frames_per_unit);
        }
 
@@ -4332,9 +4328,9 @@ Editor::idle_visual_changer ()
        nframes64_t csf=0, cef=0;
        nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
 
-       if (session) {
-               csf = session->current_start_frame();
-               cef = session->current_end_frame();
+       if (_session) {
+               csf = _session->current_start_frame();
+               cef = _session->current_end_frame();
        }
 
        /* if we seek beyond the current end of the canvas, move the end */
@@ -4397,7 +4393,7 @@ Editor::get_preferred_edit_position (bool ignore_playhead)
 
        switch (ep) {
        case EditAtPlayhead:
-               where = session->audible_frame();
+               where = _session->audible_frame();
                break;
 
        case EditAtSelectedMarker:
@@ -4431,7 +4427,7 @@ Editor::get_preferred_edit_position (bool ignore_playhead)
 void
 Editor::set_loop_range (nframes64_t start, nframes64_t end, string cmd)
 {
-       if (!session) return;
+       if (!_session) return;
 
        begin_reversible_command (cmd);
 
@@ -4439,17 +4435,17 @@ Editor::set_loop_range (nframes64_t start, nframes64_t end, string cmd)
 
        if ((tll = transport_loop_location()) == 0) {
                Location* loc = new Location (start, end, _("Loop"),  Location::IsAutoLoop);
-               XMLNode &before = session->locations()->get_state();
-               session->locations()->add (loc, true);
-               session->set_auto_loop_location (loc);
-               XMLNode &after = session->locations()->get_state();
-               session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
+               XMLNode &before = _session->locations()->get_state();
+               _session->locations()->add (loc, true);
+               _session->set_auto_loop_location (loc);
+               XMLNode &after = _session->locations()->get_state();
+               _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
        } else {
                XMLNode &before = tll->get_state();
                tll->set_hidden (false, this);
                tll->set (start, end);
                XMLNode &after = tll->get_state();
-               session->add_command (new MementoCommand<Location>(*tll, &before, &after));
+               _session->add_command (new MementoCommand<Location>(*tll, &before, &after));
        }
 
        commit_reversible_command ();
@@ -4458,7 +4454,7 @@ Editor::set_loop_range (nframes64_t start, nframes64_t end, string cmd)
 void
 Editor::set_punch_range (nframes64_t start, nframes64_t end, string cmd)
 {
-       if (!session) return;
+       if (!_session) return;
 
        begin_reversible_command (cmd);
 
@@ -4466,18 +4462,18 @@ Editor::set_punch_range (nframes64_t start, nframes64_t end, string cmd)
 
        if ((tpl = transport_punch_location()) == 0) {
                Location* loc = new Location (start, end, _("Loop"),  Location::IsAutoPunch);
-               XMLNode &before = session->locations()->get_state();
-               session->locations()->add (loc, true);
-               session->set_auto_loop_location (loc);
-               XMLNode &after = session->locations()->get_state();
-               session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
+               XMLNode &before = _session->locations()->get_state();
+               _session->locations()->add (loc, true);
+               _session->set_auto_loop_location (loc);
+               XMLNode &after = _session->locations()->get_state();
+               _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
        }
        else {
                XMLNode &before = tpl->get_state();
                tpl->set_hidden (false, this);
                tpl->set (start, end);
                XMLNode &after = tpl->get_state();
-               session->add_command (new MementoCommand<Location>(*tpl, &before, &after));
+               _session->add_command (new MementoCommand<Location>(*tpl, &before, &after));
        }
 
        commit_reversible_command ();
@@ -4643,7 +4639,7 @@ Editor::show_rhythm_ferret ()
                rhythm_ferret = new RhythmFerret(*this);
        }
 
-       rhythm_ferret->set_session (session);
+       rhythm_ferret->set_session (_session);
        rhythm_ferret->show ();
        rhythm_ferret->present ();
 }
@@ -4652,7 +4648,7 @@ void
 Editor::show_global_port_matrix (ARDOUR::DataType t)
 {
        if (_global_port_matrix[t] == 0) {
-               _global_port_matrix[t] = new GlobalPortMatrixWindow (session, t);
+               _global_port_matrix[t] = new GlobalPortMatrixWindow (_session, t);
        }
 
        _global_port_matrix[t]->show ();
@@ -4818,9 +4814,9 @@ Editor::handle_new_route (RouteList& routes)
                DataType dt = route->input()->default_type();
 
                if (dt == ARDOUR::DataType::AUDIO) {
-                       rtv = new AudioTimeAxisView (*this, *session, route, *track_canvas);
+                       rtv = new AudioTimeAxisView (*this, _session, route, *track_canvas);
                } else if (dt == ARDOUR::DataType::MIDI) {
-                       rtv = new MidiTimeAxisView (*this, *session, route, *track_canvas);
+                       rtv = new MidiTimeAxisView (*this, _session, route, *track_canvas);
                } else {
                        throw unknown_type();
                }
@@ -4833,7 +4829,7 @@ Editor::handle_new_route (RouteList& routes)
                rtv->view()->RegionViewAdded.connect (sigc::mem_fun (*this, &Editor::region_view_added));
                rtv->view()->HeightChanged.connect (sigc::mem_fun (*this, &Editor::streamview_height_changed));
 
-               rtv->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &Editor::remove_route), rtv));
+               scoped_connect (rtv->GoingAway, boost::bind (&Editor::remove_route, this, rtv));
        }
 
        _routes->routes_added (new_views);
@@ -4954,18 +4950,18 @@ Editor::consider_auditioning (boost::shared_ptr<Region> region)
        boost::shared_ptr<AudioRegion> r = boost::dynamic_pointer_cast<AudioRegion> (region);
 
        if (r == 0) {
-               session->cancel_audition ();
+               _session->cancel_audition ();
                return;
        }
 
-       if (session->is_auditioning()) {
-               session->cancel_audition ();
+       if (_session->is_auditioning()) {
+               _session->cancel_audition ();
                if (r == last_audition_region) {
                        return;
                }
        }
 
-       session->audition_region (r);
+       _session->audition_region (r);
        last_audition_region = r;
 }
 
@@ -4979,7 +4975,7 @@ Editor::hide_a_region (boost::shared_ptr<Region> r)
 void
 Editor::remove_a_region (boost::shared_ptr<Region> r)
 {
-       session->remove_region_from_region_list (r);
+       _session->remove_region_from_region_list (r);
 }
 
 void
index 36895bf784079a5c892be2b6fd74dc4570d93614..a29df6ebb62ed6668aa82c2c385e70b544dd2640 100644 (file)
@@ -46,6 +46,8 @@
 #include <gtkmm2ext/dndtreeview.h>
 
 #include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
+
 #include "ardour/import_status.h"
 #include "ardour/tempo.h"
 #include "ardour/location.h"
@@ -155,14 +157,15 @@ struct EditorCursor {
        sigc::signal<void, nframes64_t> PositionChanged;
 };
 
-class Editor : public PublicEditor
+class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
 {
   public:
        Editor ();
        ~Editor ();
 
-       void             connect_to_session (ARDOUR::Session *);
-       ARDOUR::Session* current_session() const { return session; }
+       void             set_session (ARDOUR::Session *);
+       ARDOUR::Session* session() const { return _session; }
+
        void             first_idle ();
        virtual bool     have_idled () const { return _have_idled; }
 
@@ -443,7 +446,6 @@ class Editor : public PublicEditor
 
        void color_handler ();
 
-       ARDOUR::Session     *session; ///< The session that we are editing, or 0
        bool                 constructed;
 
        // to keep track of the playhead position for control_scroll
@@ -1893,7 +1895,7 @@ public:
 
        int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
 
-       std::vector<sigc::connection> session_connections;
+       PBD::ScopedConnectionList session_connections;
 
        /* tracking step changes of track height */
 
index bc7d5ee7affeb322b85f1722b827ec85223687b1..ac98482f4e588e0d3a83c3cb96a188b20fb4d56b 100644 (file)
@@ -956,7 +956,7 @@ Editor::set_summary ()
        Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleSummary"));
        if (act) {
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-               session->config.set_show_summary (tact->get_active ());
+               _session->config.set_show_summary (tact->get_active ());
        }
 }
 
@@ -966,7 +966,7 @@ Editor::set_group_tabs ()
        Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleGroupTabs"));
        if (act) {
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-               session->config.set_show_group_tabs (tact->get_active ());
+               _session->config.set_show_group_tabs (tact->get_active ());
        }
 }
 
@@ -1350,7 +1350,7 @@ Editor::parameter_changed (std::string p)
                toggle_meter_updating();
        } else if (p == "show-summary") {
 
-               bool const s = session->config.get_show_summary ();
+               bool const s = _session->config.get_show_summary ();
                if (s) {
                        _summary->show ();
                } else {
@@ -1366,7 +1366,7 @@ Editor::parameter_changed (std::string p)
                }
        } else if (p == "show-group-tabs") {
 
-               bool const s = session->config.get_show_group_tabs ();
+               bool const s = _session->config.get_show_group_tabs ();
                if (s) {
                        _group_tabs->show ();
                } else {
index 6ae445d828d28d8341ca4d6fe4875d31f19dc2d0..108dcde7d398ad7a1525fe98a8d9e2ee0f253bb7 100644 (file)
@@ -73,14 +73,14 @@ using Glib::ustring;
 void
 Editor::add_external_audio_action (ImportMode mode_hint)
 {
-       if (session == 0) {
+       if (_session == 0) {
                MessageDialog msg (_("You can't import or embed an audiofile until you have a session loaded."));
                msg.run ();
                return;
        }
-
+       
        if (sfbrowser == 0) {
-               sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), session, 0, true, mode_hint);
+               sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), _session, 0, true, mode_hint);
        } else {
                sfbrowser->set_mode (mode_hint);
        }
@@ -94,7 +94,7 @@ Editor::external_audio_dialog ()
        vector<Glib::ustring> paths;
        uint32_t track_cnt;
 
-       if (session == 0) {
+       if (_session == 0) {
                MessageDialog msg (_("You can't import or embed an audiofile until you have a session loaded."));
                msg.run ();
                return;
@@ -113,7 +113,7 @@ Editor::external_audio_dialog ()
        }
 
        if (sfbrowser == 0) {
-               sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), session, track_cnt, true);
+               sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), _session, track_cnt, true);
        } else {
                sfbrowser->reset (track_cnt);
        }
@@ -163,7 +163,7 @@ Editor::external_audio_dialog ()
                                where = playhead_cursor->current_frame;
                                break;
                        case ImportAtStart:
-                               where = session->current_start_frame();
+                               where = _session->current_start_frame();
                                break;
                }
 
@@ -187,7 +187,7 @@ Editor::external_audio_dialog ()
 void
 Editor::session_import_dialog ()
 {
-       SessionImportDialog dialog (*session);
+       SessionImportDialog dialog (_session);
        ensure_float (dialog);
        dialog.run ();
 }
@@ -211,7 +211,7 @@ Editor::check_whether_and_how_to_import(string path, bool all_or_nothing)
 {
        string wave_name (Glib::path_get_basename(path));
 
-       SourceMap all_sources = session->get_sources();
+       SourceMap all_sources = _session->get_sources();
        bool wave_name_exists = false;
 
        for (SourceMap::iterator i = all_sources.begin(); i != all_sources.end(); ++i) {
@@ -450,7 +450,7 @@ Editor::do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode
 
   out:
        if (ok) {
-               session->save_state ("");
+               _session->save_state ("");
        }
 }
 
@@ -509,7 +509,7 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual
                                 import_status.target_regions,
                                 import_status.target_tracks,
                                 import_status.track, false) == 0) {
-                       session->save_state ("");
+                       _session->save_state ("");
                }
 
                /* update position from results */
@@ -545,7 +545,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
 
                        /* lets see if we can link it into the session */
                        
-                       sys::path tmp = session->session_directory().sound_path() / Glib::path_get_basename(path);
+                       sys::path tmp = _session->session_directory().sound_path() / Glib::path_get_basename(path);
                        linked_path = tmp.to_string();
                        
                        path_to_use = linked_path;
@@ -587,7 +587,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
                        goto out;
                }
 
-               if (check_sample_rate  && (finfo.samplerate != (int) session->frame_rate())) {
+               if (check_sample_rate  && (finfo.samplerate != (int) _session->frame_rate())) {
                        vector<string> choices;
 
                        if (multifile) {
@@ -650,10 +650,10 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
 
                                boost::shared_ptr<Source> s;
 
-                               if ((s = session->source_by_path_and_channel (path, n)) == 0) {
+                               if ((s = _session->source_by_path_and_channel (path, n)) == 0) {
 
                                        source = boost::dynamic_pointer_cast<AudioFileSource> (
-                                               SourceFactory::createReadable (DataType::AUDIO, *session,
+                                               SourceFactory::createReadable (DataType::AUDIO, *_session,
                                                                               path_to_use, n,
                                                                               (mode == ImportAsTapeTrack
                                                                                ? Source::Destructive
@@ -763,7 +763,7 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64
        }
 
        if (Config->get_output_auto_connect() & AutoConnectMaster) {
-               output_chan = (session->master_out() ? session->master_out()->n_inputs().n_audio() : input_chan);
+               output_chan = (_session->master_out() ? _session->master_out()->n_inputs().n_audio() : input_chan);
        } else {
                output_chan = input_chan;
        }
@@ -822,7 +822,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t
                begin_reversible_command (_("insert file"));
                XMLNode &before = playlist->get_state();
                playlist->add_region (copy, pos);
-               session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+               _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
                commit_reversible_command ();
                break;
        }
@@ -831,7 +831,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t
        {
                if (!existing_track) {
                        if (ar) {
-                               list<boost::shared_ptr<AudioTrack> > at (session->new_audio_track (in_chans, out_chans, Normal, 0, 1));
+                               list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, Normal, 0, 1));
 
                                if (at.empty()) {
                                        return -1;
@@ -839,7 +839,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t
 
                                existing_track = at.front();
                        } else if (mr) {
-                               list<boost::shared_ptr<MidiTrack> > mt (session->new_midi_track (Normal, 0, 1));
+                               list<boost::shared_ptr<MidiTrack> > mt (_session->new_midi_track (Normal, 0, 1));
 
                                if (mt.empty()) {
                                        return -1;
@@ -862,7 +862,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t
                if (!ar)
                        return -1;
 
-               list<boost::shared_ptr<AudioTrack> > at (session->new_audio_track (in_chans, out_chans, Destructive));
+               list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, Destructive));
                if (!at.empty()) {
                        boost::shared_ptr<Region> copy (RegionFactory::create (region));
                        at.front()->set_name (basename_nosuffix (copy->name()));
@@ -887,7 +887,7 @@ Editor::_import_thread (void *arg)
 void *
 Editor::import_thread ()
 {
-       session->import_audiofiles (import_status);
+       _session->import_audiofiles (import_status);
        pthread_exit_pbd (0);
        /*NOTREACHED*/
        return 0;
index 9baa689e51fecbaf09515055dacf0a68227e765e..ea703c415c8d550693e8dbe6edd14f67f6bd3d4e 100644 (file)
@@ -55,7 +55,7 @@ Editor::start_updating ()
        RouteTimeAxisView* rtv;
 
        //cerr << "Editor::start_updating () called" << endl;//DEBUG
-       if (is_mapped() && session) {
+       if (is_mapped() && _session) {
                for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
                        if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
                                rtv->reset_meter ();
@@ -78,7 +78,7 @@ Editor::stop_updating ()
        meters_running = false;
        fast_screen_update_connection.disconnect();
        //cerr << "Editor::stop_updating () called" << endl;//DEBUG
-       if (is_mapped() && session) {
+       if (is_mapped() && _session) {
                for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
                        if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
                                rtv->hide_meter ();
@@ -105,7 +105,7 @@ Editor::fast_update_strips ()
 {
        RouteTimeAxisView* rtv;
 
-       if (is_mapped() && session) {
+       if (is_mapped() && _session) {
                for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
                        if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
                                rtv->fast_update ();
index 97df092faaed6f43b9bc0aeb536dd32e5058bc21..f5eb29195fece7b2d8217c3fba25c548215e163d 100644 (file)
@@ -329,7 +329,7 @@ Editor::track_canvas_size_allocated ()
        _canvas_width = canvas_allocation.get_width();
        _canvas_height = canvas_allocation.get_height();
 
-       if (session) {
+       if (_session) {
                TrackViewList::iterator i;
                double height = 0;
 
@@ -725,7 +725,7 @@ Editor::autoscroll_canvas ()
 void
 Editor::start_canvas_autoscroll (int dx, int dy)
 {
-       if (!session || autoscroll_active) {
+       if (!_session || autoscroll_active) {
                return;
        }
 
@@ -896,8 +896,8 @@ Editor::color_handler()
 /*
        redisplay_tempo (true);
 
-       if (session)
-               session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
+       if (_session)
+             _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
 */
 }
 
index 149ce6717cc03cf0a99008ec71dd6b35cf661086..e016f5bb5050f255c6fcdcd51112b028bcd6be04 100644 (file)
 
 */
 
-#include "ardour/session.h"
 #include "editor_component.h"
 
-using namespace std;
-using namespace ARDOUR;
-
 EditorComponent::EditorComponent (Editor* e)
-       : _editor (e),
-         _session (0)
+       : _editor (e)
 {
-
 }
 
-void
-EditorComponent::connect_to_session (Session* s)
-{
-       _session = s;
-
-       _session_connections.push_back (_session->GoingAway.connect (sigc::mem_fun (*this, &EditorComponent::session_going_away)));
-}
-
-void
-EditorComponent::session_going_away ()
-{
-       for (list<sigc::connection>::iterator i = _session_connections.begin(); i != _session_connections.end(); ++i) {
-               i->disconnect ();
-       }
-
-       _session = 0;
-}
index 5c1ae8be2a7c658bb2b40129a953aa4574f8a783..5b4f7e15d8ebe2a663b9305abb77cc83ebe2e411 100644 (file)
 #define __ardour_gtk_editor_component_h__
 
 #include <list>
-#include <sigc++/sigc++.h>
 
-namespace ARDOUR {
-       class Session;
-}
+#include "ardour/session_handle.h"
 
 class Editor;
 
-class EditorComponent
+class EditorComponent : public ARDOUR::SessionHandlePtr
 {
 public:
        EditorComponent (Editor *);
        virtual ~EditorComponent() {}
 
-       virtual void connect_to_session (ARDOUR::Session *);
-
 protected:
-
        Editor* _editor;
-       ARDOUR::Session* _session;
-       std::list<sigc::connection> _session_connections;
-
-private:
-
-       void session_going_away ();
-
 };
 
 #endif
index 5ec2cb0439793d51becf0b24f749a60f09cc6550..bd97d42b4b7d89c970ce123f9469954c773b4ddb 100644 (file)
@@ -116,7 +116,7 @@ Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
                              *cursor,
                              event->button.time);
 
-       if (_editor->session && _editor->session->transport_rolling()) {
+       if (_editor->session() && _editor->session()->transport_rolling()) {
                _was_rolling = true;
        } else {
                _was_rolling = false;
@@ -237,7 +237,7 @@ RegionDrag::RegionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<Re
          _primary (p),
          _views (v)
 {
-       RegionView::RegionViewGoingAway.connect (sigc::mem_fun (*this, &RegionDrag::region_going_away));
+       death_connection = RegionView::RegionViewGoingAway.connect (sigc::mem_fun (*this, &RegionDrag::region_going_away));
 }
 
 void
@@ -828,7 +828,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
                        insert_result = modified_playlists.insert (to_playlist);
 
                        if (insert_result.second) {
-                               _editor->session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
+                               _editor->session()->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
                        }
 
                        to_playlist->add_region (new_region, where);
@@ -868,7 +868,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
                        insert_result = modified_playlists.insert (playlist);
 
                        if (insert_result.second) {
-                               _editor->session->add_command (new MementoCommand<Playlist>(*playlist, &playlist->get_state(), 0));
+                               _editor->session()->add_command (new MementoCommand<Playlist>(*playlist, &playlist->get_state(), 0));
                        }
                        /* freeze to avoid lots of relayering in the case of a multi-region drag */
                        frozen_insert_result = frozen_playlists.insert(playlist);
@@ -910,7 +910,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
                        insert_result = modified_playlists.insert (from_playlist);
 
                        if (insert_result.second) {
-                               _editor->session->add_command (new MementoCommand<Playlist>(*from_playlist, &from_playlist->get_state(), 0));
+                               _editor->session()->add_command (new MementoCommand<Playlist>(*from_playlist, &from_playlist->get_state(), 0));
                        }
 
                        from_playlist->remove_region (rv->region());
@@ -960,7 +960,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
 
   out:
        for (set<boost::shared_ptr<Playlist> >::iterator p = modified_playlists.begin(); p != modified_playlists.end(); ++p) {
-               _editor->session->add_command (new MementoCommand<Playlist>(*(*p), 0, &(*p)->get_state()));
+               _editor->session()->add_command (new MementoCommand<Playlist>(*(*p), 0, &(*p)->get_state()));
        }
 
        _editor->commit_reversible_command ();
@@ -1245,7 +1245,7 @@ RegionInsertDrag::finished (GdkEvent* /*event*/, bool /*movement_occurred*/)
        _editor->begin_reversible_command (_("insert region"));
        XMLNode& before = playlist->get_state ();
        playlist->add_region (_primary->region (), _last_frame_position);
-       _editor->session->add_command (new MementoCommand<Playlist> (*playlist, &before, &playlist->get_state()));
+       _editor->session()->add_command (new MementoCommand<Playlist> (*playlist, &before, &playlist->get_state()));
        _editor->commit_reversible_command ();
 
        delete _primary;
@@ -1570,7 +1570,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
                        insert_result = _editor->motion_frozen_playlists.insert (pl);
 
                        if (insert_result.second) {
-                               _editor->session->add_command(new MementoCommand<Playlist>(*pl, &pl->get_state(), 0));
+                               _editor->session()->add_command(new MementoCommand<Playlist>(*pl, &pl->get_state(), 0));
                                pl->freeze();
                        }
                }
@@ -1668,7 +1668,7 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
                for (set<boost::shared_ptr<Playlist> >::iterator p = _editor->motion_frozen_playlists.begin(); p != _editor->motion_frozen_playlists.end(); ++p) {
                        (*p)->thaw ();
                        if (_have_transaction) {
-                               _editor->session->add_command (new MementoCommand<Playlist>(*(*p).get(), 0, &(*p)->get_state()));
+                               _editor->session()->add_command (new MementoCommand<Playlist>(*(*p).get(), 0, &(*p)->get_state()));
                        }
                }
 
@@ -1750,7 +1750,7 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
 
        BBT_Time when;
 
-       TempoMap& map (_editor->session->tempo_map());
+       TempoMap& map (_editor->session()->tempo_map());
        map.bbt_time (_last_pointer_frame, when);
 
        if (_copy == true) {
@@ -1758,7 +1758,7 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
                XMLNode &before = map.get_state();
                map.add_meter (_marker->meter(), when);
                XMLNode &after = map.get_state();
-               _editor->session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
+               _editor->session()->add_command(new MementoCommand<TempoMap>(map, &before, &after));
                _editor->commit_reversible_command ();
 
                // delete the dummy marker we used for visual representation of copying.
@@ -1769,7 +1769,7 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
                XMLNode &before = map.get_state();
                map.move_meter (_marker->meter(), when);
                XMLNode &after = map.get_state();
-               _editor->session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
+               _editor->session()->add_command(new MementoCommand<TempoMap>(map, &before, &after));
                _editor->commit_reversible_command ();
        }
 }
@@ -1842,7 +1842,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
 
        BBT_Time when;
 
-       TempoMap& map (_editor->session->tempo_map());
+       TempoMap& map (_editor->session()->tempo_map());
        map.bbt_time (_last_pointer_frame, when);
 
        if (_copy == true) {
@@ -1850,7 +1850,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
                XMLNode &before = map.get_state();
                map.add_tempo (_marker->tempo(), when);
                XMLNode &after = map.get_state();
-               _editor->session->add_command (new MementoCommand<TempoMap>(map, &before, &after));
+               _editor->session()->add_command (new MementoCommand<TempoMap>(map, &before, &after));
                _editor->commit_reversible_command ();
 
                // delete the dummy marker we used for visual representation of copying.
@@ -1861,7 +1861,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
                XMLNode &before = map.get_state();
                map.move_tempo (_marker->tempo(), when);
                XMLNode &after = map.get_state();
-               _editor->session->add_command (new MementoCommand<TempoMap>(map, &before, &after));
+               _editor->session()->add_command (new MementoCommand<TempoMap>(map, &before, &after));
                _editor->commit_reversible_command ();
        }
 }
@@ -1892,12 +1892,12 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
        if (_cursor == _editor->playhead_cursor) {
                _editor->_dragging_playhead = true;
 
-               if (_editor->session && _was_rolling && _stop) {
-                       _editor->session->request_stop ();
+               if (_editor->session() && _was_rolling && _stop) {
+                       _editor->session()->request_stop ();
                }
 
-               if (_editor->session && _editor->session->is_auditioning()) {
-                       _editor->session->cancel_audition ();
+               if (_editor->session() && _editor->session()->is_auditioning()) {
+                       _editor->session()->cancel_audition ();
                }
        }
 
@@ -1937,8 +1937,8 @@ CursorDrag::finished (GdkEvent* event, bool movement_occurred)
        motion (event, false);
 
        if (_item == &_editor->playhead_cursor->canvas_item) {
-               if (_editor->session) {
-                       _editor->session->request_locate (_editor->playhead_cursor->current_frame, _was_rolling);
+               if (_editor->session()) {
+                       _editor->session()->request_locate (_editor->playhead_cursor->current_frame, _was_rolling);
                        _editor->_pending_locate_request = true;
                }
        }
@@ -2031,7 +2031,7 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred)
                tmp->audio_region()->set_fade_in_active (true);
 
                XMLNode &after = alist->get_state();
-               _editor->session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
+               _editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
        }
 
        _editor->commit_reversible_command ();
@@ -2128,7 +2128,7 @@ FadeOutDrag::finished (GdkEvent* event, bool movement_occurred)
                tmp->audio_region()->set_fade_out_active (true);
 
                XMLNode &after = alist->get_state();
-               _editor->session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
+               _editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
        }
 
        _editor->commit_reversible_command ();
@@ -2205,7 +2205,7 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
                if (e < max_frames) {
                        ++e;
                }
-               _editor->session->locations()->find_all_between (s, e, ll, Location::Flags (0));
+               _editor->session()->locations()->find_all_between (s, e, ll, Location::Flags (0));
                for (Locations::LocationList::iterator i = ll.begin(); i != ll.end(); ++i) {
                        Editor::LocationMarkers* lm = _editor->find_location_markers (*i);
                        if (lm) {
@@ -2415,7 +2415,7 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
        _editor->_dragging_edit_point = false;
 
        _editor->begin_reversible_command ( _("move marker") );
-       XMLNode &before = _editor->session->locations()->get_state();
+       XMLNode &before = _editor->session()->locations()->get_state();
 
        MarkerSelection::iterator i;
        list<Location*>::iterator x;
@@ -2441,8 +2441,8 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
                }
        }
 
-       XMLNode &after = _editor->session->locations()->get_state();
-       _editor->session->add_command(new MementoCommand<Locations>(*(_editor->session->locations()), &before, &after));
+       XMLNode &after = _editor->session()->locations()->get_state();
+       _editor->session()->add_command(new MementoCommand<Locations>(*(_editor->session()->locations()), &before, &after));
        _editor->commit_reversible_command ();
 
        _line->hide();
@@ -2855,9 +2855,9 @@ ScrubDrag::motion (GdkEvent* /*event*/, bool)
 void
 ScrubDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
 {
-       if (movement_occurred && _editor->session) {
+       if (movement_occurred && _editor->session()) {
                /* make sure we stop */
-               _editor->session->request_transport_speed (0.0);
+               _editor->session()->request_transport_speed (0.0);
        }
 }
 
@@ -2875,7 +2875,7 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
        nframes64_t start = 0;
        nframes64_t end = 0;
 
-       if (_editor->session == 0) {
+       if (_editor->session() == 0) {
                return;
        }
 
@@ -3059,7 +3059,7 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
 void
 SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
 {
-       Session* s = _editor->session;
+       Session* s = _editor->session();
 
        if (movement_occurred) {
                motion (event, false);
@@ -3113,7 +3113,7 @@ RangeMarkerBarDrag::RangeMarkerBarDrag (Editor* e, ArdourCanvas::Item* i, Operat
 void
 RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
 {
-       if (_editor->session == 0) {
+       if (_editor->session() == 0) {
                return;
        }
 
@@ -3246,8 +3246,8 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
                case CreateCDMarker:
                    {
                        _editor->begin_reversible_command (_("new range marker"));
-                       XMLNode &before = _editor->session->locations()->get_state();
-                       _editor->session->locations()->next_available_name(rangename,"unnamed");
+                       XMLNode &before = _editor->session()->locations()->get_state();
+                       _editor->session()->locations()->next_available_name(rangename,"unnamed");
                        if (_operation == CreateCDMarker) {
                                flags = Location::IsRangeMarker | Location::IsCDMarker;
                                _editor->cd_marker_bar_drag_rect->hide();
@@ -3257,9 +3257,9 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
                                _editor->range_bar_drag_rect->hide();
                        }
                        newloc = new Location(_editor->temp_location->start(), _editor->temp_location->end(), rangename, (Location::Flags) flags);
-                       _editor->session->locations()->add (newloc, true);
-                       XMLNode &after = _editor->session->locations()->get_state();
-                       _editor->session->add_command(new MementoCommand<Locations>(*(_editor->session->locations()), &before, &after));
+                       _editor->session()->locations()->add (newloc, true);
+                       XMLNode &after = _editor->session()->locations()->get_state();
+                       _editor->session()->add_command(new MementoCommand<Locations>(*(_editor->session()->locations()), &before, &after));
                        _editor->commit_reversible_command ();
                        break;
                    }
@@ -3277,14 +3277,14 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
                        nframes64_t start;
                        nframes64_t end;
 
-                       _editor->session->locations()->marks_either_side (_grab_frame, start, end);
+                       _editor->session()->locations()->marks_either_side (_grab_frame, start, end);
 
                        if (end == max_frames) {
-                               end = _editor->session->current_end_frame ();
+                               end = _editor->session()->current_end_frame ();
                        }
 
                        if (start == max_frames) {
-                               start = _editor->session->current_start_frame ();
+                               start = _editor->session()->current_start_frame ();
                        }
 
                        switch (_editor->mouse_mode) {
index d2593b24632604f40b293c3736ea1c446d852c7c..170c9a80802c84043e8641f790a1780fb2401c3a 100644 (file)
@@ -160,6 +160,7 @@ protected:
 
 private:
        void region_going_away (RegionView *);
+       boost::signals2::scoped_connection death_connection;
 };
 
 
index c8d27037a33259ca9a190bc6808b271f4e614c90..7d0fcc1bf9d2d04b4a3c6a76b8045710ca0fed8f 100644 (file)
@@ -59,7 +59,7 @@ void
 Editor::export_audio ()
 {
        ExportDialog dialog (*this);
-       dialog.set_session (session);
+       dialog.set_session (_session);
        dialog.run();
 }
 
@@ -67,7 +67,7 @@ void
 Editor::export_selection ()
 {
        ExportSelectionDialog dialog (*this);
-       dialog.set_session (session);
+       dialog.set_session (_session);
        dialog.run();
 }
 
@@ -86,7 +86,7 @@ Editor::export_range ()
 
        if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) {
                ExportRangeDialog dialog (*this, l->id().to_s());
-               dialog.set_session (session);
+               dialog.set_session (_session);
                dialog.run();
        }
 }
@@ -107,7 +107,7 @@ Editor::export_region ()
                AudioTrack & track (dynamic_cast<AudioTrack &> (*rtv.route()));
 
                ExportRegionDialog dialog (*this, region, track);
-               dialog.set_session (session);
+               dialog.set_session (_session);
                dialog.run();
 
        } catch (std::bad_cast & e) {
@@ -173,7 +173,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region)
        vector<boost::shared_ptr<AudioFileSource> > sources;
        uint32_t nchans;
 
-       const string sound_directory = session->session_directory().sound_path().to_string();
+       const string sound_directory = _session->session_directory().sound_path().to_string();
 
        nchans = region->n_channels();
 
@@ -214,9 +214,9 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region)
 
                        try {
                                fs = boost::dynamic_pointer_cast<AudioFileSource> (
-                                               SourceFactory::createWritable (DataType::AUDIO, *session,
+                                               SourceFactory::createWritable (DataType::AUDIO, *_session,
                                                                path, true,
-                                                               false, session->frame_rate()));
+                                                               false, _session->frame_rate()));
                        }
 
                        catch (failed_constructor& err) {
@@ -323,7 +323,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list
        string path;
        vector<boost::shared_ptr<AudioFileSource> > sources;
 
-       const string sound_directory = session->session_directory().sound_path().to_string();
+       const string sound_directory = _session->session_directory().sound_path().to_string();
 
        uint32_t channels = count.n_audio();
 
@@ -353,9 +353,9 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list
 
                try {
                        fs = boost::dynamic_pointer_cast<AudioFileSource> (
-                                       SourceFactory::createWritable (DataType::AUDIO, *session,
+                                       SourceFactory::createWritable (DataType::AUDIO, *_session,
                                                        path, true,
-                                                       false, session->frame_rate()));
+                                                       false, _session->frame_rate()));
                }
 
                catch (failed_constructor& err) {
index 3e99f9e6bfed9546f7e70f181a932f38c769e636..705c68586cdb4e3c019dab0876920b6346dc43e8 100644 (file)
@@ -1092,14 +1092,14 @@ Editor::handle_new_imageframe_time_axis_view(const string & track_name, void* sr
        row[route_display_columns.tv] = iftav;
        route_list_display.get_selection()->select (row);
 
-       iftav->GoingAway.connect(sigc::bind(sigc::mem_fun(*this, &Editor::remove_route), (TimeAxisView*)iftav)) ;
+       scoped_connect (iftav->GoingAway, boost::bind (&Editor::remove_route, this, (TimeAxisView*)iftav));
        iftav->gui_changed.connect(sigc::mem_fun(*this, &Editor::handle_gui_changes)) ;
 }
 
 void
 Editor::handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track)
 {
-       MarkerTimeAxis* mta = new MarkerTimeAxis (*this, *this->current_session(), *track_canvas, track_name, marked_track) ;
+       MarkerTimeAxis* mta = new MarkerTimeAxis (*this, *this->session(), *track_canvas, track_name, marked_track) ;
        ((ImageFrameTimeAxis*)marked_track)->add_marker_time_axis(mta, this) ;
        track_views.push_back(mta) ;
 
@@ -1109,7 +1109,7 @@ Editor::handle_new_imageframe_marker_time_axis_view(const string & track_name, T
        row[route_display_columns.tv] = mta;
        route_list_display.get_selection()->select (row);
 
-       mta->GoingAway.connect(sigc::bind(sigc::mem_fun(*this, &Editor::remove_route), (TimeAxisView*)mta)) ;
+       scoped_connect (mta->GoingAway, boost::bind (&Editor::remove_route, this, (TimeAxisView*)mta));
  }
 
 
index ba33e23feaa79d2c968af8fb0d02fa483ff2a50b..4b16a4b8a2cd8696cb4fb756d4af18e6cb1eaacc 100644 (file)
@@ -95,7 +95,7 @@ Editor::kbd_mute_unmute_region ()
                        (*i)->region()->set_muted (!(*i)->region()->muted ());
                        XMLNode &after = (*i)->region()->playlist()->get_state ();
 
-                       session->add_command (new MementoCommand<ARDOUR::Playlist>(*((*i)->region()->playlist()), &before, &after));
+                       _session->add_command (new MementoCommand<ARDOUR::Playlist>(*((*i)->region()->playlist()), &before, &after));
 
                }
 
@@ -109,7 +109,7 @@ Editor::kbd_mute_unmute_region ()
                entered_regionview->region()->set_muted (!entered_regionview->region()->muted());
 
                XMLNode &after = entered_regionview->region()->playlist()->get_state();
-               session->add_command (new MementoCommand<ARDOUR::Playlist>(*(entered_regionview->region()->playlist()), &before, &after));
+               _session->add_command (new MementoCommand<ARDOUR::Playlist>(*(entered_regionview->region()->playlist()), &before, &after));
                commit_reversible_command();
 
        }
index b9df06d3580697521cba85b6b95b12e232362416..0d46665782f8bf74d4861dc3eda786c0e0e39742 100644 (file)
@@ -41,13 +41,13 @@ using namespace PBD;
 void
 Editor::keyboard_selection_finish (bool add)
 {
-       if (session && have_pending_keyboard_selection) {
+       if (_session && have_pending_keyboard_selection) {
 
                nframes64_t end;
                bool ignored;
 
-               if (session->transport_rolling()) {
-                       end = session->audible_frame();
+               if (_session->transport_rolling()) {
+                       end = _session->audible_frame();
                } else {
                        if (!mouse_frame (end, ignored)) {
                                return;
@@ -67,9 +67,9 @@ Editor::keyboard_selection_finish (bool add)
 void
 Editor::keyboard_selection_begin ()
 {
-       if (session) {
-               if (session->transport_rolling()) {
-                       pending_keyboard_selection_start = session->audible_frame();
+       if (_session) {
+               if (_session->transport_rolling()) {
+                       pending_keyboard_selection_start = _session->audible_frame();
                        have_pending_keyboard_selection = true;
                } else {
                        bool ignored;
index 7031be410e9690817fbbf2967acd1e5e892832f1..d4117b86b03a39c1633c2d879e9c16016f0573fb 100644 (file)
@@ -32,9 +32,9 @@ EditorLocations::EditorLocations (Editor* e)
 }
 
 void
-EditorLocations::connect_to_session (ARDOUR::Session* s)
+EditorLocations::set_session (ARDOUR::Session* s)
 {
-       EditorComponent::connect_to_session (s);
+       EditorComponent::set_session (s);
        locations->set_session (s);
 }
 
index 3375b338bd6075b375c364fc3cf161cd17a158a7..6d4d3128e45531212aa9b94a1d13ee2b7222282c 100644 (file)
@@ -33,7 +33,7 @@ class EditorLocations : public EditorComponent
   public:
        EditorLocations (Editor *);
 
-       void connect_to_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
 
        Gtk::Widget& widget ();
 
index fa9fd83cc2056cc19b708038bcbf27aa92a6282e..4d9828a14d31f4c7a88677808ee14705eabb30af 100644 (file)
@@ -332,8 +332,8 @@ Editor::refresh_location_display ()
 {
        ENSURE_GUI_THREAD (*this, &Editor::refresh_location_display)
 
-       if (session) {
-               session->locations()->apply (*this, &Editor::refresh_location_display_internal);
+       if (_session) {
+               _session->locations()->apply (*this, &Editor::refresh_location_display_internal);
        }
 }
 
@@ -342,8 +342,8 @@ Editor::refresh_location_display_s (Change ignored)
 {
        ENSURE_GUI_THREAD (*this, &Editor::refresh_location_display_s, ignored)
 
-       if (session) {
-               session->locations()->apply (*this, &Editor::refresh_location_display_internal);
+       if (_session) {
+               _session->locations()->apply (*this, &Editor::refresh_location_display_internal);
        }
 }
 
@@ -396,18 +396,18 @@ Editor::mouse_add_new_marker (nframes64_t where, bool is_cd, bool is_xrun)
                markerprefix = "mark";
        }
 
-       if (session) {
-               session->locations()->next_available_name(markername, markerprefix);
+       if (_session) {
+               _session->locations()->next_available_name(markername, markerprefix);
                if (!is_xrun && !choose_new_marker_name(markername)) {
                        return;
                }
                Location *location = new Location (where, where, markername, (Location::Flags) flags);
-               session->begin_reversible_command (_("add marker"));
-               XMLNode &before = session->locations()->get_state();
-               session->locations()->add (location, true);
-               XMLNode &after = session->locations()->get_state();
-               session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
-               session->commit_reversible_command ();
+               _session->begin_reversible_command (_("add marker"));
+               XMLNode &before = _session->locations()->get_state();
+               _session->locations()->add (location, true);
+               XMLNode &after = _session->locations()->get_state();
+               _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+               _session->commit_reversible_command ();
 
                /* find the marker we just added */
 
@@ -436,7 +436,7 @@ Editor::remove_marker (ArdourCanvas::Item& item, GdkEvent*)
 
        Location* loc = find_location_from_marker (marker, is_start);
 
-       if (session && loc) {
+       if (_session && loc) {
                Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::really_remove_marker), loc));
        }
 }
@@ -444,12 +444,12 @@ Editor::remove_marker (ArdourCanvas::Item& item, GdkEvent*)
 gint
 Editor::really_remove_marker (Location* loc)
 {
-       session->begin_reversible_command (_("remove marker"));
-       XMLNode &before = session->locations()->get_state();
-       session->locations()->remove (loc);
-       XMLNode &after = session->locations()->get_state();
-       session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
-       session->commit_reversible_command ();
+       _session->begin_reversible_command (_("remove marker"));
+       XMLNode &before = _session->locations()->get_state();
+       _session->locations()->remove (loc);
+       XMLNode &after = _session->locations()->get_state();
+       _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+       _session->commit_reversible_command ();
        return FALSE;
 }
 
@@ -765,15 +765,15 @@ Editor::marker_menu_play_from ()
        if ((l = find_location_from_marker (marker, is_start)) != 0) {
 
                if (l->is_mark()) {
-                       session->request_locate (l->start(), true);
+                       _session->request_locate (l->start(), true);
                }
                else {
-                       //session->request_bounded_roll (l->start(), l->end());
+                       //_session->request_bounded_roll (l->start(), l->end());
 
                        if (is_start) {
-                               session->request_locate (l->start(), true);
+                               _session->request_locate (l->start(), true);
                        } else {
-                               session->request_locate (l->end(), true);
+                               _session->request_locate (l->end(), true);
                        }
                }
        }
@@ -795,13 +795,13 @@ Editor::marker_menu_set_playhead ()
        if ((l = find_location_from_marker (marker, is_start)) != 0) {
 
                if (l->is_mark()) {
-                       session->request_locate (l->start(), false);
+                       _session->request_locate (l->start(), false);
                }
                else {
                        if (is_start) {
-                               session->request_locate (l->start(), false);
+                               _session->request_locate (l->start(), false);
                        } else {
-                               session->request_locate (l->end(), false);
+                               _session->request_locate (l->end(), false);
                        }
                }
        }
@@ -811,7 +811,7 @@ void
 Editor::marker_menu_range_to_next ()
 {
        Marker* marker;
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -829,14 +829,14 @@ Editor::marker_menu_range_to_next ()
 
        nframes64_t start;
        nframes64_t end;
-       session->locations()->marks_either_side (marker->position(), start, end);
+       _session->locations()->marks_either_side (marker->position(), start, end);
 
        if (end != max_frames) {
                string range_name = l->name();
                range_name += "-range";
 
                Location* newrange = new Location (marker->position(), end, range_name, Location::IsRangeMarker);
-               session->locations()->add (newrange);
+               _session->locations()->add (newrange);
        }
 }
 
@@ -856,13 +856,13 @@ Editor::marker_menu_set_from_playhead ()
        if ((l = find_location_from_marker (marker, is_start)) != 0) {
 
                if (l->is_mark()) {
-                       l->set_start (session->audible_frame ());
+                       l->set_start (_session->audible_frame ());
                }
                else {
                        if (is_start) {
-                               l->set_start (session->audible_frame ());
+                               l->set_start (_session->audible_frame ());
                        } else {
-                               l->set_end (session->audible_frame ());
+                               l->set_end (_session->audible_frame ());
                        }
                }
        }
@@ -923,10 +923,10 @@ Editor::marker_menu_play_range ()
        if ((l = find_location_from_marker (marker, is_start)) != 0) {
 
                if (l->is_mark()) {
-                       session->request_locate (l->start(), true);
+                       _session->request_locate (l->start(), true);
                }
                else {
-                       session->request_bounded_roll (l->start(), l->end());
+                       _session->request_bounded_roll (l->start(), l->end());
 
                }
        }
@@ -951,8 +951,8 @@ Editor::marker_menu_loop_range ()
                        l2->set (l->start(), l->end());
 
                        // enable looping, reposition and start rolling
-                       session->request_play_loop(true);
-                       session->request_locate (l2->start(), true);
+                       _session->request_play_loop(true);
+                       _session->request_locate (l2->start(), true);
                }
        }
 }
@@ -1072,13 +1072,13 @@ Editor::marker_menu_rename ()
        }
 
        begin_reversible_command ( _("rename marker") );
-       XMLNode &before = session->locations()->get_state();
+       XMLNode &before = _session->locations()->get_state();
 
        dialog.get_result(txt);
        loc->set_name (txt);
 
-       XMLNode &after = session->locations()->get_state();
-       session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
+       XMLNode &after = _session->locations()->get_state();
+       _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
        commit_reversible_command ();
 }
 
@@ -1106,13 +1106,13 @@ Editor::new_transport_marker_menu_set_punch ()
 void
 Editor::update_loop_range_view (bool visibility)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
        Location* tll;
 
-       if (session->get_play_loop() && ((tll = transport_loop_location()) != 0)) {
+       if (_session->get_play_loop() && ((tll = transport_loop_location()) != 0)) {
 
                double x1 = frame_to_pixel (tll->start());
                double x2 = frame_to_pixel (tll->end());
@@ -1132,21 +1132,21 @@ Editor::update_loop_range_view (bool visibility)
 void
 Editor::update_punch_range_view (bool visibility)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
        Location* tpl;
 
-       if ((session->config.get_punch_in() || session->config.get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
+       if ((_session->config.get_punch_in() || _session->config.get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
                guint track_canvas_width,track_canvas_height;
                track_canvas->get_size(track_canvas_width,track_canvas_height);
-               if (session->config.get_punch_in()) {
+               if (_session->config.get_punch_in()) {
                        transport_punch_range_rect->property_x1() = frame_to_pixel (tpl->start());
-                       transport_punch_range_rect->property_x2() = (session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
+                       transport_punch_range_rect->property_x2() = (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
                } else {
                        transport_punch_range_rect->property_x1() = 0;
-                       transport_punch_range_rect->property_x2() = (session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
+                       transport_punch_range_rect->property_x2() = (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
                }
 
                if (visibility) {
@@ -1160,7 +1160,7 @@ Editor::update_punch_range_view (bool visibility)
 void
 Editor::marker_selection_changed ()
 {
-       if (session && session->deletion_in_progress()) {
+       if (_session && _session->deletion_in_progress()) {
                return;
        }
 
@@ -1191,10 +1191,10 @@ struct SortLocationsByPosition {
 void
 Editor::goto_nth_marker (int n)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
-       const Locations::LocationList& l (session->locations()->list());
+       const Locations::LocationList& l (_session->locations()->list());
        Locations::LocationList ordered;
        ordered = l;
 
@@ -1204,7 +1204,7 @@ Editor::goto_nth_marker (int n)
        for (Locations::LocationList::iterator i = ordered.begin(); n >= 0 && i != ordered.end(); ++i) {
                if ((*i)->is_mark() && !(*i)->is_hidden() && !(*i)->is_start()) {
                        if (n == 0) {
-                               session->request_locate ((*i)->start(), session->transport_rolling());
+                               _session->request_locate ((*i)->start(), _session->transport_rolling());
                                break;
                        }
                        --n;
index 03346dffbc3a0a2b2d6610fb2497be134cfcf45c..9decef5a2161b2e650c10f3c783fe3ef204511b9 100644 (file)
@@ -75,7 +75,7 @@ Editor::show_editor_mixer (bool yn)
 
        show_editor_mixer_when_tracks_arrive = false;
 
-       if (!session) {
+       if (!_session) {
                show_editor_mixer_when_tracks_arrive = yn;
                return;
        }
@@ -165,10 +165,10 @@ void
 Editor::create_editor_mixer ()
 {
        current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(),
-                                             *session,
+                                             _session,
                                              false);
        current_mixer_strip->Hiding.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_hidden));
-       current_mixer_strip->GoingAway.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_removed));
+       scoped_connect (current_mixer_strip->GoingAway, boost::bind (&Editor::current_mixer_strip_removed, this));
 #ifdef GTKOSX
        current_mixer_strip->WidthChanged.connect (sigc::mem_fun(*this, &Editor::ensure_all_elements_drawn));
 #endif
@@ -180,7 +180,7 @@ Editor::set_selected_mixer_strip (TimeAxisView& view)
 {
        RouteTimeAxisView* at;
 
-       if (!session || (at = dynamic_cast<RouteTimeAxisView*>(&view)) == 0) {
+       if (!_session || (at = dynamic_cast<RouteTimeAxisView*>(&view)) == 0) {
                return;
        }
 
@@ -221,9 +221,9 @@ Editor::update_current_screen ()
                return;
        }
 
-       if (session && session->engine().running()) {
+       if (_session && _session->engine().running()) {
 
-               nframes64_t const frame = session->audible_frame();
+               nframes64_t const frame = _session->audible_frame();
 
                if (_dragging_playhead) {
                        goto almost_done;
@@ -231,7 +231,7 @@ Editor::update_current_screen ()
 
                /* only update if the playhead is on screen or we are following it */
 
-               if (_follow_playhead && session->requested_return_frame() < 0) {
+               if (_follow_playhead && _session->requested_return_frame() < 0) {
 
                        //playhead_cursor->canvas_item.show();
 
@@ -242,7 +242,7 @@ Editor::update_current_screen ()
 #ifndef  CONTINUOUS_SCROLL
                                if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
 
-                                       if (session->transport_speed() < 0) {
+                                       if (_session->transport_speed() < 0) {
                                                if (frame > (current_page_frames()/2)) {
                                                        center_screen (frame-(current_page_frames()/2));
                                                } else {
@@ -261,7 +261,7 @@ Editor::update_current_screen ()
                                   editor canvas
                                */
 
-                               if (session->transport_speed()) {
+                               if (_session->transport_speed()) {
                                        double target = ((double)frame - (double)current_page_frames()/2.0) / frames_per_unit;
                                        if (target <= 0.0) target = 0.0;
                                        if ( fabs(target - current) < current_page_frames()/frames_per_unit ) {
@@ -331,9 +331,7 @@ Editor::session_going_away ()
 {
        _have_idled = false;
 
-       for (vector<sigc::connection>::iterator i = session_connections.begin(); i != session_connections.end(); ++i) {
-               (*i).disconnect ();
-       }
+       _session_connections.drop_connections ();
 
        stop_scrolling ();
        selection->clear ();
@@ -389,7 +387,7 @@ Editor::session_going_away ()
 
        set_title (title.get_string());
 
-       session = 0;
+       SessionHandlePtr::session_going_away ();
 }
 
 void
index cecddd092a5c0a3cde51b451930b292d9af21395..4fb7271c4729760d1372710e07e11279b9e02926 100644 (file)
@@ -970,7 +970,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
 
        track_canvas->grab_focus();
 
-       if (session && session->actively_recording()) {
+       if (_session && _session->actively_recording()) {
                return true;
        }
 
@@ -1013,7 +1013,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 
        /* no action if we're recording */
 
-       if (session && session->actively_recording()) {
+       if (_session && _session->actively_recording()) {
                return true;
        }
 
@@ -1291,7 +1291,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                }
                        } else {
                                /* make sure we stop */
-                               session->request_transport_speed (0.0);
+                               _session->request_transport_speed (0.0);
                        }
                        break;
 
@@ -1681,8 +1681,8 @@ Editor::scrub ()
 
        if (scrubbing_direction == 0) {
                /* first move */
-               session->request_locate (_drag->current_pointer_frame(), false);
-               session->request_transport_speed (0.1);
+               _session->request_locate (_drag->current_pointer_frame(), false);
+               _session->request_transport_speed (0.1);
                scrubbing_direction = 1;
 
        } else {
@@ -1706,7 +1706,7 @@ Editor::scrub ()
                                scrub_reverse_distance = 0;
 
                                delta = 0.01 * (last_scrub_x - _drag->current_pointer_x());
-                               session->request_transport_speed (session->transport_speed() - delta);
+                               _session->request_transport_speed (_session->transport_speed() - delta);
                        }
 
                } else {
@@ -1725,7 +1725,7 @@ Editor::scrub ()
                                scrub_reverse_distance = 0;
 
                                delta = 0.01 * (_drag->current_pointer_x() - last_scrub_x);
-                               session->request_transport_speed (session->transport_speed() + delta);
+                               _session->request_transport_speed (_session->transport_speed() + delta);
                        }
                }
 
@@ -1737,11 +1737,11 @@ Editor::scrub ()
 
                        if (scrubbing_direction > 0) {
                                /* was forwards, go backwards */
-                               session->request_transport_speed (-0.1);
+                               _session->request_transport_speed (-0.1);
                                scrubbing_direction = -1;
                        } else {
                                /* was backwards, go forwards */
-                               session->request_transport_speed (0.1);
+                               _session->request_transport_speed (0.1);
                                scrubbing_direction = 1;
                        }
 
@@ -1777,7 +1777,7 @@ Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from
                step_timeout.disconnect ();
        }
 
-       if (session && session->actively_recording()) {
+       if (_session && _session->actively_recording()) {
                /* Sorry. no dragging stuff around while we record */
                return true;
        }
@@ -1917,7 +1917,7 @@ Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos,
        nframes64_t frame_rate;
        float secs;
 
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -1931,18 +1931,18 @@ Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos,
 
        switch (m) {
        case AudioClock::BBT:
-               session->bbt_time (frame, bbt);
+               _session->bbt_time (frame, bbt);
                snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);
                break;
 
        case AudioClock::Timecode:
-               session->timecode_time (frame, timecode);
+               _session->timecode_time (frame, timecode);
                snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
                break;
 
        case AudioClock::MinSec:
                /* XXX this is copied from show_verbose_duration_cursor() */
-               frame_rate = session->frame_rate();
+               frame_rate = _session->frame_rate();
                hours = frame / (frame_rate * 3600);
                frame = frame % (frame_rate * 3600);
                mins = frame / (frame_rate * 60);
@@ -1974,9 +1974,9 @@ Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double
        int hours, mins;
        nframes64_t distance, frame_rate;
        float secs;
-       Meter meter_at_start(session->tempo_map().meter_at(start));
+       Meter meter_at_start(_session->tempo_map().meter_at(start));
 
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -1990,8 +1990,8 @@ Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double
 
        switch (m) {
        case AudioClock::BBT:
-               session->bbt_time (start, sbbt);
-               session->bbt_time (end, ebbt);
+               _session->bbt_time (start, sbbt);
+               _session->bbt_time (end, ebbt);
 
                /* subtract */
                /* XXX this computation won't work well if the
@@ -2016,14 +2016,14 @@ Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double
                break;
 
        case AudioClock::Timecode:
-               session->timecode_duration (end - start, timecode);
+               _session->timecode_duration (end - start, timecode);
                snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
                break;
 
        case AudioClock::MinSec:
                /* XXX this stuff should be elsewhere.. */
                distance = end - start;
-               frame_rate = session->frame_rate();
+               frame_rate = _session->frame_rate();
                hours = distance / (frame_rate * 3600);
                distance = distance % (frame_rate * 3600);
                mins = distance / (frame_rate * 60);
@@ -2255,7 +2255,7 @@ Editor::point_trim (GdkEvent* event)
                                        (*i)->region()->trim_front (new_bound, this);
 
                                        XMLNode &after = pl->get_state();
-                                       session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
+                                       _session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
                                }
                        }
 
@@ -2265,7 +2265,7 @@ Editor::point_trim (GdkEvent* event)
                                XMLNode &before = pl->get_state();
                                rv->region()->trim_front (new_bound, this);
                                XMLNode &after = pl->get_state();
-                               session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
+                               _session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
                        }
                }
 
@@ -2284,7 +2284,7 @@ Editor::point_trim (GdkEvent* event)
                                        XMLNode &before = pl->get_state();
                                        (*i)->region()->trim_end (new_bound, this);
                                        XMLNode &after = pl->get_state();
-                                       session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
+                                       _session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
                                }
                        }
 
@@ -2295,7 +2295,7 @@ Editor::point_trim (GdkEvent* event)
                                XMLNode &before = pl->get_state();
                                rv->region()->trim_end (new_bound, this);
                                XMLNode &after = pl->get_state();
-                               session->add_command (new MementoCommand<Playlist>(*pl.get(), &before, &after));
+                               _session->add_command (new MementoCommand<Playlist>(*pl.get(), &before, &after));
                        }
                }
 
@@ -2418,7 +2418,7 @@ Editor::mouse_brush_insert_region (RegionView* rv, nframes64_t pos)
        XMLNode &before = playlist->get_state();
        playlist->add_region (RegionFactory::create (rv->region()), (nframes64_t) (pos * speed));
        XMLNode &after = playlist->get_state();
-       session->add_command(new MementoCommand<Playlist>(*playlist.get(), &before, &after));
+       _session->add_command(new MementoCommand<Playlist>(*playlist.get(), &before, &after));
 
        // playlist is frozen, so we have to update manually
 
@@ -2534,7 +2534,7 @@ Editor::start_selection_grab (ArdourCanvas::Item* /*item*/, GdkEvent* event)
        XMLNode *before = &(playlist->get_state());
        clicked_routeview->playlist()->add_region (region, selection->time[clicked_selection].start);
        XMLNode *after = &(playlist->get_state());
-       session->add_command(new MementoCommand<Playlist>(*playlist, before, after));
+       _session->add_command(new MementoCommand<Playlist>(*playlist, before, after));
 
        commit_reversible_command ();
 
index 4ed0354491f126e4f1663bb42f3251ca389236b0..2e5556352cf11d537bfeede9e43d6ea426b39089 100644 (file)
@@ -96,16 +96,16 @@ using Gtkmm2ext::Keyboard;
 void
 Editor::undo (uint32_t n)
 {
-       if (session) {
-               session->undo (n);
+       if (_session) {
+               _session->undo (n);
        }
 }
 
 void
 Editor::redo (uint32_t n)
 {
-       if (session) {
-               session->redo (n);
+       if (_session) {
+               _session->redo (n);
        }
 }
 
@@ -171,7 +171,7 @@ Editor::split_regions_at (nframes64_t where, RegionSelection& regions)
                        XMLNode &before = pl->get_state();
                        pl->split_region ((*a)->region(), where);
                        XMLNode &after = pl->get_state();
-                       session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
+                       _session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
                }
 
                a = tmp;
@@ -308,7 +308,7 @@ Editor::nudge_forward (bool next, bool force_playhead)
 
        get_regions_for_action (rs);
 
-       if (!session) return;
+       if (!_session) return;
 
        if (!force_playhead && !rs.empty()) {
 
@@ -326,7 +326,7 @@ Editor::nudge_forward (bool next, bool force_playhead)
                         XMLNode &before = r->playlist()->get_state();
                        r->set_position (r->position() + distance, this);
                         XMLNode &after = r->playlist()->get_state();
-                       session->add_command (new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+                       _session->add_command (new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
                }
 
                commit_reversible_command ();
@@ -368,7 +368,7 @@ Editor::nudge_forward (bool next, bool force_playhead)
                                        }
                                }
                                XMLNode& after (loc->get_state());
-                               session->add_command (new MementoCommand<Location>(*loc, &before, &after));
+                               _session->add_command (new MementoCommand<Location>(*loc, &before, &after));
                        }
                }
 
@@ -376,7 +376,7 @@ Editor::nudge_forward (bool next, bool force_playhead)
 
        } else {
                distance = get_nudge_distance (playhead_cursor->current_frame, next_distance);
-               session->request_locate (playhead_cursor->current_frame + distance);
+               _session->request_locate (playhead_cursor->current_frame + distance);
        }
 }
 
@@ -389,7 +389,7 @@ Editor::nudge_backward (bool next, bool force_playhead)
 
        get_regions_for_action (rs);
 
-       if (!session) return;
+       if (!_session) return;
 
        if (!force_playhead && !rs.empty()) {
 
@@ -412,7 +412,7 @@ Editor::nudge_backward (bool next, bool force_playhead)
                                r->set_position (0, this);
                        }
                         XMLNode &after = r->playlist()->get_state();
-                       session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+                       _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
                }
 
                commit_reversible_command ();
@@ -456,7 +456,7 @@ Editor::nudge_backward (bool next, bool force_playhead)
                                }
 
                                XMLNode& after (loc->get_state());
-                               session->add_command (new MementoCommand<Location>(*loc, &before, &after));
+                               _session->add_command (new MementoCommand<Location>(*loc, &before, &after));
                        }
                }
 
@@ -467,9 +467,9 @@ Editor::nudge_backward (bool next, bool force_playhead)
                distance = get_nudge_distance (playhead_cursor->current_frame, next_distance);
 
                if (playhead_cursor->current_frame > distance) {
-                       session->request_locate (playhead_cursor->current_frame - distance);
+                       _session->request_locate (playhead_cursor->current_frame - distance);
                } else {
-                       session->goto_start();
+                       _session->goto_start();
                }
        }
 }
@@ -482,13 +482,13 @@ Editor::nudge_forward_capture_offset ()
 
        get_regions_for_action (rs);
 
-       if (!session) return;
+       if (!_session) return;
 
        if (!rs.empty()) {
 
                begin_reversible_command (_("nudge forward"));
 
-               distance = session->worst_output_latency();
+               distance = _session->worst_output_latency();
 
                for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                        boost::shared_ptr<Region> r ((*i)->region());
@@ -496,7 +496,7 @@ Editor::nudge_forward_capture_offset ()
                        XMLNode &before = r->playlist()->get_state();
                        r->set_position (r->position() + distance, this);
                        XMLNode &after = r->playlist()->get_state();
-                       session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+                       _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
                }
 
                commit_reversible_command ();
@@ -512,13 +512,13 @@ Editor::nudge_backward_capture_offset ()
 
        get_regions_for_action (rs);
 
-       if (!session) return;
+       if (!_session) return;
 
        if (!rs.empty()) {
 
                begin_reversible_command (_("nudge forward"));
 
-               distance = session->worst_output_latency();
+               distance = _session->worst_output_latency();
 
                for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                        boost::shared_ptr<Region> r ((*i)->region());
@@ -531,7 +531,7 @@ Editor::nudge_backward_capture_offset ()
                                r->set_position (0, this);
                        }
                         XMLNode &after = r->playlist()->get_state();
-                       session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+                       _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
                }
 
                commit_reversible_command ();
@@ -543,14 +543,14 @@ Editor::nudge_backward_capture_offset ()
 void
 Editor::move_to_start ()
 {
-       session->goto_start ();
+       _session->goto_start ();
 }
 
 void
 Editor::move_to_end ()
 {
 
-       session->request_locate (session->current_end_frame());
+       _session->request_locate (_session->current_end_frame());
 }
 
 void
@@ -564,7 +564,7 @@ Editor::build_region_boundary_cache ()
 
        region_boundary_cache.clear ();
 
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -597,7 +597,7 @@ Editor::build_region_boundary_cache ()
                tlist = track_views;
        }
 
-       while (pos < session->current_end_frame() && !at_end) {
+       while (pos < _session->current_end_frame() && !at_end) {
 
                nframes64_t rpos;
                nframes64_t lpos = max_frames;
@@ -714,7 +714,7 @@ Editor::find_next_region (nframes64_t frame, RegionPoint point, int32_t dir, Tra
                        break;
                }
 
-               // rpos is a "track frame", converting it to "session frame"
+               // rpos is a "track frame", converting it to "_session frame"
                rpos = track_frame_to_session_frame(rpos, track_speed);
 
                if (rpos > frame) {
@@ -807,7 +807,7 @@ Editor::cursor_to_region_boundary (bool with_selection, int32_t dir)
        nframes64_t pos = playhead_cursor->current_frame;
        nframes64_t target;
 
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -821,7 +821,7 @@ Editor::cursor_to_region_boundary (bool with_selection, int32_t dir)
        }
 
 
-       session->request_locate (target);
+       _session->request_locate (target);
 }
 
 void
@@ -842,7 +842,7 @@ Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t
        boost::shared_ptr<Region> r;
        nframes64_t pos = cursor->current_frame;
 
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -899,7 +899,7 @@ Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t
        pos = track_frame_to_session_frame(pos, speed);
 
        if (cursor == playhead_cursor) {
-               session->request_locate (pos);
+               _session->request_locate (pos);
        } else {
                cursor->set_position (pos);
        }
@@ -943,7 +943,7 @@ Editor::cursor_to_selection_start (EditorCursor *cursor)
        }
 
        if (cursor == playhead_cursor) {
-               session->request_locate (pos);
+               _session->request_locate (pos);
        } else {
                cursor->set_position (pos);
        }
@@ -975,7 +975,7 @@ Editor::cursor_to_selection_end (EditorCursor *cursor)
        }
 
        if (cursor == playhead_cursor) {
-               session->request_locate (pos);
+               _session->request_locate (pos);
        } else {
                cursor->set_position (pos);
        }
@@ -988,7 +988,7 @@ Editor::selected_marker_to_region_boundary (bool with_selection, int32_t dir)
        Location* loc;
        bool ignored;
 
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -1041,7 +1041,7 @@ Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir)
        Location* loc;
        bool ignored;
 
-       if (!session || selection->markers.empty()) {
+       if (!_session || selection->markers.empty()) {
                return;
        }
 
@@ -1117,7 +1117,7 @@ Editor::selected_marker_to_selection_start ()
        Location* loc;
        bool ignored;
 
-       if (!session || selection->markers.empty()) {
+       if (!_session || selection->markers.empty()) {
                return;
        }
 
@@ -1156,7 +1156,7 @@ Editor::selected_marker_to_selection_end ()
        Location* loc;
        bool ignored;
 
-       if (!session || selection->markers.empty()) {
+       if (!_session || selection->markers.empty()) {
                return;
        }
 
@@ -1218,7 +1218,7 @@ Editor::scroll_playhead (bool forward)
                }
        }
 
-       session->request_locate (pos);
+       _session->request_locate (pos);
 }
 
 void
@@ -1233,7 +1233,7 @@ Editor::playhead_backward ()
                cnt = 1;
        } else {
                if (was_floating) {
-                       cnt = (nframes64_t) floor (prefix * session->frame_rate ());
+                       cnt = (nframes64_t) floor (prefix * _session->frame_rate ());
                } else {
                        cnt = (nframes64_t) prefix;
                }
@@ -1252,7 +1252,7 @@ Editor::playhead_backward ()
           reload, just to move 1 sample !!!
        */
 
-       session->request_locate (pos);
+       _session->request_locate (pos);
 }
 
 void
@@ -1267,7 +1267,7 @@ Editor::playhead_forward ()
                cnt = 1;
        } else {
                if (was_floating) {
-                       cnt = (nframes64_t) floor (prefix * session->frame_rate ());
+                       cnt = (nframes64_t) floor (prefix * _session->frame_rate ());
                } else {
                        cnt = (nframes64_t) floor (prefix);
                }
@@ -1280,13 +1280,13 @@ Editor::playhead_forward ()
           reload, just to move 1 sample !!!
        */
 
-       session->request_locate (pos+cnt);
+       _session->request_locate (pos+cnt);
 }
 
 void
 Editor::cursor_align (bool playhead_to_edit)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -1296,7 +1296,7 @@ Editor::cursor_align (bool playhead_to_edit)
                        return;
                }
 
-               session->request_locate (selection->markers.front()->position(), session->transport_rolling());
+               _session->request_locate (selection->markers.front()->position(), _session->transport_rolling());
 
        } else {
                /* move selected markers to playhead */
@@ -1328,7 +1328,7 @@ Editor::edit_cursor_backward ()
                cnt = 1;
        } else {
                if (was_floating) {
-                       cnt = (nframes64_t) floor (prefix * session->frame_rate ());
+                       cnt = (nframes64_t) floor (prefix * _session->frame_rate ());
                } else {
                        cnt = (nframes64_t) prefix;
                }
@@ -1359,7 +1359,7 @@ Editor::edit_cursor_forward ()
                cnt = 1;
        } else {
                if (was_floating) {
-                       cnt = (nframes64_t) floor (prefix * session->frame_rate ());
+                       cnt = (nframes64_t) floor (prefix * _session->frame_rate ());
                } else {
                        cnt = (nframes64_t) floor (prefix);
                }
@@ -1381,12 +1381,12 @@ Editor::goto_frame ()
        }
 
        if (was_floating) {
-               frame = (nframes64_t) floor (prefix * session->frame_rate());
+               frame = (nframes64_t) floor (prefix * _session->frame_rate());
        } else {
                frame = (nframes64_t) floor (prefix);
        }
 
-       session->request_locate (frame);
+       _session->request_locate (frame);
 }
 
 void
@@ -1402,7 +1402,7 @@ Editor::scroll_backward (float pages)
                cnt = (nframes64_t) floor (pages * one_page);
        } else {
                if (was_floating) {
-                       cnt = (nframes64_t) floor (prefix * session->frame_rate());
+                       cnt = (nframes64_t) floor (prefix * _session->frame_rate());
                } else {
                        cnt = (nframes64_t) floor (prefix * one_page);
                }
@@ -1430,7 +1430,7 @@ Editor::scroll_forward (float pages)
                cnt = (nframes64_t) floor (pages * one_page);
        } else {
                if (was_floating) {
-                       cnt = (nframes64_t) floor (prefix * session->frame_rate());
+                       cnt = (nframes64_t) floor (prefix * _session->frame_rate());
                } else {
                        cnt = (nframes64_t) floor (prefix * one_page);
                }
@@ -1538,7 +1538,7 @@ Editor::temporal_zoom_step (bool coarser)
 void
 Editor::temporal_zoom (gdouble fpu)
 {
-       if (!session) return;
+       if (!_session) return;
 
        nframes64_t current_page = current_page_frames();
        nframes64_t current_leftmost = leftmost_frame;
@@ -1654,7 +1654,7 @@ Editor::temporal_zoom (gdouble fpu)
 
        }
 
-       // leftmost_after_zoom = min (leftmost_after_zoom, session->current_end_frame());
+       // leftmost_after_zoom = min (leftmost_after_zoom, _session->current_end_frame());
 
        reposition_and_zoom (leftmost_after_zoom, nfpu);
 }
@@ -1782,15 +1782,15 @@ Editor::temporal_zoom_session ()
 {
        ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_session)
 
-       if (session) {
-               temporal_zoom_by_frame (session->current_start_frame(), session->current_end_frame(), "zoom to session");
+       if (_session) {
+               temporal_zoom_by_frame (_session->current_start_frame(), _session->current_end_frame(), "zoom to _session");
        }
 }
 
 void
 Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & /*op*/)
 {
-       if (!session) return;
+       if (!_session) return;
 
        if ((start == 0 && end == 0) || end < start) {
                return;
@@ -1814,7 +1814,7 @@ Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string
 void
 Editor::temporal_zoom_to_frame (bool coarser, nframes64_t frame)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
        double range_before = frame - leftmost_frame;
@@ -1840,8 +1840,8 @@ Editor::temporal_zoom_to_frame (bool coarser, nframes64_t frame)
                new_leftmost = 0;
        }
 //     begin_reversible_command (_("zoom to frame"));
-//     session->add_undo (sigc::bind (sigc::mem_fun(*this, &Editor::reposition_and_zoom), leftmost_frame, frames_per_unit));
-//     session->add_redo (sigc::bind (sigc::mem_fun(*this, &Editor::reposition_and_zoom), new_leftmost, new_fpu));
+//     _session->add_undo (sigc::bind (sigc::mem_fun(*this, &Editor::reposition_and_zoom), leftmost_frame, frames_per_unit));
+//     _session->add_redo (sigc::bind (sigc::mem_fun(*this, &Editor::reposition_and_zoom), new_leftmost, new_fpu));
 //     commit_reversible_command ();
 
        reposition_and_zoom (new_leftmost, new_fpu);
@@ -1893,22 +1893,22 @@ Editor::add_location_from_selection ()
                return;
        }
 
-       if (session == 0 || clicked_axisview == 0) {
+       if (_session == 0 || clicked_axisview == 0) {
                return;
        }
 
        nframes64_t start = selection->time[clicked_selection].start;
        nframes64_t end = selection->time[clicked_selection].end;
 
-       session->locations()->next_available_name(rangename,"selection");
+       _session->locations()->next_available_name(rangename,"selection");
        Location *location = new Location (start, end, rangename, Location::IsRangeMarker);
 
-       session->begin_reversible_command (_("add marker"));
-        XMLNode &before = session->locations()->get_state();
-       session->locations()->add (location, true);
-        XMLNode &after = session->locations()->get_state();
-       session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
-       session->commit_reversible_command ();
+       _session->begin_reversible_command (_("add marker"));
+        XMLNode &before = _session->locations()->get_state();
+       _session->locations()->add (location, true);
+        XMLNode &after = _session->locations()->get_state();
+       _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+       _session->commit_reversible_command ();
 }
 
 void
@@ -1918,23 +1918,23 @@ Editor::add_location_mark (nframes64_t where)
 
        select_new_marker = true;
 
-       session->locations()->next_available_name(markername,"mark");
+       _session->locations()->next_available_name(markername,"mark");
        if (!choose_new_marker_name(markername)) {
                return;
        }
        Location *location = new Location (where, where, markername, Location::IsMark);
-       session->begin_reversible_command (_("add marker"));
-        XMLNode &before = session->locations()->get_state();
-       session->locations()->add (location, true);
-        XMLNode &after = session->locations()->get_state();
-       session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
-       session->commit_reversible_command ();
+       _session->begin_reversible_command (_("add marker"));
+        XMLNode &before = _session->locations()->get_state();
+       _session->locations()->add (location, true);
+        XMLNode &after = _session->locations()->get_state();
+       _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+       _session->commit_reversible_command ();
 }
 
 void
 Editor::add_location_from_playhead_cursor ()
 {
-       add_location_mark (session->audible_frame());
+       add_location_mark (_session->audible_frame());
 }
 
 void
@@ -1948,8 +1948,8 @@ Editor::add_locations_from_audio_region ()
                return;
        }
 
-       session->begin_reversible_command (rs.size () > 1 ? _("add markers") : _("add marker"));
-       XMLNode &before = session->locations()->get_state();
+       _session->begin_reversible_command (rs.size () > 1 ? _("add markers") : _("add marker"));
+       XMLNode &before = _session->locations()->get_state();
 
        cerr << "Add locations\n";
 
@@ -1959,12 +1959,12 @@ Editor::add_locations_from_audio_region ()
 
                Location *location = new Location (region->position(), region->last_frame(), region->name(), Location::IsRangeMarker);
 
-               session->locations()->add (location, true);
+               _session->locations()->add (location, true);
        }
 
-       XMLNode &after = session->locations()->get_state();
-       session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
-       session->commit_reversible_command ();
+       XMLNode &after = _session->locations()->get_state();
+       _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+       _session->commit_reversible_command ();
 }
 
 void
@@ -1978,13 +1978,13 @@ Editor::add_location_from_audio_region ()
                return;
        }
 
-       session->begin_reversible_command (_("add marker"));
-       XMLNode &before = session->locations()->get_state();
+       _session->begin_reversible_command (_("add marker"));
+       XMLNode &before = _session->locations()->get_state();
 
        string markername;
 
        if (rs.size() > 1) {            // more than one region selected
-               session->locations()->next_available_name(markername, "regions");
+               _session->locations()->next_available_name(markername, "regions");
        } else {
                RegionView* rv = *(rs.begin());
                boost::shared_ptr<Region> region = rv->region();
@@ -1999,11 +1999,11 @@ Editor::add_location_from_audio_region ()
 
        // single range spanning all selected
        Location *location = new Location (rs.start(), rs.end_frame(), markername, Location::IsRangeMarker);
-       session->locations()->add (location, true);
+       _session->locations()->add (location, true);
 
-       XMLNode &after = session->locations()->get_state();
-       session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
-       session->commit_reversible_command ();
+       XMLNode &after = _session->locations()->get_state();
+       _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+       _session->commit_reversible_command ();
 }
 
 void
@@ -2064,32 +2064,32 @@ Editor::search_forwards ()
 void
 Editor::jump_forward_to_mark ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
-       Location *location = session->locations()->first_location_after (playhead_cursor->current_frame);
+       Location *location = _session->locations()->first_location_after (playhead_cursor->current_frame);
 
        if (location) {
-               session->request_locate (location->start(), session->transport_rolling());
+               _session->request_locate (location->start(), _session->transport_rolling());
        } else {
-               session->request_locate (session->current_end_frame());
+               _session->request_locate (_session->current_end_frame());
        }
 }
 
 void
 Editor::jump_backward_to_mark ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
-       Location *location = session->locations()->first_location_before (playhead_cursor->current_frame);
+       Location *location = _session->locations()->first_location_before (playhead_cursor->current_frame);
 
        if (location) {
-               session->request_locate (location->start(), session->transport_rolling());
+               _session->request_locate (location->start(), _session->transport_rolling());
        } else {
-               session->goto_start ();
+               _session->goto_start ();
        }
 }
 
@@ -2102,66 +2102,66 @@ Editor::set_mark ()
        string markername;
 
        if (get_prefix (prefix, was_floating)) {
-               pos = session->audible_frame ();
+               pos = _session->audible_frame ();
        } else {
                if (was_floating) {
-                       pos = (nframes64_t) floor (prefix * session->frame_rate ());
+                       pos = (nframes64_t) floor (prefix * _session->frame_rate ());
                } else {
                        pos = (nframes64_t) floor (prefix);
                }
        }
 
-       session->locations()->next_available_name(markername,"mark");
+       _session->locations()->next_available_name(markername,"mark");
        if (!choose_new_marker_name(markername)) {
                return;
        }
-       session->locations()->add (new Location (pos, 0, markername, Location::IsMark), true);
+       _session->locations()->add (new Location (pos, 0, markername, Location::IsMark), true);
 }
 
 void
 Editor::clear_markers ()
 {
-       if (session) {
-               session->begin_reversible_command (_("clear markers"));
-                XMLNode &before = session->locations()->get_state();
-               session->locations()->clear_markers ();
-                XMLNode &after = session->locations()->get_state();
-               session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
-               session->commit_reversible_command ();
+       if (_session) {
+               _session->begin_reversible_command (_("clear markers"));
+                XMLNode &before = _session->locations()->get_state();
+               _session->locations()->clear_markers ();
+                XMLNode &after = _session->locations()->get_state();
+               _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+               _session->commit_reversible_command ();
        }
 }
 
 void
 Editor::clear_ranges ()
 {
-       if (session) {
-               session->begin_reversible_command (_("clear ranges"));
-                XMLNode &before = session->locations()->get_state();
+       if (_session) {
+               _session->begin_reversible_command (_("clear ranges"));
+                XMLNode &before = _session->locations()->get_state();
 
-               Location * looploc = session->locations()->auto_loop_location();
-               Location * punchloc = session->locations()->auto_punch_location();
+               Location * looploc = _session->locations()->auto_loop_location();
+               Location * punchloc = _session->locations()->auto_punch_location();
 
-               session->locations()->clear_ranges ();
+               _session->locations()->clear_ranges ();
                // re-add these
-               if (looploc) session->locations()->add (looploc);
-               if (punchloc) session->locations()->add (punchloc);
+               if (looploc) _session->locations()->add (looploc);
+               if (punchloc) _session->locations()->add (punchloc);
 
-                XMLNode &after = session->locations()->get_state();
-               session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
-               session->commit_reversible_command ();
+                XMLNode &after = _session->locations()->get_state();
+               _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+               _session->commit_reversible_command ();
        }
 }
 
 void
 Editor::clear_locations ()
 {
-       session->begin_reversible_command (_("clear locations"));
-        XMLNode &before = session->locations()->get_state();
-       session->locations()->clear ();
-        XMLNode &after = session->locations()->get_state();
-       session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
-       session->commit_reversible_command ();
-       session->locations()->clear ();
+       _session->begin_reversible_command (_("clear locations"));
+        XMLNode &before = _session->locations()->get_state();
+       _session->locations()->clear ();
+        XMLNode &after = _session->locations()->get_state();
+       _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+       _session->commit_reversible_command ();
+       _session->locations()->clear ();
 }
 
 void
@@ -2231,7 +2231,7 @@ Editor::insert_region_list_drag (boost::shared_ptr<Region> region, int x, int y)
        begin_reversible_command (_("insert dragged region"));
         XMLNode &before = playlist->get_state();
        playlist->add_region (RegionFactory::create (region), where, 1.0);
-       session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+       _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
        commit_reversible_command ();
 }
 
@@ -2309,7 +2309,7 @@ Editor::insert_region_list_selection (float times)
        begin_reversible_command (_("insert region"));
        XMLNode &before = playlist->get_state();
        playlist->add_region ((RegionFactory::create (region)), get_preferred_edit_position(), times);
-       session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+       _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
        commit_reversible_command ();
 }
 
@@ -2333,12 +2333,12 @@ Editor::edit_envelope ()
 void
 Editor::transition_to_rolling (bool fwd)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
-       if (session->config.get_external_sync()) {
-               switch (session->config.get_sync_source()) {
+       if (_session->config.get_external_sync()) {
+               switch (_session->config.get_sync_source()) {
                case JACK:
                        break;
                default:
@@ -2347,24 +2347,24 @@ Editor::transition_to_rolling (bool fwd)
                }
        }
 
-       if (session->is_auditioning()) {
-               session->cancel_audition ();
+       if (_session->is_auditioning()) {
+               _session->cancel_audition ();
                return;
        }
 
-       session->request_transport_speed (fwd ? 1.0f : -1.0f);
+       _session->request_transport_speed (fwd ? 1.0f : -1.0f);
 }
 
 void
 Editor::play_from_start ()
 {
-       session->request_locate (session->current_start_frame(), true);
+       _session->request_locate (_session->current_start_frame(), true);
 }
 
 void
 Editor::play_from_edit_point ()
 {
-       session->request_locate (get_preferred_edit_position(), true);
+       _session->request_locate (get_preferred_edit_position(), true);
 }
 
 void
@@ -2375,19 +2375,19 @@ Editor::play_from_edit_point_and_return ()
 
        start_frame = get_preferred_edit_position (true);
 
-       if (session->transport_rolling()) {
-               session->request_locate (start_frame, false);
+       if (_session->transport_rolling()) {
+               _session->request_locate (start_frame, false);
                return;
        }
 
        /* don't reset the return frame if its already set */
 
-       if ((return_frame = session->requested_return_frame()) < 0) {
-               return_frame = session->audible_frame();
+       if ((return_frame = _session->requested_return_frame()) < 0) {
+               return_frame = _session->audible_frame();
        }
 
        if (start_frame >= 0) {
-               session->request_roll_at_and_return (start_frame, return_frame);
+               _session->request_roll_at_and_return (start_frame, return_frame);
        }
 }
 
@@ -2398,7 +2398,7 @@ Editor::play_selection ()
                return;
        }
 
-       session->request_play_range (&selection->time, true);
+       _session->request_play_range (&selection->time, true);
 }
 
 void
@@ -2418,9 +2418,9 @@ Editor::loop_selected_region ()
 
                        // enable looping, reposition and start rolling
 
-                       session->request_play_loop (true);
-                       session->request_locate (tll->start(), false);
-                       session->request_transport_speed (1.0f);
+                       _session->request_play_loop (true);
+                       _session->request_locate (tll->start(), false);
+                       _session->request_transport_speed (1.0f);
                }
        }
 }
@@ -2432,7 +2432,7 @@ Editor::play_location (Location& location)
                return;
        }
 
-       session->request_bounded_roll (location.start(), location.end());
+       _session->request_bounded_roll (location.start(), location.end());
 }
 
 void
@@ -2448,8 +2448,8 @@ Editor::loop_location (Location& location)
                tll->set (location.start(), location.end());
 
                // enable looping, reposition and start rolling
-               session->request_play_loop (true);
-               session->request_locate (tll->start(), true);
+               _session->request_play_loop (true);
+               _session->request_locate (tll->start(), true);
        }
 }
 
@@ -2546,8 +2546,8 @@ Editor::rename_region()
 void
 Editor::audition_playlist_region_via_route (boost::shared_ptr<Region> region, Route& route)
 {
-       if (session->is_auditioning()) {
-               session->cancel_audition ();
+       if (_session->is_auditioning()) {
+               _session->cancel_audition ();
        }
 
        // note: some potential for creativity here, because region doesn't
@@ -2557,7 +2557,7 @@ Editor::audition_playlist_region_via_route (boost::shared_ptr<Region> region, Ro
 
        route.set_solo (true, this);
 
-       session->request_bounded_roll (region->position(), region->position() + region->length());
+       _session->request_bounded_roll (region->position(), region->position() + region->length());
 
        /* XXX how to unset the solo state ? */
 }
@@ -2569,7 +2569,7 @@ Editor::play_edit_range ()
        nframes64_t start, end;
 
        if (get_edit_op_range (start, end)) {
-               session->request_bounded_roll (start, end);
+               _session->request_bounded_roll (start, end);
        }
 }
 
@@ -2595,13 +2595,13 @@ Editor::play_selected_region ()
                }
        }
 
-       session->request_bounded_roll (start, end);
+       _session->request_bounded_roll (start, end);
 }
 
 void
 Editor::audition_playlist_region_standalone (boost::shared_ptr<Region> region)
 {
-       session->audition_region (region);
+       _session->audition_region (region);
 }
 
 void
@@ -2670,7 +2670,7 @@ Editor::region_from_selection ()
                }
 
                internal_start = start - current->position();
-               session->region_name (new_name, current->name(), true);
+               _session->region_name (new_name, current->name(), true);
                boost::shared_ptr<Region> region (RegionFactory::create (current,
                                internal_start, selection_cnt, new_name));
        }
@@ -2703,7 +2703,7 @@ Editor::create_region_from_selection (vector<boost::shared_ptr<Region> >& new_re
                }
 
                internal_start = start - current->position();
-               session->region_name (new_name, current->name(), true);
+               _session->region_name (new_name, current->name(), true);
 
                new_regions.push_back (RegionFactory::create (current,
                                        internal_start, end - start + 1, new_name));
@@ -2724,7 +2724,7 @@ Editor::split_multichannel_region ()
        vector< boost::shared_ptr<Region> > v;
 
        for (list<RegionView*>::iterator x = rs.begin(); x != rs.end(); ++x) {
-               (*x)->region()->separate_by_channel (*session, v);
+               (*x)->region()->separate_by_channel (*_session, v);
        }
 }
 
@@ -2845,7 +2845,7 @@ Editor::separate_regions_between (const TimeSelection& ts)
                                                                in_command = true;
                                                        }
 
-                                                       session->add_command(new MementoCommand<Playlist>(
+                                                       _session->add_command(new MementoCommand<Playlist>(
                                                                        *playlist, before, &playlist->get_state()));
                                                }
                                        }
@@ -2901,7 +2901,7 @@ Editor::separate_region_from_selection ()
 void
 Editor::separate_region_from_punch ()
 {
-       Location* loc  = session->locations()->auto_punch_location();
+       Location* loc  = _session->locations()->auto_punch_location();
        if (loc) {
                separate_regions_using_location (*loc);
        }
@@ -2910,7 +2910,7 @@ Editor::separate_region_from_punch ()
 void
 Editor::separate_region_from_loop ()
 {
-       Location* loc  = session->locations()->auto_loop_location();
+       Location* loc  = _session->locations()->auto_loop_location();
        if (loc) {
                separate_regions_using_location (*loc);
        }
@@ -3017,7 +3017,7 @@ Editor::crop_region_to (nframes64_t start, nframes64_t end)
                XMLNode &before = (*i)->get_state();
                region->trim_to (the_start, cnt, this);
                XMLNode &after = (*i)->get_state();
-               session->add_command (new MementoCommand<Playlist>(*(*i), &before, &after));
+               _session->add_command (new MementoCommand<Playlist>(*(*i), &before, &after));
        }
 
        commit_reversible_command ();
@@ -3031,11 +3031,11 @@ Editor::region_fill_track ()
 
        get_regions_for_action (rs);
 
-       if (!session || rs.empty()) {
+       if (!_session || rs.empty()) {
                return;
        }
 
-       end = session->current_end_frame ();
+       end = _session->current_end_frame ();
 
        begin_reversible_command (_("region fill"));
 
@@ -3057,7 +3057,7 @@ Editor::region_fill_track ()
 
                XMLNode &before = pl->get_state();
                pl->add_region (RegionFactory::create (region), region->last_frame(), times);
-               session->add_command (new MementoCommand<Playlist>(*pl, &before, &pl->get_state()));
+               _session->add_command (new MementoCommand<Playlist>(*pl, &before, &pl->get_state()));
        }
 
        commit_reversible_command ();
@@ -3101,7 +3101,7 @@ Editor::region_fill_selection ()
 
                 XMLNode &before = playlist->get_state();
                playlist->add_region (RegionFactory::create (region), start, times);
-               session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+               _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
        }
 
        commit_reversible_command ();
@@ -3137,7 +3137,7 @@ Editor::set_sync_point (nframes64_t where, const RegionSelection& rs)
                XMLNode &before = region->playlist()->get_state();
                region->set_sync_position (where);
                XMLNode &after = region->playlist()->get_state();
-               session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
+               _session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
        }
 
        if (in_command) {
@@ -3163,7 +3163,7 @@ Editor::remove_region_sync ()
                 XMLNode &before = (*i)->region()->playlist()->get_state();
                (*i)->region()->clear_sync_position ();
                 XMLNode &after = (*i)->region()->playlist()->get_state();
-               session->add_command(new MementoCommand<Playlist>(*((*i)->region()->playlist()), &before, &after));
+               _session->add_command(new MementoCommand<Playlist>(*((*i)->region()->playlist()), &before, &after));
        }
        commit_reversible_command ();
 }
@@ -3184,7 +3184,7 @@ Editor::naturalize ()
                 XMLNode &before = (*i)->region()->get_state();
                (*i)->region()->move_to_natural_position (this);
                 XMLNode &after = (*i)->region()->get_state();
-               session->add_command (new MementoCommand<Region>(*((*i)->region().get()), &before, &after));
+               _session->add_command (new MementoCommand<Region>(*((*i)->region().get()), &before, &after));
        }
        commit_reversible_command ();
 }
@@ -3286,7 +3286,7 @@ Editor::align_selection_relative (RegionPoint point, nframes64_t position, const
        XMLNode &before = r->playlist()->get_state();
        r->set_position (pos, this);
        XMLNode &after = r->playlist()->get_state();
-       session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
+       _session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after));
 
        /* move rest by the same amount */
 
@@ -3305,7 +3305,7 @@ Editor::align_selection_relative (RegionPoint point, nframes64_t position, const
                }
 
                 XMLNode &after = region->playlist()->get_state();
-               session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
+               _session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
 
        }
 
@@ -3358,7 +3358,7 @@ Editor::align_region_internal (boost::shared_ptr<Region> region, RegionPoint poi
        }
 
        XMLNode &after = region->playlist()->get_state();
-       session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
+       _session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after));
 }
 
 void
@@ -3397,7 +3397,7 @@ Editor::trim_region (bool front)
                                (*i)->region()->trim_end (where, this);
                        }
                        XMLNode &after = pl->get_state();
-                       session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
+                       _session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after));
                }
        }
 
@@ -3408,7 +3408,7 @@ Editor::trim_region (bool front)
 void
 Editor::trim_region_to_loop ()
 {
-       Location* loc = session->locations()->auto_loop_location();
+       Location* loc = _session->locations()->auto_loop_location();
        if (!loc) {
                return;
        }
@@ -3418,7 +3418,7 @@ Editor::trim_region_to_loop ()
 void
 Editor::trim_region_to_punch ()
 {
-       Location* loc = session->locations()->auto_punch_location();
+       Location* loc = _session->locations()->auto_punch_location();
        if (!loc) {
                return;
        }
@@ -3463,7 +3463,7 @@ Editor::trim_region_to_location (const Location& loc, const char* str)
                XMLNode &before = rv->region()->playlist()->get_state();
                rv->region()->trim_to (start, (end - start), this);
                XMLNode &after = rv->region()->playlist()->get_state();
-               session->add_command(new MementoCommand<Playlist>(
+               _session->add_command(new MementoCommand<Playlist>(
                                *(rv->region()->playlist()), &before, &after));
        }
 
@@ -3501,9 +3501,9 @@ Editor::trim_region_to_edit_point ()
                }
 
                XMLNode &before = rv->region()->playlist()->get_state();
-               rv->region()->trim_endsession_frame_to_track_frame(where, speed), this);
+               rv->region()->trim_end (session_frame_to_track_frame(where, speed), this);
                XMLNode &after = rv->region()->playlist()->get_state();
-               session->add_command(new MementoCommand<Playlist>(
+               _session->add_command(new MementoCommand<Playlist>(
                                *(rv->region()->playlist()), &before, &after));
        }
 
@@ -3541,9 +3541,9 @@ Editor::trim_region_from_edit_point ()
                }
 
                XMLNode &before = rv->region()->playlist()->get_state();
-               rv->region()->trim_front ( session_frame_to_track_frame(where, speed), this);
+               rv->region()->trim_front (session_frame_to_track_frame(where, speed), this);
                XMLNode &after = rv->region()->playlist()->get_state();
-               session->add_command(new MementoCommand<Playlist>(
+               _session->add_command(new MementoCommand<Playlist>(
                                *(rv->region()->playlist()), &before, &after));
        }
 
@@ -3623,7 +3623,7 @@ Editor::trim_to_region(bool forward)
                }
 
                XMLNode &after = playlist->get_state();
-               session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
+               _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
        }
 
        commit_reversible_command ();
@@ -3750,7 +3750,7 @@ Editor::bounce_range_selection (bool replace, bool enable_processing)
                }
 
                 XMLNode &after = playlist->get_state();
-               session->add_command (new MementoCommand<Playlist> (*playlist, &before, &after));
+               _session->add_command (new MementoCommand<Playlist> (*playlist, &before, &after));
        }
 
        commit_reversible_command ();
@@ -3842,7 +3842,7 @@ Editor::cut_copy (CutCopyOp op)
                bool ignored;
                Location* loc = find_location_from_marker (entered_marker, ignored);
 
-               if (session && loc) {
+               if (_session && loc) {
                        Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::really_remove_marker), loc));
                }
 
@@ -3944,7 +3944,7 @@ Editor::cut_copy_points (CutCopyOp op)
 {
        for (PointSelection::iterator i = selection->points.begin(); i != selection->points.end(); ++i) {
 
-               AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>(&(*i).track);
+               AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>((*i).track);
 
                if (atv) {
                        atv->cut_copy_clear_objects (selection->points, op);
@@ -3996,7 +3996,7 @@ Editor::remove_clicked_region ()
         XMLNode &before = playlist->get_state();
        playlist->remove_region (clicked_regionview->region());
         XMLNode &after = playlist->get_state();
-       session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
+       _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
        commit_reversible_command ();
 }
 
@@ -4008,7 +4008,7 @@ Editor::remove_selected_regions ()
        RegionSelection rs;
        get_regions_for_action (rs);
 
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -4070,7 +4070,7 @@ Editor::remove_selected_regions ()
 
        for (pl = playlists.begin(); pl != playlists.end(); ++pl) {
                (*pl).playlist->thaw ();
-               session->add_command(new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
+               _session->add_command(new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
        }
 
        commit_reversible_command ();
@@ -4165,7 +4165,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
                assert (z != pmap.end());
 
                if (!(*z).pl) {
-                       npl = PlaylistFactory::create (pl->data_type(), *session, "cutlist", true);
+                       npl = PlaylistFactory::create (pl->data_type(), *_session, "cutlist", true);
                        npl->freeze();
                        (*z).pl = npl;
                } else {
@@ -4213,7 +4213,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
 
        for (set<PlaylistState, lt_playlist>::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
                (*pl).playlist->thaw ();
-               session->add_command (new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
+               _session->add_command (new MementoCommand<Playlist>(*(*pl).playlist, (*pl).before, &(*pl).playlist->get_state()));
        }
 }
 
@@ -4352,7 +4352,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
                playlist = (*i)->region()->playlist();
                 XMLNode &before = playlist->get_state();
                playlist->duplicate (r, end_frame + (r->first_frame() - start_frame) + 1, times);
-               session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+               _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
 
                c.disconnect ();
 
@@ -4394,7 +4394,7 @@ Editor::duplicate_selection (float times)
                XMLNode &before = playlist->get_state();
                playlist->duplicate (*ri, selection->time[clicked_selection].end, times);
                XMLNode &after = playlist->get_state();
-               session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+               _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
 
                ++ri;
                if (ri == new_regions.end()) {
@@ -4412,7 +4412,7 @@ Editor::reset_point_selection ()
 
        for (PointSelection::iterator i = selection->points.begin(); i != selection->points.end(); ++i) {
 
-               AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>(&(*i).track);
+               AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>((*i).track);
 
                if (atv) {
                        atv->reset_objects (selection->points);
@@ -4441,7 +4441,7 @@ Editor::clear_playlist (boost::shared_ptr<Playlist> playlist)
         XMLNode &before = playlist->get_state();
        playlist->clear ();
         XMLNode &after = playlist->get_state();
-       session->add_command (new MementoCommand<Playlist>(*playlist.get(), &before, &after));
+       _session->add_command (new MementoCommand<Playlist>(*playlist.get(), &before, &after));
        commit_reversible_command ();
 }
 
@@ -4478,7 +4478,7 @@ Editor::nudge_track (bool use_edit, bool forwards)
                 XMLNode &before = playlist->get_state();
                playlist->nudge_after (start, distance, forwards);
                 XMLNode &after = playlist->get_state();
-               session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+               _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
        }
 
        commit_reversible_command ();
@@ -4490,7 +4490,7 @@ Editor::remove_last_capture ()
        vector<string> choices;
        string prompt;
 
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -4504,18 +4504,18 @@ Editor::remove_last_capture ()
                Gtkmm2ext::Choice prompter (prompt, choices);
 
                if (prompter.run () == 1) {
-                       session->remove_last_capture ();
+                       _session->remove_last_capture ();
                }
 
        } else {
-               session->remove_last_capture();
+               _session->remove_last_capture();
        }
 }
 
 void
 Editor::normalize_region ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -4556,7 +4556,7 @@ Editor::normalize_region ()
                        continue;
                XMLNode &before = arv->region()->get_state();
                arv->audio_region()->normalize_to (spin.get_value());
-               session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+               _session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
        }
 
        commit_reversible_command ();
@@ -4569,7 +4569,7 @@ Editor::normalize_region ()
 void
 Editor::reset_region_scale_amplitude ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -4589,7 +4589,7 @@ Editor::reset_region_scale_amplitude ()
                        continue;
                XMLNode &before = arv->region()->get_state();
                arv->audio_region()->set_scale_amplitude (1.0f);
-               session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+               _session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
        }
 
        commit_reversible_command ();
@@ -4598,7 +4598,7 @@ Editor::reset_region_scale_amplitude ()
 void
 Editor::adjust_region_scale_amplitude (bool up)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -4639,7 +4639,7 @@ Editor::adjust_region_scale_amplitude (bool up)
                }
 
                arv->audio_region()->set_scale_amplitude (fraction);
-               session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
+               _session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
        }
 
        commit_reversible_command ();
@@ -4649,18 +4649,18 @@ Editor::adjust_region_scale_amplitude (bool up)
 void
 Editor::reverse_region ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
-       Reverse rev (*session);
+       Reverse rev (*_session);
        apply_filter (rev, _("reverse regions"));
 }
 
 void
 Editor::strip_region_silence ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -4684,7 +4684,7 @@ Editor::strip_region_silence ()
        int const r = d.run ();
 
        if (r == Gtk::RESPONSE_OK) {
-               StripSilence s (*session, d.threshold (), d.minimum_length (), d.fade_length ());
+               StripSilence s (*_session, d.threshold (), d.minimum_length (), d.fade_length ());
                apply_filter (s, _("strip silence"));
        }
 }
@@ -4725,7 +4725,7 @@ Editor::apply_midi_note_edit_op (MidiOperator& op)
                        cmd = apply_midi_note_edit_op_to_region (op, *mrv);
                        if (cmd) {
                                (*cmd)();
-                               session->add_command (cmd);
+                               _session->add_command (cmd);
                        }
                }
 
@@ -4739,7 +4739,7 @@ Editor::apply_midi_note_edit_op (MidiOperator& op)
 void
 Editor::quantize_region ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -4750,7 +4750,7 @@ Editor::quantize_region ()
        qd->hide ();
 
        if (r == Gtk::RESPONSE_OK) {
-               Quantize quant (*session, Plain,
+               Quantize quant (*_session, Plain,
                                qd->snap_start(), qd->snap_end(),
                                qd->start_grid_size(), qd->end_grid_size(),
                                qd->strength(), qd->swing(), qd->threshold());
@@ -4809,7 +4809,7 @@ Editor::apply_filter (Filter& filter, string command)
                                }
 
                                XMLNode &after = playlist->get_state();
-                               session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
+                               _session->add_command(new MementoCommand<Playlist>(*playlist, &before, &after));
                        } else {
                                goto out;
                        }
@@ -4883,11 +4883,11 @@ Editor::reset_region_gain_envelopes ()
 {
        RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
 
-       if (!session || rs.empty()) {
+       if (!_session || rs.empty()) {
                return;
        }
 
-       session->begin_reversible_command (_("reset region gain"));
+       _session->begin_reversible_command (_("reset region gain"));
 
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
@@ -4896,11 +4896,11 @@ Editor::reset_region_gain_envelopes ()
                        XMLNode& before (alist->get_state());
 
                        arv->audio_region()->set_default_envelope ();
-                       session->add_command (new MementoCommand<AutomationList>(*arv->audio_region()->envelope().get(), &before, &alist->get_state()));
+                       _session->add_command (new MementoCommand<AutomationList>(*arv->audio_region()->envelope().get(), &before, &alist->get_state()));
                }
        }
 
-       session->commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
@@ -4908,11 +4908,11 @@ Editor::toggle_gain_envelope_visibility ()
 {
        RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
 
-       if (!session || rs.empty()) {
+       if (!_session || rs.empty()) {
                return;
        }
 
-       session->begin_reversible_command (_("region gain envelope visible"));
+       _session->begin_reversible_command (_("region gain envelope visible"));
 
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
@@ -4920,11 +4920,11 @@ Editor::toggle_gain_envelope_visibility ()
                        XMLNode &before = arv->region()->get_state ();
                        arv->set_envelope_visible (!arv->envelope_visible());
                        XMLNode &after = arv->region()->get_state ();
-                       session->add_command (new MementoCommand<Region> (*(arv->region().get()), &before, &after));
+                       _session->add_command (new MementoCommand<Region> (*(arv->region().get()), &before, &after));
                }
        }
 
-       session->commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
@@ -4932,11 +4932,11 @@ Editor::toggle_gain_envelope_active ()
 {
        RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
 
-       if (!session || rs.empty()) {
+       if (!_session || rs.empty()) {
                return;
        }
 
-       session->begin_reversible_command (_("region gain envelope active"));
+       _session->begin_reversible_command (_("region gain envelope active"));
 
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
@@ -4944,11 +4944,11 @@ Editor::toggle_gain_envelope_active ()
                        XMLNode &before = arv->region()->get_state ();
                        arv->audio_region()->set_envelope_active (!arv->audio_region()->envelope_active());
                        XMLNode &after = arv->region()->get_state ();
-                       session->add_command (new MementoCommand<Region> (*(arv->region().get()), &before, &after));
+                       _session->add_command (new MementoCommand<Region> (*(arv->region().get()), &before, &after));
                }
        }
 
-       session->commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
@@ -4956,20 +4956,20 @@ Editor::toggle_region_lock ()
 {
        RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
 
-       if (!session || rs.empty()) {
+       if (!_session || rs.empty()) {
                return;
        }
 
-       session->begin_reversible_command (_("region lock"));
+       _session->begin_reversible_command (_("region lock"));
 
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                XMLNode &before = (*i)->region()->get_state ();
                (*i)->region()->set_locked (!(*i)->region()->locked());
                XMLNode &after = (*i)->region()->get_state ();
-               session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
+               _session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
        }
 
-       session->commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
@@ -4977,20 +4977,20 @@ Editor::set_region_lock_style (Region::PositionLockStyle ps)
 {
        RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
 
-       if (!session || rs.empty()) {
+       if (!_session || rs.empty()) {
                return;
        }
 
-       session->begin_reversible_command (_("region lock style"));
+       _session->begin_reversible_command (_("region lock style"));
 
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                XMLNode &before = (*i)->region()->get_state ();
                (*i)->region()->set_position_lock_style (ps);
                XMLNode &after = (*i)->region()->get_state ();
-               session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
+               _session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
        }
 
-       session->commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 
@@ -4999,20 +4999,20 @@ Editor::toggle_region_mute ()
 {
        RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
 
-       if (!session || rs.empty()) {
+       if (!_session || rs.empty()) {
                return;
        }
 
-       session->begin_reversible_command (_("region mute"));
+       _session->begin_reversible_command (_("region mute"));
 
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                XMLNode &before = (*i)->region()->get_state ();
                (*i)->region()->set_muted (!(*i)->region()->muted());
                XMLNode &after = (*i)->region()->get_state ();
-               session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
+               _session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
        }
 
-       session->commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
@@ -5020,20 +5020,20 @@ Editor::toggle_region_opaque ()
 {
        RegionSelection rs = get_equivalent_regions (selection->regions, RouteGroup::Edit);
 
-       if (!session || rs.empty()) {
+       if (!_session || rs.empty()) {
                return;
        }
 
-       session->begin_reversible_command (_("region opacity"));
+       _session->begin_reversible_command (_("region opacity"));
 
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                XMLNode &before = (*i)->region()->get_state ();
                (*i)->region()->set_opaque (!(*i)->region()->opaque());
                XMLNode &after = (*i)->region()->get_state ();
-               session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
+               _session->add_command (new MementoCommand<Region> (*((*i)->region().get()), &before, &after));
        }
 
-       session->commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
@@ -5125,7 +5125,7 @@ Editor::set_fade_length (bool in)
                }
 
                XMLNode &after = alist->get_state();
-               session->add_command(new MementoCommand<AutomationList>(*alist, &before, &after));
+               _session->add_command(new MementoCommand<AutomationList>(*alist, &before, &after));
        }
 
        commit_reversible_command ();
@@ -5175,7 +5175,7 @@ Editor::toggle_fade_active (bool in)
                        region->set_fade_out_active (!yn);
                }
                XMLNode &after = region->get_state();
-               session->add_command(new MementoCommand<AudioRegion>(*region.get(), &before, &after));
+               _session->add_command(new MementoCommand<AudioRegion>(*region.get(), &before, &after));
        }
 
        commit_reversible_command ();
@@ -5207,7 +5207,7 @@ Editor::set_fade_in_shape (AudioRegion::FadeShape shape)
                tmp->audio_region()->set_fade_in_shape (shape);
 
                XMLNode &after = alist->get_state();
-               session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
+               _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
        }
 
        commit_reversible_command ();
@@ -5240,7 +5240,7 @@ Editor::set_fade_out_shape (AudioRegion::FadeShape shape)
                tmp->audio_region()->set_fade_out_shape (shape);
 
                XMLNode &after = alist->get_state();
-               session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
+               _session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
        }
 
        commit_reversible_command ();
@@ -5274,7 +5274,7 @@ Editor::set_fade_in_active (bool yn)
                ar->set_fade_in_active (yn);
 
                XMLNode &after = ar->get_state();
-               session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
+               _session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
        }
 
        commit_reversible_command ();
@@ -5307,7 +5307,7 @@ Editor::set_fade_out_active (bool yn)
                ar->set_fade_out_active (yn);
 
                XMLNode &after = ar->get_state();
-               session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
+               _session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
        }
 
        commit_reversible_command ();
@@ -5363,7 +5363,7 @@ Editor::toggle_selected_region_fades (int dir)
 void
 Editor::update_region_fade_visibility ()
 {
-       bool _fade_visibility = session->config.get_show_region_fades ();
+       bool _fade_visibility = _session->config.get_show_region_fades ();
 
        for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
                AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
@@ -5381,7 +5381,7 @@ Editor::update_region_fade_visibility ()
 void
 Editor::update_xfade_visibility ()
 {
-       _xfade_visibility = session->config.get_xfades_visible ();
+       _xfade_visibility = _session->config.get_xfades_visible ();
 
        for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
                AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
@@ -5426,7 +5426,7 @@ void
 Editor::set_playhead_cursor ()
 {
        if (entered_marker) {
-               session->request_locate (entered_marker->position(), session->transport_rolling());
+               _session->request_locate (entered_marker->position(), _session->transport_rolling());
        } else {
                nframes64_t where;
                bool ignored;
@@ -5437,8 +5437,8 @@ Editor::set_playhead_cursor ()
 
                snap_to (where);
 
-               if (session) {
-                       session->request_locate (where, session->transport_rolling());
+               if (_session) {
+                       _session->request_locate (where, _session->transport_rolling());
                }
        }
 }
@@ -5580,7 +5580,7 @@ Editor::ensure_track_visible(TimeAxisView *track)
 void
 Editor::set_loop_from_selection (bool play)
 {
-       if (session == 0 || selection->time.empty()) {
+       if (_session == 0 || selection->time.empty()) {
                return;
        }
 
@@ -5590,15 +5590,15 @@ Editor::set_loop_from_selection (bool play)
        set_loop_range (start, end,  _("set loop range from selection"));
 
        if (play) {
-               session->request_play_loop (true);
-               session->request_locate (start, true);
+               _session->request_play_loop (true);
+               _session->request_locate (start, true);
        }
 }
 
 void
 Editor::set_loop_from_edit_range (bool play)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -5612,8 +5612,8 @@ Editor::set_loop_from_edit_range (bool play)
        set_loop_range (start, end,  _("set loop range from edit range"));
 
        if (play) {
-               session->request_play_loop (true);
-               session->request_locate (start, true);
+               _session->request_play_loop (true);
+               _session->request_locate (start, true);
        }
 }
 
@@ -5643,15 +5643,15 @@ Editor::set_loop_from_region (bool play)
        set_loop_range (start, end, _("set loop range from region"));
 
        if (play) {
-               session->request_play_loop (true);
-               session->request_locate (start, true);
+               _session->request_play_loop (true);
+               _session->request_locate (start, true);
        }
 }
 
 void
 Editor::set_punch_from_selection ()
 {
-       if (session == 0 || selection->time.empty()) {
+       if (_session == 0 || selection->time.empty()) {
                return;
        }
 
@@ -5664,7 +5664,7 @@ Editor::set_punch_from_selection ()
 void
 Editor::set_punch_from_edit_range ()
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -5721,7 +5721,7 @@ Editor::pitch_shift_regions ()
 void
 Editor::use_region_as_bar ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -5752,7 +5752,7 @@ Editor::define_one_bar (nframes64_t start, nframes64_t end)
 {
        nframes64_t length = end - start;
 
-       const Meter& m (session->tempo_map().meter_at (start));
+       const Meter& m (_session->tempo_map().meter_at (start));
 
        /* length = 1 bar */
 
@@ -5764,7 +5764,7 @@ Editor::define_one_bar (nframes64_t start, nframes64_t end)
 
        /* beats per minute = */
 
-       double beats_per_minute = (session->frame_rate() * 60.0) / frames_per_beat;
+       double beats_per_minute = (_session->frame_rate() * 60.0) / frames_per_beat;
 
        /* now decide whether to:
 
@@ -5773,11 +5773,11 @@ Editor::define_one_bar (nframes64_t start, nframes64_t end)
 
        */
 
-       const TempoSection& t (session->tempo_map().tempo_section_at (start));
+       const TempoSection& t (_session->tempo_map().tempo_section_at (start));
 
        bool do_global = false;
 
-       if ((session->tempo_map().n_tempos() == 1) && (session->tempo_map().n_meters() == 1)) {
+       if ((_session->tempo_map().n_tempos() == 1) && (_session->tempo_map().n_meters() == 1)) {
 
                /* only 1 tempo & 1 meter: ask if the user wants to set the tempo
                   at the start, or create a new marker
@@ -5812,19 +5812,19 @@ Editor::define_one_bar (nframes64_t start, nframes64_t end)
        }
 
        begin_reversible_command (_("set tempo from region"));
-       XMLNode& before (session->tempo_map().get_state());
+       XMLNode& before (_session->tempo_map().get_state());
 
        if (do_global) {
-               session->tempo_map().change_initial_tempo (beats_per_minute, t.note_type());
+               _session->tempo_map().change_initial_tempo (beats_per_minute, t.note_type());
        } else if (t.frame() == start) {
-               session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type());
+               _session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type());
        } else {
-               session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), start);
+               _session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), start);
        }
 
-       XMLNode& after (session->tempo_map().get_state());
+       XMLNode& after (_session->tempo_map().get_state());
 
-       session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+       _session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
        commit_reversible_command ();
 }
 
@@ -5833,7 +5833,7 @@ Editor::split_region_at_transients ()
 {
        AnalysisFeatureList positions;
 
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -5845,7 +5845,7 @@ Editor::split_region_at_transients ()
                return;
        }
 
-       session->begin_reversible_command (_("split regions"));
+       _session->begin_reversible_command (_("split regions"));
 
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ) {
 
@@ -5864,7 +5864,7 @@ Editor::split_region_at_transients ()
                i = tmp;
        }
 
-       session->commit_reversible_command ();
+       _session->commit_reversible_command ();
 
 }
 
@@ -5963,7 +5963,7 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
 
                string new_name;
 
-               if (session->region_name (new_name, r->name())) {
+               if (_session->region_name (new_name, r->name())) {
                        break;
                }
 
@@ -5993,7 +5993,7 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
 
        XMLNode& after (pl->get_state());
 
-       session->add_command (new MementoCommand<Playlist>(*pl, &before, &after));
+       _session->add_command (new MementoCommand<Playlist>(*pl, &before, &after));
 }
 
 void
@@ -6001,11 +6001,11 @@ Editor::tab_to_transient (bool forward)
 {
        AnalysisFeatureList positions;
 
-       if (!session) {
+       if (!_session) {
                return;
        }
 
-       nframes64_t pos = session->audible_frame ();
+       nframes64_t pos = _session->audible_frame ();
 
        if (!selection->tracks.empty()) {
 
@@ -6043,7 +6043,7 @@ Editor::tab_to_transient (bool forward)
                }
        }
 
-       TransientDetector::cleanup_transients (positions, session->frame_rate(), 3.0);
+       TransientDetector::cleanup_transients (positions, _session->frame_rate(), 3.0);
 
        if (forward) {
                AnalysisFeatureList::iterator x;
@@ -6055,7 +6055,7 @@ Editor::tab_to_transient (bool forward)
                }
 
                if (x != positions.end ()) {
-                       session->request_locate (*x);
+                       _session->request_locate (*x);
                }
 
        } else {
@@ -6068,19 +6068,19 @@ Editor::tab_to_transient (bool forward)
                }
 
                if (x != positions.rend ()) {
-                       session->request_locate (*x);
+                       _session->request_locate (*x);
                }
        }
 }
 void
 Editor::playhead_forward_to_grid ()
 {
-       if (!session) return;
+       if (!_session) return;
        nframes64_t pos = playhead_cursor->current_frame;
        if (pos < max_frames - 1) {
                pos += 2;
                snap_to_internal (pos, 1, false);
-               session->request_locate (pos);
+               _session->request_locate (pos);
        }
 }
 
@@ -6088,12 +6088,12 @@ Editor::playhead_forward_to_grid ()
 void
 Editor::playhead_backward_to_grid ()
 {
-       if (!session) return;
+       if (!_session) return;
        nframes64_t pos = playhead_cursor->current_frame;
        if (pos > 2) {
                pos -= 2;
                snap_to_internal (pos, -1, false);
-               session->request_locate (pos);
+               _session->request_locate (pos);
        }
 }
 
@@ -6207,7 +6207,7 @@ Editor::remove_tracks ()
        }
 
        for (vector<boost::shared_ptr<Route> >::iterator x = routes.begin(); x != routes.end(); ++x) {
-               session->remove_route (*x);
+               _session->remove_route (*x);
        }
 }
 
@@ -6233,7 +6233,7 @@ Editor::do_insert_time ()
        table.attach (time_label, 0, 1, 0, 1, FILL | EXPAND);
        AudioClock clock ("insertTimeClock", true, X_("InsertTimeClock"), true, false, true, true);
        clock.set (0);
-       clock.set_session (session);
+       clock.set_session (_session);
        clock.set_bbt_reference (pos);
        table.attach (clock, 1, 2, 0, 1);
 
@@ -6317,7 +6317,7 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt,
 
                        XMLNode &after = pl->get_state();
 
-                       session->add_command (new MementoCommand<Playlist> (*pl, &before, &after));
+                       _session->add_command (new MementoCommand<Playlist> (*pl, &before, &after));
                        commit = true;
                }
 
@@ -6332,8 +6332,8 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt,
        /* markers */
        if (markers_too) {
                bool moved = false;
-               XMLNode& before (session->locations()->get_state());
-               Locations::LocationList copy (session->locations()->list());
+               XMLNode& before (_session->locations()->get_state());
+               Locations::LocationList copy (_session->locations()->list());
 
                for (Locations::LocationList::iterator i = copy.begin(); i != copy.end(); ++i) {
 
@@ -6349,13 +6349,13 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt,
                }
 
                if (moved) {
-                       XMLNode& after (session->locations()->get_state());
-                       session->add_command (new MementoCommand<Locations>(*session->locations(), &before, &after));
+                       XMLNode& after (_session->locations()->get_state());
+                       _session->add_command (new MementoCommand<Locations>(*_session->locations(), &before, &after));
                }
        }
 
        if (tempo_too) {
-               session->tempo_map().insert_time (pos, frames);
+               _session->tempo_map().insert_time (pos, frames);
        }
 
        if (commit) {
index 8aa6d94192977aa1727ddc411fa63b79137c50ba..2501f93726dcedef1f134cc59a586d9bafc230ec 100644 (file)
@@ -130,13 +130,15 @@ EditorRegions::EditorRegions (Editor* e)
 }
 
 void
-EditorRegions::connect_to_session (ARDOUR::Session* s)
+EditorRegions::set_session (ARDOUR::Session* s)
 {
-       EditorComponent::connect_to_session (s);
+       EditorComponent::set_session (s);
 
-       _session_connections.push_back (_session->RegionsAdded.connect (sigc::mem_fun(*this, &EditorRegions::handle_new_regions)));
-       _session_connections.push_back (_session->RegionRemoved.connect (sigc::mem_fun(*this, &EditorRegions::handle_region_removed)));
-       _session_connections.push_back (_session->RegionHiddenChange.connect (sigc::mem_fun(*this, &EditorRegions::region_hidden)));
+       if (_session) {
+               _session_connections.add_connection (_session->RegionsAdded.connect (boost::bind (&EditorRegions::handle_new_regions, this, _1)));
+               _session_connections.add_connection (_session->RegionRemoved.connect (boost::bind (&EditorRegions::handle_region_removed, this, _1)));
+               _session_connections.add_connection (_session->RegionHiddenChange.connect (boost::bind (&EditorRegions::region_hidden, this, _1)));
+       }
 
        redisplay ();
 }
index cc031b141ed46876503e5b8f84e37a1c66dbdd88..59659d3879ff604969c05f0e0d515bf798138094 100644 (file)
@@ -26,7 +26,7 @@ class EditorRegions : public EditorComponent
 public:
        EditorRegions (Editor *);
 
-       void connect_to_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
 
        Gtk::Widget& widget () {
                return _scroller;
index 10edec8682bd9bb4254528fbdd195fcafb923198..d0d0298c088c3521a68fea97cd1440550bfc900f 100644 (file)
@@ -604,7 +604,9 @@ EditorRouteGroups::groups_changed ()
                row[_columns.routegroup] = 0;
        }
 
-       _session->foreach_route_group (sigc::mem_fun (*this, &EditorRouteGroups::add));
+       if (_session) {
+               _session->foreach_route_group (sigc::mem_fun (*this, &EditorRouteGroups::add));
+       }
 }
 
 void
@@ -661,12 +663,14 @@ EditorRouteGroups::clear ()
 }
 
 void
-EditorRouteGroups::connect_to_session (Session* s)
+EditorRouteGroups::set_session (Session* s)
 {
-       EditorComponent::connect_to_session (s);
+       EditorComponent::set_session (s);
 
-       _session_connections.push_back (_session->route_group_added.connect (sigc::mem_fun (*this, &EditorRouteGroups::add)));
-       _session_connections.push_back (_session->route_group_removed.connect (sigc::mem_fun (*this, &EditorRouteGroups::groups_changed)));
+       if (_session) {
+               _session_connections.add_connection (_session->route_group_added.connect (boost::bind (&EditorRouteGroups::add, this, _1)));
+               _session_connections.add_connection (_session->route_group_removed.connect (boost::bind (&EditorRouteGroups::groups_changed, this)));
+       }
 
        groups_changed ();
 }
index b1b82fb531952592e7760aebec3a6774bf2431f4..5408649f9568bbc15ff250009c4a7da8c129986e 100644 (file)
@@ -24,7 +24,7 @@ class EditorRouteGroups : public EditorComponent
 public:
        EditorRouteGroups (Editor *);
 
-       void connect_to_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
 
        Gtk::Widget& widget () {
                return *_display_packer;
index de6b081fd423121d4434bd7a552289aab96f0395..e3a831a8b907543cc0cb59896163e6f992442f24 100644 (file)
@@ -150,17 +150,19 @@ EditorRoutes::EditorRoutes (Editor* e)
        _model->signal_rows_reordered().connect (sigc::mem_fun (*this, &EditorRoutes::reordered));
        _display.signal_button_press_event().connect (sigc::mem_fun (*this, &EditorRoutes::button_press), false);
 
-       Route::SyncOrderKeys.connect (sigc::mem_fun (*this, &EditorRoutes::sync_order_keys));
+       scoped_connect (Route::SyncOrderKeys, (sigc::mem_fun (*this, &EditorRoutes::sync_order_keys)));
 }
 
 void
-EditorRoutes::connect_to_session (Session* s)
+EditorRoutes::set_session (Session* s)
 {
-       EditorComponent::connect_to_session (s);
+       EditorComponent::set_session (s);
 
        initial_display ();
 
-       _session->SoloChanged.connect (sigc::mem_fun (*this, &EditorRoutes::solo_changed_so_update_mute));
+       if (_session) {
+               scoped_connect (_session->SoloChanged, (sigc::mem_fun (*this, &EditorRoutes::solo_changed_so_update_mute)));
+       }
 }
 
 void
@@ -260,15 +262,15 @@ EditorRoutes::show_menu ()
 void
 EditorRoutes::redisplay ()
 {
+       if (_no_redisplay || !_session) {
+               return;
+       }
+
        TreeModel::Children rows = _model->children();
        TreeModel::Children::iterator i;
        uint32_t position;
        int n;
 
-       if (_no_redisplay) {
-               return;
-       }
-
        for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
                TimeAxisView *tv = (*i)[_columns.tv];
                boost::shared_ptr<Route> route = (*i)[_columns.route];
@@ -380,18 +382,19 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
                _ignore_reorder = false;
 
                boost::weak_ptr<Route> wr ((*x)->route());
-               (*x)->route()->gui_changed.connect (sigc::mem_fun (*this, &EditorRoutes::handle_gui_changes));
-               (*x)->route()->NameChanged.connect (sigc::bind (sigc::mem_fun (*this, &EditorRoutes::route_name_changed), wr));
-               (*x)->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &EditorRoutes::route_removed), *x));
+
+               scoped_connect ((*x)->route()->gui_changed, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2));
+               scoped_connect ((*x)->route()->NameChanged, boost::bind (&EditorRoutes::route_name_changed, this, wr));
+               scoped_connect ((*x)->GoingAway, boost::bind (&EditorRoutes::route_removed, this, *x));
 
                if ((*x)->is_track()) {
                        boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> ((*x)->route());
-                       t->diskstream()->RecordEnableChanged.connect (sigc::mem_fun (*this, &EditorRoutes::update_rec_display));
+                       scoped_connect (t->diskstream()->RecordEnableChanged, boost::bind (&EditorRoutes::update_rec_display, this));
                }
 
-               (*x)->route()->mute_changed.connect (sigc::mem_fun (*this, &EditorRoutes::update_mute_display));
-               (*x)->route()->solo_changed.connect (sigc::mem_fun (*this, &EditorRoutes::update_solo_display));
-               (*x)->route()->solo_isolated_changed.connect (sigc::mem_fun (*this, &EditorRoutes::update_solo_isolate_display));
+               scoped_connect ((*x)->route()->mute_changed, boost::bind (&EditorRoutes::update_mute_display, this));
+               scoped_connect ((*x)->route()->solo_changed, boost::bind (&EditorRoutes::update_solo_display, this));
+               scoped_connect ((*x)->route()->solo_isolated_changed, boost::bind (&EditorRoutes::update_solo_isolate_display, this));
        }
 
        update_rec_display ();
@@ -710,15 +713,19 @@ struct EditorOrderRouteSorter {
 void
 EditorRoutes::initial_display ()
 {
+       suspend_redisplay ();
+       _model->clear ();
+
+       if (!_session) {
+               resume_redisplay ();
+               return;
+       }
+
        boost::shared_ptr<RouteList> routes = _session->get_routes();
        RouteList r (*routes);
        EditorOrderRouteSorter sorter;
 
        r.sort (sorter);
-
-       suspend_redisplay ();
-
-       _model->clear ();
        _editor->handle_new_route (r);
 
        /* don't show master bus in a new session */
@@ -900,19 +907,19 @@ EditorRoutes::update_rec_display ()
 }
 
 void
-EditorRoutes::update_mute_display (void* /*src*/)
+EditorRoutes::update_mute_display ()
 {
        TreeModel::Children rows = _model->children();
        TreeModel::Children::iterator i;
 
        for (i = rows.begin(); i != rows.end(); ++i) {
                boost::shared_ptr<Route> route = (*i)[_columns.route];
-               (*i)[_columns.mute_state] = RouteUI::mute_visual_state (*_session, route) > 0 ? 1 : 0;
+               (*i)[_columns.mute_state] = RouteUI::mute_visual_state (_session, route) > 0 ? 1 : 0;
        }
 }
 
 void
-EditorRoutes::update_solo_display (void* /*src*/)
+EditorRoutes::update_solo_display ()
 {
        TreeModel::Children rows = _model->children();
        TreeModel::Children::iterator i;
@@ -924,7 +931,7 @@ EditorRoutes::update_solo_display (void* /*src*/)
 }
 
 void
-EditorRoutes::update_solo_isolate_display (void* /*src*/)
+EditorRoutes::update_solo_isolate_display ()
 {
        TreeModel::Children rows = _model->children();
        TreeModel::Children::iterator i;
@@ -973,8 +980,7 @@ void
 EditorRoutes::solo_changed_so_update_mute ()
 {
        ENSURE_GUI_THREAD (*this, &EditorRoutes::solo_changed_so_update_mute)
-
-       update_mute_display (this);
+       update_mute_display ();
 }
 
 void
index 756796dbda67e23e708174f0c46f0de702bf3abd..23e1e9338894fcf67a61b93108c6d0d6f754a1e1 100644 (file)
 
 */
 
-class EditorRoutes : public EditorComponent
+#ifndef __ardour_gtk_editor_route_h__
+#define __ardour_gtk_editor_route_h__
+
+#include "pbd/scoped_connections.h"
+#include "editor_component.h"
+
+class EditorRoutes : public EditorComponent, public PBD::ScopedConnectionList
 {
 public:
        EditorRoutes (Editor *);
 
-       void connect_to_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
 
        Gtk::Widget& widget () {
                return _scroller;
@@ -66,9 +72,9 @@ private:
        void route_removed (TimeAxisView *);
        void handle_gui_changes (std::string const &, void *);
        void update_rec_display ();
-       void update_mute_display (void* /*src*/);
-       void update_solo_display (void* /*src*/);
-       void update_solo_isolate_display (void* /*src*/);
+       void update_mute_display ();
+       void update_solo_display ();
+       void update_solo_isolate_display ();
        void set_all_tracks_visibility (bool);
        void set_all_audio_visibility (int, bool);
        void show_all_routes ();
@@ -126,3 +132,5 @@ private:
        
        Gtk::Menu* _menu;
 };
+
+#endif /* __ardour_gtk_editor_route_h__ */
index be806eb36620c5a52bb349ea117b60face61b710..880b6812b56afaf859a849c1a2db581a22ffe10c 100644 (file)
@@ -215,7 +215,7 @@ Editor::ruler_scroll (GdkEventScroll* event)
 gint
 Editor::ruler_button_press (GdkEventButton* ev)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return FALSE;
        }
 
@@ -241,8 +241,8 @@ Editor::ruler_button_press (GdkEventButton* ev)
        if (ev->button == 1) {
                // Since we will locate the playhead on button release, cancel any running
                // auditions.
-               if (session->is_auditioning()) {
-                       session->cancel_audition ();
+               if (_session->is_auditioning()) {
+                       _session->cancel_audition ();
                }
 
                /* playhead cursor */
@@ -258,7 +258,7 @@ Editor::ruler_button_press (GdkEventButton* ev)
 gint
 Editor::ruler_button_release (GdkEventButton* ev)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return FALSE;
        }
 
@@ -308,7 +308,7 @@ Editor::ruler_label_button_release (GdkEventButton* ev)
 gint
 Editor::ruler_mouse_motion (GdkEventMotion* ev)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return FALSE;
        }
 
@@ -443,15 +443,15 @@ Editor::store_ruler_visibility ()
        node->add_property (X_("transportmarker"), ruler_loop_punch_action->get_active() ? "yes": "no");
        node->add_property (X_("cdmarker"), ruler_cd_marker_action->get_active() ? "yes": "no");
 
-       session->add_extra_xml (*node);
-       session->set_dirty ();
+       _session->add_extra_xml (*node);
+       _session->set_dirty ();
 }
 
 void
 Editor::restore_ruler_visibility ()
 {
        XMLProperty* prop;
-       XMLNode * node = session->extra_xml (X_("RulerVisibility"));
+       XMLNode * node = _session->extra_xml (X_("RulerVisibility"));
 
        no_ruler_shown_update = true;
 
@@ -529,11 +529,11 @@ Editor::restore_ruler_visibility ()
                        }
 
                } else {
-                       // this session doesn't yet know about the cdmarker ruler
+                       // this _session doesn't yet know about the cdmarker ruler
                        // as a benefit to the user who doesn't know the feature exists, show the ruler if
                        // any cd marks exist
                        ruler_cd_marker_action->set_active (false);
-                       const Locations::LocationList & locs = session->locations()->list();
+                       const Locations::LocationList & locs = _session->locations()->list();
                        for (Locations::LocationList::const_iterator i = locs.begin(); i != locs.end(); ++i) {
                                if ((*i)->is_cd_marker()) {
                                        ruler_cd_marker_action->set_active (true);
@@ -774,7 +774,7 @@ Editor::update_just_timecode ()
 {
        ENSURE_GUI_THREAD (*this, &Editor::update_just_timecode)
 
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -782,14 +782,14 @@ Editor::update_just_timecode ()
 
        if (ruler_timecode_action->get_active()) {
                gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame,
-                                           leftmost_frame, session->current_end_frame());
+                                           leftmost_frame, _session->current_end_frame());
        }
 }
 
 void
 Editor::compute_fixed_ruler_scale ()
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -807,7 +807,7 @@ Editor::update_fixed_rulers ()
 {
        nframes64_t rightmost_frame;
 
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -823,24 +823,24 @@ Editor::update_fixed_rulers ()
 
        if (ruler_timecode_action->get_active()) {
                gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame,
-                                           leftmost_frame, session->current_end_frame());
+                                           leftmost_frame, _session->current_end_frame());
        }
 
        if (ruler_samples_action->get_active()) {
                gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_frames_ruler), leftmost_frame, rightmost_frame,
-                                           leftmost_frame, session->current_end_frame());
+                                           leftmost_frame, _session->current_end_frame());
        }
 
        if (ruler_minsec_action->get_active()) {
                gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_minsec_ruler), leftmost_frame, rightmost_frame,
-                                           leftmost_frame, session->current_end_frame());
+                                           leftmost_frame, _session->current_end_frame());
        }
 }
 
 void
 Editor::update_tempo_based_rulers ()
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
@@ -848,7 +848,7 @@ Editor::update_tempo_based_rulers ()
 
        if (ruler_bbt_action->get_active()) {
                gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+current_page_frames(),
-                                           leftmost_frame, session->current_end_frame());
+                                           leftmost_frame, _session->current_end_frame());
        }
 }
 
@@ -885,11 +885,11 @@ Editor::set_timecode_ruler_scale (gdouble lower, gdouble upper)
        nframes64_t spacer;
        nframes64_t fr;
 
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
-       fr = session->frame_rate();
+       fr = _session->frame_rate();
 
        if (lower > (spacer = (nframes64_t)(128 * Editor::get_current_zoom ()))) {
                lower = lower - spacer;
@@ -899,26 +899,26 @@ Editor::set_timecode_ruler_scale (gdouble lower, gdouble upper)
        upper = upper + spacer;
        range = (nframes64_t) floor (upper - lower);
 
-       if (range < (2 * session->frames_per_timecode_frame())) { /* 0 - 2 frames */
+       if (range < (2 * _session->frames_per_timecode_frame())) { /* 0 - 2 frames */
                timecode_ruler_scale = timecode_show_bits;
                timecode_mark_modulo = 20;
-               timecode_nmarks = 2 + (2 * session->config.get_subframes_per_frame());
+               timecode_nmarks = 2 + (2 * _session->config.get_subframes_per_frame());
        } else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */
                timecode_ruler_scale = timecode_show_frames;
                timecode_mark_modulo = 1;
-               timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
+               timecode_nmarks = 2 + (range / (nframes64_t)_session->frames_per_timecode_frame());
        } else if (range <= (fr / 2)) { /* 0.25-0.5 second */
                timecode_ruler_scale = timecode_show_frames;
                timecode_mark_modulo = 2;
-               timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
+               timecode_nmarks = 2 + (range / (nframes64_t)_session->frames_per_timecode_frame());
        } else if (range <= fr) { /* 0.5-1 second */
                timecode_ruler_scale = timecode_show_frames;
                timecode_mark_modulo = 5;
-               timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
+               timecode_nmarks = 2 + (range / (nframes64_t)_session->frames_per_timecode_frame());
        } else if (range <= 2 * fr) { /* 1-2 seconds */
                timecode_ruler_scale = timecode_show_frames;
                timecode_mark_modulo = 10;
-               timecode_nmarks = 2 + (range / (nframes64_t)session->frames_per_timecode_frame());
+               timecode_nmarks = 2 + (range / (nframes64_t)_session->frames_per_timecode_frame());
        } else if (range <= 8 * fr) { /* 2-8 seconds */
                timecode_ruler_scale = timecode_show_seconds;
                timecode_mark_modulo = 1;
@@ -987,7 +987,7 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble
        gchar buf[16];
        gint n;
 
-       if (session == 0) {
+       if (_session == 0) {
                return 0;
        }
 
@@ -1004,10 +1004,10 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble
        case timecode_show_bits:
 
                // Find timecode time of this sample (pos) with subframe accuracy
-               session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */ );
+               _session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */ );
 
                for (n = 0; n < timecode_nmarks; n++) {
-                       session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */ );
+                       _session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */ );
                        if ((timecode.subframes % timecode_mark_modulo) == 0) {
                                if (timecode.subframes == 0) {
                                        (*marks)[n].style = GtkCustomRulerMarkMajor;
@@ -1025,17 +1025,17 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble
                        (*marks)[n].position = pos;
 
                        // Increment subframes by one
-                       Timecode::increment_subframes( timecode, session->config.get_subframes_per_frame() );
+                       Timecode::increment_subframes( timecode, _session->config.get_subframes_per_frame() );
                }
          break;
        case timecode_show_seconds:
                // Find timecode time of this sample (pos)
-               session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
                // Go to next whole second down
                Timecode::seconds_floor( timecode );
 
                for (n = 0; n < timecode_nmarks; n++) {
-                       session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
+                       _session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
                        if ((timecode.seconds % timecode_mark_modulo) == 0) {
                                if (timecode.seconds == 0) {
                                        (*marks)[n].style = GtkCustomRulerMarkMajor;
@@ -1052,17 +1052,17 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble
 
                        }
                        (*marks)[n].label = g_strdup (buf);
-                       Timecode::increment_seconds( timecode, session->config.get_subframes_per_frame() );
+                       Timecode::increment_seconds( timecode, _session->config.get_subframes_per_frame() );
                }
          break;
        case timecode_show_minutes:
                // Find timecode time of this sample (pos)
-               session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
                // Go to next whole minute down
                Timecode::minutes_floor( timecode );
 
                for (n = 0; n < timecode_nmarks; n++) {
-                       session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
+                       _session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
                        if ((timecode.minutes % timecode_mark_modulo) == 0) {
                                if (timecode.minutes == 0) {
                                        (*marks)[n].style = GtkCustomRulerMarkMajor;
@@ -1077,18 +1077,18 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble
                        }
                        (*marks)[n].label = g_strdup (buf);
                        (*marks)[n].position = pos;
-                       Timecode::increment_minutes( timecode, session->config.get_subframes_per_frame() );
+                       Timecode::increment_minutes( timecode, _session->config.get_subframes_per_frame() );
                }
 
          break;
        case timecode_show_hours:
                // Find timecode time of this sample (pos)
-               session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
                // Go to next whole hour down
                Timecode::hours_floor( timecode );
 
                for (n = 0; n < timecode_nmarks; n++) {
-                       session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
+                       _session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
                        if ((timecode.hours % timecode_mark_modulo) == 0) {
                                (*marks)[n].style = GtkCustomRulerMarkMajor;
                                snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
@@ -1100,17 +1100,17 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble
                        (*marks)[n].label = g_strdup (buf);
                        (*marks)[n].position = pos;
 
-                       Timecode::increment_hours( timecode, session->config.get_subframes_per_frame() );
+                       Timecode::increment_hours( timecode, _session->config.get_subframes_per_frame() );
                }
          break;
        case timecode_show_frames:
                // Find timecode time of this sample (pos)
-               session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
                // Go to next whole frame down
                Timecode::frames_floor( timecode );
 
                for (n = 0; n < timecode_nmarks; n++) {
-                       session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
+                       _session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
                        if ((timecode.frames % timecode_mark_modulo) == 0)  {
                                if (timecode.frames == 0) {
                                  (*marks)[n].style = GtkCustomRulerMarkMajor;
@@ -1126,7 +1126,7 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble
 
                        }
                        (*marks)[n].label = g_strdup (buf);
-                       Timecode::increment( timecode, session->config.get_subframes_per_frame() );
+                       Timecode::increment( timecode, _session->config.get_subframes_per_frame() );
                }
 
          break;
@@ -1139,14 +1139,14 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble
 void
 Editor::compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper)
 {
-        if (session == 0) {
+        if (_session == 0) {
                 return;
         }
        TempoMap::BBTPointList::iterator i;
         BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler
 
-        session->bbt_time((jack_nframes_t) lower, lower_beat);
-        session->bbt_time((jack_nframes_t) upper, upper_beat);
+        _session->bbt_time((jack_nframes_t) lower, lower_beat);
+        _session->bbt_time((jack_nframes_t) upper, upper_beat);
         uint32_t beats = 0;
 
        bbt_accent_modulo = 1;
@@ -1224,7 +1224,7 @@ Editor::compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper)
 gint
 Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
 {
-        if (session == 0) {
+        if (_session == 0) {
                 return 0;
         }
 
@@ -1341,9 +1341,9 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                                  next_beat.beats = 1;
                        }
 
-                       next_beat_pos = session->tempo_map().frame_time(next_beat);
+                       next_beat_pos = _session->tempo_map().frame_time(next_beat);
 
-                       frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() *  60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
+                       frame_skip = (nframes64_t) floor (frame_skip_error = (_session->frame_rate() *  60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
                        frame_skip_error -= frame_skip;
                        skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision);
 
@@ -1433,9 +1433,9 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                                  next_beat.beats = 1;
                        }
 
-                       next_beat_pos = session->tempo_map().frame_time(next_beat);
+                       next_beat_pos = _session->tempo_map().frame_time(next_beat);
 
-                       frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() *  60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
+                       frame_skip = (nframes64_t) floor (frame_skip_error = (_session->frame_rate() *  60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
                        frame_skip_error -= frame_skip;
                        skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision);
 
@@ -1530,9 +1530,9 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
                                  next_beat.beats = 1;
                        }
 
-                       next_beat_pos = session->tempo_map().frame_time(next_beat);
+                       next_beat_pos = _session->tempo_map().frame_time(next_beat);
 
-                       frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() *  60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
+                       frame_skip = (nframes64_t) floor (frame_skip_error = (_session->frame_rate() *  60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
                        frame_skip_error -= frame_skip;
                        skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision);
 
@@ -1704,15 +1704,15 @@ Editor::metric_get_frames (GtkCustomRulerMark **marks, gdouble lower, gdouble up
        gint nmarks;
        gint n;
 
-       if (session == 0) {
+       if (_session == 0) {
                return 0;
        }
 
        mark_interval = (iupper - ilower) / 5;
-       if (mark_interval > session->frame_rate()) {
-               mark_interval -= mark_interval % session->frame_rate();
+       if (mark_interval > _session->frame_rate()) {
+               mark_interval -= mark_interval % _session->frame_rate();
        } else {
-               mark_interval = session->frame_rate() / (session->frame_rate() / mark_interval ) ;
+               mark_interval = _session->frame_rate() / (_session->frame_rate() / mark_interval ) ;
        }
        nmarks = 5;
        *marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
@@ -1765,11 +1765,11 @@ Editor::set_minsec_ruler_scale (gdouble lower, gdouble upper)
        nframes64_t fr;
        nframes64_t spacer;
 
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
-       fr = session->frame_rate();
+       fr = _session->frame_rate();
 
        /* to prevent 'flashing' */
        if (lower > (spacer = (nframes64_t)(128 * Editor::get_current_zoom ()))) {
@@ -1866,7 +1866,7 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble /*
        gchar buf[16];
        gint n;
 
-       if (session == 0) {
+       if (_session == 0) {
                return 0;
        }
 
@@ -1882,7 +1882,7 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble /*
        switch (minsec_ruler_scale) {
        case minsec_show_seconds:
                for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
-                       sample_to_clock_parts (pos, session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+                       sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
                        if (secs % minsec_mark_modulo == 0) {
                                if (secs == 0) {
                                        (*marks)[n].style = GtkCustomRulerMarkMajor;
@@ -1900,7 +1900,7 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble /*
          break;
        case minsec_show_minutes:
                for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
-                        sample_to_clock_parts (pos, session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+                        sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
                         if (mins % minsec_mark_modulo == 0) {
                                 if (mins == 0) {
                                         (*marks)[n].style = GtkCustomRulerMarkMajor;
@@ -1918,7 +1918,7 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble /*
          break;
        case minsec_show_hours:
                 for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
-                        sample_to_clock_parts (pos, session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+                        sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
                         if (hrs % minsec_mark_modulo == 0) {
                                 (*marks)[n].style = GtkCustomRulerMarkMajor;
                                 snprintf (buf, sizeof(buf), "%02ld:%02ld:%02ld.%03ld", hrs, mins, secs, millisecs);
@@ -1932,7 +1932,7 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble /*
              break;
        case minsec_show_frames:
                for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
-                       sample_to_clock_parts (pos, session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+                       sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
                        if (millisecs % minsec_mark_modulo == 0) {
                                if (secs == 0) {
                                        (*marks)[n].style = GtkCustomRulerMarkMajor;
index 59c020feae18bd47c0b7e30336408594ccd1e523..4e66847ba2fd40609a1c39d0341ac61047b85dbb 100644 (file)
@@ -1037,7 +1037,7 @@ Editor::set_selection_from_punch()
 {
        Location* location;
 
-       if ((location = session->locations()->auto_punch_location()) == 0)  {
+       if ((location = _session->locations()->auto_punch_location()) == 0)  {
                return;
        }
 
@@ -1049,7 +1049,7 @@ Editor::set_selection_from_loop()
 {
        Location* location;
 
-       if ((location = session->locations()->auto_loop_location()) == 0)  {
+       if ((location = _session->locations()->auto_loop_location()) == 0)  {
                return;
        }
        set_selection_from_range (*location);
@@ -1107,7 +1107,7 @@ Editor::select_all_selectables_using_time_selection ()
 void
 Editor::select_all_selectables_using_punch()
 {
-       Location* location = session->locations()->auto_punch_location();
+       Location* location = _session->locations()->auto_punch_location();
        list<Selectable *> touched;
 
        if (location == 0 || (location->end() - location->start() <= 1))  {
@@ -1138,7 +1138,7 @@ Editor::select_all_selectables_using_punch()
 void
 Editor::select_all_selectables_using_loop()
 {
-       Location* location = session->locations()->auto_loop_location();
+       Location* location = _session->locations()->auto_loop_location();
        list<Selectable *> touched;
 
        if (location == 0 || (location->end() - location->start() <= 1))  {
@@ -1176,7 +1176,7 @@ Editor::select_all_selectables_using_cursor (EditorCursor *cursor, bool after)
        if (after) {
                begin_reversible_command (_("select all after cursor"));
                start = cursor->current_frame ;
-               end = session->current_end_frame();
+               end = _session->current_end_frame();
        } else {
                if (cursor->current_frame > 0) {
                        begin_reversible_command (_("select all before cursor"));
@@ -1216,7 +1216,7 @@ Editor::select_all_selectables_using_edit (bool after)
        if (after) {
                begin_reversible_command (_("select all after edit"));
                start = get_preferred_edit_position();
-               end = session->current_end_frame();
+               end = _session->current_end_frame();
        } else {
                if ((end = get_preferred_edit_position()) > 1) {
                        begin_reversible_command (_("select all before edit"));
@@ -1314,7 +1314,7 @@ Editor::get_edit_op_range (nframes64_t& start, nframes64_t& end) const
                }
 
                start = selection->markers.front()->position();
-               end = session->audible_frame();
+               end = _session->audible_frame();
 
        } else {
 
@@ -1323,10 +1323,10 @@ Editor::get_edit_op_range (nframes64_t& start, nframes64_t& end) const
                        if (selection->markers.empty()) {
                                /* use mouse + playhead */
                                start = m;
-                               end = session->audible_frame();
+                               end = _session->audible_frame();
                        } else {
                                /* use playhead + selected marker */
-                               start = session->audible_frame();
+                               start = _session->audible_frame();
                                end = selection->markers.front()->position();
                        }
                        break;
@@ -1335,7 +1335,7 @@ Editor::get_edit_op_range (nframes64_t& start, nframes64_t& end) const
                        /* use mouse + selected marker */
                        if (selection->markers.empty()) {
                                start = m;
-                               end = session->audible_frame();
+                               end = _session->audible_frame();
                        } else {
                                start = selection->markers.front()->position();
                                end = m;
index 8b544508d70d0541ea1de3bbb4d463655a4c12cf..795ba425ea142f59a34cd850cd2fe2f15e25a98e 100644 (file)
@@ -52,9 +52,9 @@ EditorSnapshots::EditorSnapshots (Editor* e)
 }
 
 void
-EditorSnapshots::connect_to_session (Session* s)
+EditorSnapshots::set_session (Session* s)
 {
-       EditorComponent::connect_to_session (s);
+       EditorComponent::set_session (s);
 
        redisplay ();
 }
index 1a17e6de3016931a8379e9e578f330bb16f0399e..5563778aa5f3af69596b9cc72a1aeaeafb6c78f4 100644 (file)
@@ -28,7 +28,7 @@ class EditorSnapshots : public EditorComponent
 public:
        EditorSnapshots (Editor *);
 
-       void connect_to_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
 
        Gtk::Widget& widget () {
                return _scroller;
index d257889682eecae13a67b9fcf7fc31ea80ecb7d6..b0021506227b5967b5c7e956c3ee567ae0523237 100644 (file)
@@ -54,15 +54,18 @@ EditorSummary::EditorSummary (Editor* e)
  *  @param s Session.
  */
 void
-EditorSummary::connect_to_session (Session* s)
+EditorSummary::set_session (Session* s)
 {
-       EditorComponent::connect_to_session (s);
+       EditorComponent::set_session (s);
 
        Region::RegionPropertyChanged.connect (sigc::hide (sigc::mem_fun (*this, &EditorSummary::set_dirty)));
 
-       _session_connections.push_back (_session->RegionRemoved.connect (sigc::hide (sigc::mem_fun (*this, &EditorSummary::set_dirty))));
-       _session_connections.push_back (_session->StartTimeChanged.connect (sigc::mem_fun (*this, &EditorSummary::set_dirty)));
-       _session_connections.push_back (_session->EndTimeChanged.connect (sigc::mem_fun (*this, &EditorSummary::set_dirty)));
+       if (_session) {
+               _session_connections.add_connection (_session->RegionRemoved.connect (boost::bind (&EditorSummary::set_dirty, this)));
+               _session_connections.add_connection (_session->StartTimeChanged.connect (boost::bind (&EditorSummary::set_dirty, this)));
+               _session_connections.add_connection (_session->EndTimeChanged.connect (boost::bind (&EditorSummary::set_dirty, this)));
+       }
+
        _editor->playhead_cursor->PositionChanged.connect (sigc::mem_fun (*this, &EditorSummary::playhead_position_changed));
 
        set_dirty ();
index e52e24cd99f54ba79ca94b3dd723553204bbf2b3..9d9763996e293d6d8c31f9630aac4541351c8770 100644 (file)
@@ -37,7 +37,7 @@ class EditorSummary : public CairoWidget, public EditorComponent
 public:
        EditorSummary (Editor *);
 
-       void connect_to_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
        void set_overlays_dirty ();
 
 private:
index 7fecf61be35a00e9916e62ed9245e85a22b5be09..438f18b91e6c5264b4d453cb77d5a0b8c2308900 100644 (file)
@@ -95,7 +95,7 @@ Editor::draw_metric_marks (const Metrics& metrics)
 void
 Editor::tempo_map_changed (Change ignored)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -105,14 +105,14 @@ Editor::tempo_map_changed (Change ignored)
                tempo_lines->tempo_map_changed();
 
        compute_current_bbt_points(leftmost_frame, leftmost_frame + current_page_frames());
-       session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
+       _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
        redraw_measures ();
 }
 
 void
 Editor::redisplay_tempo (bool immediate_redraw)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -134,14 +134,14 @@ Editor::redisplay_tempo (bool immediate_redraw)
 void
 Editor::compute_current_bbt_points (nframes_t leftmost, nframes_t rightmost)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
        BBT_Time previous_beat, next_beat; // the beats previous to the leftmost frame and after the rightmost frame
 
-       session->bbt_time(leftmost, previous_beat);
-       session->bbt_time(rightmost, next_beat);
+       _session->bbt_time(leftmost, previous_beat);
+       _session->bbt_time(rightmost, next_beat);
 
        if (previous_beat.beats > 1) {
                previous_beat.beats -= 1;
@@ -151,7 +151,7 @@ Editor::compute_current_bbt_points (nframes_t leftmost, nframes_t rightmost)
        }
        previous_beat.ticks = 0;
 
-       if (session->tempo_map().meter_at(rightmost).beats_per_bar () > next_beat.beats + 1) {
+       if (_session->tempo_map().meter_at(rightmost).beats_per_bar () > next_beat.beats + 1) {
                next_beat.beats += 1;
        } else {
                next_beat.bars += 1;
@@ -162,7 +162,7 @@ Editor::compute_current_bbt_points (nframes_t leftmost, nframes_t rightmost)
        delete current_bbt_points;
        current_bbt_points = 0;
 
-       current_bbt_points = session->tempo_map().get_points (session->tempo_map().frame_time (previous_beat), session->tempo_map().frame_time (next_beat) + 1);
+       current_bbt_points = _session->tempo_map().get_points (_session->tempo_map().frame_time (previous_beat), _session->tempo_map().frame_time (next_beat) + 1);
 }
 
 void
@@ -182,7 +182,7 @@ Editor::redraw_measures ()
 void
 Editor::draw_measures ()
 {
-       if (session == 0 || _show_measures == false ||
+       if (_session == 0 || _show_measures == false ||
            !current_bbt_points || current_bbt_points->empty()) {
                return;
        }
@@ -197,11 +197,11 @@ Editor::draw_measures ()
 void
 Editor::mouse_add_new_tempo_event (nframes64_t frame)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
-       TempoMap& map(session->tempo_map());
+       TempoMap& map(_session->tempo_map());
        TempoDialog tempo_dialog (map, frame, _("add"));
 
        tempo_dialog.set_position (Gtk::WIN_POS_MOUSE);
@@ -230,7 +230,7 @@ Editor::mouse_add_new_tempo_event (nframes64_t frame)
         XMLNode &before = map.get_state();
        map.add_tempo (Tempo (bpm,nt), requested);
         XMLNode &after = map.get_state();
-       session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
+       _session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
        commit_reversible_command ();
 
        //map.dump (cerr);
@@ -239,12 +239,12 @@ Editor::mouse_add_new_tempo_event (nframes64_t frame)
 void
 Editor::mouse_add_new_meter_event (nframes64_t frame)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return;
        }
 
 
-       TempoMap& map(session->tempo_map());
+       TempoMap& map(_session->tempo_map());
        MeterDialog meter_dialog (map, frame, _("add"));
 
        meter_dialog.set_position (Gtk::WIN_POS_MOUSE);
@@ -272,7 +272,7 @@ Editor::mouse_add_new_meter_event (nframes64_t frame)
        begin_reversible_command (_("add meter mark"));
         XMLNode &before = map.get_state();
        map.add_meter (Meter (bpb, note_type), requested);
-       session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state()));
+       _session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state()));
        commit_reversible_command ();
 
        //map.dump (cerr);
@@ -321,10 +321,10 @@ Editor::edit_meter_section (MeterSection* section)
        double note_type = meter_dialog.get_note_type ();
 
        begin_reversible_command (_("replace tempo mark"));
-        XMLNode &before = session->tempo_map().get_state();
-       session->tempo_map().replace_meter (*section, Meter (bpb, note_type));
-        XMLNode &after = session->tempo_map().get_state();
-       session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+        XMLNode &before = _session->tempo_map().get_state();
+       _session->tempo_map().replace_meter (*section, Meter (bpb, note_type));
+        XMLNode &after = _session->tempo_map().get_state();
+       _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
        commit_reversible_command ();
 }
 
@@ -351,15 +351,15 @@ Editor::edit_tempo_section (TempoSection* section)
        bpm = max (0.01, bpm);
 
        cerr << "Editing tempo section to be at " << when << endl;
-       session->tempo_map().dump (cerr);
+       _session->tempo_map().dump (cerr);
        begin_reversible_command (_("replace tempo mark"));
-       XMLNode &before = session->tempo_map().get_state();
-       session->tempo_map().replace_tempo (*section, Tempo (bpm,nt));
-       session->tempo_map().dump (cerr);
-       session->tempo_map().move_tempo (*section, when);
-       session->tempo_map().dump (cerr);
-       XMLNode &after = session->tempo_map().get_state();
-       session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+       XMLNode &before = _session->tempo_map().get_state();
+       _session->tempo_map().replace_tempo (*section, Tempo (bpm,nt));
+       _session->tempo_map().dump (cerr);
+       _session->tempo_map().move_tempo (*section, when);
+       _session->tempo_map().dump (cerr);
+       XMLNode &after = _session->tempo_map().get_state();
+       _session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
        commit_reversible_command ();
 }
 
@@ -405,10 +405,10 @@ gint
 Editor::real_remove_tempo_marker (TempoSection *section)
 {
        begin_reversible_command (_("remove tempo mark"));
-       XMLNode &before = session->tempo_map().get_state();
-       session->tempo_map().remove_tempo (*section);
-       XMLNode &after = session->tempo_map().get_state();
-       session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+       XMLNode &before = _session->tempo_map().get_state();
+       _session->tempo_map().remove_tempo (*section);
+       XMLNode &after = _session->tempo_map().get_state();
+       _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
        commit_reversible_command ();
 
        return FALSE;
@@ -439,10 +439,10 @@ gint
 Editor::real_remove_meter_marker (MeterSection *section)
 {
        begin_reversible_command (_("remove tempo mark"));
-       XMLNode &before = session->tempo_map().get_state();
-       session->tempo_map().remove_meter (*section);
-       XMLNode &after = session->tempo_map().get_state();
-       session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
+       XMLNode &before = _session->tempo_map().get_state();
+       _session->tempo_map().remove_meter (*section);
+       XMLNode &after = _session->tempo_map().get_state();
+       _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
        commit_reversible_command ();
 
        return FALSE;
index 8538c7b8b3c79548a68e7188399357aefca6847e..aab6b676585a9ff54743a165e4bc5497bdad9bb0 100644 (file)
@@ -77,14 +77,14 @@ Editor::time_stretch (RegionSelection& regions, float fraction)
 
            ARDOUR::TimeFXRequest request;
                request.time_fraction = fraction;
-               MidiStretch stretch(*session, request);
+               MidiStretch stretch(*_session, request);
                begin_reversible_command ("midi stretch");
                stretch.run(regions.front()->region());
                XMLNode &before = playlist->get_state();
                playlist->replace_region (regions.front()->region(), stretch.results[0],
                                regions.front()->region()->position());
                XMLNode &after = playlist->get_state();
-               session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+               _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
                commit_reversible_command ();
        }
 
@@ -291,12 +291,12 @@ Editor::do_timefx (TimeFXDialog& dialog)
                Filter* fx;
 
                if (dialog.pitching) {
-                       fx = new Pitch (*session, dialog.request);
+                       fx = new Pitch (*_session, dialog.request);
                } else {
 #ifdef USE_RUBBERBAND
-                       fx = new RBStretch (*session, dialog.request);
+                       fx = new RBStretch (*_session, dialog.request);
 #else
-                       fx = new STStretch (*session, dialog.request);
+                       fx = new STStretch (*_session, dialog.request);
 #endif
                }
 
@@ -311,14 +311,14 @@ Editor::do_timefx (TimeFXDialog& dialog)
                        new_region = fx->results.front();
 
                        if (!in_command) {
-                               session->begin_reversible_command (dialog.pitching ? _("pitch shift") : _("time stretch"));
+                               _session->begin_reversible_command (dialog.pitching ? _("pitch shift") : _("time stretch"));
                                in_command = true;
                        }
 
                        XMLNode &before = playlist->get_state();
                        playlist->replace_region (region, new_region, region->position());
                        XMLNode &after = playlist->get_state();
-                       session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
+                       _session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after));
                }
 
                i = tmp;
@@ -326,7 +326,7 @@ Editor::do_timefx (TimeFXDialog& dialog)
        }
 
        if (in_command) {
-               session->commit_reversible_command ();
+               _session->commit_reversible_command ();
        }
 
        dialog.status = 0;
index 17f2ad59eade7b65ef952f6a04cbd61691ff3c65..74a18b9770b6ed49b08ec9f16da8b92215f225fc 100644 (file)
@@ -108,11 +108,11 @@ void
 PortExportChannelSelector::fill_route_list ()
 {
        channel_view.clear_routes ();
-       RouteList routes = *session->get_routes();
+       RouteList routes = *_session->get_routes();
 
        /* Add master bus and then everything else */
 
-       ARDOUR::IO* master = session->master_out()->output().get();
+       ARDOUR::IO* master = _session->master_out()->output().get();
        channel_view.add_route (master);
 
        for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
@@ -435,11 +435,11 @@ PortExportChannelSelector::ChannelTreeView::update_selection_text (Glib::ustring
        update_config ();
 }
 
-RegionExportChannelSelector::RegionExportChannelSelector (ARDOUR::Session * session,
+RegionExportChannelSelector::RegionExportChannelSelector (ARDOUR::Session * _session,
                                                           ProfileManagerPtr manager,
                                                           ARDOUR::AudioRegion const & region,
                                                           ARDOUR::AudioTrack & track) :
-  ExportChannelSelector (session, manager),
+  ExportChannelSelector (_session, manager),
   region (region),
   track (track),
   region_chans (region.n_channels()),
@@ -485,11 +485,11 @@ RegionExportChannelSelector::handle_selection ()
        state->config->clear_channels ();
 
        if (raw_button.get_active ()) {
-               factory.reset (new RegionExportChannelFactory (session, region, track, RegionExportChannelFactory::Raw));
+               factory.reset (new RegionExportChannelFactory (_session, region, track, RegionExportChannelFactory::Raw));
        } else if (fades_button.get_active ()) {
-               factory.reset (new RegionExportChannelFactory (session, region, track, RegionExportChannelFactory::Fades));
+               factory.reset (new RegionExportChannelFactory (_session, region, track, RegionExportChannelFactory::Fades));
        } else if (processed_button.get_active ()) {
-               factory.reset (new RegionExportChannelFactory(session, region, track, RegionExportChannelFactory::Processed));
+               factory.reset (new RegionExportChannelFactory(_session, region, track, RegionExportChannelFactory::Processed));
        } else {
                CriticalSelectionChanged ();
                return;
index 56ce5c95019ddf3c2a6e26c7bc1275acfad31d39..6a1c4252a47a4e2ec0e3099ff7fe2f07ada0b8a6 100644 (file)
@@ -43,19 +43,18 @@ namespace ARDOUR {
 
 class XMLNode;
 
-class ExportChannelSelector : public Gtk::HBox
+class ExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
 {
   protected:
        typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
        typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
 
-       ARDOUR::Session * session;
        ProfileManagerPtr manager;
 
   public:
        ExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
-         : session (session)
-         , manager (manager)
+               : SessionHandlePtr (session)
+               , manager (manager)
        {}
 
        virtual ~ExportChannelSelector () {}
index c0e595fd001d399f02127979e03214d7ad883efb..1ec466d44928d037b7ab4a91cb7485cbdf77823d 100644 (file)
@@ -45,22 +45,26 @@ ExportDialog::~ExportDialog ()
 void
 ExportDialog::set_session (ARDOUR::Session* s)
 {
-       session = s;
+       SessionHandlePtr::set_session (s);
+
+       if (!_session) {
+               return;
+       }
 
        /* Init handler and profile manager */
 
-       handler = session->get_export_handler ();
-       status = session->get_export_status ();
-       profile_manager.reset (new ExportProfileManager (*session));
+       handler = _session->get_export_handler ();
+       status = _session->get_export_status ();
+       profile_manager.reset (new ExportProfileManager (*_session));
 
        /* Possibly init stuff in derived classes */
 
        init ();
 
-       /* Rest of session related initialization */
+       /* Rest of _session related initialization */
 
        preset_selector->set_manager (profile_manager);
-       file_notebook->set_session_and_manager (session, profile_manager);
+       file_notebook->set_session_and_manager (_session, profile_manager);
 
        /* Hand on selection range to profile manager  */
 
@@ -177,8 +181,8 @@ void
 ExportDialog::init_components ()
 {
        preset_selector.reset (new ExportPresetSelector ());
-       timespan_selector.reset (new ExportTimespanSelectorMultiple (session, profile_manager));
-       channel_selector.reset (new PortExportChannelSelector (session, profile_manager));
+       timespan_selector.reset (new ExportTimespanSelectorMultiple (_session, profile_manager));
+       channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
        file_notebook.reset (new ExportFileNotebook ());
 }
 
@@ -372,8 +376,8 @@ void
 ExportRangeDialog::init_components ()
 {
        preset_selector.reset (new ExportPresetSelector ());
-       timespan_selector.reset (new ExportTimespanSelectorSingle (session, profile_manager, range_id));
-       channel_selector.reset (new PortExportChannelSelector (session, profile_manager));
+       timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, range_id));
+       channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
        file_notebook.reset (new ExportFileNotebook ());
 }
 
@@ -385,8 +389,8 @@ void
 ExportSelectionDialog::init_components ()
 {
        preset_selector.reset (new ExportPresetSelector ());
-       timespan_selector.reset (new ExportTimespanSelectorSingle (session, profile_manager, X_("selection")));
-       channel_selector.reset (new PortExportChannelSelector (session, profile_manager));
+       timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, X_("selection")));
+       channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
        file_notebook.reset (new ExportFileNotebook ());
 }
 
@@ -410,7 +414,7 @@ ExportRegionDialog::init_components ()
        Glib::ustring loc_id = profile_manager->set_single_range (region.position(), region.position() + region.length(), region.name());
 
        preset_selector.reset (new ExportPresetSelector ());
-       timespan_selector.reset (new ExportTimespanSelectorSingle (session, profile_manager, loc_id));
-       channel_selector.reset (new RegionExportChannelSelector (session, profile_manager, region, track));
+       timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, loc_id));
+       channel_selector.reset (new RegionExportChannelSelector (_session, profile_manager, region, track));
        file_notebook.reset (new ExportFileNotebook ());
 }
index ab9a22ee28d34b6a56de36d4f8feb27d4ca2bf6f..93a78cdad2fb1b5b16004d8fd2f024c40555035c 100644 (file)
@@ -49,7 +49,7 @@ ExportFileNotebook::ExportFileNotebook () :
 void
 ExportFileNotebook::set_session_and_manager (ARDOUR::Session * s, boost::shared_ptr<ARDOUR::ExportProfileManager> manager)
 {
-       session = s;
+       SessionHandlePtr::set_session (s);
        profile_manager = manager;
 
        sync_with_manager ();
@@ -110,7 +110,7 @@ ExportFileNotebook::add_new_file_page ()
 void
 ExportFileNotebook::add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state)
 {
-       FilePage * page = Gtk::manage (new FilePage (session, profile_manager, this, page_counter, format_state, filename_state));
+       FilePage * page = Gtk::manage (new FilePage (_session, profile_manager, this, page_counter, format_state, filename_state));
        page->CriticalSelectionChanged.connect (CriticalSelectionChanged.make_slot());
        insert_page (*page, page->get_tab_widget(), get_n_pages() - 1);
 
index 4eed7dc2008855a157db3239a480f6ee941dea29..720c3b4bfde9a3bc000e05ad4bb61553a7880857 100644 (file)
 #include <gtkmm.h>
 
 #include "ardour/export_profile_manager.h"
+#include "ardour/session_handle.h"
 
 #include "export_format_selector.h"
 #include "export_filename_selector.h"
 
-namespace ARDOUR {
-       class Session;
-}
-
-
-class ExportFileNotebook : public Gtk::Notebook
+class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr
 {
   public:
 
@@ -55,7 +51,6 @@ class ExportFileNotebook : public Gtk::Notebook
        class FilePage;
 
        ManagerPtr        profile_manager;
-       ARDOUR::Session * session;
 
        void add_new_file_page ();
        void add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state);
index 30a7fbce7f8d638f6458c0ffbbc3ef157d2fb274..abd057414a145a08b8127c59cc25cb3375b2eb0b 100644 (file)
 using namespace ARDOUR;
 
 ExportFilenameSelector::ExportFilenameSelector () :
-  session (0),
-
-  include_label (_("Include in Filename(s):"), Gtk::ALIGN_LEFT),
-
-  label_label (_("Label:"), Gtk::ALIGN_LEFT),
-  session_checkbox (_("Session Name")),
-  revision_checkbox (_("Revision:")),
-
-  path_label (_("Folder:"), Gtk::ALIGN_LEFT),
-  browse_button (_("Browse"))
+       include_label (_("Include in Filename(s):"), Gtk::ALIGN_LEFT),
+       
+       label_label (_("Label:"), Gtk::ALIGN_LEFT),
+       session_checkbox (_("Session Name")),
+       revision_checkbox (_("Revision:")),
+       
+       path_label (_("Folder:"), Gtk::ALIGN_LEFT),
+       browse_button (_("Browse"))
 {
        pack_start (include_label, false, false, 6);
        pack_start (include_hbox, false, false, 0);
@@ -136,7 +134,7 @@ ExportFilenameSelector::load_state ()
 void
 ExportFilenameSelector::set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session * session_)
 {
-       session = session_;
+       SessionHandlePtr::set_session (session_);
 
        filename = state_->filename;
 
index a6c36da83d31b0750927ac3a97dafcdf39a7454b..cfe909a46bbb3ab84e054e3e63a81e30dd19fa93 100644 (file)
 
 #include "ardour/export_profile_manager.h"
 #include "ardour/export_filename.h"
-
-namespace ARDOUR {
-       class Session;
-}
+#include "ardour/session_handle.h"
 
 ///
-class ExportFilenameSelector : public Gtk::VBox {
+class ExportFilenameSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr 
+{
   public:
        typedef boost::shared_ptr<ARDOUR::ExportFilename> FilenamePtr;
 
@@ -60,7 +58,6 @@ class ExportFilenameSelector : public Gtk::VBox {
 
        void open_browse_dialog ();
 
-       ARDOUR::Session * session;
        boost::shared_ptr<ARDOUR::ExportFilename> filename;
 
        Glib::RefPtr<Gtk::SizeGroup> label_sizegroup;
index 770e46de4bfebe54945aaf4a3305d6c2736cb46b..05c17598670ece2f469a0e6b1472baaa99856002 100644 (file)
@@ -194,14 +194,14 @@ ExportFormatDialog::revert ()
 void
 ExportFormatDialog::set_session (ARDOUR::Session* s)
 {
-       session = s;
-       if (!session) {
-               return;
-       }
-
+       SessionHandlePtr::set_session (s);
        silence_start_clock.set_session (s);
        silence_end_clock.set_session (s);
 
+       if (!_session) {
+               return;
+       }
+
        update_clock (silence_start_clock, silence_start);
        update_clock (silence_end_clock, silence_end);
 
@@ -210,7 +210,7 @@ ExportFormatDialog::set_session (ARDOUR::Session* s)
        if (sample_rate_view.get_selection()->count_selected_rows() == 0) {
                Gtk::ListStore::Children::iterator it;
                for (it = sample_rate_list->children().begin(); it != sample_rate_list->children().end(); ++it) {
-                       if ((nframes_t) (*it)->get_value (sample_rate_cols.ptr)->rate == session->nominal_frame_rate()) {
+                       if ((nframes_t) (*it)->get_value (sample_rate_cols.ptr)->rate == _session->nominal_frame_rate()) {
                                sample_rate_view.get_selection()->select (it);
                                break;
                        }
@@ -586,8 +586,8 @@ ExportFormatDialog::change_sample_rate_selection (bool select, WeakSampleRatePtr
 
        if (select) {
                ExportFormatManager::SampleRatePtr ptr = rate.lock();
-               if (ptr && session) {
-                       src_quality_combo.set_sensitive ((uint32_t) ptr->rate != session->frame_rate());
+               if (ptr && _session) {
+                       src_quality_combo.set_sensitive ((uint32_t) ptr->rate != _session->frame_rate());
                }
        }
 }
@@ -728,7 +728,7 @@ void
 ExportFormatDialog::update_clock (AudioClock & clock, ARDOUR::AnyTime const & time)
 {
        // TODO position
-       clock.set (session->convert_to_frames_at (0, time), true);
+       clock.set (_session->convert_to_frames_at (0, time), true);
 
        AudioClock::Mode mode(AudioClock::Timecode);
 
@@ -753,7 +753,7 @@ ExportFormatDialog::update_clock (AudioClock & clock, ARDOUR::AnyTime const & ti
 void
 ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock)
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -762,15 +762,15 @@ ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock)
        switch (clock.mode()) {
          case AudioClock::Timecode:
                time.type = AnyTime::Timecode;
-               session->timecode_time (frames, time.timecode);
+               _session->timecode_time (frames, time.timecode);
                break;
          case AudioClock::BBT:
                time.type = AnyTime::BBT;
-               session->bbt_time (frames, time.bbt);
+               _session->bbt_time (frames, time.bbt);
                break;
          case AudioClock::MinSec:
                time.type = AnyTime::Seconds;
-               time.seconds = (double) frames / session->frame_rate();
+               time.seconds = (double) frames / _session->frame_rate();
                break;
          case AudioClock::Frames:
                time.type = AnyTime::Frames;
index 002edaf50c313af8cb00501d18e4769e9f1366f8..6b1f75987e4a595e967e0416d48e46b132c3cb88 100644 (file)
@@ -65,7 +65,8 @@ ExportFormatSelector::~ExportFormatSelector ()
 void
 ExportFormatSelector::set_state (ARDOUR::ExportProfileManager::FormatStatePtr const state_, ARDOUR::Session * session_)
 {
-       session = session_;
+       SessionHandlePtr::set_session (session_);
+
        state = state_;
 
        update_format_list ();
@@ -141,7 +142,7 @@ int
 ExportFormatSelector::open_edit_dialog (bool new_dialog)
 {
        ExportFormatDialog dialog (state->format, new_dialog);
-       dialog.set_session (session);
+       dialog.set_session (_session);
        Gtk::ResponseType response = (Gtk::ResponseType) dialog.run();
        if (response == Gtk::RESPONSE_APPLY) {
                update_format_description ();
index 46d9bc3f069486a18dba139b439cb6fe5af44e5f..6e1dd527869a2f34a05ea42cea26d37b01d44bf2 100644 (file)
 #include <sigc++/signal.h>
 #include <boost/shared_ptr.hpp>
 
+#include "ardour/session_handle.h"
+
 namespace ARDOUR {
-       class Session;
        class ExportFormatSpecification;
        class ExportProfileManager;
 }
 
 ///
-class ExportFormatSelector : public Gtk::HBox {
+class ExportFormatSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
+{
 
   private:
 
@@ -67,7 +69,6 @@ class ExportFormatSelector : public Gtk::HBox {
        void update_format_description ();
 
        ARDOUR::ExportProfileManager::FormatStatePtr state;
-       ARDOUR::Session * session;
 
        /*** GUI componenets ***/
 
index 30515d45fdfde43b4b00a885a0a2aa77e74af4bf..9f39fa556cc182f1585c993563e39253f1bd894f 100644 (file)
@@ -41,10 +41,10 @@ using namespace ARDOUR;
 using namespace PBD;
 
 ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager) :
-  session (session),
-  manager (manager),
-  time_format_label (_("Show Times as:"), Gtk::ALIGN_LEFT)
+       manager (manager),
+       time_format_label (_("Show Times as:"), Gtk::ALIGN_LEFT)
 {
+       set_session (session);
 
        option_hbox.pack_start (time_format_label, false, false, 0);
        option_hbox.pack_start (time_format_combo, false, false, 6);
@@ -100,7 +100,7 @@ ExportTimespanSelector::~ExportTimespanSelector ()
 void
 ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc)
 {
-       TimespanPtr span = session->get_export_handler()->add_timespan();
+       TimespanPtr span = _session->get_export_handler()->add_timespan();
 
        Glib::ustring id;
        if (loc == state->session_range.get()) {
@@ -201,14 +201,14 @@ ExportTimespanSelector::construct_label (ARDOUR::Location const * location) cons
 Glib::ustring
 ExportTimespanSelector::bbt_str (nframes_t frames) const
 {
-       if (!session) {
+       if (!_session) {
                return "Error!";
        }
 
        std::ostringstream oss;
        BBT_Time time;
 
-       session->bbt_time (frames, time);
+       _session->bbt_time (frames, time);
 
        oss << std::setfill('0') << std::right <<
          std::setw(3) <<
@@ -224,14 +224,14 @@ ExportTimespanSelector::bbt_str (nframes_t frames) const
 Glib::ustring
 ExportTimespanSelector::timecode_str (nframes_t frames) const
 {
-       if (!session) {
+       if (!_session) {
                return "Error!";
        }
 
        std::ostringstream oss;
        Timecode::Time time;
 
-       session->timecode_time (frames, time);
+       _session->timecode_time (frames, time);
 
        oss << std::setfill('0') << std::right <<
          std::setw(2) <<
@@ -249,7 +249,7 @@ ExportTimespanSelector::timecode_str (nframes_t frames) const
 Glib::ustring
 ExportTimespanSelector::ms_str (nframes_t frames) const
 {
-       if (!session) {
+       if (!_session) {
                return "Error!";
        }
 
@@ -261,13 +261,13 @@ ExportTimespanSelector::ms_str (nframes_t frames) const
        int sec_promilles;
 
        left = frames;
-       hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
-       left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
-       mins = (int) floor (left / (session->frame_rate() * 60.0f));
-       left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
-       secs = (int) floor (left / (float) session->frame_rate());
-       left -= (nframes_t) floor (secs * session->frame_rate());
-       sec_promilles = (int) (left * 1000 / (float) session->frame_rate() + 0.5);
+       hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
+       left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
+       mins = (int) floor (left / (_session->frame_rate() * 60.0f));
+       left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f);
+       secs = (int) floor (left / (float) _session->frame_rate());
+       left -= (nframes_t) floor (secs * _session->frame_rate());
+       sec_promilles = (int) (left * 1000 / (float) _session->frame_rate() + 0.5);
 
        oss << std::setfill('0') << std::right <<
          std::setw(2) <<
@@ -294,8 +294,8 @@ ExportTimespanSelector::update_range_name (Glib::ustring const & path, Glib::ust
 /*** ExportTimespanSelectorSingle ***/
 
 ExportTimespanSelectorSingle::ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, Glib::ustring range_id) :
-  ExportTimespanSelector (session, manager),
-  range_id (range_id)
+       ExportTimespanSelector (session, manager),
+       range_id (range_id)
 {
        range_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER);
        range_view.append_column_editable ("", range_cols.name);
index ad57aac344767cef330528c80d080a827e85a174..5d299e1e52cd25a4eb1f93bc4a02159b5f5fbc67 100644 (file)
 #include <boost/shared_ptr.hpp>
 
 #include "ardour/types.h"
+#include "ardour/session_handle.h"
 #include "ardour/export_profile_manager.h"
 
 namespace ARDOUR {
        class Location;
        class ExportTimespan;
        class ExportHandler;
-       class Session;
 }
 
 using ARDOUR::CDMarkerFormat;
 
 /// Timespan Selector base
-class ExportTimespanSelector : public Gtk::VBox {
+class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
+{
   protected:
        typedef std::list<ARDOUR::Location *> LocationList;
        typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
@@ -65,7 +66,6 @@ class ExportTimespanSelector : public Gtk::VBox {
 
   protected:
 
-       ARDOUR::Session * session;
        ProfileManagerPtr manager;
        TimespanStatePtr  state;
 
index 950071ba1300083d72ec93243a6b0e139adceeca..26036f6e665f844097df5417f00faedc219f242b 100644 (file)
@@ -74,13 +74,11 @@ GainMeter::setup_slider_pix ()
        }
 }
 
-GainMeterBase::GainMeterBase (Session& s,
+GainMeterBase::GainMeterBase (Session* s,
                              const Glib::RefPtr<Gdk::Pixbuf>& pix,
                              bool horizontal,
                              int fader_length)
-       : _session (s)
-         // 0.781787 is the value needed for gain to be set to 0.
-       , gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1)
+       : gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1)  // 0.781787 is the value needed for gain to be set to 0.
        , gain_automation_style_button ("")
        , gain_automation_state_button ("")
        , dpi_changed (false)
@@ -89,6 +87,8 @@ GainMeterBase::GainMeterBase (Session& s,
 {
        using namespace Menu_Helpers;
 
+       set_session (s);
+
        ignore_toggle = false;
        meter_menu = 0;
        next_release_selects = false;
@@ -170,6 +170,7 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r,
                             boost::shared_ptr<Amp> amp)
 {
        connections.clear ();
+       model_connections.drop_connections ();
 
        if (!pm && !amp) {
                level_meter->set_meter (0);
@@ -224,14 +225,14 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r,
                connections.push_back (gain_automation_state_button.signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false));
 
                boost::shared_ptr<AutomationControl> gc = amp->gain_control();
-
-               connections.push_back (gc->alist()->automation_state_changed.connect (sigc::mem_fun(*this, &GainMeter::gain_automation_state_changed)));
-               connections.push_back (gc->alist()->automation_style_changed.connect (sigc::mem_fun(*this, &GainMeter::gain_automation_style_changed)));
-
+               
+               model_connections.add_connection (gc->alist()->automation_state_changed.connect (boost::bind (&GainMeter::gain_automation_state_changed, this)));
+               model_connections.add_connection (gc->alist()->automation_style_changed.connect (boost::bind (&GainMeter::gain_automation_style_changed, this)));
+               
                gain_automation_state_changed ();
        }
-
-       connections.push_back (amp->gain_control()->Changed.connect (sigc::mem_fun (*this, &GainMeterBase::gain_changed)));
+       
+       model_connections.add_connection (amp->gain_control()->Changed.connect (boost::bind (&GainMeterBase::gain_changed, this)));
 
        gain_changed ();
        show_gain ();
@@ -518,7 +519,7 @@ GainMeterBase::meter_press(GdkEventButton* ev)
 
                                        /* Primary+Tertiary-click applies change to all routes */
 
-                                       _session.foreach_route (this, &GainMeterBase::set_meter_point, next_meter_point (_route->meter_point()));
+                                       _session->foreach_route (this, &GainMeterBase::set_meter_point, next_meter_point (_route->meter_point()));
 
 
                                } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
@@ -787,7 +788,7 @@ GainMeterBase::on_theme_changed()
        style_changed = true;
 }
 
-GainMeter::GainMeter (Session& s, int fader_length)
+GainMeter::GainMeter (Session* s, int fader_length)
        : GainMeterBase (s, slider, false, fader_length)
 {
        gain_display_box.set_homogeneous (true);
index 448e0239fe42065817c374667377600c2a2e0289..16c818deada582ed8594fe987fad364032382e9f 100644 (file)
 #include <gtkmm/drawingarea.h>
 #include <gdkmm/colormap.h>
 
+#include "pbd/scoped_connections.h"
+
 #include "ardour/types.h"
+#include "ardour/session_handle.h"
 
-#include <gtkmm2ext/click_box.h>
-#include <gtkmm2ext/focus_entry.h>
-#include <gtkmm2ext/slider_controller.h>
+#include "gtkmm2ext/click_box.h"
+#include "gtkmm2ext/focus_entry.h"
+#include "gtkmm2ext/slider_controller.h"
 
 #include "enums.h"
 #include "level_meter.h"
@@ -58,10 +61,10 @@ namespace Gtk {
        class Menu;
 }
 
-class GainMeterBase : virtual public sigc::trackable
+class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
 {
   public:
-       GainMeterBase (ARDOUR::Session&, const Glib::RefPtr<Gdk::Pixbuf>& pix,
+       GainMeterBase (ARDOUR::Session*, const Glib::RefPtr<Gdk::Pixbuf>& pix,
                       bool horizontal, int);
        virtual ~GainMeterBase ();
 
@@ -90,8 +93,8 @@ class GainMeterBase : virtual public sigc::trackable
        boost::shared_ptr<ARDOUR::Route> _route;
        boost::shared_ptr<ARDOUR::PeakMeter> _meter;
        boost::shared_ptr<ARDOUR::Amp> _amp;
-       ARDOUR::Session& _session;
        std::vector<sigc::connection> connections;
+       PBD::ScopedConnectionList model_connections;
 
        bool ignore_toggle;
        bool next_release_selects;
@@ -180,7 +183,7 @@ class GainMeterBase : virtual public sigc::trackable
 class GainMeter : public GainMeterBase, public Gtk::VBox
 {
   public:
-       GainMeter (ARDOUR::Session&, int);
+       GainMeter (ARDOUR::Session*, int);
        ~GainMeter () {}
 
        virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
index 9fb0deb98a0639076a25b2f80eaf55888f4b08a3..c7a10636ffcb89ade62d407a43f5882d83c29ebd 100644 (file)
@@ -34,6 +34,8 @@ using namespace Editing;
 using namespace ArdourCanvas;
 using namespace ARDOUR;
 
+boost::signals2::signal<void(GhostRegion*)> GhostRegion::GoingAway;
+
 GhostRegion::GhostRegion (ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_pos)
        : trackview (tv)
        , source_trackview (source_tv)
index b28607e6f261d7493c962af80d5ff77c8e388c4c..0932594a6f8b5bccb8f04e43619d57ce853018bc 100644 (file)
@@ -21,8 +21,8 @@
 #define __ardour_gtk_ghost_region_h__
 
 #include <vector>
-#include <sigc++/signal.h>
 #include <libgnomecanvasmm.h>
+#include <boost/signals2.hpp>
 #include "canvas.h"
 
 namespace Gnome {
@@ -37,7 +37,7 @@ namespace Gnome {
 class MidiStreamView;
 class TimeAxisView;
 
-class GhostRegion : public sigc::trackable
+class GhostRegion 
 {
 public:
        GhostRegion(ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
@@ -52,12 +52,12 @@ public:
        guint source_track_color(unsigned char alpha = 0xff);
        bool is_automation_ghost();
 
-       sigc::signal<void,GhostRegion*> GoingAway;
-
        TimeAxisView& trackview;
        TimeAxisView& source_trackview;
        ArdourCanvas::Group* group;
        ArdourCanvas::SimpleRect* base_rect;
+
+       static boost::signals2::signal<void(GhostRegion*)> GoingAway;
 };
 
 class AudioGhostRegion : public GhostRegion {
index 013df4255a58b78cc46b1b00f2381243f5df0723..3a7206c9d420a857445edfca5456c5cf331eb405 100644 (file)
@@ -40,11 +40,13 @@ GroupTabs::GroupTabs (Editor* e)
 }
 
 void
-GroupTabs::connect_to_session (Session* s)
+GroupTabs::set_session (Session* s)
 {
-       EditorComponent::connect_to_session (s);
+       EditorComponent::set_session (s);
 
-       _session_connections.push_back (_session->RouteGroupChanged.connect (sigc::mem_fun (*this, &GroupTabs::set_dirty)));
+       if (_session) {
+               _session_connections.add_connection (_session->RouteGroupChanged.connect (boost::bind (&GroupTabs::set_dirty, this)));
+       }
 }
 
 
index bb764a02a5e5af4ba55ed9fa72640cae69bc2424..dbe3174f1b2129551299bda49705f9a12a06eb13 100644 (file)
@@ -36,7 +36,7 @@ class GroupTabs : public CairoWidget, public EditorComponent
 public:
        GroupTabs (Editor *);
 
-       void connect_to_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
 
 protected:
 
index 3d85eda5d4cb657c869f84c6ad8a3f6179b63673..dc9188db1b74ed1c1d1ee6f5c483fd99ce831110 100644 (file)
@@ -1617,7 +1617,7 @@ ImageFrameSocketHandler::handle_rename_marker_view(const char* msg)
 void
 ImageFrameSocketHandler::handle_session_name_request(const char* msg)
 {
-       ARDOUR::Session* currentSession = thePublicEditor.current_session() ;
+       ARDOUR::Session* currentSession = thePublicEditor.session() ;
 
        if(currentSession == 0)
        {
index 91a4b768fded8eda489277f9c76c91aec4b07d8c..9e1eef2b2e7bb8a8ce13e1c889323401afbcd30d 100644 (file)
@@ -57,7 +57,7 @@ using namespace Gtk;
  * @param sess the current session
  * @param canvas the parent canvas item
  */
-ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas)
+ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas)
        : AxisView(sess),
          VisualTimeAxis(track_id, ed, sess, canvas)
 {
@@ -89,7 +89,7 @@ ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed
  */
 ImageFrameTimeAxis::~ImageFrameTimeAxis ()
 {
-        GoingAway() ; /* EMIT_SIGNAL */
+        GoingAway ; /* EMIT_SIGNAL */
 
        // Destroy all the marker views we may have associaited with this TimeAxis
        for(MarkerTimeAxisList::iterator iter = marker_time_axis_list.begin(); iter != marker_time_axis_list.end(); ++iter)
@@ -322,7 +322,7 @@ ImageFrameTimeAxis::add_marker_time_axis(MarkerTimeAxis* marker_track, void* src
        else
        {
                marker_time_axis_list.push_back(marker_track) ;
-               marker_track->GoingAway.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameTimeAxis::remove_time_axis_view), marker_track, (void*)this));
+               scoped_connect (marker_track->GoingAway, boost::bind (&ImageFrameTimeAxis::remove_time_axis_view, this, marker_track, (void*)this));
 
                 MarkerTimeAxisAdded(marker_track, src) ; /* EMIT_SIGNAL */
                ret = true ;
index 21db88e3e481819481dc48dac3db61a0f331bb80..6b2576fe968642ffabf95f4d736cc54e19a776bf 100644 (file)
@@ -62,7 +62,7 @@ class ImageFrameTimeAxis : public VisualTimeAxis
                 * @param sess the current session
                 * @param canvas the parent canvas item
                 */
-               ImageFrameTimeAxis(const std::string & track_id, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas) ;
+               ImageFrameTimeAxis(const std::string & track_id, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ;
 
                /**
                 * Destructor
index c3599d1b00a2041a00be4859cc86ae5a66144ac5..28d2aac1a16d4edc4b66002fa57377819c535edf 100644 (file)
@@ -74,7 +74,7 @@ ImageFrameTimeAxisGroup::~ImageFrameTimeAxisGroup()
                iter = next ;
        }
 
-        GoingAway() ; /* EMIT_SIGNAL */
+        GoingAway ; /* EMIT_SIGNAL */
 }
 
 
@@ -216,7 +216,7 @@ ImageFrameTimeAxisGroup::add_imageframe_item(const string & frame_id, nframes_t
 
                imageframe_views.push_front(ifv) ;
 
-               ifv->GoingAway.connect(sigc::bind(sigc::mem_fun(*this,&ImageFrameTimeAxisGroup::remove_imageframe_item), (void*)this)) ;
+               scoped_connect (ifv->GoingAway, boost::bind (&ImageFrameTimeAxisGroup::remove_imageframe_item, this, (void*)this));
 
                 ImageFrameAdded(ifv, src) ; /* EMIT_SIGNAL */
        }
index 88cdbd53cc6ff2b88ca88b6e20399696928938c7..fa339b42ec23a211a24330b3838960dbba17db7f 100644 (file)
@@ -214,7 +214,7 @@ ImageFrameTimeAxisView::add_imageframe_group(std::string group_id, void* src)
 
                imageframe_groups.push_front(iftag) ;
 
-               iftag->GoingAway.connect(sigc::bind(sigc::mem_fun(*this,&ImageFrameTimeAxisView::remove_imageframe_group), iftag, (void*)this)) ;
+               scoped_connect (iftag->GoingAway, boost::bind (&ImageFrameTimeAxisView::remove_imageframe_group, this, iftag, (void*)this)) ;
 
                 ImageFrameGroupAdded(iftag, src) ; /* EMIT_SIGNAL */
        }
@@ -410,7 +410,7 @@ ImageFrameTimeAxisView::set_imageframe_duration_sec(double sec)
 {
        if(selected_imageframe_group && selected_imageframe_view)
        {
-               selected_imageframe_view->set_duration((nframes_t) (sec * _trackview.editor.current_session()->frame_rate()), this) ;
+               selected_imageframe_view->set_duration((nframes_t) (sec * _trackview.editor.session()->frame_rate()), this) ;
        }
 }
 
index 65d091804ac88a55c3ae5fc46f7e9960c1b85aed..c704eb9768269b26bf9f187643d96983c9dc7590 100644 (file)
@@ -287,7 +287,7 @@ ImageFrameView::add_marker_view_item(MarkerView* item, void* src)
 {
        marker_view_list.push_back(item) ;
 
-       item->GoingAway.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameView::remove_marker_view_item), (void*)this));
+       scoped_connect (item->GoingAway, boost::bind (&ImageFrameView::remove_marker_view_item, this, (void*)this));
 
         MarkerViewAdded(item, src) ; /* EMIT_SIGNAL */
 }
index f61d2cc5c23e83d4d0f808f767acaf76879da1af..63e02a2a75bc9243eccf2caca77d584a9fc16201 100644 (file)
@@ -122,7 +122,7 @@ class PortInsertWindow : public ArdourDialog
        void accept ();
 
        void plugin_going_away ();
-       sigc::connection going_away_connection;
+       boost::signals2::scoped_connection going_away_connection;
 
        bool wm_delete (GdkEventAny*);
 };
index 3ddc9d2f9429da460541ed6e9a60e12652cd2ca7..bd85596a8cb3527cb9fdb86dc66da1f42760b45a 100644 (file)
@@ -53,11 +53,11 @@ using namespace std;
 //sigc::signal<void,RouteGroup*> LevelMeter::ResetGroupPeakDisplays;
 
 
-LevelMeter::LevelMeter (Session& s)
-       : _session (s)
-       , _meter (0)
+LevelMeter::LevelMeter (Session* s)
+       : _meter (0)
        , meter_length (0)
 {
+       set_session (s);
        set_spacing (1);
        Config->ParameterChanged.connect (sigc::mem_fun (*this, &LevelMeter::parameter_changed));
        UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &LevelMeter::on_theme_changed));
@@ -83,9 +83,9 @@ LevelMeter::set_meter (PeakMeter* meter)
 {
        _configuration_connection.disconnect();
        _meter = meter;
+
        if (_meter) {
-               _configuration_connection = _meter->ConfigurationChanged.connect(
-                       sigc::mem_fun(*this, &LevelMeter::configuration_changed));
+               _configuration_connection = _meter->ConfigurationChanged.connect(boost::bind (&LevelMeter::configuration_changed, this, _1, _2));
        }
 }
 
index bf0e081ccec5ccff2b72fd3c2e44cecc249d2743..cd2ccb7d7df612e16c72dcf26bd0480b2c42dc32 100644 (file)
@@ -31,6 +31,7 @@
 #include <gtkmm/drawingarea.h>
 
 #include "ardour/types.h"
+#include "ardour/session_handle.h"
 
 #include <gtkmm2ext/click_box.h>
 #include <gtkmm2ext/focus_entry.h>
@@ -49,10 +50,10 @@ namespace Gtk {
        class Menu;
 }
 
-class LevelMeter : public Gtk::HBox
+class LevelMeter : public Gtk::HBox, public ARDOUR::SessionHandlePtr
 {
   public:
-       LevelMeter (ARDOUR::Session&);
+       LevelMeter (ARDOUR::Session*);
        ~LevelMeter ();
 
        virtual void set_meter (ARDOUR::PeakMeter* meter);
@@ -66,7 +67,6 @@ class LevelMeter : public Gtk::HBox
        void setup_meters (int len=0, int width=3);
 
   private:
-       ARDOUR::Session&   _session;
        ARDOUR::PeakMeter* _meter;
 
        Width _width;
@@ -91,7 +91,7 @@ class LevelMeter : public Gtk::HBox
        std::vector<MeterInfo> meters;
        float                  max_peak;
 
-       sigc::connection _configuration_connection;
+       boost::signals2::scoped_connection _configuration_connection;
 
        void hide_all_meters ();
        gint meter_button_release (GdkEventButton*, uint32_t);
index 4190a2c463f84ed06a850793d364a6b8c87ce60a..328d87b5449ec182a4805fce0d8d4c010e103f7d 100644 (file)
@@ -44,7 +44,8 @@ using namespace Gtk;
 using namespace Gtkmm2ext;
 
 LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
-       : location(0), session(0),
+       : SessionHandlePtr (0), /* explicitly set below */
+         location(0), 
          item_table (1, 6, false),
          start_clock (X_("locationstart"), true, X_("LocationEditRowClock"), true, false),
          end_clock (X_("locationend"), true, X_("LocationEditRowClock"), true, false),
@@ -149,24 +150,22 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
 LocationEditRow::~LocationEditRow()
 {
        if (location) {
-               start_changed_connection.disconnect();
-               end_changed_connection.disconnect();
-               name_changed_connection.disconnect();
-               changed_connection.disconnect();
-               flags_changed_connection.disconnect();
+               connections.drop_connections ();
        }
 }
 
 void
 LocationEditRow::set_session (Session *sess)
 {
-       session = sess;
+       SessionHandlePtr::set_session (sess);
 
-       if (!session) return;
+       if (!_session) { 
+               return;
+       }
 
-       start_clock.set_session (session);
-       end_clock.set_session (session);
-       length_clock.set_session (session);
+       start_clock.set_session (_session);
+       end_clock.set_session (_session);
+       length_clock.set_session (_session);
 
 }
 
@@ -184,11 +183,7 @@ void
 LocationEditRow::set_location (Location *loc)
 {
        if (location) {
-               start_changed_connection.disconnect();
-               end_changed_connection.disconnect();
-               name_changed_connection.disconnect();
-               changed_connection.disconnect();
-               flags_changed_connection.disconnect();
+               connections.drop_connections ();
        }
 
        location = loc;
@@ -238,7 +233,7 @@ LocationEditRow::set_location (Location *loc)
                cd_check_button.set_active (location->is_cd_marker());
                cd_check_button.show();
 
-               if (location->start() == session->current_start_frame()) {
+               if (location->start() == _session->current_start_frame()) {
                        cd_check_button.set_sensitive (false);
                } else {
                        cd_check_button.set_sensitive (true);
@@ -287,11 +282,11 @@ LocationEditRow::set_location (Location *loc)
        end_clock.set_sensitive (!location->locked());
        length_clock.set_sensitive (!location->locked());
 
-       start_changed_connection = location->start_changed.connect (sigc::mem_fun(*this, &LocationEditRow::start_changed));
-       end_changed_connection = location->end_changed.connect (sigc::mem_fun(*this, &LocationEditRow::end_changed));
-       name_changed_connection = location->name_changed.connect (sigc::mem_fun(*this, &LocationEditRow::name_changed));
-       changed_connection = location->changed.connect (sigc::mem_fun(*this, &LocationEditRow::location_changed));
-       flags_changed_connection = location->FlagsChanged.connect (sigc::mem_fun(*this, &LocationEditRow::flags_changed));
+       connections.add_connection (location->start_changed.connect (boost::bind (&LocationEditRow::start_changed, this, _1)));
+       connections.add_connection (location->end_changed.connect (boost::bind (&LocationEditRow::end_changed, this, _1)));
+       connections.add_connection (location->name_changed.connect (boost::bind (&LocationEditRow::name_changed, this, _1)));
+       connections.add_connection (location->changed.connect (boost::bind (&LocationEditRow::location_changed, this, _1)));
+       connections.add_connection (location->FlagsChanged.connect (boost::bind (&LocationEditRow::flags_changed, this, _1, _2)));
 }
 
 void
@@ -406,7 +401,7 @@ LocationEditRow::cd_toggled ()
        //}
 
        if (cd_check_button.get_active()) {
-               if (location->start() <= session->current_start_frame()) {
+               if (location->start() <= _session->current_start_frame()) {
                        error << _("You cannot put a CD marker at the start of the session") << endmsg;
                        cd_check_button.set_active (false);
                        return;
@@ -518,7 +513,7 @@ LocationEditRow::start_changed (ARDOUR::Location *loc)
 
        start_clock.set (location->start());
 
-       if (location->start() == session->current_start_frame()) {
+       if (location->start() == _session->current_start_frame()) {
                cd_check_button.set_sensitive (false);
        } else {
                cd_check_button.set_sensitive (true);
@@ -587,8 +582,7 @@ LocationEditRow::focus_name() {
 
 
 LocationUI::LocationUI ()
-       : session (0)
-       , add_location_button (_("New Marker"))
+       : add_location_button (_("New Marker"))
        , add_range_button (_("New Range"))
 {
        i_am_the_modifier = 0;
@@ -681,12 +675,12 @@ LocationUI::do_location_remove (ARDOUR::Location *loc)
                return FALSE;
        }
 
-       session->begin_reversible_command (_("remove marker"));
-       XMLNode &before = session->locations()->get_state();
-       session->locations()->remove (loc);
-       XMLNode &after = session->locations()->get_state();
-       session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
-       session->commit_reversible_command ();
+       _session->begin_reversible_command (_("remove marker"));
+       XMLNode &before = _session->locations()->get_state();
+       _session->locations()->remove (loc);
+       XMLNode &after = _session->locations()->get_state();
+       _session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+       _session->commit_reversible_command ();
 
        return FALSE;
 }
@@ -769,7 +763,7 @@ LocationUI::map_locations (Locations::LocationList& locations)
 
                if (location->is_mark()) {
                        mark_n++;
-                       erow = manage (new LocationEditRow(session, location, mark_n));
+                       erow = manage (new LocationEditRow(_session, location, mark_n));
                        erow->remove_requested.connect (sigc::mem_fun(*this, &LocationUI::location_remove_requested));
                        erow->redraw_ranges.connect (sigc::mem_fun(*this, &LocationUI::location_redraw_ranges));
                        loc_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
@@ -779,17 +773,17 @@ LocationUI::map_locations (Locations::LocationList& locations)
                        }
                }
                else if (location->is_auto_punch()) {
-                       punch_edit_row.set_session (session);
+                       punch_edit_row.set_session (_session);
                        punch_edit_row.set_location (location);
                        punch_edit_row.show_all();
                }
                else if (location->is_auto_loop()) {
-                       loop_edit_row.set_session (session);
+                       loop_edit_row.set_session (_session);
                        loop_edit_row.set_location (location);
                        loop_edit_row.show_all();
                }
                else {
-                       erow = manage (new LocationEditRow(session, location));
+                       erow = manage (new LocationEditRow(_session, location));
                        erow->remove_requested.connect (sigc::mem_fun(*this, &LocationUI::location_remove_requested));
                        range_children.push_back(Box_Helpers::Element(*erow,  PACK_SHRINK, 1, PACK_START));
                }
@@ -804,19 +798,19 @@ LocationUI::add_new_location()
 {
        string markername;
 
-       if (session) {
-               nframes_t where = session->audible_frame();
-               session->locations()->next_available_name(markername,"mark");
+       if (_session) {
+               nframes_t where = _session->audible_frame();
+               _session->locations()->next_available_name(markername,"mark");
                Location *location = new Location (where, where, markername, Location::IsMark);
                if (Config->get_name_new_markers()) {
                        newest_location = location;
                }
-               session->begin_reversible_command (_("add marker"));
-               XMLNode &before = session->locations()->get_state();
-               session->locations()->add (location, true);
-               XMLNode &after = session->locations()->get_state();
-               session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
-               session->commit_reversible_command ();
+               _session->begin_reversible_command (_("add marker"));
+               XMLNode &before = _session->locations()->get_state();
+               _session->locations()->add (location, true);
+               XMLNode &after = _session->locations()->get_state();
+               _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+               _session->commit_reversible_command ();
        }
 
 }
@@ -826,28 +820,19 @@ LocationUI::add_new_range()
 {
        string rangename;
 
-       if (session) {
-               nframes_t where = session->audible_frame();
-               session->locations()->next_available_name(rangename,"unnamed");
+       if (_session) {
+               nframes_t where = _session->audible_frame();
+               _session->locations()->next_available_name(rangename,"unnamed");
                Location *location = new Location (where, where, rangename, Location::IsRangeMarker);
-               session->begin_reversible_command (_("add range marker"));
-               XMLNode &before = session->locations()->get_state();
-               session->locations()->add (location, true);
-               XMLNode &after = session->locations()->get_state();
-               session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
-               session->commit_reversible_command ();
+               _session->begin_reversible_command (_("add range marker"));
+               XMLNode &before = _session->locations()->get_state();
+               _session->locations()->add (location, true);
+               XMLNode &after = _session->locations()->get_state();
+               _session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
+               _session->commit_reversible_command ();
        }
 }
 
-
-void
-LocationUI::refresh_location_list_s (Change ignored)
-{
-       ENSURE_GUI_THREAD (*this, &LocationUI::refresh_location_list_s, ignored)
-
-       refresh_location_list ();
-}
-
 void
 LocationUI::refresh_location_list ()
 {
@@ -863,8 +848,8 @@ LocationUI::refresh_location_list ()
        loc_children.clear();
        range_children.clear();
 
-       if (session) {
-               session->locations()->apply (*this, &LocationUI::map_locations);
+       if (_session) {
+               _session->locations()->apply (*this, &LocationUI::map_locations);
        }
 
 }
@@ -872,22 +857,22 @@ LocationUI::refresh_location_list ()
 void
 LocationUI::set_session(ARDOUR::Session* s)
 {
-       session = s;
+       SessionHandlePtr::set_session (s);
 
-       if (session) {
-               session->locations()->changed.connect (sigc::mem_fun(*this, &LocationUI::refresh_location_list));
-               session->locations()->StateChanged.connect (sigc::mem_fun(*this, &LocationUI::refresh_location_list_s));
-               session->locations()->added.connect (sigc::mem_fun(*this, &LocationUI::location_added));
-               session->locations()->removed.connect (sigc::mem_fun(*this, &LocationUI::location_removed));
-               session->GoingAway.connect (sigc::mem_fun(*this, &LocationUI::session_gone));
+       if (_session) {
+               _session_connections.add_connection (_session->locations()->changed.connect (boost::bind (&LocationUI::refresh_location_list, this)));
+               _session_connections.add_connection (_session->locations()->StateChanged.connect (boost::bind (&LocationUI::refresh_location_list, this)));
+               _session_connections.add_connection (_session->locations()->added.connect (boost::bind (&LocationUI::location_added, this, _1)));
+               _session_connections.add_connection (_session->locations()->removed.connect (boost::bind (&LocationUI::location_removed, this, _1)));
        }
+
        refresh_location_list ();
 }
 
 void
-LocationUI::session_gone()
+LocationUI::session_going_away()
 {
-       ENSURE_GUI_THREAD (*this, &LocationUI::session_gone)
+       ENSURE_GUI_THREAD (*this, &LocationUI::session_going_away);
 
        using namespace Box_Helpers;
        BoxList & loc_children = location_rows.children();
@@ -901,6 +886,8 @@ LocationUI::session_gone()
 
        punch_edit_row.set_session (0);
        punch_edit_row.set_location (0);
+
+       SessionHandlePtr::session_going_away ();
 }
 
 /*------------------------*/
@@ -938,13 +925,11 @@ LocationUIWindow::set_session (Session *s)
 {
        ArdourDialog::set_session (s);
        _ui.set_session (s);
-
-       s->GoingAway.connect (sigc::mem_fun (*this, &LocationUIWindow::session_gone));
 }
 
 void
-LocationUIWindow::session_gone ()
+LocationUIWindow::session_going_away ()
 {
+       ArdourDialog::session_going_away ();
        hide_all();
-       ArdourDialog::session_gone ();
 }
index 56401f61399b515e575a0026b72bc54a82f25399..dd735cddba96a571fbde2230646106bbd818139f 100644 (file)
 #include <gtkmm/paned.h>
 #include <gtkmm/scrolledwindow.h>
 
+#include "pbd/scoped_connections.h"
+
 #include "ardour/location.h"
+#include "ardour/session_handle.h"
 
 #include "ardour_dialog.h"
 #include "audio_clock.h"
 
 namespace ARDOUR {
        class LocationStack;
-       class Session;
        class Location;
 }
 
-class LocationEditRow  : public Gtk::HBox
+class LocationEditRow  : public Gtk::HBox, public ARDOUR::SessionHandlePtr
 {
   public:
        LocationEditRow (ARDOUR::Session *sess=0, ARDOUR::Location *loc=0, int32_t num=-1);
@@ -66,9 +68,6 @@ class LocationEditRow  : public Gtk::HBox
        };
 
        ARDOUR::Location *location;
-       ARDOUR::Session  *session;
-
-
 
        Gtk::Table    item_table;
 
@@ -102,7 +101,6 @@ class LocationEditRow  : public Gtk::HBox
        Gtk::CheckButton   scms_check_button;
        Gtk::CheckButton   preemph_check_button;
 
-
        guint32 i_am_the_modifier;
        int   number;
 
@@ -130,34 +128,27 @@ class LocationEditRow  : public Gtk::HBox
        void location_changed (ARDOUR::Location *);
        void flags_changed (ARDOUR::Location *, void *src);
 
-       sigc::connection start_changed_connection;
-       sigc::connection end_changed_connection;
-       sigc::connection name_changed_connection;
-       sigc::connection changed_connection;
-       sigc::connection flags_changed_connection;
-
+       PBD::ScopedConnectionList connections;
 };
 
-class LocationUI : public Gtk::HBox
+class LocationUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr
 {
   public:
        LocationUI ();
        ~LocationUI ();
        
-       virtual void set_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
 
        void add_new_location();
        void add_new_range();
 
        void refresh_location_list ();
-       void refresh_location_list_s (ARDOUR::Change);
 
   private:
-       ARDOUR::Session* session;
        ARDOUR::LocationStack* locations;
        ARDOUR::Location *newest_location;
 
-       void session_gone();
+       void session_going_away ();
 
        Gtk::VBox  location_vpacker;
 
@@ -212,7 +203,7 @@ class LocationUIWindow : public ArdourDialog
   protected:
        LocationUI _ui;
        bool on_delete_event (GdkEventAny*);
-       void session_gone();
+       void session_going_away();
 };
 
 #endif // __ardour_location_ui_h__
index 9dea703dfd2574e695707cbec8c7f361f0e595cd..c58f607be67173979b6d769f6d74b0bbaf375016 100644 (file)
@@ -56,7 +56,7 @@ using namespace Gtk;
  * @param name the name/id of this time axis
  * @param tav the associated track view that this MarkerTimeAxis is marking up
  */
-MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& canvas, const string & name, TimeAxisView* tav)
+MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session* sess, Canvas& canvas, const string & name, TimeAxisView* tav)
        : AxisView(sess),
          VisualTimeAxis(name, ed, sess, canvas)
 {
@@ -90,7 +90,7 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas&
  */
 MarkerTimeAxis::~MarkerTimeAxis()
 {
-       GoingAway() ; /* EMIT_SIGNAL */
+       GoingAway ; /* EMIT_SIGNAL */
 
        // destroy the view helper
        // this handles removing and destroying individual marker items
index 05b95bddaaf111f7534a15f68ef157a163aed768..67c3e2beff2edacb94124a35d56d406697c2908c 100644 (file)
@@ -65,7 +65,7 @@ class MarkerTimeAxis : public VisualTimeAxis
                 * @param name the name/id of this time axis
                 * @param tav the associated track view that this MarkerTimeAxis is marking up
                 */
-               MarkerTimeAxis(PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas, const std::string & name, TimeAxisView* tav) ;
+               MarkerTimeAxis(PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas, const std::string & name, TimeAxisView* tav) ;
 
                /**
                 * Destructor
index 4189788b4cd1f5009963006b3434a2cf27421803..402f2ac479a9a9e45b9ccd5b0728449e5bed8edc 100644 (file)
@@ -211,7 +211,7 @@ MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type,
        ifv->add_marker_view_item(mv, src) ;
        marker_view_list.push_front(mv) ;
 
-       mv->GoingAway.connect(sigc::bind (sigc::mem_fun(*this,&MarkerTimeAxisView::remove_marker_view), (void*)this)) ;
+       scoped_connect (mv->GoingAway, boost::bind (&MarkerTimeAxisView::remove_marker_view, this, (void*)this));
 
         MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */
 
@@ -337,7 +337,7 @@ MarkerTimeAxisView::set_marker_duration_sec(double sec)
 {
   if(get_selected_time_axis_item() != 0)
   {
-         get_selected_time_axis_item()->set_duration((nframes_t) (sec * _trackview.editor.current_session()->frame_rate()), this) ;
+         get_selected_time_axis_item()->set_duration((nframes_t) (sec * _trackview.editor.session()->frame_rate()), this) ;
   }
 }
 
index 008597bc84493635392c9964a8a77a6278cc3d00..9c1c84ede4d76cbdc963f5f5ab2d67c496b236a3 100644 (file)
 
 using namespace ARDOUR;
 
-MidiCutBuffer::MidiCutBuffer (Session& s)
-       : AutomatableSequence<MidiModel::TimeType> (s, 0)
+MidiCutBuffer::MidiCutBuffer (Session* s)
+       : AutomatableSequence<MidiModel::TimeType> (*s, 0)
        , _origin (0)
 {
-
+       
 }
 
 MidiCutBuffer::~MidiCutBuffer ()
index 4281b962bc03224dad051ac57f6c4fe8b225759e..a52771019d16574d5897b984efb6cd34a29dfc92 100644 (file)
@@ -30,7 +30,7 @@ class MidiCutBuffer : public ARDOUR::AutomatableSequence<ARDOUR::MidiModel::Time
   public:
        typedef ARDOUR::MidiModel::TimeType TimeType;
 
-       MidiCutBuffer (ARDOUR::Session&);
+       MidiCutBuffer (ARDOUR::Session*);
        ~MidiCutBuffer();
 
        TimeType origin() const { return _origin; }
index b807de28f9813f901172a7b259ebf966689ca4c1..026b09b9272bb2f1fb9b8e47442b2315ac9ca9f4 100644 (file)
@@ -31,11 +31,12 @@ using namespace Gtk;
 using namespace Glib;
 using namespace ARDOUR;
 
-MidiListEditor::MidiListEditor (Session& s, boost::shared_ptr<MidiRegion> r)
+MidiListEditor::MidiListEditor (Session* s, boost::shared_ptr<MidiRegion> r)
        : ArdourDialog (r->name(), false, false)
-       , session (s)
        , region (r)
 {
+       set_session (s);
+
        model = ListStore::create (columns);
        view.set_model (model);
 
@@ -96,40 +97,43 @@ MidiListEditor::redisplay_model ()
        view.set_model (Glib::RefPtr<Gtk::ListStore>(0));
        model->clear ();
 
-       MidiModel::Notes notes = region->midi_source(0)->model()->notes();
-       TreeModel::Row row;
-
-       for (MidiModel::Notes::iterator i = notes.begin(); i != notes.end(); ++i) {
-               row = *(model->append());
-               row[columns.channel] = (*i)->channel();
-               row[columns.note_name] = _("Note");
-               row[columns.note] = (*i)->note();
-               row[columns.velocity] = (*i)->velocity();
-
-               BBT_Time bbt;
-               BBT_Time dur;
-               stringstream ss;
-
-               session.tempo_map().bbt_time (region->position(), bbt);
-
-               dur.bars = 0;
-               dur.beats = floor ((*i)->time());
-               dur.ticks = 0;
-
-               session.tempo_map().bbt_duration_at (region->position(), dur, 0);
-
-               ss << bbt;
-               row[columns.start] = ss.str();
-               ss << dur;
-               row[columns.length] = ss.str();
-
-               session.tempo_map().bbt_time (region->position(), bbt);
-               /* XXX get end point */
-
-               ss << bbt;
-               row[columns.end] = ss.str();
-
-               row[columns._note] = (*i);
+       if (_session) {
+               
+               MidiModel::Notes notes = region->midi_source(0)->model()->notes();
+               TreeModel::Row row;
+               
+               for (MidiModel::Notes::iterator i = notes.begin(); i != notes.end(); ++i) {
+                       row = *(model->append());
+                       row[columns.channel] = (*i)->channel();
+                       row[columns.note_name] = _("Note");
+                       row[columns.note] = (*i)->note();
+                       row[columns.velocity] = (*i)->velocity();
+                       
+                       BBT_Time bbt;
+                       BBT_Time dur;
+                       stringstream ss;
+                       
+                       _session->tempo_map().bbt_time (region->position(), bbt);
+                       
+                       dur.bars = 0;
+                       dur.beats = floor ((*i)->time());
+                       dur.ticks = 0;
+                       
+                       _session->tempo_map().bbt_duration_at (region->position(), dur, 0);
+                       
+                       ss << bbt;
+                       row[columns.start] = ss.str();
+                       ss << dur;
+                       row[columns.length] = ss.str();
+                       
+                       _session->tempo_map().bbt_time (region->position(), bbt);
+                       /* XXX get end point */
+                       
+                       ss << bbt;
+                       row[columns.end] = ss.str();
+                       
+                       row[columns._note] = (*i);
+               }
        }
 
        view.set_model (model);
index 96a04ada7c96c7515b681b66baeccba048bffa1e..de7b2220bb8900c6488a329177f143f7e05926dd 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "evoral/types.hpp"
 
+#include "ardour/session_handle.h"
+
 #include "ardour_dialog.h"
 
 namespace ARDOUR {
@@ -39,7 +41,7 @@ class MidiListEditor : public ArdourDialog
   public:
        typedef Evoral::Note<Evoral::MusicalTime> NoteType;
 
-       MidiListEditor(ARDOUR::Session&, boost::shared_ptr<ARDOUR::MidiRegion>);
+       MidiListEditor(ARDOUR::Session*, boost::shared_ptr<ARDOUR::MidiRegion>);
        ~MidiListEditor();
 
   private:
@@ -64,7 +66,6 @@ class MidiListEditor : public ArdourDialog
                Gtk::TreeModelColumn<boost::shared_ptr<NoteType> > _note;
        };
 
-       ARDOUR::Session&             session;
        MidiListModelColumns         columns;
        Glib::RefPtr<Gtk::ListStore> model;
        Gtk::TreeView                view;
index a8f6f11b42a653505cf6b920a2fa0331c40bc022..d2f1657821dfcee7abef49b6643599b05991bf00 100644 (file)
@@ -552,7 +552,7 @@ MidiRegionView::create_note_at(double x, double y, double length)
 
        MidiModel::DeltaCommand* cmd = _model->new_delta_command("add note");
        cmd->add(new_note);
-       _model->apply_command(trackview.session(), cmd);
+       _model->apply_command(*trackview.session(), cmd);
 
        play_midi_note (new_note);
 }
@@ -585,8 +585,8 @@ MidiRegionView::display_model(boost::shared_ptr<MidiModel> model)
 {
        _model = model;
        content_connection.disconnect ();
-       content_connection = _model->ContentsChanged.connect(
-                       sigc::mem_fun(this, &MidiRegionView::redisplay_model));
+       content_connection = _model->ContentsChanged.connect (boost::bind (&MidiRegionView::redisplay_model, this));
+
        clear_events ();
 
        if (_enable_display) {
@@ -665,7 +665,7 @@ MidiRegionView::apply_delta()
                _marked_for_selection.insert((*i)->note());
        }
 
-       _model->apply_command(trackview.session(), _delta_command);
+       _model->apply_command(*trackview.session(), _delta_command);
        _delta_command = 0;
        midi_view()->midi_track()->diskstream()->playlist_modified();
 
@@ -680,7 +680,7 @@ MidiRegionView::apply_diff ()
                return;
        }
 
-       _model->apply_command(trackview.session(), _diff_command);
+       _model->apply_command(*trackview.session(), _diff_command);
        _diff_command = 0;
        midi_view()->midi_track()->diskstream()->playlist_modified();
 
@@ -699,7 +699,7 @@ MidiRegionView::apply_delta_as_subcommand()
                _marked_for_selection.insert((*i)->note());
        }
 
-       _model->apply_command_as_subcommand(trackview.session(), _delta_command);
+       _model->apply_command_as_subcommand(*trackview.session(), _delta_command);
        _delta_command = 0;
        midi_view()->midi_track()->diskstream()->playlist_modified();
 
@@ -719,7 +719,7 @@ MidiRegionView::apply_diff_as_subcommand()
                _marked_for_selection.insert((*i)->note());
        }
 
-       _model->apply_command_as_subcommand(trackview.session(), _diff_command);
+       _model->apply_command_as_subcommand(*trackview.session(), _diff_command);
        _diff_command = 0;
        midi_view()->midi_track()->diskstream()->playlist_modified();
 
@@ -1071,7 +1071,7 @@ MidiRegionView::add_ghost (TimeAxisView& tv)
                }
        }
 
-       ghost->GoingAway.connect (sigc::mem_fun(*this, &MidiRegionView::remove_ghost));
+       ghost->GoingAway.connect (boost::bind (&RegionView::remove_ghost, this, _1));
 
        return ghost;
 }
@@ -1151,7 +1151,7 @@ MidiRegionView::play_midi_note(boost::shared_ptr<NoteType> note)
 
        const double note_length_beats = (note->off_event().time() - note->on_event().time());
        nframes_t note_length_ms = beats_to_frames(note_length_beats)
-                       * (1000 / (double)route_ui->session().nominal_frame_rate());
+                       * (1000 / (double)route_ui->session()->nominal_frame_rate());
        Glib::signal_timeout().connect(sigc::bind(sigc::mem_fun(this, &MidiRegionView::play_midi_note_off), note),
                        note_length_ms, G_PRIORITY_DEFAULT);
 }
@@ -2431,11 +2431,11 @@ MidiRegionView::paste (nframes64_t pos, float times, const MidiCutBuffer& mcb)
 
        if (end_frame > region_end) {
 
-               trackview.session().begin_reversible_command (_("paste"));
+               trackview.session()->begin_reversible_command (_("paste"));
 
                XMLNode& before (_region->get_state());
                _region->set_length (end_frame, this);
-               trackview.session().add_command (new MementoCommand<Region>(*_region, &before, &_region->get_state()));
+               trackview.session()->add_command (new MementoCommand<Region>(*_region, &before, &_region->get_state()));
        }
 
        apply_delta ();
index 22c2b845fd550684c7cbe1d67fe51fa6eb387905..e8c25e864766666151bbcb9e87c34e4fbaa1af8d 100644 (file)
@@ -24,6 +24,9 @@
 
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
+
+#include <boost/signals2.hpp>
+
 #include "ardour/midi_track.h"
 #include "ardour/midi_region.h"
 #include "ardour/midi_model.h"
@@ -386,7 +389,7 @@ class MidiRegionView : public RegionView
        std::vector<NoteResizeData *> _resize_data;
 
        /* connection used to connect to model's ContentChanged signal */
-       sigc::connection content_connection;
+       boost::signals2::scoped_connection content_connection;
 
        ArdourCanvas::CanvasNoteEvent* find_canvas_note (boost::shared_ptr<NoteType>);
        Events::iterator _optimization_iterator;
index 77d9afabaee3ccbecb63534437a284aa5f944e8c..4d0c7fa3856dd439ea85891c312f03672acbe556 100644 (file)
@@ -180,7 +180,7 @@ MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wfd,
        display_region (region_view, wfd);
 
        /* catch regionview going away */
-       region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &MidiStreamView::remove_region_view), region));
+       scoped_connect (region->GoingAway, boost::bind (&MidiStreamView::remove_region_view, this, region));
 
        RegionViewAdded (region_view);
 
@@ -383,10 +383,10 @@ MidiStreamView::setup_rec_box ()
 {
        // cerr << _trackview.name() << " streamview SRB\n";
 
-       if (_trackview.session().transport_rolling()) {
+       if (_trackview.session()->transport_rolling()) {
 
                if (!rec_active &&
-                   _trackview.session().record_status() == Session::Recording &&
+                   _trackview.session()->record_status() == Session::Recording &&
                    _trackview.get_diskstream()->record_enabled()) {
 
                        if (use_rec_regions && rec_regions.size() == rec_rects.size()) {
@@ -395,19 +395,15 @@ MidiStreamView::setup_rec_box ()
 
                                MidiRegion::SourceList sources;
 
-                               for (list<sigc::connection>::iterator prc = rec_data_ready_connections.begin();
-                                               prc != rec_data_ready_connections.end(); ++prc) {
-                                       (*prc).disconnect();
-                               }
-                               rec_data_ready_connections.clear();
+                               rec_data_ready_connections.drop_connections ();
 
                                boost::shared_ptr<MidiDiskstream> mds = _trackview.midi_track()->midi_diskstream();
 
                                sources.push_back(mds->write_source());
 
-                               rec_data_ready_connections.push_back (mds->write_source()->ViewDataRangeReady.connect (sigc::bind (
-                                               sigc::mem_fun (*this, &MidiStreamView::rec_data_range_ready),
-                                               boost::weak_ptr<Source>(mds->write_source()))));
+                               rec_data_ready_connections.add_connection (mds->write_source()->ViewDataRangeReady.connect 
+                                                                          (boost::bind (&MidiStreamView::rec_data_range_ready, this,
+                                                                                        _1, _2, boost::weak_ptr<Source>(mds->write_source()))));
 
                                // handle multi
 
@@ -422,7 +418,7 @@ MidiStreamView::setup_rec_box ()
 
                                assert(region);
                                region->block_property_changes ();
-                               region->set_position (_trackview.session().transport_frame(), this);
+                               region->set_position (_trackview.session()->transport_frame(), this);
                                rec_regions.push_back (make_pair(region, (RegionView*)0));
 
                                // rec regions are destroyed in setup_rec_box
@@ -455,7 +451,7 @@ MidiStreamView::setup_rec_box ()
 
                        RecBoxInfo recbox;
                        recbox.rectangle = rec_rect;
-                       recbox.start = _trackview.session().transport_frame();
+                       recbox.start = _trackview.session()->transport_frame();
                        recbox.length = 0;
 
                        rec_rects.push_back (recbox);
@@ -467,7 +463,7 @@ MidiStreamView::setup_rec_box ()
                        rec_active = true;
 
                } else if (rec_active &&
-                          (_trackview.session().record_status() != Session::Recording ||
+                          (_trackview.session()->record_status() != Session::Recording ||
                            !_trackview.get_diskstream()->record_enabled())) {
                        screen_update_connection.disconnect();
                        rec_active = false;
@@ -482,12 +478,7 @@ MidiStreamView::setup_rec_box ()
 
                        /* disconnect rapid update */
                        screen_update_connection.disconnect();
-
-                       for (list<sigc::connection>::iterator prc = rec_data_ready_connections.begin();
-                                       prc != rec_data_ready_connections.end(); ++prc) {
-                               (*prc).disconnect();
-                       }
-                       rec_data_ready_connections.clear();
+                       rec_data_ready_connections.drop_connections ();
 
                        rec_updating = false;
                        rec_active = false;
@@ -575,7 +566,7 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t
                                                gdouble xend = _trackview.editor().frame_to_pixel (region->position() + region->length());
                                                rect->property_x2() = xend;
 
-                                               ARDOUR::BeatsFramesConverter tconv(_trackview.session().tempo_map(), region->position());
+                                               ARDOUR::BeatsFramesConverter tconv(_trackview.session()->tempo_map(), region->position());
                                                const MidiModel::TimeType start_beats = tconv.from(start);
 
                                                /* draw events */
index c8c34e436934045f041f0a97035060d53dee4f19..9344e199430db8947ade7511b71635064e32a158 100644 (file)
@@ -93,7 +93,7 @@ using namespace Editing;
 static const uint32_t MIDI_CONTROLS_BOX_MIN_HEIGHT = 162;
 static const uint32_t KEYBOARD_MIN_HEIGHT = 140;
 
-MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess,
+MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess,
                boost::shared_ptr<Route> rt, Canvas& canvas)
        : AxisView(sess) // virtually inherited
        , RouteTimeAxisView(ed, sess, rt, canvas)
@@ -718,21 +718,21 @@ MidiTimeAxisView::add_region (nframes64_t pos)
 
        nframes64_t start = pos;
        real_editor->snap_to (start, -1);
-       const Meter& m = _session.tempo_map().meter_at(start);
-       const Tempo& t = _session.tempo_map().tempo_at(start);
-       double length = floor (m.frames_per_bar(t, _session.frame_rate()));
+       const Meter& m = _session->tempo_map().meter_at(start);
+       const Tempo& t = _session->tempo_map().tempo_at(start);
+       double length = floor (m.frames_per_bar(t, _session->frame_rate()));
 
        const boost::shared_ptr<MidiDiskstream> diskstream =
                boost::dynamic_pointer_cast<MidiDiskstream>(view()->trackview().track()->diskstream());
 
-       boost::shared_ptr<Source> src = _session.create_midi_source_for_session (*diskstream.get());
+       boost::shared_ptr<Source> src = _session->create_midi_source_for_session (*diskstream.get());
 
        boost::shared_ptr<Region> region = (RegionFactory::create (src, 0, (nframes_t) length,
                                                                   PBD::basename_nosuffix(src->name())));
 
        playlist()->add_region (region, start);
        XMLNode &after = playlist()->get_state();
-       _session.add_command (new MementoCommand<Playlist> (*playlist().get(), &before, &after));
+       _session->add_command (new MementoCommand<Playlist> (*playlist().get(), &before, &after));
 
        real_editor->commit_reversible_command();
 
index 85dcd2b9eaf837b6c968bc0bf4b9415b4ea7d021..a24ae43f101fde174eb1144db0c1b6905c8b381a 100644 (file)
@@ -57,7 +57,7 @@ class PianoRollHeader;
 class MidiTimeAxisView : public RouteTimeAxisView
 {
   public:
-       MidiTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
+       MidiTimeAxisView (PublicEditor&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
        virtual ~MidiTimeAxisView ();
 
        MidiStreamView* midi_view();
index 01f67c51fedf2c0d67f099ca39dbffc8122bed35..bfbdb6ac6e1040abe9b5b38dc48e17ec3c8813cb 100644 (file)
@@ -73,12 +73,12 @@ sigc::signal<void,boost::shared_ptr<Route> > MixerStrip::SwitchIO;
 
 int MixerStrip::scrollbar_height = 0;
 
-MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer)
+MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
        : AxisView(sess)
        , RouteUI (sess)
        ,_mixer(mx)
        , _mixer_owned (in_mixer)
-       , processor_box (sess, sigc::mem_fun(*this, &MixerStrip::plugin_selector), mx.selection(), this, in_mixer)
+       , processor_box (sess, boost::bind (&MixerStrip::plugin_selector, this), mx.selection(), this, in_mixer)
        , gpm (sess, 250)
        , panners (sess)
        , _mono_button (_("Mono"))
@@ -99,7 +99,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer)
        }
 }
 
-MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
+MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt, bool in_mixer)
        : AxisView(sess)
        , RouteUI (sess)
        ,_mixer(mx)
@@ -257,8 +257,8 @@ MixerStrip::init ()
        _packed = false;
        _embedded = false;
 
-       _session.engine().Stopped.connect (sigc::mem_fun(*this, &MixerStrip::engine_stopped));
-       _session.engine().Running.connect (sigc::mem_fun(*this, &MixerStrip::engine_running));
+       _session->engine().Stopped.connect (sigc::mem_fun(*this, &MixerStrip::engine_stopped));
+       _session->engine().Running.connect (sigc::mem_fun(*this, &MixerStrip::engine_running));
 
        input_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::input_press), false);
        output_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::output_press), false);
@@ -312,7 +312,7 @@ MixerStrip::init ()
 
 MixerStrip::~MixerStrip ()
 {
-       GoingAway(); /* EMIT_SIGNAL */
+       drop_references ();
 
        delete input_selector;
        delete output_selector;
@@ -363,10 +363,10 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
 
                boost::shared_ptr<AudioTrack> at = audio_track();
 
-               connections.push_back (at->FreezeChange.connect (sigc::mem_fun(*this, &MixerStrip::map_frozen)));
+               connections.add_connection (at->FreezeChange.connect (sigc::mem_fun(*this, &MixerStrip::map_frozen)));
 
                button_table.attach (*rec_enable_button, 0, 2, 2, 3);
-               rec_enable_button->set_sensitive (_session.writable());
+               rec_enable_button->set_sensitive (_session->writable());
                rec_enable_button->show();
 
        } else if (!is_track()) {
@@ -412,31 +412,22 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
                                                   _("Click to Add/Edit Comments"):
                                                   _route->comment());
 
-       connections.push_back (_route->meter_change.connect (
-                       sigc::mem_fun(*this, &MixerStrip::meter_changed)));
-       connections.push_back (_route->input()->changed.connect (
-                       sigc::mem_fun(*this, &MixerStrip::input_changed)));
-       connections.push_back (_route->output()->changed.connect (
-                       sigc::mem_fun(*this, &MixerStrip::output_changed)));
-       connections.push_back (_route->route_group_changed.connect (
-                       sigc::mem_fun(*this, &MixerStrip::route_group_changed)));
+       connections.add_connection (_route->meter_change.connect (sigc::mem_fun(*this, &MixerStrip::meter_changed)));
+       connections.add_connection (_route->input()->changed.connect (sigc::mem_fun(*this, &MixerStrip::input_changed)));
+       connections.add_connection (_route->output()->changed.connect (sigc::mem_fun(*this, &MixerStrip::output_changed)));
+       connections.add_connection (_route->route_group_changed.connect (sigc::mem_fun(*this, &MixerStrip::route_group_changed)));
 
        if (_route->panner()) {
-               connections.push_back (_route->panner()->Changed.connect (
-                       sigc::mem_fun(*this, &MixerStrip::connect_to_pan)));
+               connections.add_connection (_route->panner()->Changed.connect (sigc::mem_fun(*this, &MixerStrip::connect_to_pan)));
        }
 
        if (is_audio_track()) {
-               connections.push_back (audio_track()->DiskstreamChanged.connect (
-                       sigc::mem_fun(*this, &MixerStrip::diskstream_changed)));
+               connections.add_connection (audio_track()->DiskstreamChanged.connect (sigc::mem_fun(*this, &MixerStrip::diskstream_changed)));
        }
 
-       connections.push_back (_route->NameChanged.connect (
-                       sigc::mem_fun(*this, &RouteUI::name_changed)));
-       connections.push_back (_route->comment_changed.connect (
-                       sigc::mem_fun(*this, &MixerStrip::comment_changed)));
-       connections.push_back (_route->gui_changed.connect (
-                       sigc::mem_fun(*this, &MixerStrip::route_gui_changed)));
+       connections.add_connection (_route->NameChanged.connect (sigc::mem_fun(*this, &RouteUI::name_changed)));
+       connections.add_connection (_route->comment_changed.connect (sigc::mem_fun(*this, &MixerStrip::comment_changed)));
+       connections.add_connection (_route->gui_changed.connect (sigc::mem_fun(*this, &MixerStrip::route_gui_changed)));
 
        set_stuff_from_route ();
 
@@ -631,7 +622,7 @@ gint
 MixerStrip::output_press (GdkEventButton *ev)
 {
         using namespace Menu_Helpers;
-       if (!_session.engine().connected()) {
+       if (!_session->engine().connected()) {
                MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
                msg.run ();
                return true;
@@ -655,7 +646,7 @@ MixerStrip::output_press (GdkEventButton *ev)
 
                ARDOUR::BundleList current = _route->output()->bundles_connected ();
 
-               boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
+               boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
 
                /* give user bundles first chance at being in the menu */
                
@@ -671,7 +662,7 @@ MixerStrip::output_press (GdkEventButton *ev)
                        }
                }
                
-               boost::shared_ptr<ARDOUR::RouteList> routes = _session.get_routes ();
+               boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
                for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
                        maybe_add_bundle_to_output_menu ((*i)->input()->bundle(), current);
                }
@@ -709,7 +700,7 @@ MixerStrip::edit_output_configuration ()
                        output = _route->output ();
                }
                
-               output_selector = new IOSelectorWindow (&_session, output);
+               output_selector = new IOSelectorWindow (_session, output);
        }
 
        if (output_selector->is_visible()) {
@@ -723,7 +714,7 @@ void
 MixerStrip::edit_input_configuration ()
 {
        if (input_selector == 0) {
-               input_selector = new IOSelectorWindow (&_session, _route->input());
+               input_selector = new IOSelectorWindow (_session, _route->input());
        }
 
        if (input_selector->is_visible()) {
@@ -742,7 +733,7 @@ MixerStrip::input_press (GdkEventButton *ev)
        input_menu.set_name ("ArdourContextMenu");
        citems.clear();
 
-       if (!_session.engine().connected()) {
+       if (!_session->engine().connected()) {
                MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
                msg.run ();
                return true;
@@ -762,7 +753,7 @@ MixerStrip::input_press (GdkEventButton *ev)
 
                ARDOUR::BundleList current = _route->input()->bundles_connected ();
 
-               boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
+               boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
 
                /* give user bundles first chance at being in the menu */
                
@@ -778,7 +769,7 @@ MixerStrip::input_press (GdkEventButton *ev)
                        }
                }
                
-               boost::shared_ptr<ARDOUR::RouteList> routes = _session.get_routes ();
+               boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
                for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
                        maybe_add_bundle_to_input_menu ((*i)->output()->bundle(), current);
                }
@@ -990,7 +981,7 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt
        uint32_t io_count;
        uint32_t io_index;
        Port *port;
-       vector<string> connections;
+       vector<string> port_connections;
 
        uint32_t total_connection_count = 0;
        uint32_t io_connection_count = 0;
@@ -1028,13 +1019,13 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt
                } else {
                        port = route->output()->nth (io_index);
                }
-
-               connections.clear ();
-               port->get_connections(connections);
+               
+               port_connections.clear ();
+               port->get_connections(port_connections);
                io_connection_count = 0;
 
-               if (!connections.empty()) {
-                       for (vector<string>::iterator i = connections.begin(); i != connections.end(); ++i) {
+               if (!port_connections.empty()) {
+                       for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
                                string& connection_name (*i);
 
                                if (io_connection_count == 0) {
index d5b247019bb65af68658016a6ad91fca30bcb855..64579e0c33864b9e0c242d00bd3337acaea42241 100644 (file)
@@ -79,8 +79,8 @@ class RouteGroupMenu;
 class MixerStrip : public RouteUI, public Gtk::EventBox
 {
   public:
-       MixerStrip (Mixer_UI&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true);
-       MixerStrip (Mixer_UI&, ARDOUR::Session&, bool in_mixer = true);
+       MixerStrip (Mixer_UI&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true);
+       MixerStrip (Mixer_UI&, ARDOUR::Session*, bool in_mixer = true);
        ~MixerStrip ();
 
        void set_width_enum (Width, void* owner);
@@ -167,8 +167,6 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
 
        std::string longest_label;
 
-       sigc::connection newplug_connection;
-
        gint    mark_update_safe ();
        guint32 mode_switch_in_progress;
 
@@ -216,8 +214,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
        void input_changed (ARDOUR::IOChange, void *);
        void output_changed (ARDOUR::IOChange, void *);
 
-       sigc::connection panstate_connection;
-       sigc::connection panstyle_connection;
+       boost::signals2::scoped_connection panstate_connection;
+       boost::signals2::scoped_connection panstyle_connection;
        void connect_to_pan ();
 
        void update_diskstream_display ();
@@ -267,7 +265,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
        void revert_to_default_display ();
 
        void drop_send ();
-       sigc::connection send_gone_connection;
+       boost::signals2::scoped_connection send_gone_connection;
 
        void reset_strip_style ();
 
index 12dde081af982391d0574e3dc95e936abb3f5139..9ec05c020ceb0a77814ffc4841bf4ad65bf1cce1 100644 (file)
@@ -64,7 +64,6 @@ using PBD::atoi;
 Mixer_UI::Mixer_UI ()
        : Window (Gtk::WINDOW_TOPLEVEL)
 {
-       session = 0;
        _strip_width = Config->get_default_narrow_ms() ? Narrow : Wide;
        track_menu = 0;
        route_group_context_menu = 0;
@@ -313,7 +312,7 @@ Mixer_UI::add_strip (RouteList& routes)
                        return;
                }
 
-               strip = new MixerStrip (*this, *session, route);
+               strip = new MixerStrip (*this, _session, route);
                strips.push_back (strip);
 
                Config->get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide;
@@ -336,7 +335,7 @@ Mixer_UI::add_strip (RouteList& routes)
 
                route->NameChanged.connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_name_changed), strip));
 
-               strip->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::remove_strip), strip));
+               scoped_connect (strip->GoingAway, boost::bind (&Mixer_UI::remove_strip, this, strip));
                strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed));
                strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
        }
@@ -379,7 +378,7 @@ Mixer_UI::sync_order_keys (string const & src)
        TreeModel::Children rows = track_model->children();
        TreeModel::Children::iterator ri;
 
-       if (src == N_("signal") || !session || (session->state_of_the_state() & (Session::Loading|Session::Deletion)) || rows.empty()) {
+       if (src == N_("signal") || !_session || (_session->state_of_the_state() & (Session::Loading|Session::Deletion)) || rows.empty()) {
                return;
        }
 
@@ -452,14 +451,24 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
 }
 
 void
-Mixer_UI::connect_to_session (Session* sess)
+Mixer_UI::set_session (Session* sess)
 {
-       session = sess;
+       SessionHandlePtr::set_session (sess);
+
+       if (_plugin_selector) {
+               _plugin_selector->set_session (_session);
+       }
+
+       _group_tabs->set_session (sess);
+
+       if (!_session) {
+               return;
+       }
 
        XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
        set_state (*node);
 
-       WindowTitle title(session->name());
+       WindowTitle title(_session->name());
        title += _("Mixer");
        title += Glib::get_application_name();
 
@@ -467,30 +476,24 @@ Mixer_UI::connect_to_session (Session* sess)
 
        initial_track_display ();
 
-       session->GoingAway.connect (sigc::mem_fun(*this, &Mixer_UI::disconnect_from_session));
-       session->RouteAdded.connect (sigc::mem_fun(*this, &Mixer_UI::add_strip));
-       session->route_group_added.connect (sigc::mem_fun(*this, &Mixer_UI::add_route_group));
-       session->route_group_removed.connect (sigc::mem_fun(*this, &Mixer_UI::route_groups_changed));
-       session->config.ParameterChanged.connect (sigc::mem_fun (*this, &Mixer_UI::parameter_changed));
+       _session_connections.add_connection (_session->RouteAdded.connect (boost::bind (&Mixer_UI::add_strip, this, _1)));
+       _session_connections.add_connection (_session->route_group_added.connect (boost::bind (&Mixer_UI::add_route_group, this, _1)));
+       _session_connections.add_connection (_session->route_group_removed.connect (boost::bind (&Mixer_UI::route_groups_changed, this)));
+       _session_connections.add_connection (_session->config.ParameterChanged.connect (boost::bind (&Mixer_UI::parameter_changed, this, _1)));
 
        route_groups_changed ();
 
-       if (_plugin_selector)
-               _plugin_selector->set_session (session);
-
        if (_visible) {
               show_window();
        }
 
-       _group_tabs->connect_to_session (sess);
-
        start_updating ();
 }
 
 void
-Mixer_UI::disconnect_from_session ()
+Mixer_UI::session_going_away ()
 {
-       ENSURE_GUI_THREAD (*this, &Mixer_UI::disconnect_from_session)
+       ENSURE_GUI_THREAD (*this, &Mixer_UI::session_going_away)
 
        group_model->clear ();
        _selection.clear ();
@@ -500,6 +503,8 @@ Mixer_UI::disconnect_from_session ()
        set_title (title.get_string());
 
        stop_updating ();
+
+       SessionHandlePtr::session_going_away ();
 }
 
 void
@@ -551,7 +556,7 @@ Mixer_UI::stop_updating ()
 void
 Mixer_UI::fast_update_strips ()
 {
-       if (is_mapped () && session) {
+       if (is_mapped () && _session) {
                for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
                        (*i)->fast_update ();
                }
@@ -670,7 +675,7 @@ void
 Mixer_UI::track_list_reorder (const TreeModel::Path&, const TreeModel::iterator&, int* /*new_order*/)
 {
        strip_redisplay_does_not_sync_order_keys = true;
-       session->set_remote_control_ids();
+       _session->set_remote_control_ids();
        redisplay_track_list ();
        strip_redisplay_does_not_sync_order_keys = false;
 }
@@ -680,7 +685,7 @@ Mixer_UI::track_list_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::
 {
        // never reset order keys because of a property change
        strip_redisplay_does_not_reset_order_keys = true;
-       session->set_remote_control_ids();
+       _session->set_remote_control_ids();
        redisplay_track_list ();
        strip_redisplay_does_not_reset_order_keys = false;
 }
@@ -689,8 +694,10 @@ void
 Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&)
 {
        /* this could require an order sync */
-       session->set_remote_control_ids();
-       redisplay_track_list ();
+       if (_session && !_session->deletion_in_progress()) {
+               _session->set_remote_control_ids();
+               redisplay_track_list ();
+       }
 }
 
 void
@@ -757,7 +764,7 @@ Mixer_UI::redisplay_track_list ()
        }
 
        if (!strip_redisplay_does_not_reset_order_keys && !strip_redisplay_does_not_sync_order_keys) {
-               session->sync_order_keys (N_("signal"));
+               _session->sync_order_keys (N_("signal"));
        }
 
        // Resigc::bind all of the midi controls automatically
@@ -887,7 +894,7 @@ struct SignalOrderRouteSorter {
 void
 Mixer_UI::initial_track_display ()
 {
-       boost::shared_ptr<RouteList> routes = session->get_routes();
+       boost::shared_ptr<RouteList> routes = _session->get_routes();
        RouteList copy (*routes);
        SignalOrderRouteSorter sorter;
 
@@ -1076,13 +1083,13 @@ Mixer_UI::group_display_button_press (GdkEventButton* ev)
 void
 Mixer_UI::activate_all_route_groups ()
 {
-       session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), true));
+       _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), true));
 }
 
 void
 Mixer_UI::disable_all_route_groups ()
 {
-       session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), false));
+       _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), false));
 }
 
 void
@@ -1102,13 +1109,13 @@ Mixer_UI::route_groups_changed ()
                row[group_columns.group] = 0;
        }
 
-       session->foreach_route_group (sigc::mem_fun (*this, &Mixer_UI::add_route_group));
+       _session->foreach_route_group (sigc::mem_fun (*this, &Mixer_UI::add_route_group));
 }
 
 void
 Mixer_UI::new_route_group ()
 {
-       session->add_route_group (new RouteGroup (*session, "", RouteGroup::Active, (RouteGroup::Property) (RouteGroup::Gain |RouteGroup::Mute | RouteGroup::Solo)));
+       _session->add_route_group (new RouteGroup (*_session, "", RouteGroup::Active, (RouteGroup::Property) (RouteGroup::Gain |RouteGroup::Mute | RouteGroup::Solo)));
 }
 
 void
@@ -1131,7 +1138,7 @@ Mixer_UI::remove_selected_route_group ()
                RouteGroup* rg = (*iter)[group_columns.group];
 
                if (rg) {
-                       session->remove_route_group (*rg);
+                       _session->remove_route_group (*rg);
                }
        }
 }
@@ -1541,7 +1548,7 @@ void
 Mixer_UI::parameter_changed (string const & p)
 {
        if (p == "show-group-tabs") {
-               bool const s = session->config.get_show_group_tabs ();
+               bool const s = _session->config.get_show_group_tabs ();
                if (s) {
                        _group_tabs->show ();
                } else {
index 2945e008588052354203a968a3f46dccbcb3d438..275c0151cda839b8198878cd27ae1da288dfc114 100644 (file)
 #include <gtkmm/treeview.h>
 
 #include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
 
 #include "ardour/ardour.h"
+#include "ardour/session_handle.h"
 
 #include "route_processor_selection.h"
 #include "enums.h"
@@ -42,7 +44,6 @@
 namespace ARDOUR {
        class Route;
        class RouteGroup;
-       class Session;
        class AudioDiskstream;
 };
 
@@ -50,13 +51,13 @@ class MixerStrip;
 class PluginSelector;
 class MixerGroupTabs;
 
-class Mixer_UI : public Gtk::Window
+class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
 {
   public:
        Mixer_UI ();
        ~Mixer_UI();
 
-       void connect_to_session (ARDOUR::Session *);
+       void set_session (ARDOUR::Session *);
 
        PluginSelector* plugin_selector();
 
@@ -81,8 +82,6 @@ class Mixer_UI : public Gtk::Window
        RouteRedirectSelection& selection() { return _selection; }
 
   private:
-       ARDOUR::Session         *session;
-
        bool                                    _visible;
 
        Gtk::HBox                               global_hpacker;
@@ -146,7 +145,7 @@ class Mixer_UI : public Gtk::Window
        gint start_updating ();
        gint stop_updating ();
 
-       void disconnect_from_session ();
+       void session_going_away ();
 
        sigc::connection fast_screen_update_connection;
        void fast_update_strips ();
index 3c2cfafdfed6ca250a9ef598b51f0ae8bea85ef0..7e80c9e641317bbbf3fcb528a188194465d2ccf3 100644 (file)
@@ -48,19 +48,20 @@ using namespace Gtk;
 
 const int PannerUI::pan_bar_height = 30;
 
-PannerUI::PannerUI (Session& s)
-       : _session (s),
-         _current_nouts (-1),
-         _current_npans (-1),
-         hAdjustment(0.0, 0.0, 0.0),
-         vAdjustment(0.0, 0.0, 0.0),
-         panning_viewport(hAdjustment, vAdjustment),
-         panning_up_arrow (Gtk::ARROW_UP, Gtk::SHADOW_OUT),
-         panning_down_arrow (Gtk::ARROW_DOWN, Gtk::SHADOW_OUT),
-         panning_link_button (_("link")),
-         pan_automation_style_button (""),
-         pan_automation_state_button ("")
-{
+PannerUI::PannerUI (Session* s)
+       : _current_nouts (-1)
+       , _current_npans (-1)
+       , hAdjustment(0.0, 0.0, 0.0)
+       , vAdjustment(0.0, 0.0, 0.0)
+       , panning_viewport(hAdjustment, vAdjustment)
+       , panning_up_arrow (Gtk::ARROW_UP, Gtk::SHADOW_OUT)
+       , panning_down_arrow (Gtk::ARROW_DOWN, Gtk::SHADOW_OUT)
+       , panning_link_button (_("link"))
+       , pan_automation_style_button ("")
+       , pan_automation_state_button ("")
+{
+       set_session (s);
+
        ignore_toggle = false;
        pan_menu = 0;
        pan_astate_menu = 0;
@@ -133,7 +134,7 @@ PannerUI::PannerUI (Session& s)
 void
 PannerUI::set_panner (boost::shared_ptr<Panner> p)
 {
-       connections.clear ();
+       connections.drop_connections ();
 
        delete pan_astyle_menu;
        pan_astyle_menu = 0;
@@ -150,9 +151,9 @@ PannerUI::set_panner (boost::shared_ptr<Panner> p)
                return;
        }
 
-       connections.push_back (_panner->Changed.connect (sigc::mem_fun(*this, &PannerUI::panner_changed)));
-       connections.push_back (_panner->LinkStateChanged.connect (sigc::mem_fun(*this, &PannerUI::update_pan_linkage)));
-       connections.push_back (_panner->StateChanged.connect (sigc::mem_fun(*this, &PannerUI::update_pan_state)));
+       connections.add_connection (_panner->Changed.connect (sigc::mem_fun(*this, &PannerUI::panner_changed)));
+       connections.add_connection (_panner->LinkStateChanged.connect (sigc::mem_fun(*this, &PannerUI::update_pan_linkage)));
+       connections.add_connection (_panner->StateChanged.connect (sigc::mem_fun(*this, &PannerUI::update_pan_state)));
 
        setup_pan ();
 
@@ -644,7 +645,7 @@ PannerUI::pan_adjustment_changed (uint32_t which)
                           the panner objects have no access to the session,
                           so do this here. ick.
                        */
-                       _session.set_dirty();
+                       _session->set_dirty();
                }
        }
 }
index bebffec6c00d532501d1d7b80a2b43e0bb2ddff4..de889471aad9fe3a80c979ac3a92db90c115e8ee 100644 (file)
@@ -33,6 +33,8 @@
 #include <gtkmm2ext/click_box.h>
 #include <gtkmm2ext/slider_controller.h>
 
+#include "ardour/session_handle.h"
+
 #include "enums.h"
 
 class Panner2d;
@@ -53,10 +55,10 @@ namespace Gtk {
        class Menuitem;
 }
 
-class PannerUI : public Gtk::HBox
+class PannerUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr
 {
   public:
-       PannerUI (ARDOUR::Session&);
+       PannerUI (ARDOUR::Session*);
        ~PannerUI ();
 
        virtual void set_panner (boost::shared_ptr<ARDOUR::Panner>);
@@ -80,8 +82,7 @@ class PannerUI : public Gtk::HBox
        friend class MixerStrip;
 
        boost::shared_ptr<ARDOUR::Panner> _panner;
-       ARDOUR::Session& _session;
-       std::vector<sigc::connection> connections;
+       PBD::ScopedConnectionList connections;
 
        bool ignore_toggle;
        bool in_pan_update;
index abf249fb3d6ddb1f99f92f1a71e271f0fead3c44..aa678e80a3f765cfa6b7a986f0864da3bee51638 100644 (file)
@@ -111,7 +111,7 @@ PlaylistSelector::show_for (RouteUI* ruix)
 
        model->clear ();
 
-       session->playlists->foreach (this, &PlaylistSelector::add_playlist_to_map);
+       _session->playlists->foreach (this, &PlaylistSelector::add_playlist_to_map);
 
        this_ds = rui->get_diskstream();
 
@@ -123,7 +123,7 @@ PlaylistSelector::show_for (RouteUI* ruix)
 
        for (DSPL_Map::iterator x = dspl_map.begin(); x != dspl_map.end(); ++x) {
 
-               boost::shared_ptr<Diskstream> ds = session->diskstream_by_id (x->first);
+               boost::shared_ptr<Diskstream> ds = _session->diskstream_by_id (x->first);
 
                if (ds == 0) {
                        continue;
@@ -179,7 +179,7 @@ PlaylistSelector::show_for (RouteUI* ruix)
 
        // Add unassigned (imported) playlists to the list
        list<boost::shared_ptr<Playlist> > unassigned;
-       session->playlists->unassigned (unassigned);
+       _session->playlists->unassigned (unassigned);
 
        TreeModel::Row row;
        TreeModel::Row* selected_row = 0;
@@ -235,18 +235,6 @@ PlaylistSelector::add_playlist_to_map (boost::shared_ptr<Playlist> pl)
        x->second->push_back (pl);
 }
 
-void
-PlaylistSelector::set_session (Session* s)
-{
-       ENSURE_GUI_THREAD (*this, &PlaylistSelector::set_session, s)
-
-       session = s;
-
-       if (session) {
-               session->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &PlaylistSelector::set_session), static_cast<Session*> (0)));
-       }
-}
-
 void
 PlaylistSelector::close_button_click ()
 {
index 828607284f37adcc622e4961045c0903bc3f2570..d0b36fae48c228ade07b334744805dcfab2ca39b 100644 (file)
@@ -29,6 +29,7 @@
 #include <gtkmm2ext/selector.h>
 
 #include "ardour_dialog.h"
+#include "ardour/session_handle.h"
 
 namespace ARDOUR {
        class Session;
@@ -44,7 +45,6 @@ class PlaylistSelector : public ArdourDialog
        PlaylistSelector ();
        ~PlaylistSelector ();
 
-       void set_session (ARDOUR::Session*);
        void show_for (RouteUI*);
 
   protected:
@@ -53,7 +53,6 @@ class PlaylistSelector : public ArdourDialog
   private:
        typedef std::map<PBD::ID,std::list<boost::shared_ptr<ARDOUR::Playlist> >*> DSPL_Map;
 
-       ARDOUR::Session* session;
        Gtk::ScrolledWindow scroller;
        DSPL_Map dspl_map;
        RouteUI* rui;
index 32e43b20dadf930a1abfbd6f97998ad8b381af22..35befc0d697850fb30764c1e21b03d1c8f722404 100644 (file)
@@ -72,7 +72,6 @@ PluginSelector::PluginSelector (PluginManager *mgr)
 
        _plugin_menu = 0;
        manager = mgr;
-       session = 0;
        in_row_change = false;
 
        manager->PluginListChanged.connect (sigc::mem_fun (*this, &PluginSelector::build_plugin_menu));
@@ -205,18 +204,6 @@ PluginSelector::row_clicked(GdkEventButton* event)
                btn_add_clicked();
 }
 
-void
-PluginSelector::set_session (Session* s)
-{
-       ENSURE_GUI_THREAD (*this, &PluginSelector::set_session, s)
-
-       session = s;
-
-       if (session) {
-               session->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &PluginSelector::set_session), static_cast<Session*> (0)));
-       }
-}
-
 bool
 PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& filterstr)
 {
@@ -384,11 +371,11 @@ PluginSelector::au_refiller (const std::string&)
 PluginPtr
 PluginSelector::load_plugin (PluginInfoPtr pi)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return PluginPtr();
        }
 
-       return pi->load (*session);
+       return pi->load (*_session);
 }
 
 void
index 06e746853fa4d06390e4266f48cd79352de92367..7e0c66b60f78c33f1caa836cb4cd68a52d4954c5 100644 (file)
@@ -26,6 +26,7 @@
 #include <gtkmm2ext/selector.h>
 
 #include "ardour/plugin.h"
+#include "ardour/session_handle.h"
 #include "plugin_interest.h"
 
 namespace ARDOUR {
@@ -43,7 +44,6 @@ class PluginSelector : public ArdourDialog
 
        int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ?
 
-       void set_session (ARDOUR::Session*);
        void on_show ();
 
        Gtk::Menu* plugin_menu ();
@@ -52,7 +52,6 @@ class PluginSelector : public ArdourDialog
   private:
        PluginInterestedObject* interested_object;
 
-       ARDOUR::Session* session;
        Gtk::ScrolledWindow scroller;   // Available plugins
        Gtk::ScrolledWindow ascroller;  // Added plugins
 
index cb7491917c0b6e536cdb3ab8b3c092b12c0988f8..dd2b0b204de49163ffb7a5157b69dac04eccebca 100644 (file)
@@ -415,8 +415,8 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
 
        plugin_analysis_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_plugin_analysis));
        plugin_analysis_expander.set_expanded(false);
-
-       insert->GoingAway.connect (sigc::mem_fun (*this, &PlugUIBase::plugin_going_away));
+       
+       death_connection = insert->GoingAway.connect (sigc::mem_fun (*this, &PlugUIBase::plugin_going_away));
 }
 
 PlugUIBase::~PlugUIBase()
@@ -430,6 +430,7 @@ PlugUIBase::plugin_going_away ()
        /* drop references to the plugin/insert */
        insert.reset ();
        plugin.reset ();
+       death_connection.disconnect ();
 }
 
 void
index 221c1d71f1a302b1c5acc479f23a51559e838ffc..cf1bcd0ed8e435fd40e4e06ee02785ccc1285644 100644 (file)
@@ -121,6 +121,7 @@ class PlugUIBase : public virtual sigc::trackable
        void toggle_plugin_analysis ();
        void processor_active_changed (boost::weak_ptr<ARDOUR::Processor> p);
        void plugin_going_away ();
+       boost::signals2::scoped_connection death_connection;
 };
 
 class GenericPluginUI : public PlugUIBase, public Gtk::VBox
@@ -260,7 +261,7 @@ class PluginUIWindow : public Gtk::Window
   private:
        Glib::ustring _title;
        PlugUIBase* _pluginui;
-       sigc::connection death_connection;
+       boost::signals2::scoped_connection death_connection;
        Gtk::Window* parent;
        Gtk::VBox vbox;
        bool non_gtk_gui;
index 0b89f344548b8666693cbf3bc8c2c4db427f06d7..1b442d279bd70094a9d9fc90b0d25269a508bb43 100644 (file)
@@ -21,6 +21,7 @@
 #define __ardour_gtk_point_selection_h__
 
 #include <list>
+#include <boost/noncopyable.hpp>
 
 #include "automation_selectable.h"
 
index 1d36a52364e85ab5c16cedd78832af6520293715..11e75c1fc34ef79c2ac839c6937b2e0f8ed31c57 100644 (file)
@@ -50,6 +50,14 @@ PortGroup::PortGroup (std::string const & n)
 
 }
 
+PortGroup::~PortGroup()
+{
+       for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
+               delete *i;
+       }
+       _bundles.clear ();
+}
+
 /** Add a bundle to a group.
  *  @param b Bundle.
  *  @param allow_dups true to allow the group to contain more than one bundle with the same port, otherwise false.
@@ -80,6 +88,14 @@ PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io, Gd
        add_bundle_internal (b, io, true, c, false);
 }
 
+PortGroup::BundleRecord::BundleRecord (boost::shared_ptr<ARDOUR::Bundle> b, boost::shared_ptr<ARDOUR::IO> iop, Gdk::Color c, bool has_c)
+       : bundle (b)
+       , io (iop)
+       , colour (c)
+       , has_colour (has_c)
+{
+}
+
 void
 PortGroup::add_bundle_internal (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io, bool has_colour, Gdk::Color colour, bool allow_dups)
 {
@@ -90,7 +106,7 @@ PortGroup::add_bundle_internal (boost::shared_ptr<Bundle> b, boost::shared_ptr<I
                /* don't add this bundle if we already have one with the same ports */
                
                BundleList::iterator i = _bundles.begin ();
-               while (i != _bundles.end() && b->has_same_ports (i->bundle) == false) {
+               while (i != _bundles.end() && b->has_same_ports ((*i)->bundle) == false) {
                        ++i;
                }
                
@@ -99,14 +115,9 @@ PortGroup::add_bundle_internal (boost::shared_ptr<Bundle> b, boost::shared_ptr<I
                }
        }
 
-       BundleRecord r;
-       r.bundle = b;
-       r.io = io;
-       r.colour = colour;
-       r.has_colour = has_colour;
-       r.changed_connection = b->Changed.connect (sigc::mem_fun (*this, &PortGroup::bundle_changed));
-
-       _bundles.push_back (r);
+       BundleRecord* br = new BundleRecord (b, io, colour, has_colour);
+       br->changed_connection = b->Changed.connect (boost::bind (&PortGroup::bundle_changed, this, _1));
+       _bundles.push_back (br);
 
        Changed ();     
 }
@@ -117,7 +128,7 @@ PortGroup::remove_bundle (boost::shared_ptr<Bundle> b)
        assert (b.get());
 
        BundleList::iterator i = _bundles.begin ();
-       while (i != _bundles.end() && i->bundle != b) {
+       while (i != _bundles.end() && (*i)->bundle != b) {
                ++i;
        }
 
@@ -125,7 +136,7 @@ PortGroup::remove_bundle (boost::shared_ptr<Bundle> b)
                return;
        }
 
-       i->changed_connection.disconnect ();
+       delete *i;
        _bundles.erase (i);
 
        Changed ();
@@ -142,7 +153,7 @@ void
 PortGroup::clear ()
 {
        for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
-               i->changed_connection.disconnect ();
+               delete *i;
        }
 
        _bundles.clear ();
@@ -153,7 +164,7 @@ bool
 PortGroup::has_port (std::string const& p) const
 {
        for (BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
-               if (i->bundle->offers_port_alone (p)) {
+               if ((*i)->bundle->offers_port_alone (p)) {
                        return true;
                }
        }
@@ -165,7 +176,7 @@ boost::shared_ptr<Bundle>
 PortGroup::only_bundle ()
 {
        assert (_bundles.size() == 1);
-       return _bundles.front().bundle;
+       return _bundles.front()->bundle;
 }
 
 
@@ -174,7 +185,7 @@ PortGroup::total_channels () const
 {
        uint32_t n = 0;
        for (BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
-               n += i->bundle->nchannels ();
+               n += (*i)->bundle->nchannels ();
        }
 
        return n;
@@ -184,7 +195,7 @@ boost::shared_ptr<IO>
 PortGroup::io_from_bundle (boost::shared_ptr<ARDOUR::Bundle> b) const
 {
        BundleList::const_iterator i = _bundles.begin ();
-       while (i != _bundles.end() && i->bundle != b) {
+       while (i != _bundles.end() && (*i)->bundle != b) {
                ++i;
        }
 
@@ -192,7 +203,7 @@ PortGroup::io_from_bundle (boost::shared_ptr<ARDOUR::Bundle> b) const
                return boost::shared_ptr<IO> ();
        }
 
-       return i->io;
+       return (*i)->io;
 }
 
 
@@ -204,6 +215,11 @@ PortGroupList::PortGroupList ()
 
 }
 
+PortGroupList::~PortGroupList() 
+{
+       /* XXX need to clean up bundles, but ownership shared with PortGroups */
+}
+
 void
 PortGroupList::set_type (DataType t)
 {
@@ -272,7 +288,7 @@ PortGroupList::gather (ARDOUR::Session* session, bool inputs, bool allow_dups)
 
                route_bundles.push_back (io->bundle ());
 
-               (*i)->foreach_processor (sigc::bind (sigc::mem_fun (*this, &PortGroupList::maybe_add_processor_to_list), &route_bundles, inputs, used_io));
+               (*i)->foreach_processor (boost::bind (&PortGroupList::maybe_add_processor_to_list, this, _1, &route_bundles, inputs, used_io));
 
                /* Work out which group to put these bundles in */
                boost::shared_ptr<PortGroup> g;
@@ -463,13 +479,7 @@ void
 PortGroupList::clear ()
 {
        _groups.clear ();
-
-       for (std::vector<sigc::connection>::iterator i = _bundle_changed_connections.begin(); i != _bundle_changed_connections.end(); ++i) {
-               i->disconnect ();
-       }
-
-       _bundle_changed_connections.clear ();
-
+       _bundle_changed_connections.drop_connections ();
        emit_changed ();
 }
 
@@ -513,9 +523,7 @@ PortGroupList::add_group (boost::shared_ptr<PortGroup> g)
 
        g->Changed.connect (sigc::mem_fun (*this, &PortGroupList::emit_changed));
 
-       _bundle_changed_connections.push_back (
-               g->BundleChanged.connect (sigc::mem_fun (*this, &PortGroupList::emit_bundle_changed))
-               );
+       _bundle_changed_connections.add_connection (g->BundleChanged.connect (sigc::mem_fun (*this, &PortGroupList::emit_bundle_changed)));
 
        emit_changed ();
 }
index 1fcceb4c192fbecc80f1aa42b544db3d18c4ce33..ebab997699d2a8b07b4bd684a2c4d70db9017175 100644 (file)
 #include <vector>
 #include <string>
 #include <set>
+#include <boost/shared_ptr.hpp>
+#include <boost/signals2.hpp>
+
 #include <gtkmm/widget.h>
 #include <gtkmm/checkbutton.h>
-#include <boost/shared_ptr.hpp>
+
 #include "ardour/data_type.h"
 #include "ardour/types.h"
 
@@ -47,6 +50,7 @@ class PortGroup : public sigc::trackable
 {
 public:
        PortGroup (std::string const & n);
+       ~PortGroup ();
 
        void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, bool allow_dups = false);
        void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO> io);
@@ -65,19 +69,21 @@ public:
        sigc::signal<void> Changed;
 
        /** An individual bundle on our list has changed in some way */
-       sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
+       boost::signals2::signal<void(ARDOUR::Bundle::Change)> BundleChanged;
 
        struct BundleRecord {
-               boost::shared_ptr<ARDOUR::Bundle> bundle;
-               /** IO whose ports are in the bundle, or 0.  This is so that we can do things like adding
-                   ports to the IO from matrix editor menus. */
-               boost::shared_ptr<ARDOUR::IO> io; 
-               Gdk::Color colour;
-               bool has_colour;
-               sigc::connection changed_connection;
+           boost::shared_ptr<ARDOUR::Bundle> bundle;
+           /** IO whose ports are in the bundle, or 0.  This is so that we can do things like adding
+               ports to the IO from matrix editor menus. */
+           boost::shared_ptr<ARDOUR::IO> io; 
+           Gdk::Color colour;
+           bool has_colour;
+           boost::signals2::scoped_connection changed_connection;
+
+           BundleRecord (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, Gdk::Color, bool has_colour);
        };
 
-       typedef std::list<BundleRecord> BundleList;
+       typedef std::list<BundleRecord*> BundleList;
 
        BundleList const & bundles () const {
                return _bundles;
@@ -95,6 +101,7 @@ class PortGroupList : public sigc::trackable
 {
   public:
        PortGroupList ();
+       ~PortGroupList();
 
        typedef std::vector<boost::shared_ptr<PortGroup> > List;
 
@@ -125,10 +132,10 @@ class PortGroupList : public sigc::trackable
        bool empty () const;
 
        /** The group list has changed in some way; a group has been added or removed, or the list cleared etc. */
-       sigc::signal<void> Changed;
+       boost::signals2::signal<void()> Changed;
 
        /** A bundle in one of our groups has changed */
-       sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
+       boost::signals2::signal<void(ARDOUR::Bundle::Change)> BundleChanged;
 
   private:
        bool port_has_prefix (std::string const &, std::string const &) const;
@@ -144,7 +151,7 @@ class PortGroupList : public sigc::trackable
        ARDOUR::DataType _type;
        mutable PortGroup::BundleList _bundles;
        List _groups;
-       std::vector<sigc::connection> _bundle_changed_connections;
+       PBD::ScopedConnectionList _bundle_changed_connections;
        bool _signals_suspended;
        bool _pending_change;
        ARDOUR::Bundle::Change _pending_bundle_change;
index b9285de7c7924b57213c63cae57f0248f908c29f..9d5187ca2e1204d7ee4f9e5e71226c1bf38ad753 100644 (file)
@@ -45,19 +45,20 @@ using namespace ARDOUR;
  *  @param type Port type that we are handling.
  */
 PortMatrix::PortMatrix (Window* parent, Session* session, DataType type)
-       : Table (3, 3),
-         _session (session),
-         _parent (parent),
-         _type (type),
-         _menu (0),
-         _arrangement (TOP_TO_RIGHT),
-         _row_index (0),
-         _column_index (1),
-         _min_height_divisor (1),
-         _show_only_bundles (false),
-         _inhibit_toggle_show_only_bundles (false),
-         _ignore_notebook_page_selected (false)
-{
+       : Table (3, 3)
+       , _parent (parent)
+       , _type (type)
+       , _menu (0)
+       , _arrangement (TOP_TO_RIGHT)
+       , _row_index (0)
+       , _column_index (1)
+       , _min_height_divisor (1)
+       , _show_only_bundles (false)
+       , _inhibit_toggle_show_only_bundles (false)
+       , _ignore_notebook_page_selected (false)
+{
+       set_session (session);
+
        _body = new PortMatrixBody (this);
        _body->DimensionsChanged.connect (sigc::mem_fun (*this, &PortMatrix::body_dimensions_changed));
 
@@ -148,15 +149,13 @@ PortMatrix::init ()
        /* Part 2: notice when things have changed that require our subclass to clear and refill _ports[] */
        
        /* watch for routes being added or removed */
-       _session->RouteAdded.connect (sigc::hide (sigc::mem_fun (*this, &PortMatrix::routes_changed)));
+       _session_connections.add_connection (_session->RouteAdded.connect (boost::bind (&PortMatrix::routes_changed, this)));
 
        /* and also bundles */
-       _session->BundleAdded.connect (sigc::hide (sigc::mem_fun (*this, &PortMatrix::setup_global_ports)));
+       _session_connections.add_connection (_session->BundleAdded.connect (boost::bind (&PortMatrix::setup_global_ports, this)));
 
        /* and also ports */
-       _session->engine().PortRegisteredOrUnregistered.connect (sigc::mem_fun (*this, &PortMatrix::setup_global_ports));
-
-       _session->GoingAway.connect (sigc::mem_fun (*this, &PortMatrix::session_going_away));
+       _session_connections.add_connection (_session->engine().PortRegisteredOrUnregistered.connect (boost::bind (&PortMatrix::setup_global_ports, this)));
 
        reconnect_to_routes ();
        
@@ -167,16 +166,11 @@ PortMatrix::init ()
 void
 PortMatrix::reconnect_to_routes ()
 {
-       for (vector<sigc::connection>::iterator i = _route_connections.begin(); i != _route_connections.end(); ++i) {
-               i->disconnect ();
-       }
-       _route_connections.clear ();
+       _route_connections.drop_connections ();
 
        boost::shared_ptr<RouteList> routes = _session->get_routes ();
        for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
-               _route_connections.push_back (
-                       (*i)->processors_changed.connect (sigc::mem_fun (*this, &PortMatrix::route_processors_changed))
-                       );
+               _route_connections.add_connection ((*i)->processors_changed.connect (sigc::mem_fun (*this, &PortMatrix::route_processors_changed)));
        }
 }
 
@@ -261,13 +255,13 @@ PortMatrix::disassociate_all ()
        PortGroup::BundleList b = _ports[1].bundles ();
 
        for (PortGroup::BundleList::iterator i = a.begin(); i != a.end(); ++i) {
-               for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
+               for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
                        for (PortGroup::BundleList::iterator k = b.begin(); k != b.end(); ++k) {
-                               for (uint32_t l = 0; l < k->bundle->nchannels(); ++l) {
+                               for (uint32_t l = 0; l < (*k)->bundle->nchannels(); ++l) {
 
                                        BundleChannel c[2] = {
-                                               BundleChannel (i->bundle, j),
-                                               BundleChannel (k->bundle, l)
+                                               BundleChannel ((*i)->bundle, j),
+                                               BundleChannel ((*k)->bundle, l)
                                                        };
 
                                        if (get_state (c) == PortMatrixNode::ASSOCIATED) {
@@ -493,11 +487,11 @@ PortMatrix::disassociate_all_on_channel (boost::weak_ptr<Bundle> bundle, uint32_
        PortGroup::BundleList a = _ports[1-dim].bundles ();
 
        for (PortGroup::BundleList::iterator i = a.begin(); i != a.end(); ++i) {
-               for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
+               for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
 
                        BundleChannel c[2];
                        c[dim] = BundleChannel (sb, channel);
-                       c[1-dim] = BundleChannel (i->bundle, j);
+                       c[1-dim] = BundleChannel ((*i)->bundle, j);
 
                        if (get_state (c) == PortMatrixNode::ASSOCIATED) {
                                set_state (c, false);
index cfa4cdbadc7fe730493891bcc6794973a0f0edaf..950d5bfd3248b82421f7899537a99c144708477c 100644 (file)
 #include <gtkmm/checkbutton.h>
 #include <gtkmm/notebook.h>
 #include <boost/shared_ptr.hpp>
+
 #include "ardour/bundle.h"
 #include "ardour/types.h"
+#include "ardour/session_handle.h"
+
 #include "port_group.h"
 #include "port_matrix_types.h"
 #include "i18n.h"
@@ -55,7 +58,7 @@ namespace Gtk {
 
 class PortMatrixBody;
 
-class PortMatrix : public Gtk::Table
+class PortMatrix : public Gtk::Table, public ARDOUR::SessionHandlePtr
 {
 public:
        PortMatrix (Gtk::Window*, ARDOUR::Session *, ARDOUR::DataType);
@@ -160,7 +163,6 @@ protected:
            from left to right as you go from list 0 to list 1.  Hence subclasses which deal with
            inputs and outputs should put outputs in list 0 and inputs in list 1. */
        PortGroupList _ports[2];
-       ARDOUR::Session* _session;
 
 private:
 
@@ -190,7 +192,7 @@ private:
 
        /// port type that we are working with
        ARDOUR::DataType _type;
-       std::vector<sigc::connection> _route_connections;
+       PBD::ScopedConnectionList _route_connections;
 
        PortMatrixBody* _body;
        Gtk::HScrollbar _hscroll;
index 847ee2f2caf540ec546e1dcad76e8ad9d2afce9d..f448952c4a5df2af02e5efd81ca4c9a9b610cfcc 100644 (file)
@@ -246,10 +246,7 @@ PortMatrixBody::setup ()
 {
        /* Discard any old connections to bundles */
 
-       for (list<sigc::connection>::iterator i = _bundle_connections.begin(); i != _bundle_connections.end(); ++i) {
-               i->disconnect ();
-       }
-       _bundle_connections.clear ();
+       _bundle_connections.drop_connections ();
 
        /* Connect to bundles so that we find out when their names change */
 
@@ -257,9 +254,7 @@ PortMatrixBody::setup ()
                PortGroup::BundleList r = _matrix->visible_rows()->bundles ();
                for (PortGroup::BundleList::iterator i = r.begin(); i != r.end(); ++i) {
                        
-                       _bundle_connections.push_back (
-                               i->bundle->Changed.connect (sigc::hide (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_row_labels)))
-                               );
+                       _bundle_connections.add_connection ((*i)->bundle->Changed.connect (boost::bind (&PortMatrixBody::rebuild_and_draw_row_labels, this)));
                        
                }
        }
@@ -267,9 +262,7 @@ PortMatrixBody::setup ()
        if (_matrix->visible_columns()) {
                PortGroup::BundleList c = _matrix->visible_columns()->bundles ();
                for (PortGroup::BundleList::iterator i = c.begin(); i != c.end(); ++i) {
-                       _bundle_connections.push_back (
-                               i->bundle->Changed.connect (sigc::hide (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_column_labels)))
-                               );
+                       _bundle_connections.add_connection ((*i)->bundle->Changed.connect (boost::bind (&PortMatrixBody::rebuild_and_draw_column_labels, this)));
                }
        }
                
@@ -470,8 +463,8 @@ PortMatrixBody::highlight_associated_channels (int dim, ARDOUR::BundleChannel h)
        PortGroup::BundleList const b = _matrix->visible_ports(1 - dim)->bundles ();
 
        for (PortGroup::BundleList::const_iterator i = b.begin(); i != b.end(); ++i) {
-               for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
-                       bc[1 - dim] = ARDOUR::BundleChannel (i->bundle, j);
+               for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+                       bc[1 - dim] = ARDOUR::BundleChannel ((*i)->bundle, j);
                        if (_matrix->get_state (bc) == PortMatrixNode::ASSOCIATED) {
                                if (dim == _matrix->column_index()) {
                                        _row_labels->add_channel_highlight (bc[1 - dim]);
index 0b8facda45c2f717f6217ea92f2dc0df42ab8370..23d07c6ff3f9c083e0f73f333278df9f0260a4e1 100644 (file)
@@ -104,7 +104,7 @@ private:
        std::list<PortMatrixNode> _mouseover;
        bool _ignore_component_size_changed;
 
-       std::list<sigc::connection> _bundle_connections;
+       PBD::ScopedConnectionList _bundle_connections;
 };
 
 #endif
index be26474e7510afcd123f75ddd25b1d9d67fe4400..522015548f5b35a967130fdd37cf54c823b0607a 100644 (file)
@@ -55,16 +55,16 @@ PortMatrixColumnLabels::compute_dimensions ()
                for (PortGroup::BundleList::const_iterator j = c.begin (); j != c.end(); ++j) {
 
                        cairo_text_extents_t ext;
-                       cairo_text_extents (cr, j->bundle->name().c_str(), &ext);
+                       cairo_text_extents (cr, (*j)->bundle->name().c_str(), &ext);
                        if (ext.width > _longest_bundle_name) {
                                _longest_bundle_name = ext.width;
                        }
 
-                       for (uint32_t k = 0; k < j->bundle->nchannels (); ++k) {
+                       for (uint32_t k = 0; k < (*j)->bundle->nchannels (); ++k) {
 
                                cairo_text_extents (
                                        cr,
-                                       j->bundle->channel_name (k).c_str(),
+                                       (*j)->bundle->channel_name (k).c_str(),
                                        &ext
                                        );
 
@@ -127,13 +127,13 @@ PortMatrixColumnLabels::render (cairo_t* cr)
        PortGroup::BundleList const & bundles = _matrix->visible_columns()->bundles ();
        for (PortGroup::BundleList::const_iterator i = bundles.begin (); i != bundles.end(); ++i) {
 
-               Gdk::Color c = i->has_colour ? i->colour : get_a_bundle_colour (N);
-               render_bundle_name (cr, background_colour (), c, x, 0, i->bundle);
+               Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N);
+               render_bundle_name (cr, background_colour (), c, x, 0, (*i)->bundle);
 
                if (_matrix->show_only_bundles()) {
                        x += grid_spacing();
                } else {
-                       x += i->bundle->nchannels () * grid_spacing();
+                       x += (*i)->bundle->nchannels () * grid_spacing();
                }
                
                ++N;
@@ -147,9 +147,9 @@ PortMatrixColumnLabels::render (cairo_t* cr)
 
                for (PortGroup::BundleList::const_iterator i = bundles.begin (); i != bundles.end(); ++i) {
 
-                       for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
-                               Gdk::Color c = i->has_colour ? i->colour : get_a_bundle_colour (N);
-                               render_channel_name (cr, background_colour (), c, x, 0, ARDOUR::BundleChannel (i->bundle, j));
+                       for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+                               Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N);
+                               render_channel_name (cr, background_colour (), c, x, 0, ARDOUR::BundleChannel ((*i)->bundle, j));
                                x += grid_spacing();
                        }
                        
index d98c557c3a3a8aff74e2842ba7812142f83715f1..f728f7bd8536660ec15f7f3de95c7bd15239aa7d 100644 (file)
@@ -131,7 +131,7 @@ PortMatrixComponent::group_size (boost::shared_ptr<const PortGroup> g) const
                s = bundles.size();
        } else {
                for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
-                       s += i->bundle->nchannels();
+                       s += (*i)->bundle->nchannels();
                }
        }
 
@@ -151,7 +151,7 @@ PortMatrixComponent::channel_to_position (ARDOUR::BundleChannel bc, boost::share
 
        for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
 
-               if (i->bundle == bc.bundle) {
+               if ((*i)->bundle == bc.bundle) {
 
                        /* found the bundle */
                        
@@ -168,7 +168,7 @@ PortMatrixComponent::channel_to_position (ARDOUR::BundleChannel bc, boost::share
                if (_matrix->show_only_bundles()) {
                        p += 1;
                } else {
-                       p += i->bundle->nchannels ();
+                       p += (*i)->bundle->nchannels ();
                }
        }
 
@@ -187,16 +187,16 @@ PortMatrixComponent::position_to_channel (double p, double, boost::shared_ptr<co
                if (_matrix->show_only_bundles()) {
                        
                        if (p < 1) {
-                               return ARDOUR::BundleChannel (j->bundle, -1);
+                               return ARDOUR::BundleChannel ((*j)->bundle, -1);
                        } else {
                                p -= 1;
                        }
                        
                } else {
                        
-                       uint32_t const s = j->bundle->nchannels ();
+                       uint32_t const s = (*j)->bundle->nchannels ();
                        if (p < s) {
-                               return ARDOUR::BundleChannel (j->bundle, p);
+                               return ARDOUR::BundleChannel ((*j)->bundle, p);
                        } else {
                                p -= s;
                        }
index 3e5d17169010959f7bdf1adf3c8aaf9067b26208..fdfe45b2248066a90ce0eba2e496c4f6bb9f2042 100644 (file)
@@ -81,7 +81,7 @@ PortMatrixGrid::render (cairo_t* cr)
 
                if (!_matrix->show_only_bundles()) {
                        cairo_set_line_width (cr, thin_grid_line_width());
-                       for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
+                       for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
                                x += grid_spacing ();
                                cairo_move_to (cr, x, 0);
                                cairo_line_to (cr, x, _height);
@@ -111,7 +111,7 @@ PortMatrixGrid::render (cairo_t* cr)
 
                if (!_matrix->show_only_bundles()) {
                        cairo_set_line_width (cr, thin_grid_line_width());
-                       for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
+                       for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
                                y += grid_spacing ();
                                cairo_move_to (cr, 0, y);
                                cairo_line_to (cr, _width, y);
@@ -140,8 +140,8 @@ PortMatrixGrid::render (cairo_t* cr)
                        for (PortGroup::BundleList::const_iterator j = row_bundles.begin(); j != row_bundles.end(); ++j) {
 
                                PortMatrixNode::State s = get_association (PortMatrixNode (
-                                                                                  ARDOUR::BundleChannel (i->bundle, 0),
-                                                                                  ARDOUR::BundleChannel (j->bundle, 0)
+                                                                                  ARDOUR::BundleChannel ((*i)->bundle, 0),
+                                                                                  ARDOUR::BundleChannel ((*j)->bundle, 0)
                                                                                   ));
                                switch (s) {
                                case PortMatrixNode::ASSOCIATED:
@@ -169,14 +169,14 @@ PortMatrixGrid::render (cairo_t* cr)
                        for (PortGroup::BundleList::const_iterator j = row_bundles.begin(); j != row_bundles.end(); ++j) {
 
                                x = bx;
-                               for (uint32_t k = 0; k < i->bundle->nchannels (); ++k) {
+                               for (uint32_t k = 0; k < (*i)->bundle->nchannels (); ++k) {
 
                                        y = by;
-                                       for (uint32_t l = 0; l < j->bundle->nchannels (); ++l) {
+                                       for (uint32_t l = 0; l < (*j)->bundle->nchannels (); ++l) {
 
                                                ARDOUR::BundleChannel c[2];
-                                               c[_matrix->column_index()] = ARDOUR::BundleChannel (i->bundle, k);
-                                               c[_matrix->row_index()] = ARDOUR::BundleChannel (j->bundle, l);
+                                               c[_matrix->column_index()] = ARDOUR::BundleChannel ((*i)->bundle, k);
+                                               c[_matrix->row_index()] = ARDOUR::BundleChannel ((*j)->bundle, l);
 
                                                PortMatrixNode::State const s = _matrix->get_state (c);
 
@@ -198,10 +198,10 @@ PortMatrixGrid::render (cairo_t* cr)
                                        x += grid_spacing();
                                }
 
-                               by += j->bundle->nchannels () * grid_spacing();
+                               by += (*j)->bundle->nchannels () * grid_spacing();
                        }
 
-                       bx += i->bundle->nchannels () * grid_spacing();
+                       bx += (*i)->bundle->nchannels () * grid_spacing();
                }
        }
 }
index 80a0bb0c4f956a17dea74fd6a601d19281d6034d..2bf2b70a27a220cad60a7e04fbb05fc1cd69cb91 100644 (file)
@@ -54,16 +54,16 @@ PortMatrixRowLabels::compute_dimensions ()
                PortGroup::BundleList const r = (*i)->bundles ();
                for (PortGroup::BundleList::const_iterator j = r.begin(); j != r.end(); ++j) {
 
-                       for (uint32_t k = 0; k < j->bundle->nchannels(); ++k) {
+                       for (uint32_t k = 0; k < (*j)->bundle->nchannels(); ++k) {
                                cairo_text_extents_t ext;
-                               cairo_text_extents (cr, j->bundle->channel_name(k).c_str(), &ext);
+                               cairo_text_extents (cr, (*j)->bundle->channel_name(k).c_str(), &ext);
                                if (ext.width > _longest_port_name) {
                                        _longest_port_name = ext.width;
                                }
                        }
 
                        cairo_text_extents_t ext;
-                       cairo_text_extents (cr, j->bundle->name().c_str(), &ext);
+                       cairo_text_extents (cr, (*j)->bundle->name().c_str(), &ext);
                        if (ext.width > _longest_bundle_name) {
                                _longest_bundle_name = ext.width;
                        }
@@ -107,12 +107,12 @@ PortMatrixRowLabels::render (cairo_t* cr)
        
        PortGroup::BundleList const & bundles = _matrix->visible_rows()->bundles ();
        for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
-               render_bundle_name (cr, background_colour (), i->has_colour ? i->colour : get_a_bundle_colour (N), 0, y, i->bundle);
+               render_bundle_name (cr, background_colour (), (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N), 0, y, (*i)->bundle);
 
                if (!_matrix->show_only_bundles()) {
-                       for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
-                               Gdk::Color c = i->has_colour ? i->colour : get_a_bundle_colour (M);
-                               render_channel_name (cr, background_colour (), c, 0, y, ARDOUR::BundleChannel (i->bundle, j));
+                       for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) {
+                               Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (M);
+                               render_channel_name (cr, background_colour (), c, 0, y, ARDOUR::BundleChannel ((*i)->bundle, j));
                                y += grid_spacing();
                                ++M;
                        }
index ab6d9f546d027192f39602337e24a9fcc72fea41..3e07305868ea833bf8a99d1aa8de525a0bbd1304 100644 (file)
@@ -270,16 +270,17 @@ SendProcessorEntry::set_pixel_width (int p)
        _fader.set_fader_length (p);
 }
 
-ProcessorBox::ProcessorBox (ARDOUR::Session& sess, sigc::slot<PluginSelector*> get_plugin_selector,
-                       RouteRedirectSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
-       : _session(sess)
-       , _parent_strip (parent)
+ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelector*()> get_plugin_selector,
+                           RouteRedirectSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
+       : _parent_strip (parent)
        , _owner_is_mixer (owner_is_mixer)
        , ab_direction (true)
        , _get_plugin_selector (get_plugin_selector)
        , _placement(PreFader)
        , _rr_selection(rsel)
 {
+       set_session (sess);
+
        _width = Wide;
        processor_menu = 0;
        send_action_menu = 0;
@@ -319,17 +320,15 @@ ProcessorBox::set_route (boost::shared_ptr<Route> r)
                return;
        }
        
-       connections.clear ();
+       connections.drop_connections();
 
        /* new route: any existing block on processor redisplay must be meaningless */
        no_processor_redisplay = false;
        _route = r;
 
-       connections.push_back (_route->processors_changed.connect (sigc::mem_fun (*this, &ProcessorBox::route_processors_changed)));
-       connections.push_back (_route->GoingAway.connect (
-                       sigc::mem_fun (*this, &ProcessorBox::route_going_away)));
-       connections.push_back (_route->NameChanged.connect (
-                       sigc::mem_fun(*this, &ProcessorBox::route_name_changed)));
+       connections.add_connection (_route->processors_changed.connect (sigc::mem_fun (*this, &ProcessorBox::route_processors_changed)));
+       connections.add_connection (_route->GoingAway.connect (sigc::mem_fun (*this, &ProcessorBox::route_going_away)));
+       connections.add_connection (_route->NameChanged.connect (sigc::mem_fun(*this, &ProcessorBox::route_name_changed)));
 
        redisplay_processors ();
 }
@@ -437,7 +436,7 @@ ProcessorBox::build_send_action_menu ()
 Gtk::Menu*
 ProcessorBox::build_possible_aux_menu ()
 {
-       boost::shared_ptr<RouteList> rl = _session.get_routes_with_internal_returns();
+       boost::shared_ptr<RouteList> rl = _session->get_routes_with_internal_returns();
 
        if (rl->empty()) {
                return 0;
@@ -630,7 +629,7 @@ ProcessorBox::processor_button_press_event (GdkEventButton *ev, ProcessorEntry*
 
        if (processor && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS))) {
 
-               if (_session.engine().connected()) {
+               if (_session->engine().connected()) {
                        /* XXX giving an error message here is hard, because we may be in the midst of a button press */
                        edit_processor (processor);
                }
@@ -747,7 +746,7 @@ ProcessorBox::use_plugins (const SelectedPlugins& plugins)
 {
        for (SelectedPlugins::const_iterator p = plugins.begin(); p != plugins.end(); ++p) {
 
-               boost::shared_ptr<Processor> processor (new PluginInsert (_session, *p));
+               boost::shared_ptr<Processor> processor (new PluginInsert (*_session, *p));
 
                Route::ProcessorStreams err_streams;
 
@@ -812,18 +811,18 @@ ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams)
 void
 ProcessorBox::choose_insert ()
 {
-       boost::shared_ptr<Processor> processor (new PortInsert (_session, _route->mute_master()));
+       boost::shared_ptr<Processor> processor (new PortInsert (*_session, _route->mute_master()));
        _route->add_processor (processor, _placement);
 }
 
 void
 ProcessorBox::choose_send ()
 {
-       boost::shared_ptr<Send> send (new Send (_session, _route->mute_master()));
+       boost::shared_ptr<Send> send (new Send (*_session, _route->mute_master()));
 
        /* make an educated guess at the initial number of outputs for the send */
-       ChanCount outs = (_session.master_out())
-                       ? _session.master_out()->n_outputs()
+       ChanCount outs = (_session->master_out())
+                       ? _session->master_out()->n_outputs()
                        : _route->n_outputs();
 
        /* XXX need processor lock on route */
@@ -841,7 +840,7 @@ ProcessorBox::choose_send ()
           is closed.
         */
 
-       IOSelectorWindow *ios = new IOSelectorWindow (&_session, send->output(), true);
+       IOSelectorWindow *ios = new IOSelectorWindow (_session, send->output(), true);
        ios->show_all ();
 
        /* keep a reference to the send so it doesn't get deleted while
@@ -927,7 +926,7 @@ ProcessorBox::choose_aux (boost::weak_ptr<Route> wr)
        boost::shared_ptr<RouteList> rlist (new RouteList);
        rlist->push_back (_route);
 
-       _session.add_internal_sends (target, PreFader, rlist);
+       _session->add_internal_sends (target, PreFader, rlist);
 }
 
 void
@@ -1219,7 +1218,7 @@ ProcessorBox::rename_processor (boost::shared_ptr<Processor> processor)
        case Gtk::RESPONSE_ACCEPT:
                name_prompter.get_result (result);
                if (result.length()) {
-                       if (_session.route_by_name (result)) {
+                       if (_session->route_by_name (result)) {
                                ARDOUR_UI::instance()->popup_error (_("A track already exists with that name."));
                                return;
                        }
@@ -1279,20 +1278,20 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr
                        } else if (type->value() == "send") {
 
                                XMLNode n (**niter);
-                               Send::make_unique (n, _session);
-                               p.reset (new Send (_session, _route->mute_master(), n));
+                               Send::make_unique (n, *_session);
+                               p.reset (new Send (*_session, _route->mute_master(), n));
 
                        } else if (type->value() == "return") {
 
                                XMLNode n (**niter);
-                               Return::make_unique (n, _session);
-                               p.reset (new Return (_session, **niter));
+                               Return::make_unique (n, *_session);
+                               p.reset (new Return (*_session, **niter));
 
                        } else {
                                /* XXX its a bit limiting to assume that everything else
                                   is a plugin.
                                */
-                               p.reset (new PluginInsert (_session, **niter));
+                               p.reset (new PluginInsert (*_session, **niter));
                        }
 
                        copies.push_back (p);
@@ -1424,7 +1423,7 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor)
 
        if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
 
-               if (!_session.engine().connected()) {
+               if (!_session->engine().connected()) {
                        return;
                }
 
@@ -1449,7 +1448,7 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor)
 
        } else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) {
 
-               if (!_session.engine().connected()) {
+               if (!_session->engine().connected()) {
                        return;
                }
 
@@ -1493,7 +1492,7 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor)
 
        } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) {
 
-               if (!_session.engine().connected()) {
+               if (!_session->engine().connected()) {
                        MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible"));
                        msg.run ();
                        return;
@@ -1502,7 +1501,7 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor)
                PortInsertWindow *io_selector;
 
                if (port_insert->get_gui() == 0) {
-                       io_selector = new PortInsertWindow (&_session, port_insert);
+                       io_selector = new PortInsertWindow (_session, port_insert);
                        port_insert->set_gui (io_selector);
 
                } else {
index daff50dfe7b57ffa9d2233bf0ce9864142725183..e704eba015f3002825fc4d3df392310c05727f1f 100644 (file)
 #ifndef __ardour_gtk_processor_box__
 #define __ardour_gtk_processor_box__
 
+#include <cmath>
 #include <vector>
 
-#include <cmath>
+#include <boost/function.hpp>
+
 #include <gtkmm/box.h>
 #include <gtkmm/eventbox.h>
 #include <gtkmm/menu.h>
@@ -34,6 +36,7 @@
 #include <gtkmm2ext/pixfader.h>
 
 #include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
 
 #include "ardour/types.h"
 #include "ardour/ardour.h"
@@ -41,6 +44,7 @@
 #include "ardour/port_insert.h"
 #include "ardour/processor.h"
 #include "ardour/route.h"
+#include "ardour/session_handle.h"
 
 #include "pbd/fastlog.h"
 
@@ -120,11 +124,11 @@ private:
        static Glib::RefPtr<Gdk::Pixbuf> _slider;
 };
 
-class ProcessorBox : public Gtk::HBox, public PluginInterestedObject
+class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARDOUR::SessionHandlePtr
 {
   public:
-       ProcessorBox (ARDOUR::Session&, sigc::slot<PluginSelector*> get_plugin_selector,
-                       RouteRedirectSelection&, MixerStrip* parent, bool owner_is_mixer = false);
+       ProcessorBox (ARDOUR::Session*, boost::function<PluginSelector*()> get_plugin_selector,
+                     RouteRedirectSelection&, MixerStrip* parent, bool owner_is_mixer = false);
        ~ProcessorBox ();
 
        void set_route (boost::shared_ptr<ARDOUR::Route>);
@@ -145,13 +149,12 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject
 
   private:
        boost::shared_ptr<ARDOUR::Route>  _route;
-       ARDOUR::Session &   _session;
        MixerStrip*         _parent_strip; // null if in RouteParamsUI
        bool                _owner_is_mixer;
        bool                 ab_direction;
-       std::vector<sigc::connection> connections;
+       PBD::ScopedConnectionList connections;
 
-       sigc::slot<PluginSelector*> _get_plugin_selector;
+       boost::function<PluginSelector*()> _get_plugin_selector;
 
        boost::shared_ptr<ARDOUR::Processor> _processor_being_created;
 
index 8b4684f53921807ee0ba1ea629e8a35ed999821d..1677c2ee49aa3ef67ef1c3315bce10ffef62ee17 100644 (file)
@@ -83,7 +83,7 @@ class MarkerView;
  * of PublicEditor need not be recompiled if private methods or member variables
  * change.
  */
-class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway {
+class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
   public:
        PublicEditor ();
        virtual ~PublicEditor ();
@@ -97,10 +97,10 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
        /** Attach this editor to a Session.
         * @param s Session to connect to.
         */
-       virtual void connect_to_session (ARDOUR::Session* s) = 0;
+       virtual void set_session (ARDOUR::Session* s) = 0;
 
        /** @return The Session that we are editing, or 0 */
-       virtual ARDOUR::Session* current_session () const = 0;
+       virtual ARDOUR::Session* session () const = 0;
 
        /** Set the snap type.
         * @param t Snap type (defined in editing_syms.h)
index 596bd44140a90c7c9731011037531b61d00b2491..f66d7f8f813cebc86d0662bfdad1b35e2104768d 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __gtk_ardour_region_edit_h__
 #define __gtk_ardour_region_edit_h__
 
+#include "ardour/session_handle.h"
+
 #include "ardour_dialog.h"
 
 namespace ARDOUR { class Session; }
@@ -28,15 +30,12 @@ namespace ARDOUR { class Session; }
 class RegionEditor : public ArdourDialog
 {
   public:
-       RegionEditor(ARDOUR::Session& s)
-       : ArdourDialog ("region editor")
-       , _session(s)
-       {}
+       RegionEditor(ARDOUR::Session* s)
+               : ArdourDialog ("region editor") {
+               set_session (s);
+       }
 
        virtual ~RegionEditor () {}
-
-  protected:
-       ARDOUR::Session&     _session;
 };
 
 #endif /* __gtk_ardour_region_edit_h__ */
index b3dea4f42adf20fc339347f07fb3164164b43430..00352c96df7992b8418dca1e97ed137d4c8bfa2e 100644 (file)
 */
 
 #include "evoral/Curve.hpp"
-#include "ardour/audioregion.h"
 #include "pbd/memento_command.h"
 
+#include "ardour/audioregion.h"
+#include "ardour/session.h"
+
 #include "region_gain_line.h"
 #include "audio_region_view.h"
 #include "utils.h"
 #include "time_axis_view.h"
 #include "editor.h"
 
-#include "ardour/session.h"
-
 #include "i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-AudioRegionGainLine::AudioRegionGainLine (const string & name, Session& s, AudioRegionView& r, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l)
+AudioRegionGainLine::AudioRegionGainLine (const string & name, AudioRegionView& r, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l)
        : AutomationLine (name, r.get_time_axis_view(), parent, l)
-       , session (s)
        , rv (r)
 {
        // If this isn't true something is horribly wrong, and we'll get catastrophic gain values
@@ -55,7 +54,7 @@ AudioRegionGainLine::start_drag (ControlPoint* cp, nframes_t x, float fraction)
 {
        AutomationLine::start_drag (cp, x, fraction);
        if (!rv.audio_region()->envelope_active()) {
-               trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), &rv.audio_region()->get_state(), 0));
+               trackview.session()->add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), &rv.audio_region()->get_state(), 0));
                rv.audio_region()->set_envelope_active(false);
        }
 }
@@ -68,21 +67,21 @@ AudioRegionGainLine::remove_point (ControlPoint& cp)
 
        model_representation (cp, mr);
 
-       trackview.editor().current_session()->begin_reversible_command (_("remove control point"));
+       trackview.editor().session()->begin_reversible_command (_("remove control point"));
        XMLNode &before = alist->get_state();
 
        if (!rv.audio_region()->envelope_active()) {
                XMLNode &region_before = rv.audio_region()->get_state();
                rv.audio_region()->set_envelope_active(true);
                XMLNode &region_after = rv.audio_region()->get_state();
-               trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), &region_before, &region_after));
+               trackview.session()->add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), &region_before, &region_after));
        }
 
        alist->erase (mr.start, mr.end);
 
-       trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
-       trackview.editor().current_session()->commit_reversible_command ();
-       trackview.editor().current_session()->set_dirty ();
+       trackview.editor().session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
+       trackview.editor().session()->commit_reversible_command ();
+       trackview.editor().session()->set_dirty ();
 }
 
 void
@@ -90,7 +89,7 @@ AudioRegionGainLine::end_drag (ControlPoint* cp)
 {
        if (!rv.audio_region()->envelope_active()) {
                rv.audio_region()->set_envelope_active(true);
-               trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), 0, &rv.audio_region()->get_state()));
+               trackview.session()->add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), 0, &rv.audio_region()->get_state()));
        }
 
        AutomationLine::end_drag(cp);
index 7033c656040ac14b4e104b1c75b03e3d103fa311..d54c962294ddebe56f47acc3d846fc99168b9aff 100644 (file)
@@ -21,6 +21,7 @@
 #define __ardour_gtk_region_gain_line_h__
 
 #include "ardour/ardour.h"
+
 #include <libgnomecanvasmm.h>
 
 #include "automation_line.h"
@@ -35,7 +36,7 @@ class AudioRegionView;
 class AudioRegionGainLine : public AutomationLine
 {
   public:
-       AudioRegionGainLine (const std::string & name, ARDOUR::Session&, AudioRegionView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>);
+       AudioRegionGainLine (const std::string & name, AudioRegionView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>);
 
        void start_drag (ControlPoint*, nframes_t x, float fraction);
        void end_drag (ControlPoint*);
@@ -43,7 +44,6 @@ class AudioRegionGainLine : public AutomationLine
        void remove_point (ControlPoint&);
 
   private:
-       ARDOUR::Session& session;
        AudioRegionView& rv;
 };
 
index 94592000a122388f6cedb3a3ffe1f00998994d6c..30f6dfb565af74a05583d627e78a6adb62670aed 100644 (file)
@@ -32,7 +32,7 @@ using namespace PBD;
  */
 RegionSelection::RegionSelection ()
 {
-       RegionView::RegionViewGoingAway.connect (sigc::mem_fun(*this, &RegionSelection::remove_it));
+       death_connection = RegionView::RegionViewGoingAway.connect (boost::bind (&RegionSelection::remove_it, this, _1));
 
        _current_start = 0;
        _current_end = 0;
@@ -43,9 +43,8 @@ RegionSelection::RegionSelection ()
  */
 RegionSelection::RegionSelection (const RegionSelection& other)
        : std::list<RegionView*>()
-       , sigc::trackable(other)
 {
-       RegionView::RegionViewGoingAway.connect (sigc::mem_fun(*this, &RegionSelection::remove_it));
+       death_connection = RegionView::RegionViewGoingAway.connect (boost::bind (&RegionSelection::remove_it, this, _1));
 
        _current_start = other._current_start;
        _current_end = other._current_end;
index f89eef9eb865789b038c5fcbbb7717479bc3ca82..dcb6d68e0c71f6ed0b98837f528d625d4e4ca856 100644 (file)
@@ -21,7 +21,9 @@
 
 #include <set>
 #include <list>
-#include <sigc++/signal.h>
+
+#include <boost/signals2.hpp>
+
 #include "ardour/types.h"
 
 class RegionView;
@@ -29,7 +31,7 @@ class TimeAxisView;
 
 /** Class to represent list of selected regions.
  */
-class RegionSelection : public std::list<RegionView*>, public sigc::trackable
+class RegionSelection : public std::list<RegionView*>
 {
   public:
        RegionSelection();
@@ -69,6 +71,7 @@ class RegionSelection : public std::list<RegionView*>, public sigc::trackable
        nframes_t _current_end; ///< end position for the selection
 
        std::list<RegionView *> _bylayer; ///< list of regions sorted by layer
+       boost::signals2::scoped_connection death_connection;
 };
 
 #endif /* __ardour_gtk_region_selection_h__ */
index 343c2b47ffe43422cc42024faf2a0aad323d2ef2..5cc4df56693338564765f297a9e91e3df93e35df 100644 (file)
@@ -58,7 +58,7 @@ using namespace ArdourCanvas;
 
 static const int32_t sync_mark_width = 9;
 
-sigc::signal<void,RegionView*> RegionView::RegionViewGoingAway;
+boost::signals2::signal<void(RegionView*)> RegionView::RegionViewGoingAway;
 
 RegionView::RegionView (ArdourCanvas::Group*              parent,
                         TimeAxisView&                     tv,
index 288969616fb34d4e03f6727a1325fef83ab5399e..ad534c04bf27e5ca87f4795ab34e8708b632366d 100644 (file)
@@ -89,7 +89,7 @@ class RegionView : public TimeAxisViewItem
        void enable_display(bool yn) { _enable_display = yn; }
        virtual void update_coverage_frames (LayerDisplay);
 
-       static sigc::signal<void,RegionView*> RegionViewGoingAway;
+       static boost::signals2::signal<void(RegionView*)> RegionViewGoingAway;
 
   protected:
 
@@ -139,7 +139,7 @@ class RegionView : public TimeAxisViewItem
     bool    in_destructor;
 
     bool             wait_for_data;
-    sigc::connection data_ready_connection;
+    boost::signals2::scoped_connection data_ready_connection;
 
     std::vector<GhostRegion*> ghosts;
 
index c4a447255364f1cd142c3022c3b40ec308552122..8a12a3ece9940450b9ce9d72f88d0e5014b026d2 100644 (file)
@@ -34,10 +34,9 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session& se)
-       : _return (r)
-       , _session (se)
-       , _gpm (se, 250)
+ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session* session)
+       :_return (r)
+       , _gpm (session, 250)
 {
        _gpm.set_controls (boost::shared_ptr<Route>(), r->meter(), r->amp());
 
@@ -49,7 +48,7 @@ ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session& s
 
        _vbox.pack_start (_hbox, false, false, false);
 
-       io = manage (new IOSelector (parent, &se, r->output()));
+       io = manage (new IOSelector (parent, session, r->output()));
 
        pack_start (_vbox, false, false);
 
@@ -99,10 +98,10 @@ ReturnUI::fast_update ()
        }
 }
 
-ReturnUIWindow::ReturnUIWindow (boost::shared_ptr<Return> s, Session& ss)
-       : ArdourDialog (string("Ardour: return ") + s->name())
+ReturnUIWindow::ReturnUIWindow (boost::shared_ptr<Return> r, ARDOUR::Session* s)
+       : ArdourDialog (string("Ardour: return ") + r->name())
 {
-       ui = new ReturnUI (this, s, ss);
+       ui = new ReturnUI (this, r, s);
 
        hpacker.pack_start (*ui, true, true);
 
@@ -111,7 +110,7 @@ ReturnUIWindow::ReturnUIWindow (boost::shared_ptr<Return> s, Session& ss)
 
        set_name ("ReturnUIWindow");
 
-       going_away_connection = s->GoingAway.connect (sigc::mem_fun (*this, &ReturnUIWindow::return_going_away));
+       going_away_connection = r->GoingAway.connect (sigc::mem_fun (*this, &ReturnUIWindow::return_going_away));
        signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window *> (this)));
 }
 
@@ -124,7 +123,7 @@ void
 ReturnUIWindow::return_going_away ()
 {
        ENSURE_GUI_THREAD (*this, &ReturnUIWindow::return_going_away)
+       going_away_connection.disconnect ();    
        delete_when_idle (this);
-       going_away_connection.disconnect ();
 }
 
index 3a5e3c8f3fa8a7b75d318abe5e5cfaed2b4d3a4c..ff1f2f35e58875fa4e8967cbfb78e0c35dc0cd39 100644 (file)
 
 namespace ARDOUR {
        class Return;
-       class Session;
        class IOProcessor;
 }
 
 class IOSelector;
 
-class ReturnUI : public Gtk::HBox
+class ReturnUI : public Gtk::HBox 
 {
   public:
-       ReturnUI (Gtk::Window *,boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session&);
+       ReturnUI (Gtk::Window *,boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session*);
        ~ReturnUI();
 
        void update ();
@@ -47,7 +46,6 @@ class ReturnUI : public Gtk::HBox
 
   private:
        boost::shared_ptr<ARDOUR::Return> _return;
-       ARDOUR::Session&                  _session;
        GainMeter                         _gpm;
        Gtk::VBox                         _vbox;
        Gtk::VBox                         _hbox;
@@ -61,7 +59,7 @@ class ReturnUI : public Gtk::HBox
 class ReturnUIWindow : public ArdourDialog
 {
   public:
-       ReturnUIWindow(boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session&);
+       ReturnUIWindow(boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session*);
        ~ReturnUIWindow();
 
        ReturnUI* ui;
@@ -70,7 +68,7 @@ class ReturnUIWindow : public ArdourDialog
        Gtk::HBox hpacker;
 
        void return_going_away ();
-       sigc::connection going_away_connection;
+       boost::signals2::scoped_connection going_away_connection;
 };
 
 #endif /* __ardour_gtk_return_ui_h__ */
index 1f38bb89929a4849547631a664dd1243ae920189..f6619fcb8bce55a052bfef288ab8aab23a3a3080 100644 (file)
@@ -230,7 +230,7 @@ RhythmFerret::get_action () const
 void
 RhythmFerret::run_analysis ()
 {
-       if (!session) {
+       if (!_session) {
                return;
        }
 
@@ -268,7 +268,7 @@ RhythmFerret::run_analysis ()
 int
 RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readable, nframes64_t offset, AnalysisFeatureList& results)
 {
-       TransientDetector t (session->frame_rate());
+       TransientDetector t (_session->frame_rate());
 
        for (uint32_t i = 0; i < readable->n_channels(); ++i) {
 
@@ -295,7 +295,7 @@ RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readabl
        }
 
        if (!results.empty()) {
-               TransientDetector::cleanup_transients (results, session->frame_rate(), trigger_gap_adjustment.get_value());
+               TransientDetector::cleanup_transients (results, _session->frame_rate(), trigger_gap_adjustment.get_value());
        }
 
        return 0;
@@ -322,7 +322,7 @@ int
 RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, nframes64_t offset, AnalysisFeatureList& results)
 {
        try {
-               OnsetDetector t (session->frame_rate());
+               OnsetDetector t (_session->frame_rate());
 
                for (uint32_t i = 0; i < readable->n_channels(); ++i) {
 
@@ -356,7 +356,7 @@ RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, nfr
        }
 
        if (!results.empty()) {
-               OnsetDetector::cleanup_onsets (results, session->frame_rate(), trigger_gap_adjustment.get_value());
+               OnsetDetector::cleanup_onsets (results, _session->frame_rate(), trigger_gap_adjustment.get_value());
        }
 
        return 0;
@@ -365,7 +365,7 @@ RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, nfr
 void
 RhythmFerret::do_action ()
 {
-       if (!session || current_results.empty()) {
+       if (!_session || current_results.empty()) {
                return;
        }
 
@@ -390,7 +390,7 @@ RhythmFerret::do_split_action ()
                return;
        }
 
-       session->begin_reversible_command (_("split regions (rhythm ferret)"));
+       _session->begin_reversible_command (_("split regions (rhythm ferret)"));
 
        for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ) {
 
@@ -408,7 +408,7 @@ RhythmFerret::do_split_action ()
                i = tmp;
        }
 
-       session->commit_reversible_command ();
+       _session->commit_reversible_command ();
 }
 
 void
index 08d2312415f7fd51661f15bc4d6f4b1c9c31e1b1..7e05c26fe3d63414a559793806c9291cf0d8b52e 100644 (file)
@@ -28,9 +28,9 @@
 using namespace Gtk;
 using namespace ARDOUR;
 
-RouteGroupMenu::RouteGroupMenu (Session& s, RouteGroup::Property p)
-       : _session (s),
-         _default_properties (p)
+RouteGroupMenu::RouteGroupMenu (Session* s, RouteGroup::Property p)
+       : SessionHandlePtr (s)
+       , _default_properties (p)
 {
        rebuild (0);
 }
@@ -52,7 +52,9 @@ RouteGroupMenu::rebuild (RouteGroup* curr)
                static_cast<RadioMenuItem*> (&items().back())->set_active ();
        }
 
-       _session.foreach_route_group (sigc::bind (sigc::mem_fun (*this, &RouteGroupMenu::add_item), curr, &group));
+       if (_session) {
+               _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &RouteGroupMenu::add_item), curr, &group));
+       }
 }
 
 void
@@ -76,13 +78,17 @@ RouteGroupMenu::set_group (RouteGroup* g)
 void
 RouteGroupMenu::new_group ()
 {
-       RouteGroup* g = new RouteGroup (_session, "", RouteGroup::Active, _default_properties);
+       if (!_session) {
+               return;
+       }
+
+       RouteGroup* g = new RouteGroup (*_session, "", RouteGroup::Active, _default_properties);
 
        RouteGroupDialog d (g, Gtk::Stock::NEW);
        int const r = d.do_run ();
 
        if (r == Gtk::RESPONSE_OK) {
-               _session.add_route_group (g);
+               _session->add_route_group (g);
                set_group (g);
        } else {
                delete g;
index ba955f64a269f5cedf907ddd4176f94b3a2d6a05..7b9e539ecbf3b85f0b4bc3197c1c6c6ff8d7803d 100644 (file)
 
 */
 
+#ifndef __ardour_gtk_route_group_menu_h__
+#define __ardour_gtk_route_group_menu_h__
+
 #include "ardour/route_group.h"
+#include "ardour/session_handle.h"
 
-namespace ARDOUR {
-       class Session;
-}
 
-class RouteGroupMenu : public Gtk::Menu
+class RouteGroupMenu : public Gtk::Menu, public ARDOUR::SessionHandlePtr
 {
 public:
-       RouteGroupMenu (ARDOUR::Session &, ARDOUR::RouteGroup::Property);
+       RouteGroupMenu (ARDOUR::Session*, ARDOUR::RouteGroup::Property);
 
        void rebuild (ARDOUR::RouteGroup *);
 
        sigc::signal<void, ARDOUR::RouteGroup*> GroupSelected;
 
-private:
+  private:
        void add_item (ARDOUR::RouteGroup *, ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
        void new_group ();
        void set_group (ARDOUR::RouteGroup *);
 
-       ARDOUR::Session& _session;
        ARDOUR::RouteGroup::Property _default_properties;
 };
+
+#endif /* __ardour_gtk_route_group_menu_h__ */
index c9bba4b63baf02f5f73232bc513394795b3ef110..c948d388d8cbea75b29d766eb3c9c91c8361d0f0 100644 (file)
@@ -181,16 +181,22 @@ RouteParams_UI::add_routes (RouteList& routes)
 
                //route_select_list.rows().back().select ();
 
-               route->NameChanged.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::route_name_changed), route));
-               route->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::route_removed), route));
+               scoped_connect (route->NameChanged, boost::bind (&RouteParams_UI::route_name_changed, this, boost::weak_ptr<Route>(route)));
+               scoped_connect (route->GoingAway, boost::bind (&RouteParams_UI::route_removed, this, boost::weak_ptr<Route>(route)));
        }
 }
 
 
 void
-RouteParams_UI::route_name_changed (boost::shared_ptr<Route> route)
+RouteParams_UI::route_name_changed (boost::weak_ptr<Route> wr)
 {
-       ENSURE_GUI_THREAD (*this, &RouteParams_UI::route_name_changed, route)
+       boost::shared_ptr<Route> route (wr.lock());
+
+       if (!route) { 
+               return;
+       }
+
+       ENSURE_GUI_THREAD (*this, &RouteParams_UI::route_name_changed, wr)
 
        bool found = false ;
        TreeModel::Children rows = route_display_model->children();
@@ -216,14 +222,13 @@ RouteParams_UI::route_name_changed (boost::shared_ptr<Route> route)
 void
 RouteParams_UI::setup_processor_boxes()
 {
-       if (session && _route) {
+       if (_session && _route) {
 
                // just in case... shouldn't need this
                cleanup_processor_boxes();
 
                // construct new redirect boxes
-               insert_box = new ProcessorBox(*session,
-                               sigc::mem_fun(*this, &RouteParams_UI::plugin_selector), _rr_selection, 0);
+               insert_box = new ProcessorBox (_session, boost::bind (&RouteParams_UI::plugin_selector, this), _rr_selection, 0);
                insert_box->set_route (_route);
 
                redir_hpane.pack1 (*insert_box);
@@ -265,18 +270,19 @@ RouteParams_UI::cleanup_latency_frame ()
                latency_packer.remove (*latency_widget);
                latency_packer.remove (latency_button_box);
                latency_packer.remove (delay_label);
+               latency_connections.drop_connections ();
+               latency_click_connection.disconnect ();
+
                delete latency_widget;
                latency_widget = 0;
-               latency_conn.disconnect ();
-               delay_conn.disconnect ();
-               latency_apply_conn.disconnect ();
+               
        }
 }
 
 void
 RouteParams_UI::setup_latency_frame ()
 {
-       latency_widget = new LatencyGUI (*(_route->output()), session->frame_rate(), session->engine().frames_per_cycle());
+       latency_widget = new LatencyGUI (*(_route->output()), _session->frame_rate(), _session->engine().frames_per_cycle());
 
        char buf[128];
        snprintf (buf, sizeof (buf), _("Playback delay: %u samples"), _route->initial_delay());
@@ -286,9 +292,9 @@ RouteParams_UI::setup_latency_frame ()
        latency_packer.pack_start (latency_button_box, false, false);
        latency_packer.pack_start (delay_label);
 
-       latency_apply_conn = latency_apply_button.signal_clicked().connect (sigc::mem_fun (*latency_widget, &LatencyGUI::finish));
-       latency_conn = _route->signal_latency_changed.connect (sigc::mem_fun (*this, &RouteParams_UI::refresh_latency));
-       delay_conn = _route->initial_delay_changed.connect (sigc::mem_fun (*this, &RouteParams_UI::refresh_latency));
+       latency_click_connection = latency_apply_button.signal_clicked().connect (sigc::mem_fun (*latency_widget, &LatencyGUI::finish));
+       latency_connections.add_connection (_route->signal_latency_changed.connect (sigc::mem_fun (*this, &RouteParams_UI::refresh_latency)));
+       latency_connections.add_connection ( _route->initial_delay_changed.connect (sigc::mem_fun (*this, &RouteParams_UI::refresh_latency)));
 
        latency_frame.add (latency_packer);
        latency_frame.show_all ();
@@ -300,13 +306,13 @@ RouteParams_UI::setup_io_frames()
        cleanup_io_frames();
 
        // input
-       _input_iosel = new IOSelector (this, session, _route->input());
+       _input_iosel = new IOSelector (this, _session, _route->input());
        _input_iosel->setup ();
        input_frame.add (*_input_iosel);
        input_frame.show_all();
 
        // output
-       _output_iosel = new IOSelector (this, session, _route->output());
+       _output_iosel = new IOSelector (this, _session, _route->output());
        _output_iosel->setup ();
        output_frame.add (*_output_iosel);
        output_frame.show_all();
@@ -341,7 +347,7 @@ RouteParams_UI::cleanup_view (bool stopupdate)
                          plugui->stop_updating (0);
                }
 
-               _plugin_conn.disconnect();
+               _processor_going_away_connection.disconnect ();
                redir_hpane.remove(*_active_view);
                delete _active_view;
                _active_view = 0;
@@ -349,9 +355,15 @@ RouteParams_UI::cleanup_view (bool stopupdate)
 }
 
 void
-RouteParams_UI::route_removed (boost::shared_ptr<Route> route)
+RouteParams_UI::route_removed (boost::weak_ptr<Route> wr)
 {
-       ENSURE_GUI_THREAD (*this, &RouteParams_UI::route_removed, route)
+       boost::shared_ptr<Route> route (wr.lock());
+
+       if (!route) { 
+               return;
+       }
+
+       ENSURE_GUI_THREAD (*this, &RouteParams_UI::route_removed, wr)
 
        TreeModel::Children rows = route_display_model->children();
        TreeModel::Children::iterator ri;
@@ -380,29 +392,27 @@ void
 RouteParams_UI::set_session (Session *sess)
 {
        ArdourDialog::set_session (sess);
-
+       
        route_display_model->clear();
+       _plugin_selector->set_session (_session);
 
-       if (session) {
-               boost::shared_ptr<RouteList> r = session->get_routes();
+       if (_session) {
+               boost::shared_ptr<RouteList> r = _session->get_routes();
                add_routes (*r);
-               session->GoingAway.connect (sigc::mem_fun(*this, &ArdourDialog::session_gone));
-               session->RouteAdded.connect (sigc::mem_fun(*this, &RouteParams_UI::add_routes));
+               _session_connections.add_connection (_session->RouteAdded.connect (sigc::mem_fun(*this, &RouteParams_UI::add_routes)));
                start_updating ();
        } else {
                stop_updating ();
        }
-
-       //route_select_list.thaw ();
-
-       _plugin_selector->set_session (session);
 }
 
 
 void
-RouteParams_UI::session_gone ()
+RouteParams_UI::session_going_away ()
 {
-       ENSURE_GUI_THREAD (*this, &RouteParams_UI::session_gone)
+       ENSURE_GUI_THREAD (*this, &RouteParams_UI::session_going_away);
+
+       SessionHandlePtr::session_going_away ();
 
        route_display_model->clear();
 
@@ -414,9 +424,6 @@ RouteParams_UI::session_gone ()
        _route.reset ((Route*) 0);
        _processor.reset ((Processor*) 0);
        update_title();
-
-       ArdourDialog::session_gone();
-
 }
 
 void
@@ -436,8 +443,7 @@ RouteParams_UI::route_selected()
 
                // remove event binding from previously selected
                if (_route) {
-                       _route_conn.disconnect();
-                       _route_ds_conn.disconnect();
+                       _route_processors_connection.disconnect ();
                        cleanup_processor_boxes();
                        cleanup_view();
                        cleanup_io_frames();
@@ -452,9 +458,8 @@ RouteParams_UI::route_selected()
                setup_processor_boxes();
                setup_latency_frame ();
 
-               // sigc::bind to redirects changed event for this route
-               _route_conn = route->processors_changed.connect (sigc::mem_fun(*this, &RouteParams_UI::processors_changed));
-
+               _route_processors_connection = route->processors_changed.connect (boost::bind (&RouteParams_UI::processors_changed, this, _1));
+               
                track_input_label.set_text (_route->name());
 
                update_title();
@@ -462,7 +467,7 @@ RouteParams_UI::route_selected()
        } else {
                // no selection
                if (_route) {
-                       _route_conn.disconnect();
+                       _route_processors_connection.disconnect ();
 
                        // remove from view
                        cleanup_io_frames();
@@ -505,64 +510,62 @@ RouteParams_UI::show_track_menu()
 }
 
 void
-RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert)
+RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> proc)
 {
        boost::shared_ptr<Send> send;
        boost::shared_ptr<Return> retrn;
        boost::shared_ptr<PluginInsert> plugin_insert;
        boost::shared_ptr<PortInsert> port_insert;
 
-       if ((send = boost::dynamic_pointer_cast<Send> (insert)) != 0) {
+       if ((send = boost::dynamic_pointer_cast<Send> (proc)) != 0) {
 
-               SendUI *send_ui = new SendUI (this, send, *session);
+               SendUI *send_ui = new SendUI (this, send, _session);
 
                cleanup_view();
-               _plugin_conn = send->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::redirect_going_away),
-                                                             insert));
+               _processor_going_away_connection = send->GoingAway.connect (boost::bind (&RouteParams_UI::processor_going_away, this, 
+                                                                                        boost::weak_ptr<Processor>(proc)));
+
                _active_view = send_ui;
 
                redir_hpane.add2 (*_active_view);
                redir_hpane.show_all();
 
-       } else if ((retrn = boost::dynamic_pointer_cast<Return> (insert)) != 0) {
+       } else if ((retrn = boost::dynamic_pointer_cast<Return> (proc)) != 0) {
 
-               ReturnUI *return_ui = new ReturnUI (this, retrn, *session);
+               ReturnUI *return_ui = new ReturnUI (this, retrn, _session);
 
                cleanup_view();
-               _plugin_conn = retrn->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::redirect_going_away),
-                                                              insert));
+               _processor_going_away_connection = retrn->GoingAway.connect (boost::bind (&RouteParams_UI::processor_going_away, this,
+                                                                                         boost::weak_ptr<Processor>(proc)));
                _active_view = return_ui;
 
                redir_hpane.add2 (*_active_view);
                redir_hpane.show_all();
 
-       } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) {
+       } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (proc)) != 0) {
 
                GenericPluginUI *plugin_ui = new GenericPluginUI (plugin_insert, true);
 
                cleanup_view();
-               _plugin_conn = plugin_insert->plugin()->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::plugin_going_away),
-                                                                                PreFader));
+               _processor_going_away_connection = plugin_insert->plugin()->GoingAway.connect (boost::bind (&RouteParams_UI::plugin_going_away, this, PreFader));
                plugin_ui->start_updating (0);
                _active_view = plugin_ui;
                redir_hpane.pack2 (*_active_view);
                redir_hpane.show_all();
 
-       } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (insert)) != 0) {
+       } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (proc)) != 0) {
 
-               PortInsertUI *portinsert_ui = new PortInsertUI (this, session, port_insert);
+               PortInsertUI *portinsert_ui = new PortInsertUI (this, _session, port_insert);
 
                cleanup_view();
-               _plugin_conn = port_insert->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, &RouteParams_UI::redirect_going_away),
-                                                                    insert));
+               _processor_going_away_connection = port_insert->GoingAway.connect (boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor> (proc)));
                _active_view = portinsert_ui;
                redir_hpane.pack2 (*_active_view);
                portinsert_ui->redisplay();
                redir_hpane.show_all();
        }
 
-       _processor = insert;
-
+       _processor = proc;
        update_title();
 
 }
@@ -581,14 +584,19 @@ RouteParams_UI::plugin_going_away (Placement place)
 }
 
 void
-RouteParams_UI::redirect_going_away (boost::shared_ptr<ARDOUR::Processor> insert)
-
+RouteParams_UI::processor_going_away (boost::weak_ptr<ARDOUR::Processor> wproc)
 {
-       ENSURE_GUI_THREAD (*this, &RouteParams_UI::redirect_going_away, insert)
+       boost::shared_ptr<Processor> proc = (wproc.lock());
+
+       if (!proc) {
+               return;
+       }
+
+       ENSURE_GUI_THREAD (*this, &RouteParams_UI::processor_going_away, wproc)
 
        printf ("redirect going away\n");
        // delete the current view without calling finish
-       if (insert == _processor) {
+       if (proc == _processor) {
                cleanup_view (false);
                _processor.reset ((Processor*) 0);
        }
index 4d21805778be7dcb10ca73bf214455c4e06fdb1a..2dcb1b921d2c03e75cebcad5b1ae9b97c3289407 100644 (file)
@@ -33,6 +33,7 @@
 #include <gtkmm/treeview.h>
 
 #include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
 
 #include "ardour/ardour.h"
 
@@ -54,14 +55,14 @@ namespace ARDOUR {
 
 class PluginSelector;
 
-class RouteParams_UI : public ArdourDialog
+class RouteParams_UI : public ArdourDialog, public PBD::ScopedConnectionList
 {
   public:
        RouteParams_UI ();
        ~RouteParams_UI();
 
-       void set_session (ARDOUR::Session *);
-       void session_gone ();
+       void set_session (ARDOUR::Session*);
+       void session_going_away ();
        PluginSelector*  plugin_selector() { return _plugin_selector; }
 
   private:
@@ -105,9 +106,9 @@ class RouteParams_UI : public ArdourDialog
        Gtk::Button              latency_apply_button;
        LatencyGUI*              latency_widget;
        Gtk::Label               delay_label;
-       sigc::connection         latency_conn;
-       sigc::connection         delay_conn;
-       sigc::connection         latency_apply_conn;
+
+       PBD::ScopedConnectionList latency_connections;
+       sigc::connection          latency_click_connection;
 
        void refresh_latency ();
 
@@ -125,11 +126,10 @@ class RouteParams_UI : public ArdourDialog
        RouteRedirectSelection  _rr_selection;
 
        boost::shared_ptr<ARDOUR::Route> _route;
-       sigc::connection            _route_conn;
-       sigc::connection            _route_ds_conn;
+       boost::signals2::scoped_connection _route_processors_connection;
 
        boost::shared_ptr<ARDOUR::Processor> _processor;
-       sigc::connection                    _plugin_conn;
+       boost::signals2::scoped_connection _processor_going_away_connection;
 
 
        enum ConfigView {
@@ -161,8 +161,8 @@ class RouteParams_UI : public ArdourDialog
 
        void add_routes (ARDOUR::RouteList&);
 
-       void route_name_changed (boost::shared_ptr<ARDOUR::Route> route);
-       void route_removed (boost::shared_ptr<ARDOUR::Route> route);
+       void route_name_changed (boost::weak_ptr<ARDOUR::Route> route);
+       void route_removed (boost::weak_ptr<ARDOUR::Route> route);
 
 
        void route_selected();
@@ -182,7 +182,7 @@ class RouteParams_UI : public ArdourDialog
        void redirect_selected (boost::shared_ptr<ARDOUR::Processor>);
 
        void plugin_going_away (ARDOUR::Placement);
-       void redirect_going_away (boost::shared_ptr<ARDOUR::Processor>);
+       void processor_going_away (boost::weak_ptr<ARDOUR::Processor>);
 
        gint edit_input_configuration (GdkEventButton *ev);
        gint edit_output_configuration (GdkEventButton *ev);
index 1af1e0c968f393aea11b0f9ad6d2ca6617b9ced1..102cd724ddf6f5b8754b9d7090b7fc6ff9a2397a 100644 (file)
@@ -26,6 +26,7 @@
 #include "ardour/route.h"
 
 #include "route_processor_selection.h"
+#include "gui_thread.h"
 
 #include "i18n.h"
 
@@ -92,18 +93,28 @@ RouteRedirectSelection::add (boost::shared_ptr<Route> r)
 {
        if (find (routes.begin(), routes.end(), r) == routes.end()) {
                routes.push_back (r);
+               r->GoingAway.connect (boost::bind (&RouteRedirectSelection::removed, this, boost::weak_ptr<Route>(r)));
+               RoutesChanged();
+       }
+}
 
-               // XXX SHAREDPTR FIXME
-               // void (RouteRedirectSelection::*pmf)(Route*) = &RouteRedirectSelection::remove;
-               // r->GoingAway.connect (sigc::bind (sigc::mem_fun(*this, pmf), r));
+void
+RouteRedirectSelection::removed (boost::weak_ptr<Route> wr)
+{
+       boost::shared_ptr<Route> r (wr.lock());
 
-               RoutesChanged();
+       if (!r) {
+               return;
        }
+
+       remove (r);
 }
 
 void
 RouteRedirectSelection::remove (boost::shared_ptr<Route> r)
 {
+       ENSURE_GUI_THREAD (*this, &RouteRedirectSelection::remove, r);
+
        list<boost::shared_ptr<Route> >::iterator i;
        if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) {
                routes.erase (i);
index 83bdbc2d8bd2275d9090b547570e4abd04a7ab78..eb76d481ddc031cfd347b77d212c7a61c923ad7a 100644 (file)
 #define __ardour_gtk_route_processor_selection_h__
 
 #include <vector>
-#include <sigc++/signal.h>
+#include "pbd/scoped_connections.h"
 
 #include "processor_selection.h"
 #include "route_selection.h"
 
-class RouteRedirectSelection : public sigc::trackable
+class RouteRedirectSelection : public PBD::ScopedConnectionList, public sigc::trackable
 {
   public:
        ProcessorSelection processors;
@@ -53,6 +53,10 @@ class RouteRedirectSelection : public sigc::trackable
        void clear_routes ();
 
        bool selected (boost::shared_ptr<ARDOUR::Route>);
+
+  private:
+       void removed (boost::weak_ptr<ARDOUR::Route>);
+
 };
 
 bool operator==(const RouteRedirectSelection& a, const RouteRedirectSelection& b);
index 1f75bec50d3baeb6016e76fb3608c4926bd09fbc..e652fbc4a3bd94895654d8a3c1e52befdec9aae9 100644 (file)
@@ -100,7 +100,7 @@ RouteTimeAxisView::setup_slider_pix ()
        }
 }
 
-RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
+RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, boost::shared_ptr<Route> rt, Canvas& canvas)
        : AxisView(sess)
        , RouteUI(rt, sess)
        , TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas)
@@ -189,7 +189,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
                controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
                ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
 
-               rec_enable_button->set_sensitive (_session.writable());
+               rec_enable_button->set_sensitive (_session->writable());
        }
 
        controls_hbox.pack_start(gm.get_level_meter(), false, false);
@@ -269,7 +269,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
 
 RouteTimeAxisView::~RouteTimeAxisView ()
 {
-       GoingAway (); /* EMIT_SIGNAL */
+       drop_references ();
 
        for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
                delete *i;
@@ -1044,8 +1044,8 @@ RouteTimeAxisView::use_copy_playlist (bool prompt, vector<boost::shared_ptr<Play
                name = resolve_new_group_playlist_name(name, playlists_before_op);
        }
 
-       while (_session.playlists->by_name(name)) {
-               name = Playlist::bump_name (name, _session);
+       while (_session->playlists->by_name(name)) {
+               name = Playlist::bump_name (name, *_session);
        }
 
        // TODO: The prompter "new" button should be de-activated if the user
@@ -1096,8 +1096,8 @@ RouteTimeAxisView::use_new_playlist (bool prompt, vector<boost::shared_ptr<Playl
                name = resolve_new_group_playlist_name(name,playlists_before_op);
        }
 
-       while (_session.playlists->by_name(name)) {
-               name = Playlist::bump_name (name, _session);
+       while (_session->playlists->by_name(name)) {
+               name = Playlist::bump_name (name, *_session);
        }
 
 
@@ -1325,10 +1325,10 @@ RouteTimeAxisView::name_entry_changed ()
                return;
        }
 
-       if (!_session.route_name_unique (x)) {
+       if (!_session->route_name_unique (x)) {
                ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
                name_entry.set_text (_route->name());
-       } else if (_session.route_name_internal (x)) {
+       } else if (_session->route_name_internal (x)) {
                ARDOUR_UI::instance()->popup_error (_("You cannot create a track with that name as it is reserved for Ardour"));
                name_entry.set_text (_route->name());
        } else {
@@ -1408,7 +1408,7 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
        case Cut:
                if ((what_we_got = playlist->cut (time)) != 0) {
                        _editor.get_cut_buffer().add (what_we_got);
-                       _session.add_command( new MementoCommand<Playlist>(*playlist.get(), &before, &playlist->get_state()));
+                       _session->add_command( new MementoCommand<Playlist>(*playlist.get(), &before, &playlist->get_state()));
                        ret = true;
                }
                break;
@@ -1420,7 +1420,7 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
 
        case Clear:
                if ((what_we_got = playlist->cut (time)) != 0) {
-                       _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+                       _session->add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
                        what_we_got->release ();
                        ret = true;
                }
@@ -1452,7 +1452,7 @@ RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size
 
        XMLNode &before = playlist->get_state();
        playlist->paste (*p, pos, times);
-       _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
+       _session->add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
 
        return true;
 }
@@ -1494,7 +1494,7 @@ RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
        boost::shared_ptr<Diskstream> ds = get_diskstream();
        RadioMenuItem::Group playlist_group;
 
-       _session.playlists->get (playlists);
+       _session->playlists->get (playlists);
 
        for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
 
@@ -1584,7 +1584,7 @@ RouteTimeAxisView::use_playlist (boost::weak_ptr<Playlist> wpl)
                                        continue;
                                }
 
-                               boost::shared_ptr<Playlist> ipl = session().playlists->by_name(playlist_name);
+                               boost::shared_ptr<Playlist> ipl = session()->playlists->by_name(playlist_name);
                                if (!ipl) {
                                        // No playlist for this track for this take yet, make it
                                        track->diskstream()->use_new_playlist();
index f37f32b1fa1306c3836bc63ff5db6c8d4c98fa74..c210a55cf352c2aea1487ae8e2476ac3cc9a7728 100644 (file)
@@ -71,7 +71,7 @@ class RouteGroupMenu;
 class RouteTimeAxisView : public RouteUI, public TimeAxisView
 {
 public:
-       RouteTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
+       RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
        virtual ~RouteTimeAxisView ();
 
        void show_selection (TimeSelection&);
index 2b5c892c0c8eeab4403fcf3cb35ff566538bca90..31841c97ba42f26bf8a4761fe034745618f620d4 100644 (file)
@@ -29,7 +29,6 @@
 #include "ardour/dB.h"
 #include "pbd/memento_command.h"
 #include "pbd/stacktrace.h"
-#include "pbd/shiva.h"
 #include "pbd/controllable.h"
 #include "pbd/enumwriter.h"
 
@@ -65,13 +64,13 @@ using namespace Gtkmm2ext;
 using namespace ARDOUR;
 using namespace PBD;
 
-RouteUI::RouteUI (ARDOUR::Session& sess)
+RouteUI::RouteUI (ARDOUR::Session* sess)
        : AxisView(sess)
 {
        init ();
 }
 
-RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess)
+RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session* sess)
        : AxisView(sess)
 {
        init ();
@@ -137,8 +136,8 @@ RouteUI::init ()
        show_sends_button->set_self_managed (true);
        UI::instance()->set_tip (show_sends_button, _("make mixer strips show sends to this bus"), "");
 
-       _session.SoloChanged.connect (sigc::mem_fun(*this, &RouteUI::solo_changed_so_update_mute));
-       _session.TransportStateChange.connect (sigc::mem_fun (*this, &RouteUI::check_rec_enable_sensitivity));
+       _session_connections.add_connection (_session->SoloChanged.connect (sigc::mem_fun(*this, &RouteUI::solo_changed_so_update_mute)));
+       _session_connections.add_connection (_session->TransportStateChange.connect (sigc::mem_fun (*this, &RouteUI::check_rec_enable_sensitivity)));
 
        Config->ParameterChanged.connect (sigc::mem_fun (*this, &RouteUI::parameter_changed));
 }
@@ -146,12 +145,8 @@ RouteUI::init ()
 void
 RouteUI::reset ()
 {
-       //Remove route connections associated with us.
-       for (vector<sigc::connection>::iterator it = connections.begin(); it!=connections.end(); ++it) {
-           (*it).disconnect();
-       }
-
-       connections.clear ();
+       route_going_away_connection.disconnect();
+       connections.drop_connections ();
 
        delete solo_menu;
        solo_menu = 0;
@@ -169,6 +164,14 @@ RouteUI::reset ()
        denormal_menu_item = 0;
 }
 
+void
+RouteUI::self_delete ()
+{
+       route_going_away_connection.disconnect ();
+       connections.drop_connections ();
+       delete_when_idle (this);
+}
+
 void
 RouteUI::set_route (boost::shared_ptr<Route> rp)
 {
@@ -180,28 +183,24 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
                set_color (unique_random_color());
        }
 
-       /* no, there is no memory leak here. This object cleans itself (and other stuff)
-          up when the route is destroyed.
-       */
-
        if (self_destruct) {
-               new PairedShiva<Route,RouteUI> (*_route, *this);
+               route_going_away_connection = rp->GoingAway.connect (boost::bind (&RouteUI::self_delete, this));
        }
 
        mute_button->set_controllable (_route->mute_control());
        solo_button->set_controllable (_route->solo_control());
 
-       connections.push_back (_route->active_changed.connect (sigc::mem_fun (*this, &RouteUI::route_active_changed)));
-       connections.push_back (_route->mute_changed.connect (sigc::mem_fun(*this, &RouteUI::mute_changed)));
-       connections.push_back (_route->solo_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed)));
-       connections.push_back (_route->listen_changed.connect (sigc::mem_fun(*this, &RouteUI::listen_changed)));
-       connections.push_back (_route->solo_isolated_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed)));
+       connections.add_connection (_route->active_changed.connect (sigc::mem_fun (*this, &RouteUI::route_active_changed)));
+       connections.add_connection (_route->mute_changed.connect (sigc::mem_fun(*this, &RouteUI::mute_changed)));
+       connections.add_connection (_route->solo_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed)));
+       connections.add_connection (_route->listen_changed.connect (sigc::mem_fun(*this, &RouteUI::listen_changed)));
+       connections.add_connection (_route->solo_isolated_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed)));
 
-       if (_session.writable() && is_track()) {
+       if (_session->writable() && is_track()) {
                boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
 
-               connections.push_back (t->diskstream()->RecordEnableChanged.connect (sigc::mem_fun (*this, &RouteUI::route_rec_enable_changed)));
-               connections.push_back (_session.RecordStateChanged.connect (sigc::mem_fun (*this, &RouteUI::session_rec_enable_changed)));
+               connections.add_connection (t->diskstream()->RecordEnableChanged.connect (sigc::mem_fun (*this, &RouteUI::route_rec_enable_changed)));
+               connections.add_connection (_session->RecordStateChanged.connect (sigc::mem_fun (*this, &RouteUI::session_rec_enable_changed)));
 
                rec_enable_button->show();
                rec_enable_button->set_controllable (t->rec_enable_control());
@@ -265,10 +264,10 @@ RouteUI::mute_press (GdkEventButton* ev)
                                if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
 
                                        if (_mute_release) {
-                                               _mute_release->routes = _session.get_routes ();
+                                               _mute_release->routes = _session->get_routes ();
                                        }
 
-                                       _session.set_mute (_session.get_routes(), !_route->muted());
+                                       _session->set_mute (_session->get_routes(), !_route->muted());
 
                                } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
 
@@ -278,10 +277,10 @@ RouteUI::mute_press (GdkEventButton* ev)
 
                                        if (ev->button == 1 && _route->route_group()) {
                                                if (_mute_release) {
-                                                       _mute_release->routes = _session.get_routes ();
+                                                       _mute_release->routes = _session->get_routes ();
                                                }
                                                                
-                                               _session.set_mute (_session.get_routes(), !_route->muted(), Session::rt_cleanup, true);
+                                               _session->set_mute (_session->get_routes(), !_route->muted(), Session::rt_cleanup, true);
                                        }
 
                                } else {
@@ -295,7 +294,7 @@ RouteUI::mute_press (GdkEventButton* ev)
                                                _mute_release->routes = rl;
                                        }
 
-                                       _session.set_mute (rl, !_route->muted());
+                                       _session->set_mute (rl, !_route->muted());
 
                                }
                        }
@@ -311,7 +310,7 @@ RouteUI::mute_release (GdkEventButton*)
 {
        if (!ignore_toggle) {
                if (_mute_release){
-                       _session.set_mute (_mute_release->routes, _mute_release->active, Session::rt_cleanup, true);
+                       _session->set_mute (_mute_release->routes, _mute_release->active, Session::rt_cleanup, true);
                        delete _mute_release;
                        _mute_release = 0;
                }
@@ -362,13 +361,13 @@ RouteUI::solo_press(GdkEventButton* ev)
                                        /* Primary-Tertiary-click applies change to all routes */
 
                                        if (_solo_release) {
-                                               _solo_release->routes = _session.get_routes ();
+                                               _solo_release->routes = _session->get_routes ();
                                        }
                                        
                                        if (Config->get_solo_control_is_listen_control()) {
-                                               _session.set_listen (_session.get_routes(), !_route->listening(),  Session::rt_cleanup, true);
+                                               _session->set_listen (_session->get_routes(), !_route->listening(),  Session::rt_cleanup, true);
                                        } else {
-                                               _session.set_solo (_session.get_routes(), !_route->soloed(),  Session::rt_cleanup, true);
+                                               _session->set_solo (_session->get_routes(), !_route->soloed(),  Session::rt_cleanup, true);
                                        }
                                        
                                } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
@@ -378,7 +377,7 @@ RouteUI::solo_press(GdkEventButton* ev)
                                        if (_solo_release) {
                                                _solo_release->exclusive = true;
 
-                                               boost::shared_ptr<RouteList> routes = _session.get_routes();
+                                               boost::shared_ptr<RouteList> routes = _session->get_routes();
 
                                                for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
                                                        if ((*i)->soloed ()) {
@@ -392,7 +391,7 @@ RouteUI::solo_press(GdkEventButton* ev)
                                        if (Config->get_solo_control_is_listen_control()) {
                                                /* ??? we need a just_one_listen() method */
                                        } else {
-                                               _session.set_just_one_solo (_route, true);
+                                               _session->set_just_one_solo (_route, true);
                                        }
 
                                } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
@@ -416,9 +415,9 @@ RouteUI::solo_press(GdkEventButton* ev)
                                                }
                                        
                                                if (Config->get_solo_control_is_listen_control()) {
-                                                       _session.set_listen (_route->route_group()->route_list(), !_route->listening(),  Session::rt_cleanup, true);
+                                                       _session->set_listen (_route->route_group()->route_list(), !_route->listening(),  Session::rt_cleanup, true);
                                                } else {
-                                                       _session.set_solo (_route->route_group()->route_list(), !_route->soloed(),  Session::rt_cleanup, true);
+                                                       _session->set_solo (_route->route_group()->route_list(), !_route->soloed(),  Session::rt_cleanup, true);
                                                }
                                        }
                                        
@@ -434,9 +433,9 @@ RouteUI::solo_press(GdkEventButton* ev)
                                        }
 
                                        if (Config->get_solo_control_is_listen_control()) {
-                                               _session.set_listen (rl, !_route->listening());
+                                               _session->set_listen (rl, !_route->listening());
                                        } else {
-                                               _session.set_solo (rl, !_route->soloed());
+                                               _session->set_solo (rl, !_route->soloed());
                                        }
                                }
                        }
@@ -456,7 +455,7 @@ RouteUI::solo_release (GdkEventButton*)
                        if (_solo_release->exclusive) {
 
                        } else {
-                               _session.set_solo (_solo_release->routes, _solo_release->active, Session::rt_cleanup, true);
+                               _session->set_solo (_solo_release->routes, _solo_release->active, Session::rt_cleanup, true);
                        }
 
                        delete _solo_release;
@@ -474,7 +473,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
                return true;
        }
 
-       if (!_session.engine().connected()) {
+       if (!_session->engine().connected()) {
                MessageDialog msg (_("Not connected to JACK - cannot engage record"));
                msg.run ();
                return true;
@@ -489,7 +488,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
 
                } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
 
-                       _session.set_record_enable (_session.get_routes(), !rec_enable_button->get_active());
+                       _session->set_record_enable (_session->get_routes(), !rec_enable_button->get_active());
 
                } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
 
@@ -497,7 +496,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
                           NOTE: Primary-button2 is MIDI learn.
                        */
                        if (ev->button == 1 && _route->route_group()) {
-                               _session.set_record_enable (_route->route_group()->route_list(), !rec_enable_button->get_active(), Session::rt_cleanup, true);
+                               _session->set_record_enable (_route->route_group()->route_list(), !rec_enable_button->get_active(), Session::rt_cleanup, true);
                        }
 
                } else if (Keyboard::is_context_menu_event (ev)) {
@@ -508,7 +507,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
 
                        boost::shared_ptr<RouteList> rl (new RouteList);
                        rl->push_back (route());
-                       _session.set_record_enable (rl, !rec_enable_button->get_active());
+                       _session->set_record_enable (rl, !rec_enable_button->get_active());
                }
        }
 
@@ -543,7 +542,7 @@ RouteUI::build_sends_menu ()
 void
 RouteUI::create_sends (Placement p)
 {
-       _session.globally_add_internal_sends (_route, p);
+       _session->globally_add_internal_sends (_route, p);
 }
 
 void
@@ -564,25 +563,25 @@ RouteUI::create_selected_sends (Placement p)
                }
        }
        
-       _session.add_internal_sends (_route, p, rlist);
+       _session->add_internal_sends (_route, p, rlist);
 }
 
 void
 RouteUI::set_sends_gain_from_track ()
 {
-       _session.globally_set_send_gains_from_track (_route);
+       _session->globally_set_send_gains_from_track (_route);
 }
 
 void
 RouteUI::set_sends_gain_to_zero ()
 {
-       _session.globally_set_send_gains_to_zero (_route);
+       _session->globally_set_send_gains_to_zero (_route);
 }
 
 void
 RouteUI::set_sends_gain_to_unity ()
 {
-       _session.globally_set_send_gains_to_unity (_route);
+       _session->globally_set_send_gains_to_unity (_route);
 }
 
 bool
@@ -767,7 +766,7 @@ RouteUI::mute_changed(void* /*src*/)
 }
 
 int
-RouteUI::mute_visual_state (Session& s, boost::shared_ptr<Route> r)
+RouteUI::mute_visual_state (Session* s, boost::shared_ptr<Route> r)
 {
        if (r->is_master() || r->is_control()) {
                return 0;
@@ -778,7 +777,7 @@ RouteUI::mute_visual_state (Session& s, boost::shared_ptr<Route> r)
                if (r->muted ()) {
                        /* full mute */
                        return 2;
-               } else if (s.soloing() && !r->soloed() && !r->solo_isolated()) {
+               } else if (s->soloing() && !r->soloed() && !r->solo_isolated()) {
                        /* mute-because-not-soloed */
                        return 1;
                } else {
@@ -851,7 +850,7 @@ RouteUI::update_rec_display ()
 
        if (model) {
 
-               switch (_session.record_status ()) {
+               switch (_session->record_status ()) {
                case Session::Recording:
                        rec_enable_button->set_visual_state (1);
                        break;
@@ -1110,7 +1109,7 @@ RouteUI::remove_this_route ()
 gint
 RouteUI::idle_remove_this_route (RouteUI *rui)
 {
-       rui->_session.remove_route (rui->_route);
+       rui->_session->remove_route (rui->_route);
        return false;
 }
 
@@ -1329,7 +1328,7 @@ RouteUI::map_frozen ()
 void
 RouteUI::adjust_latency ()
 {
-       LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session.frame_rate(), _session.engine().frames_per_cycle());
+       LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session->frame_rate(), _session->engine().frames_per_cycle());
 }
 
 void
@@ -1370,7 +1369,7 @@ RouteUI::save_as_template ()
 void
 RouteUI::check_rec_enable_sensitivity ()
 {
-       if (_session.transport_rolling() && rec_enable_button->get_active() && Config->get_disable_disarm_during_roll()) {
+       if (_session->transport_rolling() && rec_enable_button->get_active() && Config->get_disable_disarm_during_roll()) {
                rec_enable_button->set_sensitive (false);
        } else {
                rec_enable_button->set_sensitive (true);
@@ -1420,7 +1419,7 @@ RouteUI::open_remote_control_id_dialog ()
 {
        ArdourDialog dialog (_("Remote Control ID"));
 
-       uint32_t const limit = _session.ntracks() + _session.nbusses () + 4;
+       uint32_t const limit = _session->ntracks() + _session->nbusses () + 4;
 
        HBox* hbox = manage (new HBox);
        hbox->set_spacing (6);
index 21d335ef795bb47aa1c760911e95a74657d12611..a4d7e43b7d27ce482646f7854f1ea06833aaf3a2 100644 (file)
@@ -23,6 +23,8 @@
 #include <list>
 
 #include "pbd/xml++.h"
+#include "pbd/scoped_connections.h"
+
 #include "ardour/ardour.h"
 #include "ardour/mute_master.h"
 #include "ardour/session_event.h"
@@ -49,8 +51,8 @@ class BindableToggleButton;
 class RouteUI : public virtual AxisView
 {
   public:
-       RouteUI(ARDOUR::Session&);
-       RouteUI(boost::shared_ptr<ARDOUR::Route>, ARDOUR::Session&);
+       RouteUI(ARDOUR::Session*);
+       RouteUI(boost::shared_ptr<ARDOUR::Route>, ARDOUR::Session*);
 
        virtual ~RouteUI();
 
@@ -194,16 +196,18 @@ class RouteUI : public virtual AxisView
        static int solo_visual_state (boost::shared_ptr<ARDOUR::Route>);
        static int solo_visual_state_with_isolate (boost::shared_ptr<ARDOUR::Route>);
        static int solo_isolate_visual_state (boost::shared_ptr<ARDOUR::Route>);
-       static int mute_visual_state (ARDOUR::Session &, boost::shared_ptr<ARDOUR::Route>);
+       static int mute_visual_state (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>);
 
    protected:
-       std::vector<sigc::connection> connections;
+       PBD::ScopedConnectionList connections;
+       boost::signals2::scoped_connection route_going_away_connection;
        bool self_destruct;
 
        void init ();
        void reset ();
 
        void queue_route_group_op (ARDOUR::RouteGroup::Property prop, void (ARDOUR::Session::*session_method)(boost::shared_ptr<ARDOUR::RouteList>, bool), bool yn);
+       void self_delete ();
 
   private:
        void check_rec_enable_sensitivity ();
@@ -225,6 +229,7 @@ class RouteUI : public virtual AxisView
 
        SoloMuteRelease* _solo_release;
        SoloMuteRelease* _mute_release;
+
 };
 
 #endif /* __ardour_route_ui__ */
index da706a34d7a4b344866ebd98cadb1b716616e1b6..d2f1a674764b3942cd1723ce2aaf5b807e207e30 100644 (file)
@@ -45,6 +45,7 @@ struct AudioRangeComparator {
     }
 };
 
+#if 0
 Selection&
 Selection::operator= (const Selection& other)
 {
@@ -58,6 +59,7 @@ Selection::operator= (const Selection& other)
        }
        return *this;
 }
+#endif
 
 bool
 operator== (const Selection& a, const Selection& b)
@@ -207,7 +209,7 @@ Selection::toggle (TimeAxisView* track)
 
        if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) {
                void (Selection::*pmf)(TimeAxisView*) = &Selection::remove;
-               track->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, pmf), track));
+               track->GoingAway.connect (boost::bind (pmf, this, track));
                tracks.push_back (track);
        } else {
                tracks.erase (i);
@@ -336,7 +338,7 @@ Selection::add (const TrackViewList& track_list)
 
        for (list<TimeAxisView*>::const_iterator i = added.begin(); i != added.end(); ++i) {
                void (Selection::*pmf)(TimeAxisView*) = &Selection::remove;
-               (*i)->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, pmf), (*i)));
+               scoped_connect ((*i)->GoingAway, boost::bind (pmf, this, (*i)));
        }
 
        if (!added.empty()) {
@@ -947,7 +949,7 @@ Selection::add (Marker* m)
 
                void (Selection::*pmf)(Marker*) = &Selection::remove;
 
-               m->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, pmf), m));
+               scoped_connect (m->GoingAway, boost::bind (pmf, this, m));
 
                markers.push_back (m);
                MarkersChanged();
index f95b1dbfbea6efea414e332cb0ea81b4398a9a02..739d3b4c016e3ab290f2ace34d7be44922916753 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <sigc++/signal.h>
 
+#include "pbd/scoped_connections.h"
+
 #include "time_selection.h"
 #include "region_selection.h"
 #include "track_selection.h"
@@ -57,7 +59,7 @@ namespace Evoral {
 
 /** The Selection class holds lists of selected items (tracks, regions, etc. etc.). */
 
-class Selection : public sigc::trackable
+class Selection : public sigc::trackable, public PBD::ScopedConnectionList
 {
   public:
        enum SelectionType {
@@ -86,7 +88,7 @@ class Selection : public sigc::trackable
                clear();
        }
 
-       Selection& operator= (const Selection& other);
+       // Selection& operator= (const Selection& other);
 
        sigc::signal<void> RegionsChanged;
        sigc::signal<void> TracksChanged;
@@ -185,9 +187,10 @@ class Selection : public sigc::trackable
        template<class A> void foreach_region (void (ARDOUR::Region::*method)(A), A arg);
 
   private:
+       Selection (const Selection& other) {}
        PublicEditor const * editor;
        uint32_t next_time_id;
-
+       
        void add (std::vector<AutomationSelectable*>&);
 };
 
index 98dfab586082d7418a9d630968280f630beaa11c..1617ccd96ad0650f29fa589cfac48e4711c7a484 100644 (file)
@@ -34,11 +34,10 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se)
+SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session)
        : _send (s)
-       , _session (se)
-       , _gpm (se, 250)
-       , _panners (se)
+       , _gpm (session, 250)
+       , _panners (session)
 {
        _panners.set_panner (s->panner());
        _gpm.set_controls (boost::shared_ptr<Route>(), s->meter(), s->amp());
@@ -52,7 +51,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se)
        _vbox.pack_start (_hbox, false, false, false);
        _vbox.pack_start (_panners, false, false);
 
-       io = manage (new IOSelector (parent, &se, s->output()));
+       io = manage (new IOSelector (parent, session, s->output()));
 
        pack_start (_vbox, false, false);
 
@@ -119,10 +118,10 @@ SendUI::fast_update ()
        }
 }
 
-SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
+SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session* session)
        : ArdourDialog (string("Ardour: send ") + s->name())
 {
-       ui = new SendUI (this, s, ss);
+       ui = new SendUI (this, s, session);
 
        hpacker.pack_start (*ui, true, true);
 
@@ -131,8 +130,7 @@ SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
 
        set_name ("SendUIWindow");
 
-       going_away_connection = s->GoingAway.connect (
-                       sigc::mem_fun (*this, &SendUIWindow::send_going_away));
+       going_away_connection = s->GoingAway.connect (sigc::mem_fun (*this, &SendUIWindow::send_going_away));
 
        signal_delete_event().connect (sigc::bind (
                                               sigc::ptr_fun (just_hide_it),
@@ -148,7 +146,7 @@ void
 SendUIWindow::send_going_away ()
 {
        ENSURE_GUI_THREAD (*this, &SendUIWindow::send_going_away)
-       delete_when_idle (this);
        going_away_connection.disconnect ();
+       delete_when_idle (this);
 }
 
index df5a8a216ea91d1b302741b7c10fb9543745ddf4..16543140a80824382523d12d2df4e95dbda16061 100644 (file)
@@ -26,7 +26,6 @@
 
 namespace ARDOUR {
        class Send;
-       class Session;
        class IOProcessor;
 }
 
@@ -35,7 +34,7 @@ class IOSelector;
 class SendUI : public Gtk::HBox
 {
   public:
-       SendUI (Gtk::Window *, boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session&);
+       SendUI (Gtk::Window *, boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session*);
        ~SendUI();
 
        void update ();
@@ -47,7 +46,6 @@ class SendUI : public Gtk::HBox
 
   private:
        boost::shared_ptr<ARDOUR::Send> _send;
-       ARDOUR::Session&                _session;
        GainMeter                       _gpm;
        PannerUI                        _panners;
        Gtk::VBox                       _vbox;
@@ -63,7 +61,7 @@ class SendUI : public Gtk::HBox
 class SendUIWindow : public ArdourDialog
 {
   public:
-       SendUIWindow(boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session&);
+       SendUIWindow(boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session*);
        ~SendUIWindow();
 
        SendUI* ui;
@@ -72,7 +70,7 @@ class SendUIWindow : public ArdourDialog
        Gtk::HBox hpacker;
 
        void send_going_away ();
-       sigc::connection going_away_connection;
+       boost::signals2::scoped_connection going_away_connection;
 };
 
 #endif /* __ardour_gtk_send_ui_h__ */
index 5511a0d68f60a0cbe443dfafc0c64d2c9e5dd191..4b5793271be7dc7db9bca7371de0fbe45b33e7a4 100644 (file)
 using namespace std;
 using namespace ARDOUR;
 
-SessionImportDialog::SessionImportDialog (ARDOUR::Session & target) :
+SessionImportDialog::SessionImportDialog (ARDOUR::Session* target) :
   ArdourDialog (_("Import from session")),
-  target (target),
   file_browse_button (_("Browse"))
 {
+       set_session (target);
+
        // File entry
        file_entry.set_name ("ImportFileNameEntry");
        file_entry.set_text ("/");
@@ -101,24 +102,26 @@ SessionImportDialog::SessionImportDialog (ARDOUR::Session & target) :
 void
 SessionImportDialog::load_session (const string& filename)
 {
-       tree.read (filename);
-       boost::shared_ptr<AudioRegionImportHandler> region_handler (new AudioRegionImportHandler (tree, target));
-       boost::shared_ptr<AudioPlaylistImportHandler> pl_handler (new AudioPlaylistImportHandler (tree, target, *region_handler));
-
-       handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (region_handler));
-       handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (pl_handler));
-       handlers.push_back (HandlerPtr(new UnusedAudioPlaylistImportHandler (tree, target, *region_handler)));
-       handlers.push_back (HandlerPtr(new AudioTrackImportHandler (tree, target, *pl_handler)));
-       handlers.push_back (HandlerPtr(new LocationImportHandler (tree, target)));
-       handlers.push_back (HandlerPtr(new TempoMapImportHandler (tree, target)));
-
-       fill_list();
-
-       if (ElementImportHandler::dirty()) {
-               // Warn user
-               string txt = _("Some elements had errors in them. Please see the log for details");
-               Gtk::MessageDialog msg (txt, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
-               msg.run();
+       if (_session) {
+               tree.read (filename);
+               boost::shared_ptr<AudioRegionImportHandler> region_handler (new AudioRegionImportHandler (tree, *_session));
+               boost::shared_ptr<AudioPlaylistImportHandler> pl_handler (new AudioPlaylistImportHandler (tree, *_session, *region_handler));
+               
+               handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (region_handler));
+               handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (pl_handler));
+               handlers.push_back (HandlerPtr(new UnusedAudioPlaylistImportHandler (tree, *_session, *region_handler)));
+               handlers.push_back (HandlerPtr(new AudioTrackImportHandler (tree, *_session, *pl_handler)));
+               handlers.push_back (HandlerPtr(new LocationImportHandler (tree, *_session)));
+               handlers.push_back (HandlerPtr(new TempoMapImportHandler (tree, *_session)));
+               
+               fill_list();
+               
+               if (ElementImportHandler::dirty()) {
+                       // Warn user
+                       string txt = _("Some elements had errors in them. Please see the log for details");
+                       Gtk::MessageDialog msg (txt, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
+                       msg.run();
+               }
        }
 }
 
index 4144d07c880d27da5c050a7c7e8f4544cc466b2b..01cbb6c0cccb4f4ce8e4e2fdec040a3bf7908d5a 100644 (file)
@@ -48,7 +48,7 @@ class SessionImportDialog : public ArdourDialog
        typedef std::list<ElementPtr> ElementList;
 
   public:
-       SessionImportDialog (ARDOUR::Session & target);
+       SessionImportDialog (ARDOUR::Session* target);
 
        virtual Gtk::FileChooserAction browse_action() const { return Gtk::FILE_CHOOSER_ACTION_OPEN; }
 
@@ -68,7 +68,6 @@ class SessionImportDialog : public ArdourDialog
        // Data
        HandlerList        handlers;
        XMLTree            tree;
-       ARDOUR::Session   &target;
 
        // GUI
        Gtk::Frame                    file_frame;
index 6feec36fdf87dca68f0f1619e85491008350c69b..0bce776c62412f7875aedce1dd160c44695aeddf 100644 (file)
@@ -216,7 +216,6 @@ NumberMetadataField::str_to_uint (ustring const & str) const
 SessionMetadataSet::SessionMetadataSet (ustring const & name) :
   name (name)
 {
-       session = 0;
 }
 
 void
@@ -247,9 +246,13 @@ SessionMetadataSetEditable::get_tab_widget ()
 void
 SessionMetadataSetEditable::set_session (ARDOUR::Session * s)
 {
-       session = s;
+       SessionHandlePtr::set_session (s);
 
-       ARDOUR::SessionMetadata const & data = session->metadata();
+       if (!_session) {
+               return;
+       }
+
+       ARDOUR::SessionMetadata const & data = _session->metadata();
 
        table.resize (list.size(), 2);
        uint32_t row = 0;
@@ -266,7 +269,7 @@ SessionMetadataSetEditable::set_session (ARDOUR::Session * s)
 void
 SessionMetadataSetEditable::save_data ()
 {
-       ARDOUR::SessionMetadata & data = session->metadata();
+       ARDOUR::SessionMetadata & data = _session->metadata();
        for (DataList::const_iterator it = list.begin(); it != list.end(); ++it) {
                (*it)->save_data(data);
        }
@@ -300,8 +303,6 @@ SessionMetadataSetImportable::SessionMetadataSetImportable (ustring const & name
        tree_view.append_column (*viewcol);
 
        select_all_check.signal_toggled().connect (sigc::mem_fun(*this, &SessionMetadataSetImportable::select_all));
-
-       session = 0;
 }
 
 Gtk::Widget &
@@ -321,12 +322,12 @@ SessionMetadataSetImportable::get_select_all_widget ()
 void
 SessionMetadataSetImportable::load_extra_data (ARDOUR::SessionMetadata const & data)
 {
-       if (!session) {
+       if (!_session) {
                std::cerr << "Programming error: no session set for SessionMetaDataSetImportable (in load_data)!" << std::endl;
                return;
        }
 
-       ARDOUR::SessionMetadata & session_data = session->metadata();
+       ARDOUR::SessionMetadata & session_data = _session->metadata();
 
        MetadataPtr session_field;
        MetadataPtr import_field;
@@ -369,12 +370,12 @@ SessionMetadataSetImportable::load_extra_data (ARDOUR::SessionMetadata const & d
 void
 SessionMetadataSetImportable::save_data ()
 {
-       if (!session) {
+       if (!_session) {
                std::cerr << "Programming error: no session set for SessionMetaDataSetImportable (in import_data)!" << std::endl;
                return;
        }
 
-       ARDOUR::SessionMetadata & session_data = session->metadata();
+       ARDOUR::SessionMetadata & session_data = _session->metadata();
 
        Gtk::TreeModel::Children fields = tree->children();
        Gtk::TreeModel::Children::iterator it;
@@ -425,7 +426,7 @@ template <typename DataSet>
 void
 SessionMetadataDialog<DataSet>::init_data ()
 {
-       if (!session) {
+       if (!_session) {
                std::cerr << "Programming error: no session set for SessionMetaDataDialog (in init_data)!" << std::endl;
                return;
        }
@@ -435,7 +436,7 @@ SessionMetadataDialog<DataSet>::init_data ()
        init_people_data ();
 
        for (DataSetList::iterator it = data_list.begin(); it != data_list.end(); ++it) {
-               (*it)->set_session (session);
+               (*it)->set_session (_session);
 
                notebook.append_page ((*it)->get_widget(), (*it)->get_tab_widget());
        }
@@ -659,7 +660,7 @@ SessionMetadataImporter::~SessionMetadataImporter ()
 void
 SessionMetadataImporter::run ()
 {
-       if (!session) {
+       if (!_session) {
                std::cerr << "Programming error: no session set for SessionMetaDataImporter (in run)!" << std::endl;
                return;
        }
index 3e618c079ffb5525617779030e928c72fe47e156..be64c90ae930cdc5f0ada7abc14c682ce22e25aa 100644 (file)
@@ -117,15 +117,13 @@ class NumberMetadataField : public MetadataField {
 };
 
 /// Interface for MetadataFields
-class SessionMetadataSet {
+class SessionMetadataSet : public ARDOUR::SessionHandlePtr {
   public:
        SessionMetadataSet (Glib::ustring const & name);
        virtual ~SessionMetadataSet () {};
 
        void add_data_field (MetadataPtr field);
 
-       /// Sets session, into which the data is eventually saved
-       virtual void set_session (ARDOUR::Session * s) { session = s; }
        /// allows loading extra data into data sets (for importing etc.)
        virtual void load_extra_data (ARDOUR::SessionMetadata const & /*data*/) { }
        /// Saves data to session
@@ -138,7 +136,6 @@ class SessionMetadataSet {
        typedef std::list<MetadataPtr> DataList;
        DataList list;
        Glib::ustring name;
-       ARDOUR::Session *session;
 };
 
 /// Contains MetadataFields for editing
index 05eacd1367e57574601119c5a8ecb4891f09d8cc..6919be9f622ca7d4979b58fb26a1026ffcec1eb5 100644 (file)
@@ -113,8 +113,7 @@ importmode2string (ImportMode mode)
 }
 
 SoundFileBox::SoundFileBox (bool persistent)
-       : _session(0),
-         table (6, 2),
+       : table (6, 2),
          length_clock ("sfboxLengthClock", !persistent, "EditCursorClock", false, false, true, false),
          timecode_clock ("sfboxTimecodeClock", !persistent, "EditCursorClock", false, false, false, false),
          main_box (false, 6),
@@ -202,16 +201,15 @@ SoundFileBox::SoundFileBox (bool persistent)
 void
 SoundFileBox::set_session(Session* s)
 {
-       _session = s;
+       SessionHandlePtr::set_session (s);
+
+       length_clock.set_session (s);
+       timecode_clock.set_session (s);
 
        if (!_session) {
                play_btn.set_sensitive (false);
                stop_btn.set_sensitive (false);
        }
-
-
-       length_clock.set_session (s);
-       timecode_clock.set_session (s);
 }
 
 bool
@@ -582,7 +580,8 @@ SoundFileBrowser::set_session (Session* s)
 {
        ArdourDialog::set_session (s);
        preview.set_session (s);
-       if (s) {
+
+       if (_session) {
                add_gain_meter ();
        } else {
                remove_gain_meter ();
@@ -594,9 +593,9 @@ SoundFileBrowser::add_gain_meter ()
 {
        delete gm;
 
-       gm = new GainMeter (*session, 250);
+       gm = new GainMeter (_session, 250);
 
-       boost::shared_ptr<Route> r = session->the_auditioner ();
+       boost::shared_ptr<Route> r = _session->the_auditioner ();
 
        gm->set_controls (r, r->shared_peak_meter(), r->amp());
 
@@ -633,7 +632,7 @@ SoundFileBrowser::stop_metering ()
 void
 SoundFileBrowser::meter ()
 {
-       if (is_mapped () && session && gm) {
+       if (is_mapped () && _session && gm) {
                gm->update_meters ();
        }
 }
@@ -906,7 +905,7 @@ SoundFileOmega::reset_options ()
        bool same_size;
        bool src_needed;
        bool selection_includes_multichannel;
-       bool selection_can_be_embedded_with_links = check_link_status (*session, paths);
+       bool selection_can_be_embedded_with_links = check_link_status (_session, paths);
        ImportMode mode;
 
        if (check_info (paths, same_size, src_needed, selection_includes_multichannel)) {
@@ -1100,7 +1099,7 @@ SoundFileOmega::check_info (const vector<ustring>& paths, bool& same_size, bool&
                                }
                        }
 
-                       if ((nframes_t) info.samplerate != session->frame_rate()) {
+                       if ((nframes_t) info.samplerate != _session->frame_rate()) {
                                src_needed = true;
                        }
 
@@ -1126,9 +1125,9 @@ SoundFileOmega::check_info (const vector<ustring>& paths, bool& same_size, bool&
 
 
 bool
-SoundFileOmega::check_link_status (const Session& s, const vector<ustring>& paths)
+SoundFileOmega::check_link_status (const Session* s, const vector<ustring>& paths)
 {
-       sys::path path = s.session_directory().sound_path() / "linktest";
+       sys::path path = s->session_directory().sound_path() / "linktest";
        string tmpdir = path.to_string();
        bool ret = false;
 
@@ -1174,8 +1173,8 @@ SoundFileChooser::on_hide ()
        ArdourDialog::on_hide();
        stop_metering ();
 
-       if (session) {
-               session->cancel_audition();
+       if (_session) {
+               _session->cancel_audition();
        }
 }
 
@@ -1360,8 +1359,8 @@ void
 SoundFileOmega::on_hide ()
 {
        ArdourDialog::on_hide();
-       if (session) {
-               session->cancel_audition();
+       if (_session) {
+               _session->cancel_audition();
        }
 }
 
index c3030669c2134a6148a9b8a0bf64fb64808f27c4..15affab5706db414ec8cbc9340f803116615c4c3 100644 (file)
@@ -39,6 +39,7 @@
 #include <gtkmm/textview.h>
 
 #include "ardour/audiofilesource.h"
+#include "ardour/session_handle.h"
 
 #include "ardour_dialog.h"
 #include "editing.h"
@@ -50,7 +51,7 @@ namespace ARDOUR {
 
 class GainMeter;
 
-class SoundFileBox : public Gtk::VBox
+class SoundFileBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
 {
   public:
        SoundFileBox (bool persistent);
@@ -64,7 +65,6 @@ class SoundFileBox : public Gtk::VBox
        bool autoplay () const;
 
   protected:
-       ARDOUR::Session* _session;
        Glib::ustring path;
 
        ARDOUR::SoundFileInfo sf_info;
@@ -241,7 +241,7 @@ class SoundFileOmega : public SoundFileBrowser
        bool check_info (const std::vector<Glib::ustring>& paths,
                         bool& same_size, bool& src_needed, bool& multichannel);
 
-       static bool check_link_status (const ARDOUR::Session&, const std::vector<Glib::ustring>& paths);
+       static bool check_link_status (const ARDOUR::Session*, const std::vector<Glib::ustring>& paths);
 
        void file_selection_changed ();
        bool reset_options ();
index 168ddb390437af04b3d9a8cb0c0d0d00c7ac7be2..626e2bf5375c14e9c9ffb42d7b1c6318b5cbe83b 100644 (file)
@@ -79,16 +79,12 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group)
                        canvas_rect, &_trackview));
 
        if (_trackview.is_track()) {
-               _trackview.track()->DiskstreamChanged.connect (
-                               sigc::mem_fun (*this, &StreamView::diskstream_changed));
-               _trackview.session().TransportStateChange.connect (
-                               sigc::mem_fun (*this, &StreamView::transport_changed));
-               _trackview.session().TransportLooped.connect (
-                               sigc::mem_fun (*this, &StreamView::transport_looped));
-               _trackview.get_diskstream()->RecordEnableChanged.connect (
-                               sigc::mem_fun (*this, &StreamView::rec_enable_changed));
-               _trackview.session().RecordStateChanged.connect (
-                               sigc::mem_fun (*this, &StreamView::sess_rec_enable_changed));
+               scoped_connect (_trackview.track()->DiskstreamChanged, boost::bind (&StreamView::diskstream_changed, this));
+               scoped_connect (_trackview.get_diskstream()->RecordEnableChanged, boost::bind (&StreamView::rec_enable_changed, this));
+
+               scoped_connect (_trackview.session()->TransportStateChange, boost::bind (&StreamView::transport_changed, this));
+               scoped_connect (_trackview.session()->TransportLooped, boost::bind (&StreamView::transport_looped, this));
+               scoped_connect (_trackview.session()->RecordStateChanged, boost::bind (&StreamView::sess_rec_enable_changed, this));
        }
 
        ColorsChanged.connect (sigc::mem_fun (*this, &StreamView::color_handler));
@@ -96,6 +92,8 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group)
 
 StreamView::~StreamView ()
 {
+       cerr << "Streamview " << _trackview.name() << " deleted\n";
+
        undisplay_diskstream ();
 
        delete canvas_rect;
@@ -210,6 +208,7 @@ StreamView::remove_region_view (boost::weak_ptr<Region> weak_r)
                if (((*i)->region()) == r) {
                        RegionView* rv = *i;
                        region_views.erase (i);
+                       cerr << "Deleting RV for " << r->name() << " @ " << r << endl;
                        delete rv;
                        break;
                }
@@ -234,9 +233,7 @@ StreamView::display_diskstream (boost::shared_ptr<Diskstream> ds)
 {
        playlist_change_connection.disconnect();
        playlist_changed (ds);
-       playlist_change_connection = ds->PlaylistChanged.connect (
-               sigc::bind (sigc::mem_fun (*this, &StreamView::playlist_changed_weak),
-                           boost::weak_ptr<Diskstream> (ds)));
+       playlist_change_connection = ds->PlaylistChanged.connect (boost::bind (&StreamView::playlist_changed_weak, this, boost::weak_ptr<Diskstream> (ds)));
 }
 
 void
@@ -342,12 +339,7 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds)
 
        /* disconnect from old playlist */
 
-       for (vector<sigc::connection>::iterator i = playlist_connections.begin();
-                       i != playlist_connections.end(); ++i) {
-               (*i).disconnect();
-       }
-
-       playlist_connections.clear();
+       playlist_connections.drop_connections ();
        undisplay_diskstream ();
 
        /* update layers count and the y positions and heights of our regions */
@@ -363,14 +355,9 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds)
 
        /* catch changes */
 
-       playlist_connections.push_back (ds->playlist()->Modified.connect (sigc::bind (
-                       sigc::mem_fun (*this, &StreamView::playlist_modified_weak), ds)));
-
-       playlist_connections.push_back (ds->playlist()->RegionAdded.connect (
-                       sigc::mem_fun (*this, &StreamView::add_region_view_weak)));
-
-       playlist_connections.push_back (ds->playlist()->RegionRemoved.connect (
-                       sigc::mem_fun (*this, &StreamView::remove_region_view)));
+       playlist_connections.add_connection (ds->playlist()->Modified.connect (boost::bind (&StreamView::playlist_modified_weak, this, ds)));
+       playlist_connections.add_connection (ds->playlist()->RegionAdded.connect (boost::bind (&StreamView::add_region_view_weak, this, _1)));
+       playlist_connections.add_connection (ds->playlist()->RegionRemoved.connect (boost::bind (&StreamView::remove_region_view, this, _1)));
 }
 
 void
index 3b715ff0993e45aff93bfe4a83e435b777e25e11..0fe0b1a9ed5942c434fa68c16cf687e979ab5b33 100644 (file)
@@ -22,6 +22,8 @@
 #include <list>
 #include <cmath>
 
+#include "pbd/scoped_connections.h"
+
 #include "ardour/location.h"
 #include "enums.h"
 #include "simplerect.h"
@@ -53,7 +55,7 @@ class RegionSelection;
 class CrossfadeView;
 class Selection;
 
-class StreamView : public sigc::trackable
+class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
 {
 public:
        virtual ~StreamView ();
@@ -158,16 +160,16 @@ protected:
        Gdk::Color region_color;      ///< Contained region color
        uint32_t   stream_base_color; ///< Background color
 
-       std::vector<sigc::connection> playlist_connections;
-       sigc::connection         playlist_change_connection;
+       PBD::ScopedConnectionList playlist_connections;
+       boost::signals2::scoped_connection playlist_change_connection;
 
        ARDOUR::layer_t _layers;
        LayerDisplay    _layer_display;
 
        double height;
 
-       std::list<sigc::connection> rec_data_ready_connections;
-       nframes_t                   last_rec_data_frame;
+       PBD::ScopedConnectionList rec_data_ready_connections;
+       nframes_t                 last_rec_data_frame;
 
 private:
        void update_coverage_frames ();
index 6872e164556dc558834d95c7617ef104de3f2689..ab1297d6bcbebe619974e7ea78b430aa33af25a9 100644 (file)
@@ -129,7 +129,7 @@ StripSilenceDialog::create_waves ()
        int n = 0;
 
        for (std::list<Wave>::iterator i = _waves.begin(); i != _waves.end(); ++i) {
-               if (i->region->audio_source(0)->peaks_ready (sigc::mem_fun (*this, &StripSilenceDialog::peaks_ready), _peaks_ready_connection)) {
+               if (i->region->audio_source(0)->peaks_ready (boost::bind (&StripSilenceDialog::peaks_ready, this), _peaks_ready_connection)) {
                        i->view = new WaveView (*(_canvas->root()));
                        i->view->property_data_src() = static_cast<gpointer>(i->region.get());
                        i->view->property_cache() = WaveView::create_cache ();
index b7f776b537319cfafed24052e0aa35d0328d33f2..f79abb8eb9254457cfdb59b0581055626f22102c 100644 (file)
@@ -66,5 +66,5 @@ private:
        int _wave_width;
        int _wave_height;
 
-       sigc::connection _peaks_ready_connection;
+       boost::signals2::scoped_connection _peaks_ready_connection;
 };
index b8d7b3b9e02517dc1a567f7bcd4d705d28bfa748..e1368dc5f339f0be168a59133a8aef4ff5ed3491 100644 (file)
@@ -74,7 +74,7 @@ uint32_t TimeAxisView::hSmall = 0;
 bool TimeAxisView::need_size_info = true;
 int const TimeAxisView::_max_order = 512;
 
-TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
+TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
        : AxisView (sess),
          controls_table (2, 8),
          _y_position (0),
@@ -924,7 +924,7 @@ TimeAxisView::add_ghost (RegionView* rv)
 
        if(gr) {
                ghosts.push_back(gr);
-               gr->GoingAway.connect (sigc::mem_fun(*this, &TimeAxisView::erase_ghost));
+               scoped_connect (gr->GoingAway, boost::bind (&TimeAxisView::erase_ghost, this, _1));
        }
 }
 
index e8860cb907840ed772d5dbf950e13b28681f4abb..67aaa0d327e07084ea2f69dc2b51e1526c3821cc 100644 (file)
@@ -34,6 +34,7 @@
 #include <gtkmm2ext/focus_entry.h>
 
 #include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
 
 #include "ardour/types.h"
 #include "ardour/region.h"
@@ -89,7 +90,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
        static uint32_t hSmaller;
        static uint32_t hSmall;
 
-       TimeAxisView(ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* parent, ArdourCanvas::Canvas& canvas);
+       TimeAxisView(ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* parent, ArdourCanvas::Canvas& canvas);
        virtual ~TimeAxisView ();
 
        XMLNode& get_state ();
index de8d3792dba68dfc6013ba5c764805094ed8977b..1dd16043ad583e8943350f2bee2ece71881fad14 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <libgnomecanvasmm/pixbuf.h>
 
+#include "pbd/scoped_connections.h"
+
 #include "selectable.h"
 #include "simplerect.h"
 #include "canvas.h"
@@ -35,7 +37,7 @@ class TimeAxisView;
  * A base class for 'items' that may appear upon a TimeAxisView
  *
  */
-class TimeAxisViewItem : public Selectable
+class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
 {
    public:
        virtual ~TimeAxisViewItem() ;
index 1e83f56dc97e324a265f3889ff53371002a85d2b..b4b613042b99cbcd96152a506bc4f9f0c1015bdc 100644 (file)
@@ -65,7 +65,7 @@ using namespace Gtk;
  * @param sess the current session
  * @param canvas the parent canvas object
  */
-VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session& sess, Canvas& canvas)
+VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session* sess, Canvas& canvas)
        : AxisView(sess),
          TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
          visual_button (_("v")),
index f728a1f4cf81bcafe52ed51015b496b8cf77f859..9bc98fc345d20bebbb9542ed899cb2f0a0f60c0c 100644 (file)
@@ -145,7 +145,7 @@ class VisualTimeAxis : public TimeAxisView
                 * @param sess the current session
                 * @param canvas the parent canvas object
                 */
-               VisualTimeAxis(const std::string & name, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas) ;
+               VisualTimeAxis(const std::string & name, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ;
 
 
                //---------------------------------------------------------------------------------------//
index a1b3d06f6218736d8a7ffe0fcccbf7d0010feb0a..1333b58d6f5c805efbc1522d3f965e106fe4e170 100644 (file)
@@ -26,6 +26,8 @@
 #include <limits.h>
 #include <signal.h>
 
+#include <boost/signals2.hpp>
+
 #include "pbd/error.h"
 #include "pbd/failed_constructor.h"
 #include "pbd/locale_guard.h"
@@ -44,7 +46,7 @@ namespace ARDOUR {
        class AudioEngine;
 
        static const nframes_t max_frames = JACK_MAX_FRAMES;
-       extern sigc::signal<void,std::string> BootMessage;
+       extern boost::signals2::signal<void(std::string)> BootMessage;
 
        int init (bool with_vst, bool try_optimization);
        void init_post_engine ();
index 838c9406eeab517e13881500511d3b4d0647a095..4d2209d79b7703422c575526772edc9c726d8ce1 100644 (file)
@@ -19,7 +19,6 @@
 #ifndef __ardour_audio_diskstream_h__
 #define __ardour_audio_diskstream_h__
 
-#include <sigc++/signal.h>
 
 #include <cmath>
 #include <string>
index a9c414e5663745be1e29f9c4a5cef5b704d25baf..ac367ddd64bdeb96074f846bd3f3ab74cc209231 100644 (file)
 #include <exception>
 #include <string>
 
-#include <sigc++/signal.h>
 
 #include <glibmm/thread.h>
 
 #include "pbd/rcu.h"
+#include "pbd/scoped_connections.h"
 
 #include "ardour/ardour.h"
 #include <jack/jack.h>
 #include <jack/transport.h>
-#include "ardour/types.h"
+
 #include "ardour/data_type.h"
+#include "ardour/session_handle.h"
+#include "ardour/types.h"
 
 namespace ARDOUR {
 
@@ -45,7 +47,7 @@ class MidiPort;
 class Port;
 class Session;
 
-class AudioEngine : public sigc::trackable
+class AudioEngine : public SessionHandlePtr
 {
    public:
        typedef std::set<Port*> Ports;
@@ -110,7 +112,7 @@ class AudioEngine : public sigc::trackable
        }
 
        void set_session (Session *);
-       void remove_session ();
+       void remove_session (); // not a replacement for SessionHandle::session_going_away()
 
        class PortRegistrationFailure : public std::exception {
        public:
@@ -185,32 +187,32 @@ class AudioEngine : public sigc::trackable
 _         the regular process() call to session->process() is not made.
        */
 
-       sigc::signal<int,nframes_t> Freewheel;
+       boost::signals2::signal<int(nframes_t)> Freewheel;
 
-       sigc::signal<void> Xrun;
+       boost::signals2::signal<void()> Xrun;
 
        /* this signal is if JACK notifies us of a graph order event */
 
-       sigc::signal<void> GraphReordered;
+       boost::signals2::signal<void()> GraphReordered;
 
        /* this signal is emitted if the sample rate changes */
 
-       sigc::signal<void,nframes_t> SampleRateChanged;
+       boost::signals2::signal<void(nframes_t)> SampleRateChanged;
 
        /* this signal is sent if JACK ever disconnects us */
 
-       sigc::signal<void> Halted;
+       boost::signals2::signal<void()> Halted;
 
        /* these two are emitted when the engine itself is
           started and stopped
        */
 
-       sigc::signal<void> Running;
-       sigc::signal<void> Stopped;
+       boost::signals2::signal<void()> Running;
+       boost::signals2::signal<void()> Stopped;
 
        /* this signal is emitted if a JACK port is registered or unregistered */
 
-       sigc::signal<void> PortRegisteredOrUnregistered;
+       boost::signals2::signal<void()> PortRegisteredOrUnregistered;
 
        std::string make_port_name_relative (std::string);
        std::string make_port_name_non_relative (std::string);
@@ -221,7 +223,6 @@ _      the regular process() call to session->process() is not made.
   private:
        static AudioEngine*       _instance;
 
-       ARDOUR::Session*           session;
        jack_client_t* volatile   _jack; /* could be reset to null by SIGPIPE or another thread */
        std::string                jack_client_name;
        Glib::Mutex               _process_lock;
@@ -241,7 +242,7 @@ _      the regular process() call to session->process() is not made.
        bool                      _freewheeling;
        bool                      _freewheel_pending;
        bool                      _freewheel_thread_registered;
-       sigc::slot<int,nframes_t>  freewheel_action;
+       boost::function<int(nframes_t)>  freewheel_action;
        bool                       reconnect_on_halt;
        int                       _usecs_per_cycle;
 
index 6c04ebffb16bc2b51b1ace1ac403df8597c58309..3312bc889d6a3148d03941e6d6b8f3720b6446a2 100644 (file)
@@ -84,7 +84,7 @@ public:
        static void set_bwf_serial_number (int);
        static void set_header_position_offset (nframes_t offset );
 
-       static sigc::signal<void> HeaderPositionOffsetChanged;
+       static boost::signals2::signal<void()> HeaderPositionOffsetChanged;
 
 protected:
        /** Constructor to be called for existing external-to-session files */
index 277fe5a8e194b33d0b943f61f2e1873e7a2f3a62..927ccfbe1159c17445d42c2a99e797012fd0b444 100644 (file)
@@ -52,9 +52,9 @@ class AudioPlaylist : public ARDOUR::Playlist
 
        int set_state (const XMLNode&, int version);
 
-       sigc::signal<void,boost::shared_ptr<Crossfade> > NewCrossfade;
-
-       void foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> >);
+       boost::signals2::signal<void(boost::shared_ptr<Crossfade>)>  NewCrossfade;
+       
+       void foreach_crossfade (boost::function<void (boost::shared_ptr<Crossfade>)>);
        void crossfades_at (nframes_t frame, Crossfades&);
 
        bool destroy_region (boost::shared_ptr<Region>);
index 328a23ac19a8ca19eb077e66a302523945aeef67..dfa103f2e3af1fa63e96fd173766b2067165f50e 100644 (file)
@@ -27,8 +27,7 @@
 
 #include <glibmm/thread.h>
 #include <glibmm/ustring.h>
-
-#include <sigc++/signal.h>
+#include <boost/function.hpp>
 
 #include "ardour/source.h"
 #include "ardour/ardour.h"
@@ -73,10 +72,10 @@ class AudioSource : virtual public Source,
                        sframes_t start, nframes_t cnt, double samples_per_visual_peak) const;
 
        int  build_peaks ();
-       bool peaks_ready (sigc::slot<void>, sigc::connection&) const;
+       bool peaks_ready (boost::function<void()> callWhenReady, boost::signals2::connection& connection_established_if_not_ready) const;
 
-       mutable sigc::signal<void>  PeaksReady;
-       mutable sigc::signal<void,nframes_t,nframes_t>  PeakRangeReady;
+       mutable boost::signals2::signal<void()>  PeaksReady;
+       mutable boost::signals2::signal<void(nframes_t,nframes_t)>  PeakRangeReady;
 
        XMLNode& get_state ();
        int set_state (const XMLNode&, int version);
index 69c8e38c9510771bdc4d0dc318c53129c5fc3e26..c75abda0b728971e8a1b9061cb364373effa6731 100644 (file)
@@ -24,7 +24,6 @@
 #include <list>
 #include <cmath>
 
-#include <sigc++/signal.h>
 #include <glibmm/thread.h>
 
 #include "pbd/undo.h"
@@ -57,11 +56,11 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL
 
        void set_automation_state (AutoState);
        AutoState automation_state() const { return _state; }
-       sigc::signal<void> automation_state_changed;
+       boost::signals2::signal<void()> automation_state_changed;
 
        void set_automation_style (AutoStyle m);
        AutoStyle automation_style() const { return _style; }
-       sigc::signal<void> automation_style_changed;
+       boost::signals2::signal<void()> automation_style_changed;
 
        bool automation_playback() const {
                return (_state & Play) || ((_state & Touch) && !_touching);
@@ -70,10 +69,10 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL
                return (_state & Write) || ((_state & Touch) && _touching);
        }
 
-       sigc::signal<void> StateChanged;
+       boost::signals2::signal<void()> StateChanged;
 
-       static sigc::signal<void, AutomationList*> AutomationListCreated;
-       mutable sigc::signal<void> Dirty;
+       static boost::signals2::signal<void(AutomationList*)> AutomationListCreated;
+       mutable boost::signals2::signal<void()> Dirty;
 
        void start_touch ();
        void stop_touch ();
index 196b1f2a091c1ac8757b5d8bb79084016b28ebf0..662c3799a5292f569a282c055546cc734dfc34cc 100644 (file)
 #include <string>
 #include <vector>
 #include <glibmm/thread.h>
-#include <sigc++/signal.h>
 #include <boost/shared_ptr.hpp>
+
+#include "pbd/scoped_connections.h"
+
 #include "ardour/data_type.h"
 
 namespace ARDOUR {
@@ -37,7 +39,7 @@ class AudioEngine;
  *  `Channel' is a rather overloaded term but I can't think of a better
  *  one right now.
  */
-class Bundle : public sigc::trackable
+class Bundle : public PBD::ScopedConnectionList
 {
   public:
 
@@ -118,7 +120,7 @@ class Bundle : public sigc::trackable
                DirectionChanged = 0x10 ///< the direction (whether ports are inputs or outputs) has changed
        };
 
-       sigc::signal<void, Change> Changed;
+       boost::signals2::signal<void(Change)> Changed;
 
   protected:
 
index b88b82073605385a3dcc3d8dc6a6ba49500ea34e..60697517fb4095bb20cf86456b7d967dc231aad6 100644 (file)
 #define __ardour_butler_h__
 
 #include <glibmm/thread.h>
+
 #include "ardour/types.h"
+#include "ardour/session_handle.h"
 
 namespace ARDOUR {
 
-class Session;
-
-class Butler {
-public:
-       Butler(Session* session);
+class Butler : public SessionHandleRef
+{
+  public:
+       Butler (Session& session);
        ~Butler();
-
+       
        int  start_thread();
        void terminate_thread();
        void schedule_transport_work();
@@ -58,7 +59,6 @@ public:
                };
        };
 
-       Session*     session;
        pthread_t    thread;
        Glib::Mutex  request_lock;
        Glib::Cond   paused;
index 02bbcaca23a5f9dd42cb90729909270c7d8bc959..1c82309d87fc0c567588510beaabecc3b08d2cf2 100644 (file)
@@ -19,7 +19,9 @@
 
 #ifndef __ardour_configuration_h__
 #define __ardour_configuration_h__
+
 #include <boost/function.hpp>
+#include <boost/signals2.hpp>
 #include "pbd/stateful.h"
 #include "ardour/configuration_variable.h"
 
@@ -39,7 +41,7 @@ class Configuration : public PBD::Stateful
        virtual XMLNode & get_variables () = 0;
        virtual void set_variables (XMLNode const &) = 0;
 
-       sigc::signal<void, std::string> ParameterChanged;
+       boost::signals2::signal<void(std::string)> ParameterChanged;
 };
 
 } // namespace ARDOUR
index d2b1796b1807bda11453ab8c30898dad205580a9..6fedc95c6c679bb309d69d8a79bc9c67a9d39d88 100644 (file)
 #include <string>
 #include <list>
 
-#include <sigc++/sigc++.h>
 
 #include <glibmm/thread.h>
 
 #include "pbd/stateful.h"
+#include "ardour/session_handle.h"
 
 namespace ARDOUR {
 
@@ -49,16 +49,16 @@ struct ControlProtocolInfo {
     ~ControlProtocolInfo() { if (state) { delete state; } }
 };
 
- class ControlProtocolManager : public sigc::trackable, public PBD::Stateful
+class ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandlePtr
 {
   public:
        ~ControlProtocolManager ();
 
        static ControlProtocolManager& instance();
 
-       void set_session (Session&);
+       void set_session (Session*);
        void discover_control_protocols ();
-       void foreach_known_protocol (sigc::slot<void,const ControlProtocolInfo*>);
+       void foreach_known_protocol (boost::function<void(const ControlProtocolInfo*)>);
        void load_mandatory_protocols ();
 
        ControlProtocol* instantiate (ControlProtocolInfo&);
@@ -77,11 +77,10 @@ struct ControlProtocolInfo {
        ControlProtocolManager ();
        static ControlProtocolManager* _instance;
 
-       Session* _session;
        Glib::Mutex protocols_lock;
        std::list<ControlProtocol*>    control_protocols;
 
-       void drop_session ();
+       void session_going_away ();
 
        int control_protocol_discover (std::string path);
        ControlProtocolDescriptor* get_descriptor (std::string path);
index 5d8e0235fb96ed604f6a9e7d9873a344437587b1..1a492b742b9029a0b594910cd8f0d6c457ac62ed 100644 (file)
@@ -24,7 +24,6 @@
 #include <algorithm>
 #include <boost/shared_ptr.hpp>
 
-#include <sigc++/signal.h>
 
 #include "pbd/undo.h"
 #include "pbd/statefuldestructible.h"
@@ -106,8 +105,8 @@ class Crossfade : public ARDOUR::AudioRegion
 
        nframes_t overlap_length() const;
 
-       sigc::signal<void,boost::shared_ptr<Region> > Invalidated;
-       sigc::signal<void,Change>     StateChanged;
+       boost::signals2::signal<void(boost::shared_ptr<Region>)> Invalidated;
+       boost::signals2::signal<void(Change)>     StateChanged;
 
        bool covers (nframes_t frame) const {
                return _position <= frame && frame < _position + _length;
index 1b1a217466a79b72e57ac0856868bfa520546152..7a5931c5fb68551b4392a49ea1e3b6cf18074c6d 100644 (file)
@@ -20,6 +20,7 @@
 #define __ardour_delivery_h__
 
 #include <string>
+
 #include "ardour/types.h"
 #include "ardour/chan_count.h"
 #include "ardour/io_processor.h"
@@ -31,7 +32,8 @@ class IO;
 class MuteMaster;
 class Panner;
 
-class Delivery : public IOProcessor {
+class Delivery : public IOProcessor
+{
 public:
        enum Role {
                /* main outputs - delivers out-of-place to port buffers, and cannot be removed */
@@ -83,9 +85,9 @@ public:
 
        BufferSet& output_buffers() { return *_output_buffers; }
 
-       sigc::signal<void> MuteChange;
+       boost::signals2::signal<void()> MuteChange;
 
-       static sigc::signal<void,nframes_t> CycleStart;
+       static boost::signals2::signal<void(nframes_t)> CycleStart;
 
        XMLNode& state (bool full);
        int set_state (const XMLNode&, int version);
@@ -118,10 +120,10 @@ public:
        boost::shared_ptr<Panner> _panner;
 
        static bool panners_legal;
-       static sigc::signal<int>            PannersLegal;
+       static boost::signals2::signal<int()>            PannersLegal;
 
        int panners_became_legal ();
-       sigc::connection panner_legal_c;
+       boost::signals2::scoped_connection panner_legal_c;
        void output_changed (IOChange, void*);
 
        gain_t target_gain ();
index 87fffb92f7a913396d405c84bc570fe5fe04f7bd..a9664daa3227512f4a5f41ea494561de90fe414a 100644 (file)
@@ -27,8 +27,6 @@
 #include <cmath>
 #include <time.h>
 
-#include <sigc++/signal.h>
-
 #include <boost/utility.hpp>
 
 #include "evoral/types.hpp"
@@ -145,15 +143,15 @@ class Diskstream : public SessionObject, public boost::noncopyable
        void move_processor_automation (boost::weak_ptr<Processor>,
                        std::list< Evoral::RangeMove<nframes_t> > const &);
 
-       sigc::signal<void>            RecordEnableChanged;
-       sigc::signal<void>            SpeedChanged;
-       sigc::signal<void>            ReverseChanged;
-       sigc::signal<void>            PlaylistChanged;
-       sigc::signal<void>            AlignmentStyleChanged;
-       sigc::signal<void,Location *> LoopSet;
+       boost::signals2::signal<void()>            RecordEnableChanged;
+       boost::signals2::signal<void()>            SpeedChanged;
+       boost::signals2::signal<void()>            ReverseChanged;
+       boost::signals2::signal<void()>            PlaylistChanged;
+       boost::signals2::signal<void()>            AlignmentStyleChanged;
+       boost::signals2::signal<void(Location *)> LoopSet;
 
-       static sigc::signal<void>     DiskOverrun;
-       static sigc::signal<void>     DiskUnderrun;
+       static boost::signals2::signal<void()>     DiskOverrun;
+       static boost::signals2::signal<void()>     DiskUnderrun;
 
   protected:
        friend class Session;
@@ -306,11 +304,9 @@ class Diskstream : public SessionObject, public boost::noncopyable
        nframes_t scrub_buffer_size;
        nframes_t scrub_offset;
 
-       sigc::connection ports_created_c;
-       sigc::connection plmod_connection;
-       sigc::connection plgone_connection;
-       sigc::connection plregion_connection;
-       sigc::connection ic_connection;
+       PBD::ScopedConnectionList playlist_connections;
+
+       boost::signals2::scoped_connection ic_connection;
 
        Flag _flags;
 
index a203c5d37bb7b956581526dff571a287db13e677..d728a4b98997431973de1ea01ad96dd7cf9f0b65 100644 (file)
@@ -24,8 +24,7 @@
 #include <string>
 #include <utility>
 
-#include <sigc++/signal.h>
-
+#include <boost/signals2.hpp>
 #include "ardour/types.h"
 
 class XMLTree;
@@ -73,10 +72,10 @@ class ElementImporter
        bool broken () { return _broken; }
 
        /// Signal that requests for anew name
-       static sigc::signal <std::pair<bool, std::string>, std::string, std::string> Rename;
+       static boost::signals2::signal <std::pair<bool, std::string> (std::string, std::string)> Rename;
 
        /// Signal for ok/cancel prompting
-       static sigc::signal <bool, std::string> Prompt;
+       static boost::signals2::signal <bool(std::string)> Prompt;
 
   protected:
 
index 78a0e9abb0693ad856d2996ca22c85d6ad950525..055168118d8ed6a99dd53b813eb4a09737d4d2d6 100644 (file)
@@ -24,7 +24,6 @@
 #include <vector>
 #include <string>
 
-#include <sigc++/signal.h>
 
 #include <sndfile.h>
 #include <samplerate.h>
@@ -39,7 +38,7 @@ namespace ARDOUR
        typedef std::pair<Port *, uint32_t> PortChannelPair;
        typedef std::map<uint32_t, std::vector<PortChannelPair> > ExportPortMap;
 
-       struct ExportSpecification : public SF_INFO, public sigc::trackable {
+       struct ExportSpecification : public SF_INFO, public PBD::ScopedConnectionList {
 
                ExportSpecification();
                ~ExportSpecification ();
@@ -85,7 +84,7 @@ namespace ARDOUR
                SRC_STATE*     src_state;
                nframes_t      pos;
 
-               sigc::connection freewheel_connection;
+               boost::signals2::scoped_connection freewheel_connection;
 
                /* shared between UI thread and audio thread */
 
index fdb466a06e053f441acf4b950f45334b545388cb..4a2f74b775843c6fef975257166b12d9714aa69d 100644 (file)
 #ifndef __ardour_export_channel_h__
 #define __ardour_export_channel_h__
 
-#include "ardour/audioregion.h"
-#include "ardour/buffer_set.h"
-
 #include <set>
 
+#include <boost/signals2.hpp>
 #include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
+
+#include "ardour/audioregion.h"
+#include "ardour/buffer_set.h"
 
 namespace ARDOUR {
 
@@ -89,7 +89,7 @@ class PortExportChannel : public ExportChannel
 };
 
 /// Handles RegionExportChannels and does actual reading from region
-class RegionExportChannelFactory : public sigc::trackable
+class RegionExportChannelFactory 
 {
   public:
        enum Type {
@@ -106,7 +106,7 @@ class RegionExportChannelFactory : public sigc::trackable
 
   private:
 
-       int new_cycle_started () { buffers_up_to_date = false; return 0; }
+       int new_cycle_started (nframes_t) { buffers_up_to_date = false; return 0; }
        void update_buffers (nframes_t frames);
 
        AudioRegion const & region;
@@ -122,6 +122,8 @@ class RegionExportChannelFactory : public sigc::trackable
 
        Sample * mixdown_buffer;
        Sample * gain_buffer;
+
+       boost::signals2::scoped_connection export_connection;
 };
 
 /// Export channel that reads from region channel
index 8ef9bba6dce66327c79d36ecb16f540936581388..b8d7fa6bf178358e3d12fff974ef5877c27240b0 100644 (file)
@@ -24,7 +24,6 @@
 #include <list>
 
 #include <glibmm/ustring.h>
-#include <sigc++/signal.h>
 
 #include "ardour/export_channel.h"
 #include "ardour/export_status.h"
@@ -96,7 +95,7 @@ class ExportChannelConfiguration
 
        /// Writes all files for this channel config @return true if a new thread was spawned
        bool write_files (boost::shared_ptr<ExportProcessor> new_processor);
-       sigc::signal<void> FilesWritten;
+       boost::signals2::signal<void()> FilesWritten;
 
        // Tells the handler the necessary information for it to handle tempfiles
        void register_with_timespan (TimespanPtr timespan);
index 7bc012500402bc6a90685f9e4d9f893f071d1568..ceb11a2cc9cecd5ea3ac7d0b9637dfd655f64bc3 100644 (file)
@@ -115,8 +115,8 @@ class ExportFormatBase {
                        : _selected (false), _compatible (true) { }
                ~SelectableCompatible () {}
 
-               sigc::signal<void, bool> SelectChanged;
-               sigc::signal<void, bool> CompatibleChanged;
+               boost::signals2::signal<void(bool)> SelectChanged;
+               boost::signals2::signal<void(bool)> CompatibleChanged;
 
                bool selected () const { return _selected; }
                bool compatible () const { return _compatible; }
index 705b9dcf170a3b2c50468215f8bd74b9f536a2ff..52463350fea3cab85821e77e14d90cf14b9262c4 100644 (file)
@@ -26,8 +26,8 @@
 
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
-#include <sigc++/signal.h>
-#include <sigc++/trackable.h>
+
+#include "pbd/scoped_connections.h"
 
 #include "ardour/export_formats.h"
 
@@ -39,7 +39,7 @@ class ExportFormatCompatibility;
 class ExportFormatSpecification;
 class AnyTime;
 
-class ExportFormatManager : public sigc::trackable
+class ExportFormatManager : public PBD::ScopedConnectionList
 {
   public:
 
@@ -92,7 +92,7 @@ class ExportFormatManager : public sigc::trackable
 
        /* Signals */
 
-       sigc::signal<void, bool> CompleteChanged;
+       boost::signals2::signal<void(bool)> CompleteChanged;
 
        /* Access to lists */
 
index 3312e9abd626cbf27314a13085beb9c26f448122..3ef207097b29776e6eb800309ae84cd856ae6336 100644 (file)
 #ifndef __ardour_export_formats_h__
 #define __ardour_export_formats_h__
 
-#include "ardour/export_format_base.h"
-#include "ardour/export_format_compatibility.h"
-
 #include <list>
 #include <boost/weak_ptr.hpp>
+
 #include "pbd/failed_constructor.h"
+#include "pbd/scoped_connections.h"
+
+#include "ardour/export_format_base.h"
+#include "ardour/export_format_compatibility.h"
 
 namespace ARDOUR
 {
@@ -84,7 +86,7 @@ class ExportFormat : public ExportFormatBase, public ExportFormatBase::Selectabl
 };
 
 /// Class to be inherited by export formats that have a selectable sample format
-class HasSampleFormat {
+class HasSampleFormat : public PBD::ScopedConnectionList {
   public:
 
        class SampleFormatState : public ExportFormatBase::SelectableCompatible {
@@ -126,11 +128,11 @@ class HasSampleFormat {
 
        /* Proxies for signals from sample formats and dither types */
 
-       sigc::signal<void, bool, WeakSampleFormatPtr> SampleFormatSelectChanged;
-       sigc::signal<void, bool, WeakSampleFormatPtr> SampleFormatCompatibleChanged;
+       boost::signals2::signal<void(bool, WeakSampleFormatPtr)> SampleFormatSelectChanged;
+       boost::signals2::signal<void(bool, WeakSampleFormatPtr)> SampleFormatCompatibleChanged;
 
-       sigc::signal<void, bool, WeakDitherTypePtr> DitherTypeSelectChanged;
-       sigc::signal<void, bool, WeakDitherTypePtr> DitherTypeCompatibleChanged;
+       boost::signals2::signal<void(bool, WeakDitherTypePtr)> DitherTypeSelectChanged;
+       boost::signals2::signal<void(bool, WeakDitherTypePtr)> DitherTypeCompatibleChanged;
 
        static std::string get_sample_format_name (ExportFormatBase::SampleFormat format);
 
index fad21ac7800475c3a08bf516cc14414d03544c93..ded6ed5b022d6f9898652a3291d6fcbf2887af92 100644 (file)
@@ -68,7 +68,7 @@ class ExportElementFactory
        Session & session;
 };
 
-class ExportHandler : public ExportElementFactory, public sigc::trackable
+class ExportHandler : public ExportElementFactory
 {
   private:
 
@@ -118,8 +118,10 @@ class ExportHandler : public ExportElementFactory, public sigc::trackable
 
        bool               realtime;
 
-       sigc::connection          files_written_connection;
+       boost::signals2::scoped_connection          files_written_connection;
+       boost::signals2::scoped_connection          export_read_finished_connection;
        std::list<Glib::ustring> files_written;
+       void add_file (const Glib::ustring&);
 
        /* CD Marker stuff */
 
@@ -175,7 +177,7 @@ class ExportHandler : public ExportElementFactory, public sigc::trackable
        TimespanPtr          current_timespan;
        ConfigMap::iterator  current_map_it;
        TimespanBounds       timespan_bounds;
-       sigc::connection     channel_config_connection;
+       boost::signals2::scoped_connection     channel_config_connection;
 
 };
 
index 4826a35668cd96b227edd70343cd53054c308e05..aace72cc427acdd6123b622f5f3c45a30f79ab2e 100644 (file)
@@ -36,7 +36,7 @@
                bool selected () const { return _selected; }
                void select (bool value);
 
-               sigc::signal<void, bool> SelectChanged;
+               boost::signals2::signal<void(bool)> SelectChanged;
 
          protected:
 
        void split_node (GraphNode * node, float position);
        void remove_node (GraphNode * node);
 
-       sigc::signal<void> GraphChanged;
+       boost::signals2::signal<void()> GraphChanged;
 
   private:
 
index c2cb5034c75db39dd45a8894da653d146101a7d0..8e7918d7c514f8b9ba109da3b36ddec94a11dd99 100644 (file)
@@ -80,7 +80,7 @@ class ExportProcessor
 
        void write_files ();
 
-       static sigc::signal<void, Glib::ustring> WritingFile;
+       static boost::signals2::signal<void(const Glib::ustring&)> WritingFile;
 
   private:
 
index 47acacd387283ae0b3a98619fe93d60b100a8248..30bb3c5b91becf1225d1015313f897e308822789 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
-#include <sigc++/signal.h>
 #include <glibmm/ustring.h>
 
 #include "pbd/uuid.h"
@@ -207,7 +206,7 @@ class ExportProfileManager
        void remove_format_profile (FormatPtr format);
        FormatPtr get_new_format (FormatPtr original);
 
-       sigc::signal<void> FormatListChanged;
+       boost::signals2::signal<void()> FormatListChanged;
 
   private:
 
index 3322ca639c45bd024c2f22b8b16529b1ce88249a..9fd3c84eccdaa77b799a04f84218b78cc77e4583 100644 (file)
@@ -22,9 +22,9 @@
 #define __ardour_export_status_h__
 
 #include <list>
+#include <boost/signals2.hpp>
 
 #include <stdint.h>
-#include <sigc++/signal.h>
 
 namespace ARDOUR
 {
@@ -36,7 +36,7 @@ enum ExportStage {
        export_Write
 };
 
-struct ExportStatus : public sigc::trackable {
+struct ExportStatus {
 
        ExportStatus ();
        void init ();
@@ -46,12 +46,12 @@ struct ExportStatus : public sigc::trackable {
        volatile bool           stop;
        volatile bool           running;
 
-       sigc::signal<void>      Aborting;
+       boost::signals2::signal<void()>      Aborting;
        void abort (bool error_occurred = false);
        bool aborted () const { return _aborted; }
        bool errors () const { return _errors; }
 
-       sigc::signal<void>      Finished;
+       boost::signals2::signal<void()>      Finished;
        void finish ();
        bool finished () const { return _finished; }
 
index 255d1e377d5225b7b0d2c004fdd0d3f383c672c8..461caf6dd8bac0aa6224900c2e651c93394ddad5 100644 (file)
@@ -36,7 +36,7 @@ namespace ARDOUR
 class ExportChannel;
 class ExportTempFile;
 
-class ExportTimespan : public sigc::trackable
+class ExportTimespan
 {
   private:
        typedef boost::shared_ptr<ExportTempFile> TempFilePtr;
@@ -69,7 +69,7 @@ class ExportTimespan : public sigc::trackable
        /// Reads data from each channel and writes to tempfile
        int process (nframes_t frames);
 
-       sigc::connection  process_connection;
+       boost::signals2::scoped_connection  process_connection;
 
        void set_range (nframes_t start, nframes_t end);
        nframes_t get_length () const { return end_frame - start_frame; }
index 25a14f3fae9b9980404b011567931cf98010dea0..e6207c6ee82ab8b26f0faf6603713c3093088334 100644 (file)
@@ -24,7 +24,6 @@
 #include <vector>
 
 #include <stdint.h>
-#include <sigc++/signal.h>
 
 #include "ardour/types.h"
 
index 205559fe4e8f7ad4596cd0f2e16da1a3fc5dcf47..498c9f3605bd8a1681e362fcd635f7af32c128f5 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef __ardour_internal_return_h__
 #define __ardour_internal_return_h__
 
-#include <sigc++/signal.h>
 
 #include "ardour/ardour.h"
 #include "ardour/return.h"
@@ -48,7 +47,7 @@ class InternalReturn : public Return
        BufferSet* get_buffers();
        void release_buffers();
 
-       static sigc::signal<void,nframes_t> CycleStart;
+       static boost::signals2::signal<void(nframes_t)> CycleStart;
 
   private:
        BufferSet buffers;
index 12279b166e62513a9de71817e1f387b0f558e70a..7573efd685cff14e4050eaaf90b391938cd71912 100644 (file)
@@ -53,7 +53,7 @@ class InternalSend : public Send
        BufferSet* target;
        boost::shared_ptr<Route> _send_to;
        PBD::ID _send_to_id;
-       sigc::connection connect_c;
+       boost::signals2::scoped_connection connect_c;
 
        void send_to_going_away ();
        void send_to_name_changed ();
index da0b88e5fec58ef459ec253c5387c6beffeff335..eeb7ed64f0c06c39569a03986c279934bfa469e0 100644 (file)
@@ -23,7 +23,6 @@
 #include <string>
 #include <vector>
 #include <cmath>
-#include <sigc++/signal.h>
 #include <jack/jack.h>
 
 #include <glibmm/thread.h>
@@ -133,7 +132,7 @@ class IO : public SessionObject, public Latent
 
        const ChanCount& n_ports ()  const { return _ports.count(); }
 
-       sigc::signal<void,IOChange,void*> changed;
+       boost::signals2::signal<void(IOChange,void*)> changed;
 
        virtual XMLNode& state (bool full);
        XMLNode& get_state (void);
@@ -145,7 +144,7 @@ class IO : public SessionObject, public Latent
        static int  disable_ports (void);
        static int  enable_ports (void);
 
-       static sigc::signal<void,ChanCount> PortCountChanged; // emitted when the number of ports changes
+       static boost::signals2::signal<void(ChanCount)> PortCountChanged; // emitted when the number of ports changes
 
        static std::string name_from_state (const XMLNode&);
        static void set_name_in_state (XMLNode&, const std::string&);
@@ -153,7 +152,7 @@ class IO : public SessionObject, public Latent
        /* we have to defer/order port connection. this is how we do it.
        */
 
-       static sigc::signal<int> ConnectingLegal;
+       static boost::signals2::signal<int()> ConnectingLegal;
        static bool              connecting_legal;
 
        XMLNode *pending_state_node;
@@ -180,20 +179,18 @@ class IO : public SessionObject, public Latent
        bool     _active;
 
   private:
-
        int connecting_became_legal ();
-       sigc::connection connection_legal_c;
+       boost::signals2::scoped_connection connection_legal_c;
 
        boost::shared_ptr<Bundle> _bundle; ///< a bundle representing our ports
 
        struct UserBundleInfo {
-               UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b);
-
-               boost::shared_ptr<UserBundle> bundle;
-               sigc::connection changed;
+           UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b);
+           boost::shared_ptr<UserBundle> bundle;
+           boost::signals2::scoped_connection changed;
        };
-
-       std::vector<UserBundleInfo> _bundles_connected; ///< user bundles connected to our ports
+       
+       std::vector<UserBundleInfo*> _bundles_connected; ///< user bundles connected to our ports
 
        static int parse_io_string (const std::string&, std::vector<std::string>& chns);
        static int parse_gain_string (const std::string&, std::vector<std::string>& chns);
@@ -201,7 +198,7 @@ class IO : public SessionObject, public Latent
        int ensure_ports (ChanCount, bool clear, bool lockit, void *src);
 
        void check_bundles_connected ();
-       void check_bundles (std::vector<UserBundleInfo>&, const PortSet&);
+       void check_bundles (std::vector<UserBundleInfo*>&, const PortSet&);
 
        void bundle_changed (Bundle::Change);
 
index 0d564bb00c1a9dbf278466f82acd77943ea04407..e4a42a80e2840c68bf6c5094ae51ed7b789a1b88 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <string>
 #include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
 
 #include <glibmm/thread.h>
 
@@ -68,8 +67,8 @@ class IOProcessor : public Processor
 
        virtual bool feeds (boost::shared_ptr<Route> other) const;
 
-       sigc::signal<void,IOProcessor*,bool>     AutomationPlaybackChanged;
-       sigc::signal<void,IOProcessor*,uint32_t> AutomationChanged;
+       boost::signals2::signal<void(IOProcessor*,bool)>     AutomationPlaybackChanged;
+       boost::signals2::signal<void(IOProcessor*,uint32_t)> AutomationChanged;
 
        XMLNode& state (bool full_state);
        int set_state (const XMLNode&, int version);
index 3101ce95230e201c72bd4b7394503e023ac97fbb..0bb0752d5590bbfcb3794b71479ec07f08da21b3 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef __ardour_jack_port_h__
 #define __ardour_jack_port_h__
 
-#include <sigc++/signal.h>
 #include "pbd/failed_constructor.h"
 #include "ardour/port.h"
 #include <jack/jack.h>
index 656c13afae1bd355c150ee09ef4815046bb7a352..00f00c99b6dd7737f305b74913cd7eb93e22952c 100644 (file)
@@ -25,7 +25,6 @@
 #include <string>
 #include <dlfcn.h>
 
-#include <sigc++/signal.h>
 
 #include "pbd/stateful.h"
 
index 149a559d850904714d72a0768c3e09c4c5ce7f47..b50a645a93aeeda8078314c84b339f8660a83296 100644 (file)
@@ -26,7 +26,6 @@
 #include <map>
 
 #include <sys/types.h>
-#include <sigc++/signal.h>
 
 #include <glibmm/thread.h>
 
@@ -109,15 +108,15 @@ class Location : public PBD::StatefulDestructible
        bool is_range_marker() const { return _flags & IsRangeMarker; }
        bool matches (Flags f) const { return _flags & f; }
 
-       sigc::signal<void,Location*> name_changed;
-       sigc::signal<void,Location*> end_changed;
-       sigc::signal<void,Location*> start_changed;
+       boost::signals2::signal<void(Location*)> name_changed;
+       boost::signals2::signal<void(Location*)> end_changed;
+       boost::signals2::signal<void(Location*)> start_changed;
 
-       sigc::signal<void,Location*,void*> FlagsChanged;
+       boost::signals2::signal<void(Location*,void*)> FlagsChanged;
 
        /* this is sent only when both start&end change at the same time */
 
-       sigc::signal<void,Location*> changed;
+       boost::signals2::signal<void(Location*)> changed;
 
        /* CD Track / CD-Text info */
 
@@ -176,11 +175,11 @@ class Locations : public PBD::StatefulDestructible
 
        void find_all_between (nframes64_t start, nframes64_t, LocationList&, Location::Flags);
 
-       sigc::signal<void,Location*> current_changed;
-       sigc::signal<void>           changed;
-       sigc::signal<void,Location*> added;
-       sigc::signal<void,Location*> removed;
-       sigc::signal<void,Change>    StateChanged;
+       boost::signals2::signal<void(Location*)> current_changed;
+       boost::signals2::signal<void()>           changed;
+       boost::signals2::signal<void(Location*)> added;
+       boost::signals2::signal<void(Location*)> removed;
+       boost::signals2::signal<void(Change)>    StateChanged;
 
        template<class T> void apply (T& obj, void (T::*method)(LocationList&)) {
                Glib::Mutex::Lock lm (lock);
index 9705459ee1dc7e9f53168470bf482e993e1e7fc3..157d9144b85db4b7e191b163941d81e48001b627 100644 (file)
@@ -26,7 +26,6 @@
 #include <string>
 #include <dlfcn.h>
 
-#include <sigc++/signal.h>
 
 #include "pbd/stateful.h"
 
index ae0a1672dbf59609a3fe358a1b911146e979807e..1f5e3307d6079abbc28757ddd4022f32a86da143 100644 (file)
@@ -20,7 +20,6 @@
 #define __ardour_meter_h__
 
 #include <vector>
-#include <sigc++/slot.h>
 #include "ardour/types.h"
 #include "ardour/processor.h"
 #include "pbd/fastlog.h"
@@ -34,10 +33,10 @@ class Session;
 class Metering {
   public:
        static void               update_meters ();
-       static sigc::signal<void> Meter;
+       static boost::signals2::signal<void()> Meter;
 
-       static sigc::connection   connect (sigc::slot<void> the_slot);
-       static void               disconnect (sigc::connection& c);
+       static boost::signals2::connection connect (boost::function<void()>);
+       static void                        disconnect (boost::signals2::connection& c);
 
   private:
        /* this object is not meant to be instantiated */
index 930d37330ac0471d4595555ecad84fa341f733b8..72667ca66253fee50897dced244f5d00bdd4dd63 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef __ardour_midi_diskstream_h__
 #define __ardour_midi_diskstream_h__
 
-#include <sigc++/signal.h>
 
 #include <cmath>
 #include <cassert>
index b099f575a16b3e6b761c705c2830542d0d4fd144..9961b51528b5dad63b0f0c5dc71b697d8cbc23c8 100644 (file)
@@ -158,7 +158,7 @@ public:
        XMLNode& get_state();
        int set_state(const XMLNode&) { return 0; }
 
-       sigc::signal<void> ContentsChanged;
+       boost::signals2::signal<void()> ContentsChanged;
 
        const MidiSource* midi_source() const { return _midi_source; }
        void set_midi_source(MidiSource* source) { _midi_source = source; }
index a48c9ddfe7d0601c884eb4e91835254c26f8418e..8c4ff43d5cdd7e4b04cac456d7885c34e236c9e1 100644 (file)
@@ -22,6 +22,8 @@
 #define MIDI_PATCH_MANAGER_H_
 
 #include "midi++/midnam_patch.h"
+#include "pbd/scoped_connections.h"
+#include "ardour/session_handle.h"
 
 namespace ARDOUR {
        class Session;
@@ -33,7 +35,7 @@ namespace MIDI
 namespace Name
 {
 
-class MidiPatchManager
+class MidiPatchManager : public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
 {
        /// Singleton
 private:
@@ -55,7 +57,7 @@ public:
                return *_manager;
        }
 
-       void set_session (ARDOUR::Session&);
+       void set_session (ARDOUR::Session*);
 
        boost::shared_ptr<MIDINameDocument> document_by_model(std::string model_name)
                { return _documents[model_name]; }
@@ -76,7 +78,6 @@ public:
                }
        }
 
-
        boost::shared_ptr<Patch> find_patch(
                        std::string model,
                        std::string custom_device_mode,
@@ -133,10 +134,9 @@ public:
        const MasterDeviceNames::Models& all_models() const { return _all_models; }
 
 private:
-       void drop_session();
+       void session_going_away();
        void refresh();
 
-       ARDOUR::Session*                        _session;
        MidiNameDocuments                       _documents;
        MIDINameDocument::MasterDeviceNamesList _master_devices_by_model;
        MasterDeviceNames::Models               _all_models;
@@ -145,4 +145,5 @@ private:
 } // namespace Name
 
 } // namespace MIDI
+
 #endif /* MIDI_PATCH_MANAGER_H_ */
index dfbd5ea6a2f1377bed86fba0802099944ed5ab2b..74448991d99b3d190d9a6bf0f99ce1cc97b79636 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <string>
 #include <time.h>
-#include <sigc++/signal.h>
 #include <glibmm/thread.h>
 #include "pbd/stateful.h"
 #include "pbd/xml++.h"
@@ -87,10 +86,10 @@ class MidiSource : virtual public Source
        uint32_t read_data_count()  const { return _read_data_count; }
        uint32_t write_data_count() const { return _write_data_count; }
 
-       static sigc::signal<void,MidiSource*> MidiSourceCreated;
+       static boost::signals2::signal<void(MidiSource*)> MidiSourceCreated;
 
        // Signal a range of recorded data is available for reading from model()
-       mutable sigc::signal<void,sframes_t,nframes_t> ViewDataRangeReady;
+       mutable boost::signals2::signal<void(sframes_t,nframes_t)> ViewDataRangeReady;
 
        XMLNode& get_state ();
        int set_state (const XMLNode&, int version);
index 2daec06774c0bd6fbe2e69180dcb038d136c1237..0ecf1b0589c79c4dd6f764d4dc57c02338d744b0 100644 (file)
@@ -2,6 +2,7 @@
 #define __libardour_midi_ui_h__
 
 #include <list>
+#include <boost/signals2.hpp>
 #include "pbd/abstract_ui.h"
 
 namespace MIDI { 
@@ -41,7 +42,8 @@ class MidiControlUI : public AbstractUI<MidiUIRequest>
        typedef std::list<GSource*> PortSources;
        PortSources port_sources;
        ARDOUR::Session& _session;
-       
+       boost::signals2::scoped_connection rebind_connection;
+
        bool midi_input_handler (Glib::IOCondition, MIDI::Port*);
        void reset_ports ();
        void clear_ports ();
index ef65e69aba6b70b4c088c12203513c8864dd6175..a76775c710aeff78d6bdccff1cbe38149776cb06 100644 (file)
@@ -64,7 +64,7 @@ class MuteMaster : public AutomationControl
        void set_value (float); /* note: float is used as a bitfield of MutePoints */
        float get_value () const;
 
-       sigc::signal<void> MutePointChanged;
+       boost::signals2::signal<void()> MutePointChanged;
 
        XMLNode& get_state();
        int set_state(const XMLNode&, int version);
index d41f104e1a1518e0684621fd42e92772b33c1c9f..0c930d5b72aed4a0830c657341c3a84d94d53f08 100644 (file)
@@ -46,7 +46,7 @@ struct NamedSelection : public PBD::Stateful
 
     int set_state (const XMLNode&, int version);
 
-    static sigc::signal<void,NamedSelection*> NamedSelectionCreated;
+    static boost::signals2::signal<void(NamedSelection*)> NamedSelectionCreated;
 };
 
 }/* namespace ARDOUR */
index 7ea37e99743cd7d657e39f93b1783ae9280b027d..bf5a04c745d33191f6c62499ba82a606becebdcd 100644 (file)
@@ -25,7 +25,6 @@
 #include <vector>
 #include <string>
 #include <iostream>
-#include <sigc++/signal.h>
 
 #include "pbd/stateful.h"
 #include "pbd/controllable.h"
@@ -41,7 +40,7 @@ class Panner;
 class BufferSet;
 class AudioBuffer;
 
-class StreamPanner : public sigc::trackable, public PBD::Stateful
+class StreamPanner : public PBD::Stateful
 {
   public:
        StreamPanner (Panner& p, Evoral::Parameter param);
@@ -82,8 +81,8 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful
 
        boost::shared_ptr<AutomationControl> pan_control()  { return _control; }
 
-       sigc::signal<void> Changed;      /* for position */
-       sigc::signal<void> StateChanged; /* for mute */
+       boost::signals2::signal<void()> Changed;      /* for position */
+       boost::signals2::signal<void()> StateChanged; /* for mute */
 
        int set_state (const XMLNode&, int version);
        virtual XMLNode& state (bool full_state) = 0;
@@ -271,9 +270,9 @@ public:
        StreamPanner &streampanner( uint32_t n ) const { assert( n < _streampanners.size() ); return *_streampanners[n]; }
        uint32_t npanners() const { return _streampanners.size(); }
 
-       sigc::signal<void> Changed;
-       sigc::signal<void> LinkStateChanged;
-       sigc::signal<void> StateChanged; /* for bypass */
+       boost::signals2::signal<void()> Changed;
+       boost::signals2::signal<void()> LinkStateChanged;
+       boost::signals2::signal<void()> StateChanged; /* for bypass */
 
        /* only StreamPanner should call these */
 
index 3ed32f09845f0f55a95e7f4f19431ab17c6c88bf..9c089c2f05dae927aa42ebea4ca6dabf998c9706 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <glib.h>
 
-#include <sigc++/signal.h>
 
 #include "pbd/undo.h"
 #include "pbd/stateful.h"
@@ -51,9 +50,9 @@ namespace ARDOUR  {
 class Session;
 class Region;
 
-class Playlist : public SessionObject,
-                 public boost::noncopyable,
-                 public boost::enable_shared_from_this<Playlist> {
+class Playlist : public SessionObject
+              , public boost::noncopyable
+              , public boost::enable_shared_from_this<Playlist> {
   public:
        typedef std::list<boost::shared_ptr<Region> >    RegionList;
 
@@ -125,19 +124,19 @@ class Playlist : public SessionObject,
 
        nframes64_t find_next_transient (nframes64_t position, int dir);
 
-       void foreach_region (sigc::slot<void, boost::shared_ptr<Region> >);
+       void foreach_region (boost::function<void (boost::shared_ptr<Region>)>);
 
        XMLNode& get_state ();
        int set_state (const XMLNode&, int version);
        XMLNode& get_template ();
 
-       sigc::signal<void,bool> InUse;
-       sigc::signal<void>      Modified;
-       sigc::signal<void, boost::weak_ptr<Region> > RegionAdded;
-       sigc::signal<void, boost::weak_ptr<Region> > RegionRemoved;
-       sigc::signal<void>      NameChanged;
-       sigc::signal<void>      LengthChanged;
-       sigc::signal<void, std::list< Evoral::RangeMove<nframes_t> > const &> RangesMoved;
+       boost::signals2::signal<void(bool)> InUse;
+       boost::signals2::signal<void()>      Modified;
+       boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionAdded;
+       boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionRemoved;
+       boost::signals2::signal<void()>      NameChanged;
+       boost::signals2::signal<void()>      LengthChanged;
+       boost::signals2::signal<void(std::list< Evoral::RangeMove<nframes_t> > const &)> RangesMoved;
 
        static std::string bump_name (std::string old_name, Session&);
 
@@ -195,7 +194,7 @@ class Playlist : public SessionObject,
 
        RegionList       regions;  /* the current list of regions in the playlist */
        std::set<boost::shared_ptr<Region> > all_regions; /* all regions ever added to this playlist */
-       std::list<sigc::connection> region_state_changed_connections;
+       PBD::ScopedConnectionList region_state_changed_connections;
        DataType        _type;
        mutable gint    block_notifications;
        mutable gint    ignore_state_changes;
index 02bd68ae7a1248bd1665046283e3c7c7863f2b27..4c3680ae8e8d1e6d1330a5e31783c94965dd3886 100644 (file)
@@ -31,7 +31,7 @@ class Session;
 class PlaylistFactory {
 
   public:
-       static sigc::signal<void,boost::shared_ptr<Playlist>, bool> PlaylistCreated;
+       static boost::signals2::signal<void(boost::shared_ptr<Playlist>, bool)> PlaylistCreated;
 
        static boost::shared_ptr<Playlist> create (Session&, const XMLNode&, bool hidden = false, bool unused = false);
        static boost::shared_ptr<Playlist> create (DataType type, Session&, std::string name, bool hidden = false);
index 5a86b6e005fc51e0d1ef44becfac8e2120f00ef0..ea8f95d8f500c83f3f7b663959609d3df8aca906 100644 (file)
@@ -21,7 +21,6 @@
 #define __ardour_plugin_h__
 
 #include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
 #include <glibmm/ustring.h>
 
 #include "pbd/statefuldestructible.h"
@@ -144,7 +143,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent
 
        virtual bool has_editor() const = 0;
 
-       sigc::signal<void,uint32_t,float> ParameterChanged;
+       boost::signals2::signal<void(uint32_t,float)> ParameterChanged;
 
        /* NOTE: this block of virtual methods looks like the interface
           to a Processor, but Plugin does not inherit from Processor.
index 593db1ff0d2363488db141bd61880c9abe77c612..6be8f1dda6d03a84bd620f5c9f1f461d65827c69 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <boost/weak_ptr.hpp>
 
-#include <sigc++/signal.h>
 #include "ardour/ardour.h"
 #include "ardour/types.h"
 #include "ardour/processor.h"
@@ -107,7 +106,7 @@ class PluginInsert : public Processor
 
        void collect_signal_for_analysis(nframes_t nframes);
 
-       sigc::signal<void, BufferSet*, BufferSet*> AnalysisDataGathered;
+       boost::signals2::signal<void(BufferSet*, BufferSet*)> AnalysisDataGathered;
 
   private:
        /* disallow copy construction */
index 0a056b574aeecb18a6c420820409b4667a2dcc34..44c529835e6d5952822da693365d2281598f1881 100644 (file)
@@ -70,7 +70,7 @@ class PluginManager : public boost::noncopyable {
        PluginStatusType get_status (const PluginInfoPtr&);
 
        /** plugins were added to or removed from one of the PluginInfoLists */
-       sigc::signal<void> PluginListChanged;
+       boost::signals2::signal<void()> PluginListChanged;
 
   private:
        struct PluginStatus {
index 2597fa9601117c640968c16fc63436bd33d74bd3..be4df6bd025486ca31165f8c615951f30a159167 100644 (file)
@@ -25,7 +25,8 @@
 #include <vector>
 #include <jack/jack.h>
 #include <boost/utility.hpp>
-#include <sigc++/trackable.h>
+#include <boost/signals2.hpp>
+
 #include "ardour/data_type.h"
 #include "ardour/types.h"
 
@@ -34,7 +35,7 @@ namespace ARDOUR {
 class AudioEngine;
 class Buffer;
 
-class Port : public sigc::trackable, public boost::noncopyable
+class Port : public boost::noncopyable
 {
 public:
        enum Flags {
@@ -117,7 +118,7 @@ public:
 
        static void set_engine (AudioEngine *);
 
-       sigc::signal<void, bool> MonitorInputChanged;
+       boost::signals2::signal<void(bool)> MonitorInputChanged;
 
 protected:
 
index 97f930df6e50dafda1ec2690aa8b19a96beb5722..5e50b4775e70fd30ad4d3e4d560b2b89d6647ff1 100644 (file)
@@ -24,7 +24,6 @@
 #include <string>
 #include <exception>
 
-#include <sigc++/signal.h>
 #include "ardour/ardour.h"
 #include "ardour/io_processor.h"
 #include "ardour/types.h"
index c57eb4354c3e310a647e9e8f011d64e7d13f5baa..5962e8f44ecb95c54f8304d86fc5e01fdce2c023 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "pbd/statefuldestructible.h"
 
-#include <sigc++/signal.h>
 
 #include "ardour/ardour.h"
 #include "ardour/automatable_controls.h"
@@ -99,10 +98,10 @@ class Processor : public SessionObject, public AutomatableControls, public Laten
        void *get_gui () const { return _gui; }
        void  set_gui (void *p) { _gui = p; }
 
-       static sigc::signal<void,Processor*> ProcessorCreated;
+       static boost::signals2::signal<void(Processor*)> ProcessorCreated;
 
-       sigc::signal<void>                     ActiveChanged;
-       sigc::signal<void,ChanCount,ChanCount> ConfigurationChanged;
+       boost::signals2::signal<void()>                     ActiveChanged;
+       boost::signals2::signal<void(ChanCount,ChanCount)> ConfigurationChanged;
 
 protected:
        int       _pending_active;
index 7bae98e573a69bc507d9270b8f83b0f509a65192..a276fb19eee92ae2bcc0ba461c26719c02b5a074 100644 (file)
@@ -26,6 +26,7 @@
 #include <boost/utility.hpp>
 
 #include "pbd/undo.h"
+#include "pbd/scoped_connections.h"
 
 #include "ardour/ardour.h"
 #include "ardour/data_type.h"
@@ -95,8 +96,8 @@ class Region
        static Change LayerChanged;
        static Change HiddenChanged;
 
-       sigc::signal<void,Change> StateChanged;
-       static sigc::signal<void,boost::shared_ptr<ARDOUR::Region> > RegionPropertyChanged;
+       boost::signals2::signal<void(Change)> StateChanged;
+       static boost::signals2::signal<void(boost::shared_ptr<ARDOUR::Region>)> RegionPropertyChanged;
        void unlock_property_changes () { _flags = Flag (_flags & ~DoNotSendPropertyChanges); }
        void block_property_changes () { _flags = Flag (_flags | DoNotSendPropertyChanges); }
 
@@ -218,7 +219,7 @@ class Region
        boost::shared_ptr<ARDOUR::Playlist> playlist() const { return _playlist.lock(); }
        virtual void set_playlist (boost::weak_ptr<ARDOUR::Playlist>);
 
-       void source_deleted (boost::shared_ptr<Source>);
+       void source_deleted (boost::weak_ptr<Source>);
 
        boost::shared_ptr<Source> source (uint32_t n=0) const { return _sources[ (n < _sources.size()) ? n : 0 ]; }
        uint32_t                  n_channels()          const { return _sources.size(); }
index e702a2433f85282336c2dfc76f3adf75fcae83b2..51858e4926072cedff6df1aa80c6fb77ac7de88c 100644 (file)
@@ -40,7 +40,7 @@ class RegionFactory {
           itself, to permit dynamic_cast<> to be used to
           infer the type of Region.
        */
-       static sigc::signal<void,boost::shared_ptr<Region> > CheckNewRegion;
+       static boost::signals2::signal<void(boost::shared_ptr<Region>)>  CheckNewRegion;
 
        static boost::shared_ptr<Region> create (boost::shared_ptr<const Region>);
 
index a3d3859899fc0ff026f34c2cdb2cb6738742f1f9..f663c109a505f355bafc44d187c64bd05aedde57 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef __ardour_return_h__
 #define __ardour_return_h__
 
-#include <sigc++/signal.h>
 #include <string>
 
 
index 92a3c8c6b8683ebb76583e435bef69c6242175c0..dd6173e96329af237b245560e09140e43c8104de 100644 (file)
@@ -163,7 +163,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
 
        void flush_processors ();
 
-       void foreach_processor (sigc::slot<void, boost::weak_ptr<Processor> > method) {
+       void foreach_processor (boost::function<void(boost::weak_ptr<Processor>)> method) {
                Glib::RWLock::ReaderLock lm (_processor_lock);
                for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
                        method (boost::weak_ptr<Processor> (*i));
@@ -227,28 +227,28 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
        void set_user_latency (nframes_t);
        nframes_t initial_delay() const { return _initial_delay; }
 
-       sigc::signal<void>       active_changed;
-       sigc::signal<void>       phase_invert_changed;
-       sigc::signal<void>       denormal_protection_changed;
-       sigc::signal<void,void*> listen_changed;
-       sigc::signal<void,void*> solo_changed;
-       sigc::signal<void,void*> solo_safe_changed;
-       sigc::signal<void,void*> solo_isolated_changed;
-       sigc::signal<void,void*> comment_changed;
-       sigc::signal<void,void*> mute_changed;
-       sigc::signal<void>       mute_points_changed;
+       boost::signals2::signal<void()>       active_changed;
+       boost::signals2::signal<void()>       phase_invert_changed;
+       boost::signals2::signal<void()>       denormal_protection_changed;
+       boost::signals2::signal<void(void*)> listen_changed;
+       boost::signals2::signal<void(void*)> solo_changed;
+       boost::signals2::signal<void(void*)> solo_safe_changed;
+       boost::signals2::signal<void(void*)> solo_isolated_changed;
+       boost::signals2::signal<void(void*)> comment_changed;
+       boost::signals2::signal<void(void*)> mute_changed;
+       boost::signals2::signal<void()>       mute_points_changed;
 
        /** the processors have changed; the parameter indicates what changed */
-       sigc::signal<void, RouteProcessorChange> processors_changed;
-       sigc::signal<void,void*> record_enable_changed;
+       boost::signals2::signal<void(RouteProcessorChange)> processors_changed;
+       boost::signals2::signal<void(void*)> record_enable_changed;
        /** the metering point has changed */
-       sigc::signal<void,void*> meter_change; 
-       sigc::signal<void>       signal_latency_changed;
-       sigc::signal<void>       initial_delay_changed;
+       boost::signals2::signal<void(void*)> meter_change; 
+       boost::signals2::signal<void()>       signal_latency_changed;
+       boost::signals2::signal<void()>       initial_delay_changed;
 
        /* gui's call this for their own purposes. */
 
-       sigc::signal<void,std::string,void*> gui_changed;
+       boost::signals2::signal<void(std::string,void*)> gui_changed;
 
        /* stateful */
 
@@ -261,7 +261,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
 
        int save_as_template (const std::string& path, const std::string& name);
 
-       sigc::signal<void,void*> SelectedChanged;
+       boost::signals2::signal<void(void*)> SelectedChanged;
 
        int listen_via (boost::shared_ptr<Route>, Placement p, bool active, bool aux);
        void drop_listen (boost::shared_ptr<Route>);
@@ -306,10 +306,10 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
 
        void set_remote_control_id (uint32_t id);
        uint32_t remote_control_id () const;
-       sigc::signal<void> RemoteControlIDChanged;
+       boost::signals2::signal<void()> RemoteControlIDChanged;
 
        void sync_order_keys (std::string const &);
-       static sigc::signal<void, std::string const &> SyncOrderKeys;
+       static boost::signals2::signal<void(std::string const &)> SyncOrderKeys;
 
   protected:
        friend class Session;
@@ -379,8 +379,6 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
 
        void silence (nframes_t nframes);
 
-       sigc::connection input_signal_connection;
-
        ChanCount processor_max_streams;
        uint32_t _remote_control_id;
 
@@ -391,7 +389,6 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
 
        boost::shared_ptr<Amp>       _amp;
        boost::shared_ptr<PeakMeter> _meter;
-       sigc::connection _meter_connection;
 
   private:
        void init ();
index bec9a7e8a91140ff6006ac7a20d2e085a225ce31..fe4079050d754971d0cdc00c53f096c0e64ef886 100644 (file)
 #include <set>
 #include <string>
 #include <stdint.h>
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
 
 #include "pbd/stateful.h"
+#include "pbd/scoped_connections.h"
+
 #include "ardour/types.h"
 
 namespace ARDOUR {
@@ -36,7 +38,7 @@ class Track;
 class AudioTrack;
 class Session;
 
-class RouteGroup : public PBD::Stateful, public sigc::trackable {
+class RouteGroup : public PBD::Stateful, public PBD::ScopedConnectionList {
 public:
        enum Flag {
                Relative = 0x1,
@@ -126,8 +128,8 @@ public:
 
        boost::shared_ptr<RouteList> route_list() { return routes; }
 
-       sigc::signal<void> changed;
-       sigc::signal<void,void*> FlagsChanged;
+       boost::signals2::signal<void()> changed;
+       boost::signals2::signal<void(void*)> FlagsChanged;
 
        XMLNode& get_state ();
        
index 4b577121a609653034c92ad719025f1ef3287a00..8743423b1888e181b5254943a55a00274075a364 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef __libardour_route_group_member_h__
 #define __libardour_route_group_member_h__
 
-#include <sigc++/signal.h>
 
 namespace ARDOUR  {
 
@@ -34,7 +33,7 @@ class RouteGroupMember
 
        RouteGroup* route_group () const { return _route_group; }
 
-       sigc::signal<void> route_group_changed;
+       boost::signals2::signal<void()> route_group_changed;
 
   protected:
        RouteGroup* _route_group;
index 78a82820dfbd027400e914dfabbc7b43bd2180b0..8b39d12727e61cb2efeee40ac848c18444dc58f4 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef __ardour_send_h__
 #define __ardour_send_h__
 
-#include <sigc++/signal.h>
 #include <string>
 
 #include "pbd/stateful.h"
index 192dc09908f8882d9276e54935081847df3bba04..273f251f3de0f75d37512b68ef68a42dd4cef8a7 100644 (file)
 #include "pbd/error.h"
 #include "pbd/rcu.h"
 #include "pbd/statefuldestructible.h"
+#include "pbd/scoped_connections.h"
 #include "pbd/undo.h"
 
 #include "midi++/mmc.h"
 #include "midi++/types.h"
 
-#include "pbd/destructible.h"
-#include "pbd/stateful.h"
-
 #include "ardour/ardour.h"
 #include "ardour/click.h"
 #include "ardour/chan_count.h"
@@ -120,7 +118,7 @@ class VSTPlugin;
 
 extern void setup_enum_writer ();
 
-class Session : public PBD::StatefulDestructible, public SessionEventManager, public boost::noncopyable
+class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager, public boost::noncopyable
 {
   public:
        enum RecordState {
@@ -166,14 +164,14 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        void set_deletion_in_progress ();
        void clear_deletion_in_progress ();
        bool deletion_in_progress() const { return _state_of_the_state & Deletion; }
-       sigc::signal<void> DirtyChanged;
+       boost::signals2::signal<void()> DirtyChanged;
 
        const SessionDirectory& session_directory () const { return *(_session_dir.get()); }
 
-       static sigc::signal<void> AutoBindingOn;
-       static sigc::signal<void> AutoBindingOff;
+       static boost::signals2::signal<void()> AutoBindingOn;
+       static boost::signals2::signal<void()> AutoBindingOff;
 
-       static sigc::signal<void,std::string> Dialog;
+       static boost::signals2::signal<void(std::string)> Dialog;
 
        std::string sound_dir (bool with_path = true) const;
        std::string peak_dir () const;
@@ -274,29 +272,29 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
 
        /* Proxy signal for region hidden changes */
 
-       sigc::signal<void,boost::shared_ptr<Region> > RegionHiddenChange;
+       boost::signals2::signal<void(boost::shared_ptr<Region>)> RegionHiddenChange;
 
        /* Emitted when all i/o connections are complete */
 
-       sigc::signal<void> IOConnectionsComplete;
+       boost::signals2::signal<void()> IOConnectionsComplete;
 
        /* Record status signals */
 
-       sigc::signal<void> RecordStateChanged;
+       boost::signals2::signal<void()> RecordStateChanged;
 
        /* Transport mechanism signals */
 
-       sigc::signal<void> TransportStateChange; /* generic */
-       sigc::signal<void,nframes64_t> PositionChanged; /* sent after any non-sequential motion */
-       sigc::signal<void> DurationChanged;
-       sigc::signal<void,nframes64_t> Xrun;
-       sigc::signal<void> TransportLooped;
+       boost::signals2::signal<void()> TransportStateChange; /* generic */
+       boost::signals2::signal<void(nframes64_t)> PositionChanged; /* sent after any non-sequential motion */
+       boost::signals2::signal<void()> DurationChanged;
+       boost::signals2::signal<void(nframes64_t)> Xrun;
+       boost::signals2::signal<void()> TransportLooped;
 
        /** emitted when a locate has occurred */
-       sigc::signal<void> Located;
+       boost::signals2::signal<void()> Located;
 
-       sigc::signal<void,RouteList&> RouteAdded;
-       sigc::signal<void> RouteGroupChanged;
+       boost::signals2::signal<void(RouteList&)> RouteAdded;
+       boost::signals2::signal<void()> RouteGroupChanged;
 
        void queue_event (SessionEvent*);
 
@@ -350,9 +348,9 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
 
        Locations *locations() { return &_locations; }
 
-       sigc::signal<void,Location*>    auto_loop_location_changed;
-       sigc::signal<void,Location*>    auto_punch_location_changed;
-       sigc::signal<void>              locations_modified;
+       boost::signals2::signal<void(Location*)>    auto_loop_location_changed;
+       boost::signals2::signal<void(Location*)>    auto_punch_location_changed;
+       boost::signals2::signal<void()>              locations_modified;
 
        void set_auto_punch_location (Location *);
        void set_auto_loop_location (Location *);
@@ -377,8 +375,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        static int rename_template (std::string old_name, std::string new_name);
        static int delete_template (std::string name);
 
-       sigc::signal<void,std::string> StateSaved;
-       sigc::signal<void> StateReady;
+       boost::signals2::signal<void(std::string)> StateSaved;
+       boost::signals2::signal<void()> StateReady;
 
        std::vector<std::string*>* possible_states() const;
        static std::vector<std::string*>* possible_states (std::string path);
@@ -408,12 +406,12 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
 
        RouteGroup *route_group_by_name (std::string);
 
-       sigc::signal<void,RouteGroup*> route_group_added;
-       sigc::signal<void>             route_group_removed;
+       boost::signals2::signal<void(RouteGroup*)> route_group_added;
+       boost::signals2::signal<void()>             route_group_removed;
 
-       void foreach_route_group (sigc::slot<void,RouteGroup*> sl) {
+       void foreach_route_group (boost::function<void(RouteGroup*)> f) {
                for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); i++) {
-                       sl (*i);
+                       f (*i);
                }
        }
 
@@ -478,9 +476,9 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
 
        nframes_t convert_to_frames_at (nframes_t position, AnyTime const &);
 
-       static sigc::signal<void> StartTimeChanged;
-       static sigc::signal<void> EndTimeChanged;
-       static sigc::signal<void> TimecodeOffsetChanged;
+       static boost::signals2::signal<void()> StartTimeChanged;
+       static boost::signals2::signal<void()> EndTimeChanged;
+       static boost::signals2::signal<void()> TimecodeOffsetChanged;
 
         std::vector<SyncSource> get_available_sync_options() const;
        void   request_sync_source (Slave*);
@@ -498,15 +496,15 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        TempoMap& tempo_map() { return *_tempo_map; }
 
        /// signals the current transport position in frames, bbt and timecode time (in that order)
-       sigc::signal<void, const nframes_t&, const BBT_Time&, const Timecode::Time&> tick;
+       boost::signals2::signal<void(const nframes_t&, const BBT_Time&, const Timecode::Time&)> tick;
 
        /* region info  */
 
        void add_regions (std::vector<boost::shared_ptr<Region> >&);
 
-       sigc::signal<void,boost::weak_ptr<Region> > RegionAdded;
-       sigc::signal<void,std::vector<boost::weak_ptr<Region> >& > RegionsAdded;
-       sigc::signal<void,boost::weak_ptr<Region> > RegionRemoved;
+       boost::signals2::signal<void(boost::weak_ptr<Region>)>              RegionAdded;
+       boost::signals2::signal<void(std::vector<boost::weak_ptr<Region> >&)> RegionsAdded;
+       boost::signals2::signal<void(boost::weak_ptr<Region>)>              RegionRemoved;
 
        int region_name (std::string& result, std::string base = std::string(""), bool newlevel = false);
        std::string new_region_name (std::string);
@@ -531,9 +529,9 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
 
        int  start_audio_export (nframes_t position, bool realtime);
 
-       sigc::signal<int, nframes_t> ProcessExport;
-       sigc::signal<void> ExportReadFinished;
-       static sigc::signal<void, std::string, std::string> Exported;
+       boost::signals2::signal<int(nframes_t)> ProcessExport;
+       boost::signals2::signal<void()> ExportReadFinished;
+       static boost::signals2::signal<void(std::string, std::string)> Exported;
 
        void add_source (boost::shared_ptr<Source>);
        void remove_source (boost::weak_ptr<Source>);
@@ -550,16 +548,16 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
            0 for "yes, delete this playlist",
            1 for "no, don't delete this playlist".
        */
-       sigc::signal<int,boost::shared_ptr<Playlist> > AskAboutPlaylistDeletion;
+       boost::signals2::signal<void(boost::shared_ptr<Playlist>)>  AskAboutPlaylistDeletion;
 
        /** handlers should return 0 for "ignore the rate mismatch",
            !0 for "do not use this session"
        */
-       static sigc::signal<int,nframes_t, nframes_t> AskAboutSampleRateMismatch;
+       static boost::signals2::signal<int(nframes_t, nframes_t)> AskAboutSampleRateMismatch;
 
        /** handlers should return !0 for use pending state, 0 for ignore it.
        */
-       static sigc::signal<int> AskAboutPendingState;
+       static boost::signals2::signal<int()> AskAboutPendingState;
 
        boost::shared_ptr<AudioFileSource> create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive);
 
@@ -577,8 +575,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        void remove_named_selection (NamedSelection *);
 
        template<class T> void foreach_named_selection (T& obj, void (T::*func)(NamedSelection&));
-       sigc::signal<void> NamedSelectionAdded;
-       sigc::signal<void> NamedSelectionRemoved;
+       boost::signals2::signal<void()> NamedSelectionAdded;
+       boost::signals2::signal<void()> NamedSelectionRemoved;
 
        /* Curves and AutomationLists (TODO when they go away) */
        void add_automation_list(AutomationList*);
@@ -597,7 +595,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        void cancel_audition ();
        bool is_auditioning () const;
 
-       sigc::signal<void,bool> AuditionActive;
+       boost::signals2::signal<void(bool)> AuditionActive;
 
        /* flattening stuff */
 
@@ -619,8 +617,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        void set_listen (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
        void set_record_enable (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
 
-       sigc::signal<void,bool> SoloActive;
-       sigc::signal<void> SoloChanged;
+       boost::signals2::signal<void(bool)> SoloActive;
+       boost::signals2::signal<void()> SoloChanged;
        
 
        /* control/master out */
@@ -658,8 +656,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        void remove_bundle (boost::shared_ptr<Bundle>);
        boost::shared_ptr<Bundle> bundle_by_name (std::string) const;
 
-       sigc::signal<void,boost::shared_ptr<Bundle> > BundleAdded;
-       sigc::signal<void,boost::shared_ptr<Bundle> > BundleRemoved;
+       boost::signals2::signal<void(boost::shared_ptr<Bundle>)> BundleAdded;
+       boost::signals2::signal<void(boost::shared_ptr<Bundle>)> BundleRemoved;
 
        /* MIDI control */
 
@@ -673,10 +671,10 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        MIDI::Port *midi_port() const { return _midi_port; }
        MIDI::Port *midi_clock_port() const { return _midi_clock_port; }
 
-       sigc::signal<void> MTC_PortChanged;
-       sigc::signal<void> MMC_PortChanged;
-       sigc::signal<void> MIDI_PortChanged;
-       sigc::signal<void> MIDIClock_PortChanged;
+       boost::signals2::signal<void()> MTC_PortChanged;
+       boost::signals2::signal<void()> MMC_PortChanged;
+       boost::signals2::signal<void()> MIDI_PortChanged;
+       boost::signals2::signal<void()> MIDIClock_PortChanged;
 
        void set_trace_midi_input (bool, MIDI::Port* port = 0);
        void set_trace_midi_output (bool, MIDI::Port* port = 0);
@@ -693,7 +691,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        void stop_scrub ();
        void set_scrub_speed (float);
        nframes_t scrub_buffer_size() const;
-       sigc::signal<void> ScrubReady;
+       boost::signals2::signal<void()> ScrubReady;
 
        /* History (for editors, mixers, UIs etc.) */
 
@@ -726,11 +724,11 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
                _current_trans.top()->add_command (cmd);
        }
 
-       std::map<PBD::ID, PBD::StatefulThingWithGoingAway*> registry;
+       std::map<PBD::ID,PBD::StatefulDestructible*> registry;
 
        // these commands are implemented in libs/ardour/session_command.cc
        Command* memento_command_factory(XMLNode* n);
-       void register_with_memento_command_factory(PBD::ID, PBD::StatefulThingWithGoingAway*);
+       void register_with_memento_command_factory(PBD::ID, PBD::StatefulDestructible*);
 
        /* clicking */
 
@@ -767,7 +765,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
                        void* ptr,
                        float opt);
 
-       static sigc::signal<void> SendFeedback;
+       static boost::signals2::signal<void()> SendFeedback;
 
        /* Controllables */
 
@@ -945,7 +943,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        int  stop_audio_export ();
        void finalize_audio_export ();
 
-       sigc::connection export_freewheel_connection;
+       boost::signals2::scoped_connection export_freewheel_connection;
 
        void prepare_diskstreams ();
        void commit_diskstreams (nframes_t, bool& session_requires_butler);
@@ -1069,16 +1067,12 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        void              locations_added (Location*);
        void              handle_locations_changed (Locations::LocationList&);
 
-       sigc::connection auto_punch_start_changed_connection;
-       sigc::connection auto_punch_end_changed_connection;
-       sigc::connection auto_punch_changed_connection;
+       PBD::ScopedConnectionList punch_connections;
        void             auto_punch_start_changed (Location *);
        void             auto_punch_end_changed (Location *);
        void             auto_punch_changed (Location *);
 
-       sigc::connection auto_loop_start_changed_connection;
-       sigc::connection auto_loop_end_changed_connection;
-       sigc::connection auto_loop_changed_connection;
+       PBD::ScopedConnectionList loop_connections;
        void             auto_loop_changed (Location *);
 
        void first_stage_init (std::string path, std::string snapshot_name);
@@ -1143,7 +1137,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
        struct timeval last_mmc_step;
        double step_speed;
 
-       typedef sigc::slot<bool> MidiTimeoutCallback;
+       typedef boost::function<bool()> MidiTimeoutCallback;
        typedef std::list<MidiTimeoutCallback> MidiTimeoutList;
 
        MidiTimeoutList midi_timeouts;
index 1a3303087d53a4500a8cbbd59065a5d8a64ed077..66c8720186e5b08fb578365b3c24bed0ddb81db2 100644 (file)
@@ -4,7 +4,6 @@
 #include <list>
 #include <boost/function.hpp>
 #include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
 
 #include "pbd/pool.h"
 #include "pbd/ringbuffer.h"
diff --git a/libs/ardour/ardour/session_handle.h b/libs/ardour/ardour/session_handle.h
new file mode 100644 (file)
index 0000000..c747ee9
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+    Copyright (C) 2009 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __libardour_session_handle_h__
+#define __libardour_session_handle_h__
+
+#include "pbd/scoped_connections.h"
+
+namespace ARDOUR {
+       class Session;
+
+class SessionHandleRef : public PBD::ScopedConnectionList
+{
+  public:
+       SessionHandleRef (ARDOUR::Session& s);
+       virtual ~SessionHandleRef () {}
+
+  protected:
+       ARDOUR::Session&          _session;
+       virtual void session_going_away ();
+};
+
+class SessionHandlePtr
+{
+  public:
+       SessionHandlePtr (ARDOUR::Session* s);
+       SessionHandlePtr () : _session (0) {}
+       virtual ~SessionHandlePtr () {}
+
+       virtual void set_session (ARDOUR::Session *);
+
+  protected:
+       ARDOUR::Session*          _session;
+       PBD::ScopedConnectionList _session_connections;
+
+       virtual void session_going_away ();
+};
+
+} /* namespace */
+
+#endif /* __libardour_session_handle_h__ */
index 3a796c75b5711e65e38e635488728479cc752b10..eb1a7c3e3093efbe4ad1cb55bb0a179e1a46b576 100644 (file)
 
 #include <string>
 #include "pbd/statefuldestructible.h"
+#include "pbd/scoped_connections.h"
+
+#include "ardour/session_handle.h"
 
 namespace ARDOUR {
 
 class Session;
 
-/** An object associated with a Session.
- *
- * This is a few common things factored out of IO which weren't IO specific
- * (to fix the problem with e.g. PluginInsert being an IO which it shouldn't be).
+/** A named object associated with a Session. Objects derived from this class are
+    expected to be destroyed before the session calls drop_references().
  */
-class SessionObject : public PBD::StatefulDestructible
+
+class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible
 {
-public:
-       SessionObject(Session& session, const std::string& name)
-               : _session(session)
+  public:
+       SessionObject (Session& session, const std::string& name)
+               : SessionHandleRef (session)
                , _name(name)
        {}
-
+       
        Session&           session() const { return _session; }
        const std::string& name()    const { return _name; }
 
@@ -51,10 +53,9 @@ public:
                return true;
        }
 
-       sigc::signal<void> NameChanged;
+       boost::signals2::signal<void()> NameChanged;
 
-protected:
-       Session&    _session;
+  protected:
        std::string _name;
 };
 
index 83f469cfd404e17ed0d8b59536f6672b3ea19c5e..8870794cc0ba0155513cd43da28c8c0bdb463e70 100644 (file)
@@ -25,7 +25,9 @@
 #include <string>
 #include <glibmm/thread.h>
 #include <boost/shared_ptr.hpp>
-#include <sigc++/trackable.h>
+#include <boost/function.hpp>
+
+#include "pbd/scoped_connections.h"
 
 class XMLNode;
 
@@ -36,7 +38,7 @@ class Region;
 class Source;
 class Session;
        
-class SessionPlaylists : public sigc::trackable
+class SessionPlaylists : public PBD::ScopedConnectionList
 {
 public:
        ~SessionPlaylists ();
@@ -58,7 +60,7 @@ private:
        void find_equivalent_playlist_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >& result);
        void update_after_tempo_map_change ();
        void add_state (XMLNode *, bool);
-       bool maybe_delete_unused (sigc::signal<int, boost::shared_ptr<Playlist> >);
+       bool maybe_delete_unused (boost::function<int(boost::shared_ptr<Playlist>)>);
        int load (Session &, const XMLNode&);
        int load_unused (Session &, const XMLNode&);
        boost::shared_ptr<Playlist> XMLPlaylistFactory (Session &, const XMLNode&);
index 1125e920a0d3a8f9e688950de267547466d8a684..4fe8e1ec46865a8d83870d50c4164e6410758199 100644 (file)
 #include <vector>
 
 #include <glibmm/thread.h>
+#include <boost/signals2.hpp>
 
 #include <jack/jack.h>
 
-#include <sigc++/signal.h>
+#include "pbd/scoped_connections.h"
+
 #include "ardour/types.h"
 #include "midi++/parser.h"
 #include "midi++/types.h"
@@ -220,7 +222,7 @@ struct SafeTime {
     }
 };
 
-class MTC_Slave : public Slave, public sigc::trackable {
+class MTC_Slave : public Slave {
   public:
        MTC_Slave (Session&, MIDI::Port&);
        ~MTC_Slave ();
@@ -240,7 +242,7 @@ class MTC_Slave : public Slave, public sigc::trackable {
   private:
        Session&    session;
        MIDI::Port* port;
-       std::vector<sigc::connection> connections;
+       PBD::ScopedConnectionList* port_connections;
        bool        can_notify_on_unknown_rate;
        PIChaser* pic;
 
@@ -277,7 +279,7 @@ class MTC_Slave : public Slave, public sigc::trackable {
        void process_apparent_speed (double);
 };
 
-class MIDIClock_Slave : public Slave, public sigc::trackable {
+class MIDIClock_Slave : public Slave {
   public:
        MIDIClock_Slave (Session&, MIDI::Port&, int ppqn = 24);
 
@@ -301,7 +303,7 @@ class MIDIClock_Slave : public Slave, public sigc::trackable {
   private:
        ISlaveSessionProxy* session;
        MIDI::Port* port;
-       std::vector<sigc::connection> connections;
+       PBD::ScopedConnectionList* port_connections;
 
        /// pulses per quarter note for one MIDI clock frame (default 24)
        int         ppqn;
index b2e1381e431d777102aafcbd0b390ab82cb67831..a7a6e2207cc227aa562ace2575bdcf4896a9c22b 100644 (file)
@@ -24,7 +24,6 @@
 #include <set>
 
 #include <boost/utility.hpp>
-#include <sigc++/signal.h>
 #include "pbd/statefuldestructible.h"
 
 #include "ardour/ardour.h"
@@ -82,15 +81,15 @@ class Source : public SessionObject, public boost::noncopyable
        virtual bool set_destructive (bool /*yn*/) { return false; }
        virtual bool length_mutable() const    { return false; }
 
-       static sigc::signal<void,Source*>             SourceCreated;
-       sigc::signal<void,boost::shared_ptr<Source> > Switched;
+       static boost::signals2::signal<void(Source*)>             SourceCreated;
+       boost::signals2::signal<void(boost::shared_ptr<Source>)> Switched;
 
        bool has_been_analysed() const;
        virtual bool can_be_analysed() const { return false; }
        virtual void set_been_analysed (bool yn);
        virtual bool check_for_analysis_data_on_disk();
 
-       sigc::signal<void> AnalysisChanged;
+       boost::signals2::signal<void()> AnalysisChanged;
 
        AnalysisFeatureList transients;
        std::string get_transients_path() const;
index 21af4ece75499309413819194788d8732a90b960..4da285e980e75f2137c569d2d1ad5baa72fde306 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <string>
 #include <stdint.h>
-#include <sigc++/sigc++.h>
 #include <boost/shared_ptr.hpp>
 
 #include "ardour/source.h"
@@ -38,7 +37,7 @@ class SourceFactory {
   public:
        static void init ();
 
-       static sigc::signal<void,boost::shared_ptr<Source> > SourceCreated;
+       static boost::signals2::signal<void(boost::shared_ptr<Source>)> SourceCreated;
 
        static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false);
        static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node,
index 28c974bff1fd393566cfd2edf983bfba1b6f2b92..ba7bbbcf7e60c17ec5ed3ec3fe3aafda33ef3ed9 100644 (file)
@@ -30,7 +30,6 @@
 #include "pbd/stateful.h"
 #include "pbd/statefuldestructible.h"
 
-#include <sigc++/signal.h>
 
 #include "ardour/ardour.h"
 
@@ -259,7 +258,7 @@ class TempoMap : public PBD::StatefulDestructible
 
        nframes_t frame_rate () const { return _frame_rate; }
 
-       sigc::signal<void,ARDOUR::Change> StateChanged;
+       boost::signals2::signal<void(ARDOUR::Change)> StateChanged;
 
   private:
        static Tempo    _default_tempo;
index 3e0f1844a690f8395709b083b937fa5a9d656219..9a26d4d3ff2eb0afa3baca9e2eff7c034f80662e 100644 (file)
     $Id$
 */
 
-#include <sigc++/sigc++.h>
 
-#include "ardour/types.h"
 #include "midi++/jack.h"
+#include "pbd/scoped_connections.h"
+
+#include "ardour/types.h"
+#include "ardour/session_handle.h"
+
 
 #ifndef TICKER_H_
 #define TICKER_H_
@@ -31,22 +34,18 @@ namespace ARDOUR
 
 class Session;
 
-class Ticker : public sigc::trackable
+class Ticker : public SessionHandlePtr
 {
 public:
-       Ticker() : _session(0) {};
-       virtual ~Ticker() {};
+       Ticker() {};
+       virtual ~Ticker() {}
 
        virtual void tick(
                const nframes_t& transport_frames,
                const BBT_Time& transport_bbt,
                const Timecode::Time& transport_timecode) = 0;
 
-       virtual void set_session(Session& s);
-       virtual void going_away() { _session = 0; }
-
-protected:
-       Session* _session;
+       void set_session (Session* s);
 };
 
 class MidiClockTicker : public Ticker
@@ -70,8 +69,8 @@ public:
                const BBT_Time& transport_bbt,
                const Timecode::Time& transport_timecode);
 
-       void set_session(Session& s);
-       void going_away() { _midi_port = 0; Ticker::going_away(); }
+       void set_session (Session* s);
+       void session_going_away();
 
        /// slot for the signal session::MIDIClock_PortChanged
        void update_midi_clock_port();
index 5d8e2dbbd5b284d434e68e3ada002cbe7b64316a..c23e159684a113e20fac769b550d247507e3d569 100644 (file)
@@ -43,7 +43,7 @@ class Track : public Route
        TrackMode mode () const { return _mode; }
        virtual int set_mode (TrackMode /*m*/) { return false; }
        virtual bool can_use_mode (TrackMode /*m*/, bool& /*bounce_required*/) { return false; }
-       sigc::signal<void> TrackModeChanged;
+       boost::signals2::signal<void()> TrackModeChanged;
 
        virtual int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
                        bool state_changing, bool can_record, bool rec_monitors_input);
@@ -90,8 +90,8 @@ class Track : public Route
        bool record_enabled() const;
        void set_record_enable (bool yn, void *src);
 
-       sigc::signal<void> DiskstreamChanged;
-       sigc::signal<void> FreezeChange;
+       boost::signals2::signal<void()> DiskstreamChanged;
+       boost::signals2::signal<void()> FreezeChange;
 
   protected:
        Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO);
@@ -141,7 +141,7 @@ class Track : public Route
 
        FreezeRecord          _freeze_record;
        XMLNode*              pending_state;
-       sigc::connection      recenable_connection;
+       boost::signals2::scoped_connection  recenable_connection;
        bool                  _destructive;
 
        boost::shared_ptr<RecEnableControllable> _rec_enable_control;
index 2d9875df579e63765dee138360aad2e79561fe0d..753d94294f4ba55a968a6760c2bf4641dd18cf82 100644 (file)
@@ -27,7 +27,6 @@
 #include <string>
 #include <dlfcn.h>
 
-#include <sigc++/signal.h>
 #include "pbd/stateful.h"
 #include <jack/types.h>
 #include "ardour/plugin.h"
index 40411f413321778a9d98a7c592f05de524dd5543..2ad323ca1c391af4f0f03a5dde2409c6a5d16c37 100644 (file)
@@ -126,8 +126,6 @@ AudioDiskstream::~AudioDiskstream ()
 {
        DEBUG_TRACE (DEBUG::Destruction, string_compose ("Audio Diskstream %1 destructor\n", _name));
 
-       notify_callbacks ();
-
        {
                RCUWriter<ChannelList> writer (channels);
                boost::shared_ptr<ChannelList> c = writer.get_copy();
@@ -1506,7 +1504,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
                                continue; /* XXX is this OK? */
                        }
 
-                       region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr<Region>(region)));
+                       scoped_connect (region->GoingAway, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
 
                        _last_capture_regions.push_back (region);
 
index 63013426cbadaa8c577c2c95009bd13b78783900..acb44e43c477b9841c4799a0db54c916d6c26c5a 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <cstdlib>
 
-#include <sigc++/bind.h>
 
 #include "ardour/types.h"
 #include "ardour/configuration.h"
@@ -103,12 +102,10 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, nfra
 
 AudioPlaylist::~AudioPlaylist ()
 {
-       GoingAway (); /* EMIT SIGNAL */
+       drop_references ();
 
        /* drop connections to signals */
 
-       notify_callbacks ();
-
        _crossfades.clear ();
 }
 
@@ -531,8 +528,8 @@ AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade)
        } else {
                _crossfades.push_back (xfade);
 
-               xfade->Invalidated.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
-               xfade->StateChanged.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_changed));
+               scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+               scoped_connect (xfade->StateChanged, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
 
                notify_crossfade_added (xfade);
        }
@@ -587,8 +584,8 @@ AudioPlaylist::set_state (const XMLNode& node, int version)
                try {
                        boost::shared_ptr<Crossfade> xfade = boost::shared_ptr<Crossfade> (new Crossfade (*((const Playlist *)this), *child));
                        _crossfades.push_back (xfade);
-                       xfade->Invalidated.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
-                       xfade->StateChanged.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_changed));
+                       scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+                       scoped_connect (xfade->StateChanged, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
                        NewCrossfade(xfade);
                }
 
@@ -791,7 +788,7 @@ AudioPlaylist::crossfades_at (nframes_t frame, Crossfades& clist)
 }
 
 void
-AudioPlaylist::foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> > s)
+AudioPlaylist::foreach_crossfade (boost::function<void (boost::shared_ptr<Crossfade>)> s)
 {
        RegionLock rl (this, false);
        for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
index cb6bbed907d3f5fc13eefd0e9d80975830d0a0f0..3f773fc0a98633a7e7d87b3e6b4981d123b27107 100644 (file)
@@ -170,7 +170,7 @@ AudioPlaylistImporter::_prepare_move ()
 {
        // Rename
        while (session.playlists->by_name (name) || !handler.check_name (name)) {
-               std::pair<bool, string> rename_pair = Rename (_("A playlist with this name already exists, please rename it."), name);
+               std::pair<bool, string> rename_pair = *Rename (_("A playlist with this name already exists, please rename it."), name);
                if (!rename_pair.first) {
                        return false;
                }
index 68081661ad277d7e9454567acddcdc44bc8c7dd2..736fe417386a57b0a88a7b0f9211f52fda08e6cd 100644 (file)
@@ -17,9 +17,6 @@
 
 */
 
-#include <sigc++/retype.h>
-#include <sigc++/retype_return.h>
-#include <sigc++/bind.h>
 
 #include "pbd/error.h"
 #include "pbd/enumwriter.h"
@@ -185,7 +182,7 @@ AudioTrack::set_diskstream (boost::shared_ptr<AudioDiskstream> ds, void * /*src*
        if (audio_diskstream()->deprecated_io_node) {
 
                if (!IO::connecting_legal) {
-                       IO::ConnectingLegal.connect (sigc::mem_fun (*this, &AudioTrack::deprecated_use_diskstream_connections));
+                       scoped_connect (IO::ConnectingLegal, boost::bind (&AudioTrack::deprecated_use_diskstream_connections, this));
                } else {
                        deprecated_use_diskstream_connections ();
                }
@@ -307,7 +304,7 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
        pending_state = const_cast<XMLNode*> (&node);
 
        if (_session.state_of_the_state() & Session::Loading) {
-               _session.StateReady.connect (sigc::mem_fun (*this, &AudioTrack::set_state_part_two));
+               scoped_connect (_session.StateReady, boost::bind (&AudioTrack::set_state_part_two, this));
        } else {
                set_state_part_two ();
        }
index 146722b3c0bdc398891e47325047674dda20add1..aad20f9317284d44f635ba6954f28bc1132bb789 100644 (file)
@@ -240,7 +240,7 @@ AudioTrackImporter::_prepare_move ()
        /* Rename */
 
        while (session.route_by_name (name) || !track_handler.check_name (name)) {
-               std::pair<bool, string> rename_pair = Rename (_("A playlist with this name already exists, please rename it."), name);
+               std::pair<bool, string> rename_pair = *Rename (_("A playlist with this name already exists, please rename it."), name);
                if (!rename_pair.first) {
                        return false;
                }
index 2c16c52296a0bb8b0b0b2215ef5d97e3e3db2df7..b1c55275702e86ac02b9136af0332cd87e124c38 100644 (file)
@@ -66,7 +66,6 @@ AudioEngine::AudioEngine (string client_name)
 {
        _instance = this; /* singleton */
 
-       session = 0;
        session_remove_pending = false;
        _running = false;
        _has_run = false;
@@ -158,24 +157,24 @@ AudioEngine::start ()
 
                nframes_t blocksize = jack_get_buffer_size (_priv_jack);
 
-               if (session) {
+               if (_session) {
                        BootMessage (_("Connect session to engine"));
 
-                       session->set_block_size (blocksize);
-                       session->set_frame_rate (jack_get_sample_rate (_priv_jack));
+                       _session->set_block_size (blocksize);
+                       _session->set_frame_rate (jack_get_sample_rate (_priv_jack));
 
                        /* page in as much of the session process code as we
                           can before we really start running.
                        */
 
-                       session->process (blocksize);
-                       session->process (blocksize);
-                       session->process (blocksize);
-                       session->process (blocksize);
-                       session->process (blocksize);
-                       session->process (blocksize);
-                       session->process (blocksize);
-                       session->process (blocksize);
+                       _session->process (blocksize);
+                       _session->process (blocksize);
+                       _session->process (blocksize);
+                       _session->process (blocksize);
+                       _session->process (blocksize);
+                       _session->process (blocksize);
+                       _session->process (blocksize);
+                       _session->process (blocksize);
                }
 
                _processed_frames = 0;
@@ -192,7 +191,7 @@ AudioEngine::start ()
                jack_set_freewheel_callback (_priv_jack, _freewheel_callback, this);
                jack_set_port_registration_callback (_priv_jack, _registration_callback, this);
 
-               if (session && session->config.get_jack_time_master()) {
+               if (_session && _session->config.get_jack_time_master()) {
                        jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this);
                }
 
@@ -269,8 +268,8 @@ void
 AudioEngine::jack_timebase_callback (jack_transport_state_t state, nframes_t nframes,
                                     jack_position_t* pos, int new_position)
 {
-       if (_jack && session && session->synced_to_jack()) {
-               session->jack_timebase_callback (state, nframes, pos, new_position);
+       if (_jack && _session && _session->synced_to_jack()) {
+               _session->jack_timebase_callback (state, nframes, pos, new_position);
        }
 }
 
@@ -283,8 +282,8 @@ AudioEngine::_jack_sync_callback (jack_transport_state_t state, jack_position_t*
 int
 AudioEngine::jack_sync_callback (jack_transport_state_t state, jack_position_t* pos)
 {
-       if (_jack && session) {
-               return session->jack_sync_callback (state, pos);
+       if (_jack && _session) {
+               return _session->jack_sync_callback (state, pos);
        }
 
        return true;
@@ -372,7 +371,7 @@ AudioEngine::process_callback (nframes_t nframes)
                next_processed_frames = _processed_frames + nframes;
        }
 
-       if (!tm.locked() || session == 0) {
+       if (!tm.locked() || _session == 0) {
                /* return having done nothing */
                _processed_frames = next_processed_frames;
                return 0;
@@ -380,7 +379,7 @@ AudioEngine::process_callback (nframes_t nframes)
 
        if (session_remove_pending) {
                /* perform the actual session removal */
-               session = 0;
+               _session = 0;
                session_remove_pending = false;
                session_removed.signal();
                _processed_frames = next_processed_frames;
@@ -402,14 +401,16 @@ AudioEngine::process_callback (nframes_t nframes)
        }
 
        if (_freewheeling) {
-               /* emit the Freewheel signal and stop freewheeling in the event of trouble */
-               if (Freewheel (nframes)) {
+               /* emit the Freewheel signal and stop freewheeling in the event of trouble 
+                * the indirection is to pick up the return value of the signal.
+                */
+               if (*Freewheel (nframes)) {
                        jack_set_freewheel (_priv_jack, false);
                }
 
        } else {
-               if (session) {
-                       session->process (nframes);
+               if (_session) {
+                       _session->process (nframes);
                }
        }
 
@@ -442,7 +443,7 @@ AudioEngine::process_callback (nframes_t nframes)
                last_monitor_check = next_processed_frames;
        }
 
-       if (session->silent()) {
+       if (_session->silent()) {
 
                boost::shared_ptr<Ports> p = ports.reader();
 
@@ -483,8 +484,8 @@ AudioEngine::jack_sample_rate_callback (nframes_t nframes)
        monitor_check_interval = nframes / 10;
        last_monitor_check = 0;
 
-       if (session) {
-               session->set_frame_rate (nframes);
+       if (_session) {
+               _session->set_frame_rate (nframes);
        }
 
        SampleRateChanged (nframes); /* EMIT SIGNAL */
@@ -514,8 +515,8 @@ AudioEngine::jack_bufsize_callback (nframes_t nframes)
                (*i)->reset();
        }
 
-       if (session) {
-               session->set_block_size (_buffer_size);
+       if (_session) {
+               _session->set_block_size (_buffer_size);
        }
 
        return 0;
@@ -536,7 +537,7 @@ AudioEngine::start_metering_thread ()
 {
        if (m_meter_thread == 0) {
                g_atomic_int_set (&m_meter_exit, 0);
-               m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread),
+               m_meter_thread = Glib::Thread::create (boost::bind (&AudioEngine::meter_thread, this),
                                                       500000, true, true, Glib::THREAD_PRIORITY_NORMAL);
        }
 }
@@ -558,31 +559,31 @@ AudioEngine::set_session (Session *s)
 {
        Glib::Mutex::Lock pl (_process_lock);
 
-       if (!session) {
-
-               session = s;
+       SessionHandlePtr::set_session (s);
 
+       if (_session) {
+               
                nframes_t blocksize = jack_get_buffer_size (_jack);
-
+               
                /* page in as much of the session process code as we
                   can before we really start running.
                */
-
+               
                boost::shared_ptr<Ports> p = ports.reader();
-
+               
                for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
                        (*i)->cycle_start (blocksize);
                }
-
-               s->process (blocksize);
-               s->process (blocksize);
-               s->process (blocksize);
-               s->process (blocksize);
-               s->process (blocksize);
-               s->process (blocksize);
-               s->process (blocksize);
-               s->process (blocksize);
-
+               
+               _session->process (blocksize);
+               _session->process (blocksize);
+               _session->process (blocksize);
+               _session->process (blocksize);
+               _session->process (blocksize);
+               _session->process (blocksize);
+               _session->process (blocksize);
+               _session->process (blocksize);
+               
                for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
                        (*i)->cycle_end (blocksize);
                }
@@ -596,13 +597,13 @@ AudioEngine::remove_session ()
 
        if (_running) {
 
-               if (session) {
+               if (_session) {
                        session_remove_pending = true;
                        session_removed.wait(_process_lock);
                }
 
        } else {
-               session = 0;
+               SessionHandlePtr::set_session (0);
        }
 
        remove_all_ports ();
@@ -1081,8 +1082,8 @@ int
 AudioEngine::reset_timebase ()
 {
         GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
-       if (session) {
-               if (session->config.get_jack_time_master()) {
+       if (_session) {
+               if (_session->config.get_jack_time_master()) {
                        return jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this);
                } else {
                        return jack_release_timebase (_jack);
@@ -1214,11 +1215,11 @@ AudioEngine::reconnect_to_jack ()
 
         GET_PRIVATE_JACK_POINTER_RET (_jack,-1);
 
-       if (session) {
-               session->reset_jack_connection (_priv_jack);
+       if (_session) {
+               _session->reset_jack_connection (_priv_jack);
                nframes_t blocksize = jack_get_buffer_size (_priv_jack);
-               session->set_block_size (blocksize);
-               session->set_frame_rate (jack_get_sample_rate (_priv_jack));
+               _session->set_block_size (blocksize);
+               _session->set_frame_rate (jack_get_sample_rate (_priv_jack));
 
                _raw_buffer_sizes[DataType::AUDIO] = blocksize * sizeof(float);
                cout << "FIXME: Assuming maximum MIDI buffer size " << blocksize * 4 << "bytes" << endl;
@@ -1237,7 +1238,7 @@ AudioEngine::reconnect_to_jack ()
        jack_set_sync_callback (_priv_jack, _jack_sync_callback, this);
        jack_set_freewheel_callback (_priv_jack, _freewheel_callback, this);
 
-       if (session && session->config.get_jack_time_master()) {
+       if (_session && _session->config.get_jack_time_master()) {
                jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this);
        }
 
index b840c3a7c9a76373820e43e516c09155a898423a..1500b139acdff2edf26c3b34e5428b2fa040d1e2 100644 (file)
@@ -70,7 +70,7 @@ using namespace Glib;
 
 ustring AudioFileSource::peak_dir = "";
 
-sigc::signal<void> AudioFileSource::HeaderPositionOffsetChanged;
+boost::signals2::signal<void()> AudioFileSource::HeaderPositionOffsetChanged;
 uint64_t           AudioFileSource::header_position_offset = 0;
 
 /* XXX maybe this too */
index d660616bb33fee9963f1994a147d888d758d5d51..ac173db546c5bfb0e7f38178653101045fbc20d3 100644 (file)
@@ -24,8 +24,6 @@
 
 #include <set>
 
-#include <sigc++/bind.h>
-#include <sigc++/class_slot.h>
 
 #include <glibmm/thread.h>
 
@@ -98,7 +96,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n
 {
        boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
        if (afs) {
-               afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+               scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this));
        }
 
        init ();
@@ -115,7 +113,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n
 {
        boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
        if (afs) {
-               afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+               scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this));
        }
 
        init ();
@@ -207,7 +205,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, const Sour
 
                boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> ((*i));
                if (afs) {
-                       afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+                       scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this));
                }
        }
 
@@ -231,7 +229,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& nod
 {
        boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
        if (afs) {
-               afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+               scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this));
        }
 
        init ();
@@ -272,7 +270,7 @@ void
 AudioRegion::connect_to_analysis_changed ()
 {
        for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) {
-               (*i)->AnalysisChanged.connect (sigc::mem_fun (*this, &AudioRegion::invalidate_transients));
+               scoped_connect ((*i)->AnalysisChanged, boost::bind (&AudioRegion::invalidate_transients, this));
        }
 }
 
@@ -287,7 +285,7 @@ AudioRegion::connect_to_header_position_offset_changed ()
                        unique_srcs.insert (*i);
                        boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (*i);
                        if (afs) {
-                               afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed));
+                               scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this));
                        }
                }
        }
@@ -296,9 +294,9 @@ AudioRegion::connect_to_header_position_offset_changed ()
 void
 AudioRegion::listen_to_my_curves ()
 {
-       _envelope->StateChanged.connect (sigc::mem_fun (*this, &AudioRegion::envelope_changed));
-       _fade_in->StateChanged.connect (sigc::mem_fun (*this, &AudioRegion::fade_in_changed));
-       _fade_out->StateChanged.connect (sigc::mem_fun (*this, &AudioRegion::fade_out_changed));
+       scoped_connect (_envelope->StateChanged, boost::bind (&AudioRegion::envelope_changed, this));
+       scoped_connect (_fade_in->StateChanged, boost::bind (&AudioRegion::fade_in_changed, this));
+       scoped_connect (_fade_out->StateChanged, boost::bind (&AudioRegion::fade_out_changed, this));
 }
 
 void
index f7d6088aec1e3e62ec6f77083c68331c37a2c867..fd481c973009f2cfb0912e42e2e32c3a596c00b8 100644 (file)
@@ -149,7 +149,7 @@ AudioSource::update_length (sframes_t pos, sframes_t cnt)
  ***********************************************************************/
 
 bool
-AudioSource::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) const
+AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, boost::signals2::connection& connect_here_if_not) const
 {
        bool ret;
        Glib::Mutex::Lock lm (_peaks_ready_lock);
@@ -159,7 +159,7 @@ AudioSource::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) con
        */
 
        if (!(ret = _peaks_built)) {
-               conn = PeaksReady.connect (the_slot);
+               connect_here_if_not = PeaksReady.connect (doThisWhenReady);
        }
 
        return ret;
index dbb76c005ea0f8e9a95cb92783c1c2be47e2bca7..7d353a1bddd88b302595c8f0dee6eaa6ba333490 100644 (file)
@@ -72,7 +72,7 @@ Auditioner::Auditioner (Session& s)
        _main_outs->allow_pan_reset ();
        _main_outs->reset_panner ();
 
-       _output->changed.connect (sigc::mem_fun (*this, &Auditioner::output_changed));
+       scoped_connect (_output->changed, boost::bind (&Auditioner::output_changed, this, _1, _2));
 
        the_region.reset ((AudioRegion*) 0);
        g_atomic_int_set (&_active, 0);
index db8f5bb799e4558019faace760ee791625160d77..9a6eb08e453981ff69dc09bfd87e16b61de83ad0 100644 (file)
@@ -23,7 +23,6 @@
 #include <cmath>
 #include <sstream>
 #include <algorithm>
-#include <sigc++/bind.h>
 #include "ardour/automation_list.h"
 #include "ardour/event_type_map.h"
 #include "evoral/Curve.hpp"
@@ -36,7 +35,7 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-sigc::signal<void,AutomationList *> AutomationList::AutomationListCreated;
+boost::signals2::signal<void(AutomationList *)> AutomationList::AutomationListCreated;
 
 #if 0
 static void dumpit (const AutomationList& al, string prefix = "")
@@ -113,7 +112,7 @@ AutomationList::AutomationList (const XMLNode& node, Evoral::Parameter id)
 
 AutomationList::~AutomationList()
 {
-       GoingAway ();
+       drop_references ();
 }
 
 boost::shared_ptr<Evoral::ControlList>
index 05ac7316ec1af3f9b2a7e9e53e16ccc140a9bb59..2fd4c1d9c1f313f515a567ff6f13db2d0bd5dba6 100644 (file)
@@ -38,8 +38,8 @@ static float _write_data_rate;
 
 namespace ARDOUR {
 
-Butler::Butler(Session* s)
-       : session(s)
+Butler::Butler(Session& s)
+       : SessionHandleRef (s)
        , thread(0)
        , audio_dstream_buffer_size(0)
        , midi_dstream_buffer_size(0)
@@ -54,7 +54,7 @@ Butler::~Butler()
 int
 Butler::start_thread()
 {
-       const float rate = (float)session->frame_rate();
+       const float rate = (float)_session.frame_rate();
 
        /* size is in Samples, not bytes */
        audio_dstream_buffer_size = (uint32_t) floor (Config->get_audio_track_buffer_seconds() * rate);
@@ -194,7 +194,7 @@ Butler::thread_work ()
                }
 
                if (transport_work_requested()) {
-                       session->butler_transport_work ();
+                       _session.butler_transport_work ();
                }
 
                disk_work_outstanding = false;
@@ -203,7 +203,7 @@ Butler::thread_work ()
 
                begin = get_microseconds();
 
-               boost::shared_ptr<Session::DiskstreamList> dsl = session->diskstream_list().reader ();
+               boost::shared_ptr<Session::DiskstreamList> dsl = _session.diskstream_list().reader ();
 
 //             for (i = dsl->begin(); i != dsl->end(); ++i) {
 //                     cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl;
@@ -285,11 +285,11 @@ Butler::thread_work ()
                        }
                }
 
-               if (err && session->actively_recording()) {
+               if (err && _session.actively_recording()) {
                        /* stop the transport and try to catch as much possible
                           captured state as we can.
                        */
-                       session->request_stop ();
+                       _session.request_stop ();
                }
 
                if (i != dsl->end()) {
@@ -304,15 +304,15 @@ Butler::thread_work ()
                if (compute_io) {
                        // there are no apparent users for this calculation?
                        end = get_microseconds();
-                       if(end-begin > 0) {
-                       _write_data_rate = (float) bytes / (float) (end - begin);
+                       if (end - begin > 0) {
+                               _write_data_rate = (float) bytes / (float) (end - begin);
                        } else {
-                       _write_data_rate = 0; // Well, infinity would be better
+                               _write_data_rate = 0; // Well, infinity would be better
                        }
                }
 
                if (!disk_work_outstanding) {
-                       session->refresh_disk_space ();
+                       _session.refresh_disk_space ();
                }
 
 
index d15283c85c2179072a8f1de58a7e14d373e94ddb..47f8d5bf983095ff0dcab481e4efaed6bae971d3 100644 (file)
@@ -39,7 +39,6 @@ ControlProtocolManager* ControlProtocolManager::_instance = 0;
 const string ControlProtocolManager::state_node_name = X_("ControlProtocols");
 
 ControlProtocolManager::ControlProtocolManager ()
-       : _session (0)
 {
 
 }
@@ -63,36 +62,42 @@ ControlProtocolManager::~ControlProtocolManager()
 }
 
 void
-ControlProtocolManager::set_session (Session& s)
+ControlProtocolManager::set_session (Session* s)
 {
-       _session = &s;
-       _session->GoingAway.connect (sigc::mem_fun (*this, &ControlProtocolManager::drop_session));
+       SessionHandlePtr::set_session (s);
 
-       for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
-               if ((*i)->requested || (*i)->mandatory) {
-                       instantiate (**i);
-                       (*i)->requested = false;
+       if (_session) {
+               Glib::Mutex::Lock lm (protocols_lock);
 
-                       if ((*i)->protocol && (*i)->state) {
-                               (*i)->protocol->set_state (*(*i)->state, Stateful::loading_state_version);
+               for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
+                       if ((*i)->requested || (*i)->mandatory) {
+                               instantiate (**i);
+                               (*i)->requested = false;
+                               
+                               if ((*i)->protocol && (*i)->state) {
+                                       (*i)->protocol->set_state (*(*i)->state, Stateful::loading_state_version);
+                               }
                        }
                }
        }
 }
 
 void
-ControlProtocolManager::drop_session ()
+ControlProtocolManager::session_going_away()
 {
-       _session = 0;
+       SessionHandlePtr::session_going_away ();
 
        {
                Glib::Mutex::Lock lm (protocols_lock);
+
                for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) {
                        delete *p;
                }
+
                control_protocols.clear ();
 
                for (list<ControlProtocolInfo*>::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) {
+                       // mark existing protocols as requested
                        // otherwise the ControlProtocol instances are not recreated in set_session
                        if ((*p)->protocol) {
                                (*p)->requested = true;
@@ -263,7 +268,7 @@ ControlProtocolManager::get_descriptor (string path)
 }
 
 void
-ControlProtocolManager::foreach_known_protocol (sigc::slot<void,const ControlProtocolInfo*> method)
+ControlProtocolManager::foreach_known_protocol (boost::function<void(const ControlProtocolInfo*)> method)
 {
        for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
                method (*i);
index 55e81ae9e07ebf2eefaa15c948b56ce951f0e9e9..bbb0d8ca8987149ccb6e938b582dd3f4f6903d3b 100644 (file)
@@ -90,7 +90,7 @@ CoreAudioSource::init_cafile ()
 
 CoreAudioSource::~CoreAudioSource ()
 {
-       GoingAway (); /* EMIT SIGNAL */
+       drop_references ();
 }
 
 int
index 7bbad9a1d1d5bf0f069845d487648c7ef619c353..75f2bae587bc2fca12704851abbf80b43d525eb1 100644 (file)
@@ -17,7 +17,6 @@
 
 */
 
-#include <sigc++/bind.h>
 
 #include "pbd/stacktrace.h"
 
@@ -192,7 +191,6 @@ Crossfade::Crossfade (boost::shared_ptr<Crossfade> orig, boost::shared_ptr<Audio
 
 Crossfade::~Crossfade ()
 {
-       notify_callbacks ();
 }
 
 void
index 07489687c18b4d7023a69540bef889be3af5697e..7f159a441c62b0537d43279d986d7dc699bb0791 100644 (file)
@@ -42,9 +42,9 @@ using namespace std;
 using namespace PBD;
 using namespace ARDOUR;
 
-sigc::signal<void,nframes_t> Delivery::CycleStart;
-sigc::signal<int>            Delivery::PannersLegal;
-bool                         Delivery::panners_legal = false;
+boost::signals2::signal<void(nframes_t)> Delivery::CycleStart;
+boost::signals2::signal<int()>           Delivery::PannersLegal;
+bool                                     Delivery::panners_legal = false;
 
 /* deliver to an existing IO object */
 
@@ -64,10 +64,10 @@ Delivery::Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<Mute
        _display_to_user = false;
 
        if (_output) {
-               _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed));
+               scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2));
        }
 
-       CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start));
+       scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1));
 }
 
 /* deliver to a new IO object */
@@ -88,10 +88,10 @@ Delivery::Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const string&
        _display_to_user = false;
 
        if (_output) {
-               _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed));
+               scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2));
        }
 
-       CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start));
+       scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1));
 }
 
 /* deliver to a new IO object, reconstruct from XML */
@@ -116,10 +116,10 @@ Delivery::Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode&
        }
 
        if (_output) {
-               _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed));
+               scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2));
        }
 
-       CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start));
+       scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1));
 }
 
 /* deliver to an existing IO object, reconstruct from XML */
@@ -144,10 +144,10 @@ Delivery::Delivery (Session& s, boost::shared_ptr<IO> out, boost::shared_ptr<Mut
        }
 
        if (_output) {
-               _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed));
+               scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2));
        }
 
-       CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start));
+       scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1));
 }
 
 std::string
@@ -419,7 +419,7 @@ Delivery::reset_panner ()
                }
        } else {
                panner_legal_c.disconnect ();
-               panner_legal_c = PannersLegal.connect (sigc::mem_fun (*this, &Delivery::panners_became_legal));
+               panner_legal_c = PannersLegal.connect (boost::bind (&Delivery::panners_became_legal, this));
        }
 }
 
@@ -465,7 +465,7 @@ int
 Delivery::reset_panners ()
 {
        panners_legal = true;
-       return PannersLegal ();
+       return *PannersLegal ();
 }
 
 
index ee279c601d50c5922ba4e801c76fe92932278047..f9e8202ebc5e8701fb504d25f25b8572cf8d5205 100644 (file)
@@ -31,7 +31,6 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 
-#include <sigc++/bind.h>
 
 #include "pbd/error.h"
 #include "pbd/basename.h"
@@ -69,8 +68,8 @@ using namespace PBD;
  */
 ARDOUR::nframes_t Diskstream::disk_io_chunk_frames = 1024 * 256;
 
-sigc::signal<void>                Diskstream::DiskOverrun;
-sigc::signal<void>                Diskstream::DiskUnderrun;
+boost::signals2::signal<void()>                Diskstream::DiskOverrun;
+boost::signals2::signal<void()>                Diskstream::DiskUnderrun;
 
 Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
        : SessionObject(sess, name)
@@ -143,13 +142,13 @@ Diskstream::set_route (Route& r)
        _io = _route->input();
 
        ic_connection.disconnect();
-       ic_connection = _io->changed.connect (sigc::mem_fun (*this, &Diskstream::handle_input_change));
+       ic_connection = _io->changed.connect (boost::bind (&Diskstream::handle_input_change, this, _1, _2));
 
        input_change_pending = ConfigurationChanged;
        non_realtime_input_change ();
        set_align_style_from_io ();
 
-       _route->GoingAway.connect (sigc::mem_fun (*this, &Diskstream::route_going_away));
+       scoped_connect (_route->GoingAway, boost::bind (&Diskstream::route_going_away, this));
 }
 
 void
@@ -327,9 +326,7 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist)
                        return 0;
                }
 
-               plmod_connection.disconnect ();
-               plgone_connection.disconnect ();
-               plregion_connection.disconnect ();
+               playlist_connections.drop_connections ();
 
                if (_playlist) {
                        _playlist->release();
@@ -342,9 +339,9 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist)
                        reset_write_sources (false);
                }
 
-               plmod_connection = _playlist->Modified.connect (sigc::mem_fun (*this, &Diskstream::playlist_modified));
-               plgone_connection = _playlist->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Diskstream::playlist_deleted), boost::weak_ptr<Playlist>(_playlist)));
-               plregion_connection = _playlist->RangesMoved.connect (sigc::mem_fun (*this, &Diskstream::playlist_ranges_moved));
+               playlist_connections.add_connection (_playlist->Modified.connect (boost::bind (&Diskstream::playlist_modified, this)));
+               playlist_connections.add_connection (_playlist->GoingAway.connect (boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr<Playlist>(_playlist))));
+               playlist_connections.add_connection (_playlist->RangesMoved.connect (boost::bind (&Diskstream::playlist_ranges_moved, this, _1)));
        }
 
        /* don't do this if we've already asked for it *or* if we are setting up
@@ -457,12 +454,11 @@ Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<nframes_t> > const &
        }
 
        /* move processor automation */
-       _route->foreach_processor (sigc::bind (sigc::mem_fun (*this, &Diskstream::move_processor_automation), movements_frames));
+       _route->foreach_processor (boost::bind (&Diskstream::move_processor_automation, this, _1, movements_frames));
 }
 
 void
-Diskstream::move_processor_automation (boost::weak_ptr<Processor> p,
-                                      list< Evoral::RangeMove<nframes_t> > const & movements_frames)
+Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evoral::RangeMove<nframes_t> > const & movements_frames)
 {
        boost::shared_ptr<Processor> processor (p.lock ());
        if (!processor) {
index c02b841ea7081d292fc422eb3da1224e3f53e23c..3e7c2c9a91db9639ece995444afcac6625e0e21e 100644 (file)
@@ -32,8 +32,8 @@ using namespace std;
 using namespace PBD;
 using namespace ARDOUR;
 
-sigc::signal <std::pair<bool, string>, string, string> ElementImporter::Rename;
-sigc::signal <bool, string> ElementImporter::Prompt;
+boost::signals2::signal <std::pair<bool, string> (string, string)> ElementImporter::Rename;
+boost::signals2::signal <bool (string)> ElementImporter::Prompt;
 
 ElementImporter::ElementImporter (XMLTree const & source, ARDOUR::Session & session) :
   source (source),
index 583dc9a843201fda68f660808a1b448e45993eea..3006fbc3ee68bb85cec40311a3f07bc33a1288dc 100644 (file)
@@ -108,7 +108,7 @@ RegionExportChannelFactory::RegionExportChannelFactory (Session * session, Audio
                throw ExportFailed ("Unhandled type in ExportChannelFactory constructor");
        }
 
-       session->ProcessExport.connect (sigc::hide (sigc::mem_fun (*this, &RegionExportChannelFactory::new_cycle_started)));
+       export_connection = session->ProcessExport.connect (boost::bind (&RegionExportChannelFactory::new_cycle_started, this, _1));
 
        buffers.set_count (ChanCount (DataType::AUDIO, n_channels));
        buffers.ensure_buffers (DataType::AUDIO, n_channels, frames_per_cycle);
index 908ae6f8a8bf07c53499d00437d187f92a2854d9..f26f0635d8cae6f4a8773aca52023e2e8b0284e8 100644 (file)
@@ -211,13 +211,13 @@ void
 ExportFormatManager::add_compatibility (CompatPtr ptr)
 {
        compatibilities.push_back (ptr);
-       ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_compatibility_selection), WeakCompatPtr (ptr)));
+       scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_compatibility_selection, this, _1, WeakCompatPtr (ptr)));
 }
 
 void
 ExportFormatManager::add_quality (QualityPtr ptr)
 {
-       ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_quality_selection), WeakQualityPtr (ptr)));
+       scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_quality_selection, this, _1, WeakQualityPtr (ptr)));
        qualities.push_back (ptr);
 }
 
@@ -225,7 +225,7 @@ void
 ExportFormatManager::add_format (FormatPtr ptr)
 {
        formats.push_back (ptr);
-       ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_format_selection), WeakFormatPtr (ptr)));
+       scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_format_selection, this, _1, WeakFormatPtr (ptr)));
        universal_set = universal_set->get_union (*ptr);
 
        /* Encoding options */
@@ -233,15 +233,15 @@ ExportFormatManager::add_format (FormatPtr ptr)
        boost::shared_ptr<HasSampleFormat> hsf;
 
        if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (ptr)) {
-               hsf->SampleFormatSelectChanged.connect (sigc::mem_fun (*this, &ExportFormatManager::change_sample_format_selection));
-               hsf->DitherTypeSelectChanged.connect (sigc::mem_fun (*this, &ExportFormatManager::change_dither_type_selection));
+               scoped_connect (hsf->SampleFormatSelectChanged, boost::bind (&ExportFormatManager::change_sample_format_selection, this, _1, _2));
+               scoped_connect (hsf->DitherTypeSelectChanged, boost::bind (&ExportFormatManager::change_dither_type_selection, this, _1, _2));
        }
 }
 
 void
 ExportFormatManager::add_sample_rate (SampleRatePtr ptr)
 {
-       ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_sample_rate_selection), WeakSampleRatePtr (ptr)));
+       scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_sample_rate_selection, this, _1, WeakSampleRatePtr (ptr)));
        sample_rates.push_back (ptr);
 }
 
index 362076876e10b75c030b115c48f1d4e514d88534..b7637f3c07f5f9432788eb238225d3076d20dcab 100644 (file)
@@ -59,9 +59,10 @@ HasSampleFormat::add_sample_format (ExportFormatBase::SampleFormat format)
 
        SampleFormatPtr ptr (new SampleFormatState (format, get_sample_format_name (format)));
        sample_format_states.push_back (ptr);
-       ptr->SelectChanged.connect (sigc::bind (SampleFormatSelectChanged.make_slot(), WeakSampleFormatPtr (ptr)));
-       ptr->SelectChanged.connect (sigc::mem_fun (*this, &HasSampleFormat::update_sample_format_selection));
-       ptr->CompatibleChanged.connect (sigc::bind (SampleFormatCompatibleChanged.make_slot(), WeakSampleFormatPtr (ptr)));
+       scoped_connect (ptr->SelectChanged, boost::bind (&HasSampleFormat::update_sample_format_selection, this, _1));
+       // BOOST SIGNALS how to connect one signal to another
+       // scoped_connect (ptr->SelectChanged, boost::bind (SampleFormatSelectChanged, _1, WeakSampleFormatPtr (ptr));
+       // scoped_connect (ptr->CompatibleChanged, boost::bind (SampleFormatCompatibleChanged, _1, WeakSampleFormatPtr (ptr));
 }
 
 void
@@ -69,9 +70,10 @@ HasSampleFormat::add_dither_type (ExportFormatBase::DitherType type, Glib::ustri
 {
        DitherTypePtr ptr (new DitherTypeState (type, name));
        dither_type_states.push_back (ptr);
-       ptr->SelectChanged.connect (sigc::bind (DitherTypeSelectChanged.make_slot(), WeakDitherTypePtr (ptr)));
-       ptr->SelectChanged.connect (sigc::mem_fun (*this, &HasSampleFormat::update_dither_type_selection));
-       ptr->CompatibleChanged.connect (sigc::bind (DitherTypeCompatibleChanged.make_slot(), WeakDitherTypePtr (ptr)));
+       scoped_connect (ptr->SelectChanged, boost::bind (&HasSampleFormat::update_dither_type_selection, this, _1));
+       // BOOST SIGNALS how to connect one signal to another
+       // scoped_connect (ptr->SelectChanged, boost::bind (DitherTypeSelectChanged, _1, WeakDitherTypePtr (ptr));
+       // scoped_connect (ptr->CompatibleChanged, boost::bind (DitherTypeCompatibleChanged, _1, WeakDitherTypePtr (ptr));
 }
 
 HasSampleFormat::SampleFormatPtr
index 0c7a2e8d48352d3e945eb3e13e25699e9250d8fe..7bf231acd2f76ef9604148d8c42542d47f954d50 100644 (file)
@@ -98,15 +98,15 @@ ExportElementFactory::add_filename_copy (FilenamePtr other)
 
 /*** ExportHandler ***/
 
-ExportHandler::ExportHandler (Session & session) :
-  ExportElementFactory (session),
-  session (session),
-  export_status (session.get_export_status ()),
-  realtime (false)
+ExportHandler::ExportHandler (Session & session) 
+       : ExportElementFactory (session)
+       , session (session)
+       , export_status (session.get_export_status ())
+       , realtime (false)
 {
        processor.reset (new ExportProcessor (session));
 
-       files_written_connection = ExportProcessor::WritingFile.connect (sigc::mem_fun (files_written, &std::list<Glib::ustring>::push_back));
+       files_written_connection = ExportProcessor::WritingFile.connect (boost::bind (&ExportHandler::add_file, this, _1));
 }
 
 ExportHandler::~ExportHandler ()
@@ -121,6 +121,12 @@ ExportHandler::~ExportHandler ()
        files_written_connection.disconnect();
 }
 
+void
+ExportHandler::add_file (const Glib::ustring& str)
+{
+       files_written.push_back (str);
+}
+
 bool
 ExportHandler::add_export_config (TimespanPtr timespan, ChannelConfigPtr channel_config, FormatPtr format, FilenamePtr filename)
 {
@@ -162,7 +168,7 @@ ExportHandler::do_export (bool rt)
 
        realtime = rt;
 
-       session.ExportReadFinished.connect (sigc::mem_fun (*this, &ExportHandler::finish_timespan));
+       export_read_finished_connection = session.ExportReadFinished.connect (boost::bind (&ExportHandler::finish_timespan, this));
        start_timespan ();
 }
 
@@ -499,7 +505,7 @@ ExportHandler::start_timespan ()
 
        /* connect stuff and start export */
 
-       current_timespan->process_connection = session.ProcessExport.connect (sigc::mem_fun (*current_timespan, &ExportTimespan::process));
+       current_timespan->process_connection = session.ProcessExport.connect (boost::bind (&ExportTimespan::process, current_timespan, _1));
        session.start_audio_export (current_timespan->get_start(), realtime);
 }
 
@@ -538,6 +544,7 @@ void
 ExportHandler::timespan_thread_finished ()
 {
        channel_config_connection.disconnect();
+       export_read_finished_connection.disconnect ();
 
        if (current_map_it != timespan_bounds.second) {
 
@@ -559,7 +566,7 @@ ExportHandler::timespan_thread_finished ()
                        cc = current_map_it->second.channel_config;
                }
 
-               channel_config_connection = cc->FilesWritten.connect (sigc::mem_fun (*this, &ExportHandler::timespan_thread_finished));
+               channel_config_connection = cc->FilesWritten.connect (boost::bind (&ExportHandler::timespan_thread_finished, this));
                ++current_map_it;
 
        } else { /* All files are written from current timespan, reset timespan and start new */
index d36ef9f18ab6994bb788e12733cfd034169e3e87..7d04e8f8d6cf33dc60e06cab4c061f394c63876d 100644 (file)
@@ -38,7 +38,7 @@ using namespace PBD;
 namespace ARDOUR
 {
 
-sigc::signal<void, Glib::ustring> ExportProcessor::WritingFile;
+boost::signals2::signal<void (const Glib::ustring&)> ExportProcessor::WritingFile;
 
 ExportProcessor::ExportProcessor (Session & session) :
   session (session),
index 9953524c34b6ed17373725e451032d6018e9aecc..e3e37a710753b4533e282031ef3393380467a0b1 100644 (file)
@@ -109,7 +109,7 @@ apply_gain_to_buffer_t  ARDOUR::apply_gain_to_buffer = 0;
 mix_buffers_with_gain_t ARDOUR::mix_buffers_with_gain = 0;
 mix_buffers_no_gain_t   ARDOUR::mix_buffers_no_gain = 0;
 
-sigc::signal<void,std::string> ARDOUR::BootMessage;
+boost::signals2::signal<void(std::string)> ARDOUR::BootMessage;
 
 void ARDOUR::setup_enum_writer ();
 
index 41c29f43f10a39a8f78002a27ef48d2f41c76951..ccee62c9887daa4eefdd50c30e2b4daeba064225 100644 (file)
 using namespace std;
 using namespace ARDOUR;
 
-sigc::signal<void,nframes_t> InternalReturn::CycleStart;
+boost::signals2::signal<void(nframes_t)> InternalReturn::CycleStart;
 
 InternalReturn::InternalReturn (Session& s)
        : Return (s, true)
        , user_count (0)
 {
-       CycleStart.connect (sigc::mem_fun (*this, &InternalReturn::cycle_start));
+       scoped_connect (CycleStart, boost::bind (&InternalReturn::cycle_start, this, _1));
 }
 
 InternalReturn::InternalReturn (Session& s, const XMLNode& node)
        : Return (s, node, true)
        , user_count (0)
 {
-       CycleStart.connect (sigc::mem_fun (*this, &InternalReturn::cycle_start));
+       scoped_connect (CycleStart, boost::bind (&InternalReturn::cycle_start, this, _1));
 }
 
 void
index e10857a2a9a24d5ab130e1787cca18b6d491d400..d6489f8f496a9320f85c1cc9357bd529b2b4d386 100644 (file)
@@ -43,8 +43,8 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost:
 
        set_name (sendto->name());
 
-       _send_to->GoingAway.connect (sigc::mem_fun (*this, &InternalSend::send_to_going_away));
-       _send_to->NameChanged.connect (sigc::mem_fun (*this, &InternalSend::send_to_name_changed));
+       scoped_connect (_send_to->GoingAway, boost::bind (&InternalSend::send_to_going_away, this));
+       scoped_connect (_send_to->NameChanged, boost::bind (&InternalSend::send_to_name_changed, this));
 }
 
 InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
@@ -187,7 +187,7 @@ InternalSend::set_our_state (const XMLNode& node, int version)
                */
 
                if (!IO::connecting_legal) {
-                       connect_c = IO::ConnectingLegal.connect (sigc::mem_fun (*this, &InternalSend::connect_when_legal));
+                       connect_c = IO::ConnectingLegal.connect (boost::bind (&InternalSend::connect_when_legal, this));
                } else {
                        connect_when_legal ();
                }
index d8d7ec88a5bb6eaf9711ce7d80898c1fbad40602..b9fd9ccbc66ed4bbfcbcad79e98a729f64972709 100644 (file)
@@ -22,7 +22,6 @@
 #include <locale.h>
 #include <errno.h>
 
-#include <sigc++/bind.h>
 
 #include <glibmm.h>
 #include <glibmm/thread.h>
@@ -68,8 +67,8 @@ using namespace PBD;
 
 const string                 IO::state_node_name = "IO";
 bool                         IO::connecting_legal = false;
-sigc::signal<int>            IO::ConnectingLegal;
-sigc::signal<void,ChanCount> IO::PortCountChanged;
+boost::signals2::signal<int()>            IO::ConnectingLegal;
+boost::signals2::signal<void(ChanCount)> IO::PortCountChanged;
 
 /** @param default_type The type of port that will be created by ensure_io
  * and friends if no type is explicitly requested (to avoid breakage).
@@ -124,13 +123,13 @@ IO::check_bundles_connected ()
 }
 
 void
-IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports)
+IO::check_bundles (std::vector<UserBundleInfo*>& list, const PortSet& ports)
 {
-       std::vector<UserBundleInfo> new_list;
+       std::vector<UserBundleInfo*> new_list;
 
-       for (std::vector<UserBundleInfo>::iterator i = list.begin(); i != list.end(); ++i) {
+       for (std::vector<UserBundleInfo*>::iterator i = list.begin(); i != list.end(); ++i) {
 
-               uint32_t const N = i->bundle->nchannels ();
+               uint32_t const N = (*i)->bundle->nchannels ();
 
                if (_ports.num_ports (default_type()) < N) {
                        continue;
@@ -140,7 +139,7 @@ IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports)
 
                for (uint32_t j = 0; j < N; ++j) {
                        /* Every port on bundle channel j must be connected to our input j */
-                       Bundle::PortList const pl = i->bundle->channel_ports (j);
+                       Bundle::PortList const pl = (*i)->bundle->channel_ports (j);
                        for (uint32_t k = 0; k < pl.size(); ++k) {
                                if (ports.port(j)->connected_to (pl[k]) == false) {
                                        ok = false;
@@ -156,7 +155,7 @@ IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports)
                if (ok) {
                        new_list.push_back (*i);
                } else {
-                       i->changed.disconnect ();
+                       delete *i;
                }
        }
 
@@ -475,9 +474,9 @@ IO::state (bool /*full_state*/)
        node->add_property ("direction", enum_2_string (_direction));
        node->add_property ("default-type", _default_type.to_string());
 
-       for (std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
+       for (std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
                XMLNode* n = new XMLNode ("Bundle");
-               n->add_property ("name", i->bundle->name ());
+               n->add_property ("name", (*i)->bundle->name ());
                node->add_child_nocopy (*n);
        }
 
@@ -567,7 +566,7 @@ IO::set_state (const XMLNode& node, int version)
                pending_state_node = new XMLNode (node);
                pending_state_node_version = version;
                pending_state_node_in = false;
-               connection_legal_c = ConnectingLegal.connect (sigc::mem_fun (*this, &IO::connecting_became_legal));
+               connection_legal_c = ConnectingLegal.connect (boost::bind (&IO::connecting_became_legal, this));
        }
 
 
@@ -620,7 +619,7 @@ IO::set_state_2X (const XMLNode& node, int version, bool in)
                pending_state_node = new XMLNode (node);
                pending_state_node_version = version;
                pending_state_node_in = in;
-               connection_legal_c = ConnectingLegal.connect (sigc::mem_fun (*this, &IO::connecting_became_legal));
+               connection_legal_c = ConnectingLegal.connect (boost::bind (&IO::connecting_became_legal, this));
        }
 
        return 0;
@@ -1164,14 +1163,14 @@ IO::connect_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
                if (ub) {
 
                        /* See if we already know about this one */
-                       std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin();
-                       while (i != _bundles_connected.end() && i->bundle != ub) {
+                       std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin();
+                       while (i != _bundles_connected.end() && (*i)->bundle != ub) {
                                ++i;
                        }
 
                        if (i == _bundles_connected.end()) {
                                /* We don't, so make a note */
-                               _bundles_connected.push_back (UserBundleInfo (this, ub));
+                               _bundles_connected.push_back (new UserBundleInfo (this, ub));
                        }
                }
        }
@@ -1194,12 +1193,13 @@ IO::disconnect_ports_from_bundle (boost::shared_ptr<Bundle> c, void* src)
                boost::shared_ptr<UserBundle> ub = boost::dynamic_pointer_cast<UserBundle> (c);
                if (ub) {
 
-                       std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin();
-                       while (i != _bundles_connected.end() && i->bundle != ub) {
+                       std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin();
+                       while (i != _bundles_connected.end() && (*i)->bundle != ub) {
                                ++i;
                        }
 
                        if (i != _bundles_connected.end()) {
+                               delete *i;
                                _bundles_connected.erase (i);
                        }
                }
@@ -1221,7 +1221,7 @@ int
 IO::enable_connecting ()
 {
        connecting_legal = true;
-       return ConnectingLegal ();
+       return *ConnectingLegal ();
 }
 
 void
@@ -1362,8 +1362,8 @@ IO::bundles_connected ()
        BundleList bundles;
 
        /* User bundles */
-       for (std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
-               bundles.push_back (i->bundle);
+       for (std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) {
+               bundles.push_back ((*i)->bundle);
        }
 
        /* Session bundles */
@@ -1399,9 +1399,7 @@ IO::bundles_connected ()
 IO::UserBundleInfo::UserBundleInfo (IO* io, boost::shared_ptr<UserBundle> b)
 {
        bundle = b;
-       changed = b->Changed.connect (
-               sigc::mem_fun (*io, &IO::bundle_changed)
-               );
+       changed = b->Changed.connect (boost::bind (&IO::bundle_changed, io, _1));
 }
 
 std::string
index 6bdac9fe199e47f6b0064f351ac5a63b7cc10d55..91247d5082dd62c6c993f524e4b2945817075813 100644 (file)
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <sstream>
 
-#include <sigc++/bind.h>
 
 #include "pbd/xml++.h"
 #include "pbd/enumwriter.h"
@@ -89,7 +88,6 @@ IOProcessor::IOProcessor (Session& s, boost::shared_ptr<IO> in, boost::shared_pt
 
 IOProcessor::~IOProcessor ()
 {
-       notify_callbacks ();
 }
 
 void
index a242a76c3189880e8601b2d0f542ca614df79f4b..b0d64ad41bc1759a320952966bcaeeabd1669323 100644 (file)
@@ -144,7 +144,7 @@ LadspaPlugin::~LadspaPlugin ()
        deactivate ();
        cleanup ();
 
-       GoingAway (); /* EMIT SIGNAL */
+       drop_references ();
 
        /* XXX who should close a plugin? */
 
index 24e4628c0b8fbda510cdbab665930c92cbf2685f..7e3330ecd9476128d9f54158b57dbe997c05391b 100644 (file)
@@ -25,7 +25,6 @@
 #include <ctime>
 #include <list>
 
-#include <sigc++/bind.h>
 
 #include "pbd/stl_delete.h"
 #include "pbd/xml++.h"
index 6fb9f7b7db0e57b9b518a26c90eac112fe06ca53..655a8f1a848c0b641582b881a6110f084f3ae5a1 100644 (file)
@@ -143,7 +143,7 @@ LocationImporter::_prepare_move ()
        std::pair<bool, string> rename_pair;
 
        if (location->is_auto_punch()) {
-               rename_pair = Rename (_("The location is the Punch range. It will be imported as a normal range.\nYou may rename the imported location:"), name);
+               rename_pair = *Rename (_("The location is the Punch range. It will be imported as a normal range.\nYou may rename the imported location:"), name);
                if (!rename_pair.first) {
                        return false;
                }
@@ -154,7 +154,7 @@ LocationImporter::_prepare_move ()
        }
 
        if (location->is_auto_loop()) {
-               rename_pair = Rename (_("The location is a Loop range. It will be imported as a normal range.\nYou may rename the imported location:"), name);
+               rename_pair = *Rename (_("The location is a Loop range. It will be imported as a normal range.\nYou may rename the imported location:"), name);
                if (!rename_pair.first) { return false; }
 
                location->set_auto_loop (false, this);
@@ -165,7 +165,7 @@ LocationImporter::_prepare_move ()
        Locations::LocationList const & locations(session.locations()->list());
        for (Locations::LocationList::const_iterator it = locations.begin(); it != locations.end(); ++it) {
                if (!((*it)->name().compare (location->name())) || !handler.check_name (location->name())) {
-                       rename_pair = Rename (_("A location with that name already exists.\nYou may rename the imported location:"), name);
+                       rename_pair = *Rename (_("A location with that name already exists.\nYou may rename the imported location:"), name);
                        if (!rename_pair.first) { return false; }
                        name = rename_pair.second;
                }
index 2090d18e96d212d83c88abb5d9e270fb3c8e41b5..6c593a869aa8ed741a026a1478f3dbe51fae2d10 100644 (file)
@@ -181,7 +181,7 @@ LV2Plugin::~LV2Plugin ()
        deactivate ();
        cleanup ();
 
-       GoingAway (); /* EMIT SIGNAL */
+       drop_references ();
 
        slv2_instance_free(_instance);
        slv2_value_free(_name);
index 4566ed7e0255a23bdfd182c98b1be76a8802312b..4ad0f585805092d7750051e58743744d67bdeb03 100644 (file)
@@ -31,20 +31,20 @@ using namespace std;
 
 using namespace ARDOUR;
 
-sigc::signal<void> Metering::Meter;
+boost::signals2::signal<void()> Metering::Meter;
 Glib::StaticMutex  Metering::m_meter_signal_lock;
 
-sigc::connection
-Metering::connect (sigc::slot<void> the_slot)
+boost::signals2::connection
+Metering::connect (boost::function<void()> f)
 {
        // SignalProcessor::Meter is emitted from another thread so the
        // Meter signal must be protected.
        Glib::Mutex::Lock guard (m_meter_signal_lock);
-       return Meter.connect (the_slot);
+       return Meter.connect (f);
 }
 
 void
-Metering::disconnect (sigc::connection& c)
+Metering::disconnect (boost::signals2::connection& c)
 {
        Glib::Mutex::Lock guard (m_meter_signal_lock);
        c.disconnect ();
index e2b83a1e65d3c2a2c3c879fb11f6c094e2fccf93..12d25ac9ae637a46be65540279db60b5ae643766 100644 (file)
@@ -43,7 +43,8 @@ using namespace MIDI;
 using namespace PBD;
 
 MIDIClock_Slave::MIDIClock_Slave (Session& s, MIDI::Port& p, int ppqn)
-       : ppqn (ppqn)
+       : port_connections (0)
+       , ppqn (ppqn)
        , bandwidth (30.0 / 60.0) // 1 BpM = 1 / 60 Hz
 {
        session = (ISlaveSessionProxy *) new SlaveSessionProxy(s);
@@ -53,6 +54,7 @@ MIDIClock_Slave::MIDIClock_Slave (Session& s, MIDI::Port& p, int ppqn)
 
 MIDIClock_Slave::MIDIClock_Slave (ISlaveSessionProxy* session_proxy, int ppqn)
        : session(session_proxy)
+       , port_connections (0)
        , ppqn (ppqn)
        , bandwidth (30.0 / 60.0) // 1 BpM = 1 / 60 Hz
 {
@@ -62,27 +64,27 @@ MIDIClock_Slave::MIDIClock_Slave (ISlaveSessionProxy* session_proxy, int ppqn)
 
 MIDIClock_Slave::~MIDIClock_Slave()
 {
-  delete session;
+       delete session;
+       delete port_connections;
 }
 
 void
 MIDIClock_Slave::rebind (MIDI::Port& p)
 {
-       for (vector<sigc::connection>::iterator i = connections.begin(); i != connections.end(); ++i) {
-               (*i).disconnect ();
-       }
-
+       delete port_connections;
+       port_connections = new ScopedConnectionList;
+       
        port = &p;
 
-       #ifdef DEBUG_MIDI_CLOCK
-               std::cerr << "MIDIClock_Slave: connecting to port " << port->name() << std::endl;
-       #endif
+#ifdef DEBUG_MIDI_CLOCK
+       std::cerr << "MIDIClock_Slave: connecting to port " << port->name() << std::endl;
+#endif
 
-       connections.push_back (port->input()->timing.connect   (sigc::mem_fun (*this, &MIDIClock_Slave::update_midi_clock)));
-       connections.push_back (port->input()->start.connect    (sigc::mem_fun (*this, &MIDIClock_Slave::start)));
-       connections.push_back (port->input()->contineu.connect (sigc::mem_fun (*this, &MIDIClock_Slave::contineu)));
-       connections.push_back (port->input()->stop.connect     (sigc::mem_fun (*this, &MIDIClock_Slave::stop)));
-       connections.push_back (port->input()->position.connect (sigc::mem_fun (*this, &MIDIClock_Slave::position)));
+       port_connections->add_connection (port->input()->timing.connect (boost::bind (&MIDIClock_Slave::update_midi_clock, this, _1, _2)));
+       port_connections->add_connection (port->input()->start.connect (boost::bind (&MIDIClock_Slave::start, this, _1, _2)));
+       port_connections->add_connection (port->input()->contineu.connect (boost::bind (&MIDIClock_Slave::contineu, this, _1, _2)));
+       port_connections->add_connection (port->input()->stop.connect (boost::bind (&MIDIClock_Slave::stop, this, _1, _2)));
+       port_connections->add_connection (port->input()->position.connect (boost::bind (&MIDIClock_Slave::position, this, _1, _2, 3)));
 }
 
 void
index f780948d693dcf8d7f32284677c584305b16f6a3..6b181b1a2787c2ef8742430450f81f272755b763 100644 (file)
@@ -1024,7 +1024,7 @@ MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool a
                                continue; /* XXX is this OK? */
                        }
 
-                       region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr<Region>(region)));
+                       scoped_connect (region->GoingAway, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
 
                        _last_capture_regions.push_back (region);
 
index 47bc14852c1cf1828521f98fbc57415bebff3938..baa3c2c7c016d4c54b408de7cf38e48c6d78e126 100644 (file)
@@ -267,7 +267,7 @@ MidiModel::DeltaCommand::set_state (const XMLNode& delta_command, int /*version*
        if (added_notes) {
                XMLNodeList notes = added_notes->children();
                transform(notes.begin(), notes.end(), back_inserter(_added_notes),
-                         sigc::mem_fun(*this, &DeltaCommand::unmarshal_note));
+                         boost::bind (&DeltaCommand::unmarshal_note, this, _1));
        }
 
        _removed_notes.clear();
@@ -275,7 +275,7 @@ MidiModel::DeltaCommand::set_state (const XMLNode& delta_command, int /*version*
        if (removed_notes) {
                XMLNodeList notes = removed_notes->children();
                transform(notes.begin(), notes.end(), back_inserter(_removed_notes),
-                         sigc::mem_fun(*this, &DeltaCommand::unmarshal_note));
+                         boost::bind (&DeltaCommand::unmarshal_note, this, _1));
        }
 
        return 0;
@@ -288,14 +288,16 @@ MidiModel::DeltaCommand::get_state()
        delta_command->add_property("midi-source", _model->midi_source()->id().to_s());
 
        XMLNode* added_notes = delta_command->add_child(ADDED_NOTES_ELEMENT);
-       for_each(_added_notes.begin(), _added_notes.end(), sigc::compose(
-                       sigc::mem_fun(*added_notes, &XMLNode::add_child_nocopy),
-                       sigc::mem_fun(*this, &DeltaCommand::marshal_note)));
+       for_each(_added_notes.begin(), _added_notes.end(), 
+                boost::bind(
+                        boost::bind (&XMLNode::add_child_nocopy, *added_notes, _1),
+                        boost::bind (&DeltaCommand::marshal_note, this, _1)));
 
        XMLNode* removed_notes = delta_command->add_child(REMOVED_NOTES_ELEMENT);
-       for_each(_removed_notes.begin(), _removed_notes.end(), sigc::compose(
-                       sigc::mem_fun(*removed_notes, &XMLNode::add_child_nocopy),
-                       sigc::mem_fun(*this, &DeltaCommand::marshal_note)));
+       for_each(_removed_notes.begin(), _removed_notes.end(), 
+                boost::bind (
+                        boost::bind (&XMLNode::add_child_nocopy, *removed_notes, _1),
+                        boost::bind (&DeltaCommand::marshal_note, this, _1)));
 
        return *delta_command;
 }
@@ -650,9 +652,9 @@ MidiModel::DiffCommand::set_state(const XMLNode& diff_command, int /*version*/)
 
        if (changed_notes) {
                XMLNodeList notes = changed_notes->children();
-
                transform (notes.begin(), notes.end(), back_inserter(_changes),
-                          sigc::mem_fun(*this, &DiffCommand::unmarshal_change));
+                          boost::bind (&DiffCommand::unmarshal_change, this, _1));
+
        }
 
        return 0;
@@ -665,9 +667,10 @@ MidiModel::DiffCommand::get_state ()
        diff_command->add_property("midi-source", _model->midi_source()->id().to_s());
 
        XMLNode* changes = diff_command->add_child(DIFF_NOTES_ELEMENT);
-       for_each(_changes.begin(), _changes.end(), sigc::compose(
-                        sigc::mem_fun(*changes, &XMLNode::add_child_nocopy),
-                        sigc::mem_fun(*this, &DiffCommand::marshal_change)));
+       for_each(_changes.begin(), _changes.end(), 
+                boost::bind (
+                        boost::bind (&XMLNode::add_child_nocopy, *changes, _1),
+                        boost::bind (&DiffCommand::marshal_change, this, _1)));
 
        return *diff_command;
 }
index 307655bff8e4f09daf96146e751bd7ef84b72444..a2522fe997099ba2fec55a04ef15156f070632c5 100644 (file)
@@ -18,7 +18,6 @@
     $Id$
 */
 
-#include <sigc++/sigc++.h>
 #include <boost/shared_ptr.hpp>
 
 #include "pbd/compose.h"
@@ -41,11 +40,9 @@ using namespace PBD::sys;
 MidiPatchManager* MidiPatchManager::_manager = 0;
 
 void
-MidiPatchManager::set_session (Session& s)
+MidiPatchManager::set_session (Session* s)
 {
-       _session = &s;
-       _session->GoingAway.connect (sigc::mem_fun (*this, &MidiPatchManager::drop_session));
-
+       SessionHandlePtr::set_session (s);
        refresh();
 }
 
@@ -56,6 +53,10 @@ MidiPatchManager::refresh()
        _master_devices_by_model.clear();
        _all_models.clear();
 
+       if (!_session) {
+               return;
+       }
+
        path path_to_patches = _session->session_directory().midi_patch_path();
 
        if (!exists(path_to_patches)) {
@@ -93,10 +94,8 @@ MidiPatchManager::refresh()
 }
 
 void
-MidiPatchManager::drop_session ()
+MidiPatchManager::session_going_away ()
 {
-       _session = 0;
-       _documents.clear();
-       _master_devices_by_model.clear();
-       _all_models.clear();
+       SessionHandlePtr::session_going_away ();
+       refresh ();
 }
index b230f6f6d55d44e2cfaa300e21c64057668c689a..a8e60ec86695c7e214019a4d51bcd545fdc00ec7 100644 (file)
@@ -23,7 +23,6 @@
 #include <iostream>
 
 #include <stdlib.h>
-#include <sigc++/bind.h>
 
 #include "evoral/EventList.hpp"
 
@@ -72,11 +71,9 @@ MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, nframes
 
 MidiPlaylist::~MidiPlaylist ()
 {
-       GoingAway (); /* EMIT SIGNAL */
+       drop_references ();
 
        /* drop connections to signals */
-
-       notify_callbacks ();
 }
 
 template<typename Time>
index a722afd39944337f09dd8f7380f6f74d7ef8bee7..3b13d4db8d07fe1042eaf5c6488229d3d3768b18 100644 (file)
@@ -24,8 +24,6 @@
 
 #include <set>
 
-#include <sigc++/bind.h>
-#include <sigc++/class_slot.h>
 
 #include <glibmm/thread.h>
 
@@ -54,7 +52,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nfra
        : Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::MIDI, 0,  Region::Flag(Region::DefaultFlags|Region::External))
 {
        assert(_name.find("/") == string::npos);
-       midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source));
+       scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
 /* Basic MidiRegion constructor (one channel) */
@@ -62,7 +60,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nfra
        : Region (src, start, length, name, DataType::MIDI, layer, flags)
 {
        assert(_name.find("/") == string::npos);
-       midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source));
+       scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
 /* Basic MidiRegion constructor (many channels) */
@@ -70,7 +68,7 @@ MidiRegion::MidiRegion (const SourceList& srcs, nframes_t start, nframes_t lengt
        : Region (srcs, start, length, name, DataType::MIDI, layer, flags)
 {
        assert(_name.find("/") == string::npos);
-       midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source));
+       scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
 
@@ -79,14 +77,14 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, nframes_t off
        : Region (other, offset, length, name, layer, flags)
 {
        assert(_name.find("/") == string::npos);
-       midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source));
+       scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
 MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other)
        : Region (other)
 {
        assert(_name.find("/") == string::npos);
-       midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source));
+       scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
 MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node)
@@ -96,7 +94,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node)
                throw failed_constructor();
        }
 
-       midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source));
+       scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
        assert(_name.find("/") == string::npos);
        assert(_type == DataType::MIDI);
 }
@@ -108,7 +106,7 @@ MidiRegion::MidiRegion (const SourceList& srcs, const XMLNode& node)
                throw failed_constructor();
        }
 
-       midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source));
+       scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1));
        assert(_name.find("/") == string::npos);
        assert(_type == DataType::MIDI);
 }
index 2ece2f53cead56abe618e4777ea5d96555834350..14b096c915d5c623ce566af3fbd29ea04fa9b7fd 100644 (file)
@@ -49,7 +49,7 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-sigc::signal<void,MidiSource *> MidiSource::MidiSourceCreated;
+boost::signals2::signal<void(MidiSource*)> MidiSource::MidiSourceCreated;
 
 MidiSource::MidiSource (Session& s, string name, Source::Flag flags)
        : Source(s, DataType::MIDI, name, flags)
@@ -260,7 +260,7 @@ MidiSource::session_saved()
 
                newsrc->flush_midi();
 
-               Switched.emit(newsrc);
+               Switched (newsrc); /* EMIT SIGNAL */
        }
 }
 
index ebbe231e62acb6d62a4977ddae69cea0278fb475..179d0bb57c9b9856b2d56711e785416daf957fac 100644 (file)
@@ -17,9 +17,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 #include "pbd/error.h"
-#include <sigc++/retype.h>
-#include <sigc++/retype_return.h>
-#include <sigc++/bind.h>
 
 #include "pbd/enumwriter.h"
 #include "midi++/events.h"
@@ -233,7 +230,7 @@ MidiTrack::_set_state (const XMLNode& node, int version, bool call_base)
        pending_state = const_cast<XMLNode*> (&node);
 
        if (_session.state_of_the_state() & Session::Loading) {
-               _session.StateReady.connect (sigc::mem_fun (*this, &MidiTrack::set_state_part_two));
+               scoped_connect (_session.StateReady, boost::bind (&MidiTrack::set_state_part_two, this));
        } else {
                set_state_part_two ();
        }
index 1bb10d713f3e34a739c482d919311ef7cdbacfcc..db26ee8e8303c93d62a1cac14271fc6b0c38da3a 100644 (file)
@@ -18,6 +18,8 @@
 */
 #include <cstdlib>
 
+#include <sigc++/signal.h>
+
 #include "pbd/pthread_utils.h"
 
 #include "midi++/manager.h"
@@ -44,7 +46,7 @@ MidiControlUI::MidiControlUI (Session& s)
        : AbstractUI<MidiUIRequest> (_("midiui"))
        , _session (s) 
 {
-       MIDI::Manager::instance()->PortsChanged.connect (sigc::mem_fun (*this, &MidiControlUI::change_midi_ports));
+       rebind_connection = MIDI::Manager::instance()->PortsChanged.connect (boost::bind (&MidiControlUI::change_midi_ports, this));
 }
 
 MidiControlUI::~MidiControlUI ()
@@ -125,7 +127,7 @@ MidiControlUI::reset_ports ()
                if ((fd = (*i)->selectable ()) >= 0) {
                        Glib::RefPtr<IOSource> psrc = IOSource::create (fd, IO_IN|IO_HUP|IO_ERR);
 
-                       psrc->connect (sigc::bind (sigc::mem_fun (*this, &MidiControlUI::midi_input_handler), (*i)));
+                       psrc->connect (sigc::bind (sigc::mem_fun (this, &MidiControlUI::midi_input_handler), *i));
                        psrc->attach (_main_loop->get_context());
 
                        // glibmm hack: for now, store only the GSource*
index 3e06efa56fc358b9478999ea11c73701d20dd89d..50ef5011ba74dd83c5f0c096506cf7ad0f3aabb8 100644 (file)
@@ -52,6 +52,7 @@ const int MTC_Slave::frame_tolerance = 2;
 
 MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p)
        : session (s)
+       , port_connections (0)
 {
        can_notify_on_unknown_rate = true;
        did_reset_tc_format = false;
@@ -70,9 +71,12 @@ MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p)
 
 MTC_Slave::~MTC_Slave()
 {
+       delete port_connections;
+
        if (did_reset_tc_format) {
                session.config.set_timecode_format (saved_tc_format);
        }
+
        delete pic;
        delete [] speed_accumulator;
 }
@@ -87,15 +91,14 @@ MTC_Slave::give_slave_full_control_over_transport_speed() const
 void
 MTC_Slave::rebind (MIDI::Port& p)
 {
-       for (vector<sigc::connection>::iterator i = connections.begin(); i != connections.end(); ++i) {
-               (*i).disconnect ();
-       }
-
+       delete port_connections;
+       port_connections = new ScopedConnectionList;
+       
        port = &p;
-
-       connections.push_back (port->input()->mtc_time.connect (sigc::mem_fun (*this, &MTC_Slave::update_mtc_time)));
-       connections.push_back (port->input()->mtc_qtr.connect (sigc::mem_fun (*this, &MTC_Slave::update_mtc_qtr)));
-       connections.push_back (port->input()->mtc_status.connect (sigc::mem_fun (*this, &MTC_Slave::update_mtc_status)));
+       
+       port_connections->add_connection (port->input()->mtc_time.connect ( boost::bind (&MTC_Slave::update_mtc_time, this, _1, _2, _3)));
+       port_connections->add_connection (port->input()->mtc_qtr.connect (boost::bind (&MTC_Slave::update_mtc_qtr, this, _1, _2, _3)));
+       port_connections->add_connection (port->input()->mtc_status.connect (boost::bind (&MTC_Slave::update_mtc_status, this, _1)));
 }
 
 void
index 5353d1e8243dcaf839479deda1750c2184d88ec9..81e9f9df8a8b116a2e47e87dfb40def669340983 100644 (file)
@@ -32,7 +32,7 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-sigc::signal<void,NamedSelection*> NamedSelection::NamedSelectionCreated;
+boost::signals2::signal<void(NamedSelection*)> NamedSelection::NamedSelectionCreated;
 
 typedef std::list<boost::shared_ptr<Playlist> > PlaylistList;
 
@@ -102,7 +102,7 @@ NamedSelection::~NamedSelection ()
 {
        for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
                (*i)->release ();
-               (*i)->GoingAway ();
+               (*i)->drop_references ();
        }
 }
 
index 29beb7c6b73e296a872a5751809bcf93627353b1..b93e2b311a2d9e0cf78cd480c68db9572fd0991b 100644 (file)
@@ -25,7 +25,6 @@
 #include <string>
 #include <climits>
 
-#include <sigc++/bind.h>
 
 #include "pbd/failed_constructor.h"
 #include "pbd/stl_delete.h"
@@ -116,7 +115,9 @@ Playlist::Playlist (Session& sess, const XMLNode& node, DataType type, bool hide
 }
 
 Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, bool hide)
-       : SessionObject(other->_session, namestr), _type(other->_type), _orig_diskstream_id(other->_orig_diskstream_id)
+       : SessionObject(other->_session, namestr)
+       , _type(other->_type)
+       , _orig_diskstream_id(other->_orig_diskstream_id)
 {
        init (hide);
 
@@ -148,7 +149,9 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo
 }
 
 Playlist::Playlist (boost::shared_ptr<const Playlist> other, nframes_t start, nframes_t cnt, string str, bool hide)
-       : SessionObject(other->_session, str), _type(other->_type), _orig_diskstream_id(other->_orig_diskstream_id)
+       : SessionObject(other->_session, str)
+       , _type(other->_type)
+       , _orig_diskstream_id(other->_orig_diskstream_id)
 {
        RegionLock rlock2 (const_cast<Playlist*> (other.get()));
 
@@ -267,12 +270,13 @@ Playlist::init (bool hide)
        freeze_length = 0;
        _explicit_relayering = false;
 
-       Modified.connect (sigc::mem_fun (*this, &Playlist::mark_session_dirty));
+       scoped_connect (Modified, boost::bind (&Playlist::mark_session_dirty, this));
 }
 
 Playlist::~Playlist ()
 {
        DEBUG_TRACE (DEBUG::Destruction, string_compose ("Playlist %1 destructor\n", _name));
+
        {
                RegionLock rl (this);
 
@@ -601,10 +605,8 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t posit
                }
        }
 
-       region_state_changed_connections.push_back (
-               region->StateChanged.connect (sigc::bind (sigc::mem_fun (this, &Playlist::region_changed_proxy),
-                                                         boost::weak_ptr<Region> (region)))
-               );
+       region_state_changed_connections.add_connection 
+               (region->StateChanged.connect (boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region))));
 
        return true;
 }
@@ -1318,7 +1320,6 @@ Playlist::region_changed_proxy (Change what_changed, boost::weak_ptr<Region> wea
                return;
        }
 
-
        /* this makes a virtual call to the right kind of playlist ... */
 
        region_changed (what_changed, region);
@@ -1369,13 +1370,7 @@ Playlist::clear (bool with_signals)
        {
                RegionLock rl (this);
 
-               for (
-                       std::list<sigc::connection>::iterator i = region_state_changed_connections.begin ();
-                       i != region_state_changed_connections.end ();
-                       ++i
-               ) {
-                       i->disconnect ();
-               }
+               region_state_changed_connections.drop_connections ();
 
                for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
                        pending_removes.insert (*i);
@@ -2493,7 +2488,7 @@ Playlist::update_after_tempo_map_change ()
 }
 
 void
-Playlist::foreach_region (sigc::slot<void, boost::shared_ptr<Region> > s)
+Playlist::foreach_region (boost::function<void(boost::shared_ptr<Region>)> s)
 {
        RegionLock rl (this, false);
        for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
index 554c36df172552be8470addb4befd06fe9c8a789..cfcec40d1b6bece3cad0c1ca64385e640ec9c15f 100644 (file)
@@ -31,7 +31,7 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-sigc::signal<void,boost::shared_ptr<Playlist>, bool> PlaylistFactory::PlaylistCreated;
+boost::signals2::signal<void(boost::shared_ptr<Playlist>, bool)> PlaylistFactory::PlaylistCreated;
 
 boost::shared_ptr<Playlist>
 PlaylistFactory::create (Session& s, const XMLNode& node, bool hidden, bool unused)
index f41d6bbc25725cbad1eafec233d83d0a8c586cd3..c2bf7f3562728389ecb773b73ee9b7fa55bc1e59 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <string>
 
-#include <sigc++/bind.h>
 
 #include "pbd/failed_constructor.h"
 #include "pbd/xml++.h"
@@ -131,7 +130,7 @@ PluginInsert::set_count (uint32_t num)
 
 PluginInsert::~PluginInsert ()
 {
-       GoingAway (); /* EMIT SIGNAL */
+       drop_references ();
 }
 
 void
index eccd5f29f902a9702e6f78388c97903fc41fa45e..044230e1f7b31dc070a4b279cbed94594f81cdcd 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <string>
 
-#include <sigc++/bind.h>
 
 #include "pbd/failed_constructor.h"
 #include "pbd/xml++.h"
@@ -62,7 +61,7 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLN
 
 PortInsert::~PortInsert ()
 {
-       GoingAway ();
+       drop_references ();
 }
 
 void
index 3bc9db024bef1873c5b1d0db710cb38f5a8648b6..54701ae8d4300a519f293b9cac0caf85191f8d31 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <string>
 
-#include <sigc++/bind.h>
 
 #include "pbd/failed_constructor.h"
 #include "pbd/enumwriter.h"
@@ -57,7 +56,7 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-sigc::signal<void,Processor*> Processor::ProcessorCreated;
+boost::signals2::signal<void(Processor*)> Processor::ProcessorCreated;
 
 // Always saved as Processor, but may be IOProcessor or Send in legacy sessions
 const string Processor::state_node_name = "Processor";
@@ -269,7 +268,7 @@ Processor::configure_io (ChanCount in, ChanCount out)
        _configured_output = out;
        _configured = true;
 
-       ConfigurationChanged.emit (in, out);
+       ConfigurationChanged (in, out); /* EMIT SIGNAL */
 
        return true;
 }
index 2c4d8004cf89dea75ff73939cbcfa92535566401..4fcb7de3cac0aa8896136ee820c3d44c93980261 100644 (file)
@@ -23,8 +23,6 @@
 #include <algorithm>
 #include <sstream>
 
-#include <sigc++/bind.h>
-#include <sigc++/class_slot.h>
 
 #include <glibmm/thread.h>
 #include "pbd/xml++.h"
@@ -56,7 +54,7 @@ Change Region::LockChanged       = ARDOUR::new_change ();
 Change Region::LayerChanged      = ARDOUR::new_change ();
 Change Region::HiddenChanged     = ARDOUR::new_change ();
 
-sigc::signal<void,boost::shared_ptr<ARDOUR::Region> > Region::RegionPropertyChanged;
+boost::signals2::signal<void(boost::shared_ptr<ARDOUR::Region>)> Region::RegionPropertyChanged;
 
 /* derived-from-derived constructor (no sources in constructor) */
 Region::Region (Session& s, nframes_t start, nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags)
@@ -111,7 +109,7 @@ Region::Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length
        _sources.push_back (src);
        _master_sources.push_back (src);
 
-       src->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Region::source_deleted), src));
+       scoped_connect (src->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(src)));
 
        assert(_sources.size() > 0);
        _positional_lock_style = AudioTime;
@@ -340,7 +338,6 @@ Region::Region (boost::shared_ptr<Source> src, const XMLNode& node)
 Region::~Region ()
 {
        DEBUG_TRACE (DEBUG::Destruction, string_compose ("Region %1 destructor @ %2\n", _name, this));
-       notify_callbacks ();
        drop_references ();
 }
 
@@ -1416,9 +1413,10 @@ Region::region_list_equivalent (boost::shared_ptr<const Region> other) const
 }
 
 void
-Region::source_deleted (boost::shared_ptr<Source>)
+Region::source_deleted (boost::weak_ptr<Source>)
 {
        _sources.clear ();
+       cerr << "Send drop ref signal from region " << ' ' << this << endl;
        drop_references ();
 }
 
@@ -1588,14 +1586,14 @@ Region::use_sources (SourceList const & s)
 
        for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) {
                _sources.push_back (*i);
-               (*i)->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Region::source_deleted), *i));
+               scoped_connect ((*i)->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
                unique_srcs.insert (*i);
        }
 
        for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) {
                _master_sources.push_back (*i);
                if (unique_srcs.find (*i) == unique_srcs.end()) {
-                       (*i)->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Region::source_deleted), *i));
+                       scoped_connect ((*i)->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
                }
        }
 }
index 91cc2dbe2ac76b88f0a0c71a2c39f65e24caed7b..ff4b9d527082a92c255f41878b3d80f54d1a4e4d 100644 (file)
@@ -34,7 +34,7 @@
 using namespace ARDOUR;
 using namespace PBD;
 
-sigc::signal<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion;
+boost::signals2::signal<void(boost::shared_ptr<Region>)> RegionFactory::CheckNewRegion;
 
 boost::shared_ptr<Region>
 RegionFactory::create (boost::shared_ptr<Region> region, nframes_t start,
index 82d1cf6ff2dea83765289799a9292d44c7cad0cb..991c6ae7d1dd27d90570f07a184a6807fbedd7df 100644 (file)
@@ -67,7 +67,7 @@ Return::Return (Session& s, const XMLNode& node, bool internal)
 
 Return::~Return ()
 {
-       GoingAway ();
+       drop_references ();
 }
 
 XMLNode&
index 33902458282ce337d611cae49f3682fad934670d..154c5fd0a06669381eec5c53775726a044c18232 100644 (file)
@@ -22,7 +22,6 @@
 #include <cassert>
 #include <algorithm>
 
-#include <sigc++/bind.h>
 #include "pbd/xml++.h"
 #include "pbd/enumwriter.h"
 #include "pbd/memento_command.h"
@@ -64,7 +63,7 @@ using namespace ARDOUR;
 using namespace PBD;
 
 uint32_t Route::order_key_cnt = 0;
-sigc::signal<void, string const &> Route::SyncOrderKeys;
+boost::signals2::signal<void(string const&)> Route::SyncOrderKeys;
 
 Route::Route (Session& sess, string name, Flag flg, DataType default_type)
        : SessionObject (sess, name)
@@ -94,7 +93,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type)
 
        /* now that we have _meter, its safe to connect to this */
 
-       _meter_connection = Metering::connect (sigc::mem_fun (*this, &Route::meter));
+       scoped_connect (Metering::Meter, (boost::bind (&Route::meter, this)));
 }
 
 Route::Route (Session& sess, const XMLNode& node, DataType default_type)
@@ -110,7 +109,7 @@ Route::Route (Session& sess, const XMLNode& node, DataType default_type)
 
        /* now that we have _meter, its safe to connect to this */
 
-       _meter_connection = Metering::connect (sigc::mem_fun (*this, &Route::meter));
+       scoped_connect (Metering::Meter, (boost::bind (&Route::meter, this)));
 }
 
 void
@@ -148,8 +147,8 @@ Route::init ()
        _input.reset (new IO (_session, _name, IO::Input, _default_type));
        _output.reset (new IO (_session, _name, IO::Output, _default_type));
 
-       _input->changed.connect (sigc::mem_fun (this, &Route::input_change_handler));
-       _output->changed.connect (sigc::mem_fun (this, &Route::output_change_handler));
+       scoped_connect (_input->changed, boost::bind (&Route::input_change_handler, this, _1, _2));
+       scoped_connect (_output->changed, boost::bind (&Route::output_change_handler, this, _1, _2));
 
        /* add amp processor  */
 
@@ -160,7 +159,6 @@ Route::init ()
 Route::~Route ()
 {
        DEBUG_TRACE (DEBUG::Destruction, string_compose ("route %1 destructor\n", _name));
-       Metering::disconnect (_meter_connection);
 
        /* don't use clear_processors here, as it depends on the session which may
           be half-destroyed by now */
@@ -794,7 +792,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite
                        // XXX: do we want to emit the signal here ? change call order.
                        processor->activate ();
                }
-               processor->ActiveChanged.connect (sigc::bind (sigc::mem_fun (_session, &Session::update_latency_compensation), false, false));
+               scoped_connect (processor->ActiveChanged, boost::bind (&Session::update_latency_compensation, &_session, false, false));
 
                _output->set_user_latency (0);
        }
@@ -1049,7 +1047,7 @@ Route::add_processors (const ProcessorList& others, ProcessorList::iterator iter
                                return -1;
                        }
 
-                       (*i)->ActiveChanged.connect (sigc::bind (sigc::mem_fun (_session, &Session::update_latency_compensation), false, false));
+                       scoped_connect ((*i)->ActiveChanged, boost::bind (&Session::update_latency_compensation, &_session, false, false));
                }
 
                _output->set_user_latency (0);
index 3d98c6154809a17bea66e166a5989e086d0d5be3..82953be0f869f12cbab9685cede091ed85cbe634 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <algorithm>
 
-#include <sigc++/bind.h>
 
 #include "pbd/error.h"
 #include "pbd/enumwriter.h"
@@ -77,7 +76,7 @@ RouteGroup::add (boost::shared_ptr<Route> r)
        routes->push_back (r);
 
        r->join_route_group (this);
-       r->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &RouteGroup::remove_when_going_away), boost::weak_ptr<Route> (r)));
+       scoped_connect (r->GoingAway, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
        
        _session.set_dirty ();
        changed (); /* EMIT SIGNAL */
index 6117b09be2053141d1ad584c3a42358b11cf3225..1bb03642d070612698e8205484afd2e311f591fa 100644 (file)
@@ -64,7 +64,7 @@ Send::Send (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node, i
 
 Send::~Send ()
 {
-       GoingAway ();
+       drop_references ();
 }
 
 void
index fbe8edfa80f304a4fdb40147552f9bb155b3aa0f..d8e3b2843c6205b7d94d09d5036367e8c31071bc 100644 (file)
@@ -28,8 +28,6 @@
 #include <unistd.h>
 #include <limits.h>
 
-#include <sigc++/bind.h>
-#include <sigc++/retype.h>
 
 #include <glibmm/thread.h>
 #include <glibmm/miscutils.h>
@@ -105,17 +103,17 @@ using boost::weak_ptr;
 
 bool Session::_disable_all_loaded_plugins = false;
 
-sigc::signal<void,std::string> Session::Dialog;
-sigc::signal<int> Session::AskAboutPendingState;
-sigc::signal<int,nframes_t,nframes_t> Session::AskAboutSampleRateMismatch;
-sigc::signal<void> Session::SendFeedback;
+boost::signals2::signal<void(std::string)> Session::Dialog;
+boost::signals2::signal<int()> Session::AskAboutPendingState;
+boost::signals2::signal<int(nframes_t,nframes_t)> Session::AskAboutSampleRateMismatch;
+boost::signals2::signal<void()> Session::SendFeedback;
 
-sigc::signal<void> Session::TimecodeOffsetChanged;
-sigc::signal<void> Session::StartTimeChanged;
-sigc::signal<void> Session::EndTimeChanged;
-sigc::signal<void> Session::AutoBindingOn;
-sigc::signal<void> Session::AutoBindingOff;
-sigc::signal<void, std::string, std::string> Session::Exported;
+boost::signals2::signal<void()> Session::TimecodeOffsetChanged;
+boost::signals2::signal<void()> Session::StartTimeChanged;
+boost::signals2::signal<void()> Session::EndTimeChanged;
+boost::signals2::signal<void()> Session::AutoBindingOn;
+boost::signals2::signal<void()> Session::AutoBindingOff;
+boost::signals2::signal<void(std::string, std::string)> Session::Exported;
 
 static void clean_up_session_event (SessionEvent* ev) { delete ev; }
 const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event);
@@ -138,7 +136,7 @@ Session::Session (AudioEngine &eng,
          _midi_clock_port (default_midi_clock_port),
          _session_dir (new SessionDirectory(fullpath)),
          state_tree (0),
-         _butler (new Butler (this)),
+         _butler (new Butler (*this)),
          _post_transport_work (0),
          _send_timecode_update (false),
          diskstreams (new DiskstreamList),
@@ -191,8 +189,8 @@ Session::Session (AudioEngine &eng,
 
        _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
 
-       Config->ParameterChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::config_changed), false));
-       config.ParameterChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::config_changed), true));
+       scoped_connect (Config->ParameterChanged, boost::bind (&Session::config_changed, this, _1, false));
+       scoped_connect (config.ParameterChanged, boost::bind (&Session::config_changed, this, _1, true));
 
        if (was_dirty) {
                DirtyChanged (); /* EMIT SIGNAL */
@@ -223,7 +221,7 @@ Session::Session (AudioEngine &eng,
          _midi_clock_port (default_midi_clock_port),
          _session_dir ( new SessionDirectory(fullpath)),
          state_tree (0),
-         _butler (new Butler (this)),
+         _butler (new Butler (*this)),
          _post_transport_work (0),
          _send_timecode_update (false),
          diskstreams (new DiskstreamList),
@@ -280,7 +278,9 @@ Session::Session (AudioEngine &eng,
 
                if (master_out_channels) {
                        ChanCount count(DataType::AUDIO, master_out_channels);
-                       shared_ptr<Route> r (new Route (*this, _("master"), Route::MasterOut, DataType::AUDIO));
+                       Route* rt = new Route (*this, _("master"), Route::MasterOut, DataType::AUDIO);
+                       boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name());
+                       shared_ptr<Route> r (rt);
                        r->input()->ensure_io (count, false, this);
                        r->output()->ensure_io (count, false, this);
                        r->set_remote_control_id (control_id);
@@ -293,7 +293,9 @@ Session::Session (AudioEngine &eng,
 
                if (control_out_channels) {
                        ChanCount count(DataType::AUDIO, control_out_channels);
-                       shared_ptr<Route> r (new Route (*this, _("monitor"), Route::ControlOut, DataType::AUDIO));
+                       Route* rt = new Route (*this, _("monitor"), Route::ControlOut, DataType::AUDIO);
+                       boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name());
+                       shared_ptr<Route> r (rt);
                        r->input()->ensure_io (count, false, this);
                        r->output()->ensure_io (count, false, this);
                        r->set_remote_control_id (control_id++);
@@ -324,7 +326,7 @@ Session::Session (AudioEngine &eng,
 
        _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
 
-       Config->ParameterChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::config_changed), false));
+       scoped_connect (Config->ParameterChanged, boost::bind (&Session::config_changed, this, _1, false));
 }
 
 Session::~Session ()
@@ -347,12 +349,6 @@ Session::destroy ()
 
        _engine.remove_session ();
 
-       GoingAway (); /* EMIT SIGNAL */
-
-       /* do this */
-
-       notify_callbacks ();
-
        /* clear history so that no references to objects are held any more */
 
        _history.clear ();
@@ -391,7 +387,7 @@ Session::destroy ()
        
        AudioDiskstream::free_working_buffers();
 
-       Route::SyncOrderKeys.clear();
+       // BOOST::SIGNALS: Route::SyncOrderKeys.clear();
 
        DEBUG_TRACE (DEBUG::Destruction, "delete named selections\n");
        for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ) {
@@ -410,6 +406,8 @@ Session::destroy ()
 
                tmp = i;
                ++tmp;
+
+               boost::shared_ptr<Region> keep (i->second);
                
                DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for region %1 (%2); pre-ref = %3\n", i->second->name(), i->second.get(), i->second.use_count()));
                i->second->drop_references ();
@@ -479,6 +477,10 @@ Session::destroy ()
        /* not strictly necessary, but doing it here allows the shared_ptr debugging to work */
        playlists.reset ();
 
+       /* tell everyone who is still standing that we're about to die */
+
+       drop_references ();
+
        boost_debug_list_ptrs ();
 
        DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n");
@@ -522,7 +524,7 @@ Session::when_engine_running ()
 
        /* every time we reconnect, recompute worst case output latencies */
 
-       _engine.Running.connect (sigc::mem_fun (*this, &Session::set_worst_io_latencies));
+       scoped_connect (_engine.Running, boost::bind (&Session::set_worst_io_latencies, this));
 
        if (synced_to_jack()) {
                _engine.transport_stop ();
@@ -876,7 +878,7 @@ Session::diskstream_playlist_changed (boost::weak_ptr<Diskstream> wp)
        boost::shared_ptr<Playlist> playlist;
 
        if ((playlist = dstream->playlist()) != 0) {
-               playlist->LengthChanged.connect (sigc::mem_fun (this, &Session::playlist_length_changed));
+               scoped_connect (playlist->LengthChanged, boost::bind (&Session::playlist_length_changed, this));
        }
 
        /* see comment in playlist_length_changed () */
@@ -992,9 +994,7 @@ Session::set_auto_punch_location (Location* location)
        Location* existing;
 
        if ((existing = _locations.auto_punch_location()) != 0 && existing != location) {
-               auto_punch_start_changed_connection.disconnect();
-               auto_punch_end_changed_connection.disconnect();
-               auto_punch_changed_connection.disconnect();
+               punch_connections.drop_connections();
                existing->set_auto_punch (false, this);
                remove_event (existing->start(), SessionEvent::PunchIn);
                clear_events (SessionEvent::PunchOut);
@@ -1012,17 +1012,14 @@ Session::set_auto_punch_location (Location* location)
                return;
        }
 
-       auto_punch_start_changed_connection.disconnect();
-       auto_punch_end_changed_connection.disconnect();
-       auto_punch_changed_connection.disconnect();
+       punch_connections.drop_connections ();
 
-       auto_punch_start_changed_connection = location->start_changed.connect (sigc::mem_fun (this, &Session::auto_punch_start_changed));
-       auto_punch_end_changed_connection = location->end_changed.connect (sigc::mem_fun (this, &Session::auto_punch_end_changed));
-       auto_punch_changed_connection = location->changed.connect (sigc::mem_fun (this, &Session::auto_punch_changed));
+       punch_connections.add_connection (location->start_changed.connect (boost::bind (&Session::auto_punch_start_changed, this, _1)));
+       punch_connections.add_connection (location->end_changed.connect (boost::bind (&Session::auto_punch_end_changed, this, _1)));
+       punch_connections.add_connection (location->changed.connect (boost::bind (&Session::auto_punch_changed, this, _1)));
 
        location->set_auto_punch (true, this);
 
-
        auto_punch_changed (location);
 
        auto_punch_location_changed (location);
@@ -1034,9 +1031,7 @@ Session::set_auto_loop_location (Location* location)
        Location* existing;
 
        if ((existing = _locations.auto_loop_location()) != 0 && existing != location) {
-               auto_loop_start_changed_connection.disconnect();
-               auto_loop_end_changed_connection.disconnect();
-               auto_loop_changed_connection.disconnect();
+               loop_connections.drop_connections ();
                existing->set_auto_loop (false, this);
                remove_event (existing->end(), SessionEvent::AutoLoop);
                auto_loop_location_changed (0);
@@ -1055,16 +1050,11 @@ Session::set_auto_loop_location (Location* location)
 
        last_loopend = location->end();
 
-       auto_loop_start_changed_connection.disconnect();
-       auto_loop_end_changed_connection.disconnect();
-       auto_loop_changed_connection.disconnect();
+       loop_connections.drop_connections ();
 
-       auto_loop_start_changed_connection = location->start_changed.connect (
-                       sigc::mem_fun (this, &Session::auto_loop_changed));
-       auto_loop_end_changed_connection = location->end_changed.connect (
-                       sigc::mem_fun (this, &Session::auto_loop_changed));
-       auto_loop_changed_connection = location->changed.connect (
-                       sigc::mem_fun (this, &Session::auto_loop_changed));
+       loop_connections.add_connection (location->start_changed.connect (boost::bind (&Session::auto_loop_changed, this, _1)));
+       loop_connections.add_connection (location->end_changed.connect (boost::bind (&Session::auto_loop_changed, this, _1)));
+       loop_connections.add_connection (location->changed.connect (boost::bind (&Session::auto_loop_changed, this, _1)));
 
        location->set_auto_loop (true, this);
 
@@ -1658,7 +1648,7 @@ Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_m
                                route_group->add (track);
                        }
 
-                       track->DiskstreamChanged.connect (sigc::mem_fun (this, &Session::resort_routes));
+                       scoped_connect (track->DiskstreamChanged, boost::bind (&Session::resort_routes, this));
                        //track->set_remote_control_id (control_id);
 
                        new_routes.push_back (track);
@@ -1771,7 +1761,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
 
                try {
                        AudioTrack* at = new AudioTrack (*this, track_name, Route::Flag (0), mode);
-                       // boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
+                       boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
                        track = boost::shared_ptr<AudioTrack>(at);
 
                        if (track->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
@@ -1833,7 +1823,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
 
                        track->audio_diskstream()->non_realtime_input_change();
 
-                       track->DiskstreamChanged.connect (sigc::mem_fun (this, &Session::resort_routes));
+                       scoped_connect (track->DiskstreamChanged, boost::bind (&Session::resort_routes, this));
                        track->set_remote_control_id (control_id);
                        ++control_id;
 
@@ -1961,7 +1951,9 @@ Session::new_audio_route (bool aux, int input_channels, int output_channels, Rou
                } while (bus_id < (UINT_MAX-1));
 
                try {
-                       shared_ptr<Route> bus (new Route (*this, bus_name, Route::Flag(0), DataType::AUDIO));
+                       Route* rt = new Route (*this, bus_name, Route::Flag(0), DataType::AUDIO);
+                       boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name());
+                       shared_ptr<Route> bus (rt);
 
                        if (bus->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
                                error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"),
@@ -2158,12 +2150,12 @@ Session::add_routes (RouteList& new_routes, bool save)
 
                boost::weak_ptr<Route> wpr (*x);
 
-               (*x)->listen_changed.connect (sigc::bind (sigc::mem_fun (*this, &Session::route_listen_changed), wpr));
-               (*x)->solo_changed.connect (sigc::bind (sigc::mem_fun (*this, &Session::route_solo_changed), wpr));
-               (*x)->mute_changed.connect (sigc::mem_fun (*this, &Session::route_mute_changed));
-               (*x)->output()->changed.connect (sigc::mem_fun (*this, &Session::set_worst_io_latencies_x));
-               (*x)->processors_changed.connect (sigc::mem_fun (*this, &Session::route_processors_changed));
-               (*x)->route_group_changed.connect (sigc::mem_fun (*this, &Session::route_group_changed));
+               scoped_connect ((*x)->listen_changed, boost::bind (&Session::route_listen_changed, this, _1, wpr));
+               scoped_connect ((*x)->solo_changed, boost::bind (&Session::route_solo_changed, this, _1, wpr));
+               scoped_connect ((*x)->mute_changed, boost::bind (&Session::route_mute_changed, this, _1));
+               scoped_connect ((*x)->output()->changed, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2));
+               scoped_connect ((*x)->processors_changed, boost::bind (&Session::route_processors_changed, this, _1));
+               scoped_connect ((*x)->route_group_changed, boost::bind (&Session::route_group_changed, this));
 
                if ((*x)->is_master()) {
                        _master_out = (*x);
@@ -2303,11 +2295,11 @@ Session::add_diskstream (boost::shared_ptr<Diskstream> dstream)
                /* writer goes out of scope, copies ds back to main */
        }
 
-       dstream->PlaylistChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::diskstream_playlist_changed), boost::weak_ptr<Diskstream> (dstream)));
+       scoped_connect (dstream->PlaylistChanged, boost::bind (&Session::diskstream_playlist_changed, this, boost::weak_ptr<Diskstream> (dstream)));
        /* this will connect to future changes, and check the current length */
        diskstream_playlist_changed (boost::weak_ptr<Diskstream> (dstream));
 
-       dstream->RecordEnableChanged.connect (sigc::mem_fun (*this, &Session::update_have_rec_enabled_diskstream));
+       scoped_connect (dstream->RecordEnableChanged, boost::bind (&Session::update_have_rec_enabled_diskstream, this));
 
        dstream->prepare ();
 
@@ -2821,8 +2813,8 @@ Session::add_regions (vector<boost::shared_ptr<Region> >& new_regions)
                                }
                        }
 
-                       region->StateChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::region_changed), boost::weak_ptr<Region>(region)));
-                       region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Session::remove_region), boost::weak_ptr<Region>(region)));
+                       scoped_connect (region->StateChanged, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
+                       scoped_connect (region->GoingAway, boost::bind (&Session::remove_region, this, boost::weak_ptr<Region>(region)));
 
                        update_region_name_map (region);
                }
@@ -3010,7 +3002,7 @@ Session::add_source (boost::shared_ptr<Source> source)
        }
 
        if (result.second) {
-               source->GoingAway.connect (sigc::bind (sigc::mem_fun (this, &Session::remove_source), boost::weak_ptr<Source> (source)));
+               scoped_connect (source->GoingAway, boost::bind (&Session::remove_source, this, boost::weak_ptr<Source> (source)));
                set_dirty();
        }
 
@@ -3401,7 +3393,7 @@ Session::add_playlist (boost::shared_ptr<Playlist> playlist, bool unused)
 
        bool existing = playlists->add (playlist);
        if (!existing) {
-               playlist->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Session::remove_playlist), boost::weak_ptr<Playlist>(playlist)));
+               scoped_connect (playlist->GoingAway, boost::bind (&Session::remove_playlist, this, boost::weak_ptr<Playlist>(playlist)));
        }
 
        if (unused) {
@@ -3492,8 +3484,8 @@ Session::remove_empty_sounds ()
        TapeFileMatcher tape_file_matcher;
 
        remove_if (audio_filenames.begin(), audio_filenames.end(),
-                       sigc::mem_fun (tape_file_matcher, &TapeFileMatcher::matches));
-
+                  boost::bind (&TapeFileMatcher::matches, &tape_file_matcher, _1));
+       
        for (vector<string>::iterator i = audio_filenames.begin(); i != audio_filenames.end(); ++i) {
 
                sys::path audio_file_path (_session_dir->sound_path());
@@ -3575,7 +3567,7 @@ Session::graph_reordered ()
 void
 Session::add_processor (Processor* processor)
 {
-       processor->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Session::remove_processor), processor));
+       scoped_connect (processor->GoingAway, boost::bind (&Session::remove_processor, this, processor));
        set_dirty();
 }
 
index 4d733264fbc38752e309bd96ddacedf466de467c..828af69901f63cb422c6b69617a193234566ef91 100644 (file)
@@ -43,7 +43,7 @@ using namespace ARDOUR;
 
 #include "i18n.h"
 
-void Session::register_with_memento_command_factory(PBD::ID id, PBD::StatefulThingWithGoingAway *ptr)
+void Session::register_with_memento_command_factory(PBD::ID id, PBD::StatefulDestructible *ptr)
 {
     registry[id] = ptr;
 }
@@ -114,8 +114,8 @@ Session::memento_command_factory(XMLNode *n)
                if (i != automation_lists.end()) {
                    return new MementoCommand<AutomationList>(*i->second, before, after);
                }
-    } else if (registry.count(id)) { // For Editor and AutomationLine which are off-limits here
-           return new MementoCommand<PBD::StatefulThingWithGoingAway>(*registry[id], before, after);
+    } else if (registry.count(id)) { // For Editor and AutomationLine which are off-limits herea
+           return new MementoCommand<PBD::StatefulDestructible>(*registry[id], before, after);
     }
 
     /* we failed */
index da18ceb3cbc141ea090bb92df05612989b0bcce9..8b56271e42587c93152a916624ec715d21b11900 100644 (file)
@@ -17,7 +17,6 @@
 
 */
 
-#include <sigc++/bind.h>
 
 #include "pbd/error.h"
 #include <glibmm/thread.h>
@@ -92,8 +91,8 @@ Session::pre_export ()
 
        _exporting = true;
        export_status->running = true;
-       export_status->Aborting.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::stop_audio_export)));
-       export_status->Finished.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::finalize_audio_export)));
+       scoped_connect (export_status->Aborting, boost::bind (&Session::stop_audio_export, this));
+       scoped_connect (export_status->Finished, boost::bind (&Session::finalize_audio_export, this));
 
        return 0;
 }
@@ -151,7 +150,7 @@ Session::start_audio_export (nframes_t position, bool realtime)
                last_process_function = process_function;
                process_function = &Session::process_export;
        } else {
-               export_freewheel_connection = _engine.Freewheel.connect (sigc::mem_fun (*this, &Session::process_export_fw));
+               export_freewheel_connection = _engine.Freewheel.connect (boost::bind (&Session::process_export_fw, this, _1));
                return _engine.freewheel (true);
        }
 
@@ -180,7 +179,7 @@ Session::process_export (nframes_t nframes)
 
                process_without_events (nframes);
 
-               /* handle export */
+               /* handle export - XXX what about error handling? */
 
                ProcessExport (nframes);
 
@@ -236,8 +235,11 @@ Session::finalize_audio_export ()
 
        /* Clean up */
 
-       ProcessExport.clear();
-       ExportReadFinished.clear();
+       /* BOOST SIGNAL are these necessary? 
+          ProcessExport.clear();
+          ExportReadFinished.clear();
+       */
+
        export_freewheel_connection.disconnect();
        export_handler.reset();
        export_status.reset();
diff --git a/libs/ardour/session_handle.cc b/libs/ardour/session_handle.cc
new file mode 100644 (file)
index 0000000..03671cf
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+    Copyright (C) 2009 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "pbd/error.h"
+
+#include "ardour/session.h"
+#include "ardour/session_handle.h"
+
+#include "i18n.h"
+
+using namespace std;
+using namespace ARDOUR;
+using namespace PBD;
+
+SessionHandlePtr::SessionHandlePtr (Session* s)
+       : _session (s) 
+{
+       if (_session) {
+               _session_connections.add_connection (_session->GoingAway.connect (boost::bind (&SessionHandlePtr::session_going_away, this)));
+       }
+}      
+
+void
+SessionHandlePtr::set_session (Session* s)
+{
+       _session_connections.drop_connections ();
+
+       if (_session) {
+               _session = 0;
+       }
+
+       if (s) {
+               _session = s;
+               _session_connections.add_connection (_session->GoingAway.connect (boost::bind (&SessionHandlePtr::session_going_away, this)));
+       }
+}
+
+void
+SessionHandlePtr::session_going_away ()
+{
+       set_session (0);
+}
+
+/*-------------------------*/
+
+
+SessionHandleRef::SessionHandleRef (Session& s)
+       : _session (s) 
+{
+       scoped_connect (_session.GoingAway, boost::bind (&SessionHandleRef::session_going_away, this));
+}      
+
+void
+SessionHandleRef::session_going_away ()
+{
+       error << string_compose (_("programming error: %1"), "SessionHandleRef exists across sesssion deletion!") << endmsg;
+}
index d006097f09bbc7e6fe8f687521e065e6a03523f6..b2cece991c45ac77d93f9c17976914a81b4eac6e 100644 (file)
@@ -208,39 +208,26 @@ Session::set_mmc_port (string port_tag)
                mmc->set_send_device_id (old_send_device_id);
        }
 
-       mmc->Play.connect
-               (sigc::mem_fun (*this, &Session::mmc_deferred_play));
-       mmc->DeferredPlay.connect
-               (sigc::mem_fun (*this, &Session::mmc_deferred_play));
-       mmc->Stop.connect
-               (sigc::mem_fun (*this, &Session::mmc_stop));
-       mmc->FastForward.connect
-               (sigc::mem_fun (*this, &Session::mmc_fast_forward));
-       mmc->Rewind.connect
-               (sigc::mem_fun (*this, &Session::mmc_rewind));
-       mmc->Pause.connect
-               (sigc::mem_fun (*this, &Session::mmc_pause));
-       mmc->RecordPause.connect
-               (sigc::mem_fun (*this, &Session::mmc_record_pause));
-       mmc->RecordStrobe.connect
-               (sigc::mem_fun (*this, &Session::mmc_record_strobe));
-       mmc->RecordExit.connect
-               (sigc::mem_fun (*this, &Session::mmc_record_exit));
-       mmc->Locate.connect
-               (sigc::mem_fun (*this, &Session::mmc_locate));
-       mmc->Step.connect
-               (sigc::mem_fun (*this, &Session::mmc_step));
-       mmc->Shuttle.connect
-               (sigc::mem_fun (*this, &Session::mmc_shuttle));
-       mmc->TrackRecordStatusChange.connect
-               (sigc::mem_fun (*this, &Session::mmc_record_enable));
+       scoped_connect (mmc->Play, boost::bind (&Session::mmc_deferred_play, this, _1));
+       scoped_connect (mmc->DeferredPlay, boost::bind (&Session::mmc_deferred_play, this, _1));
+       scoped_connect (mmc->Stop, boost::bind (&Session::mmc_stop, this, _1));
+       scoped_connect (mmc->FastForward, boost::bind (&Session::mmc_fast_forward, this, _1));
+       scoped_connect (mmc->Rewind, boost::bind (&Session::mmc_rewind, this, _1));
+       scoped_connect (mmc->Pause, boost::bind (&Session::mmc_pause, this, _1));
+       scoped_connect (mmc->RecordPause, boost::bind (&Session::mmc_record_pause, this, _1));
+       scoped_connect (mmc->RecordStrobe, boost::bind (&Session::mmc_record_strobe, this, _1));
+       scoped_connect (mmc->RecordExit, boost::bind (&Session::mmc_record_exit, this, _1));
+       scoped_connect (mmc->Locate, boost::bind (&Session::mmc_locate, this, _1, _2));
+       scoped_connect (mmc->Step, boost::bind (&Session::mmc_step, this, _1, _2));
+       scoped_connect (mmc->Shuttle, boost::bind (&Session::mmc_shuttle, this, _1, _2, _3));
+       scoped_connect (mmc->TrackRecordStatusChange, boost::bind (&Session::mmc_record_enable, this, _1, _2, _3));
 
 
        /* also handle MIDI SPP because its so common */
 
-       _mmc_port->input()->start.connect (sigc::mem_fun (*this, &Session::spp_start));
-       _mmc_port->input()->contineu.connect (sigc::mem_fun (*this, &Session::spp_continue));
-       _mmc_port->input()->stop.connect (sigc::mem_fun (*this, &Session::spp_stop));
+       scoped_connect (_mmc_port->input()->start, boost::bind (&Session::spp_start, this, _1, _2));
+       scoped_connect (_mmc_port->input()->contineu, boost::bind (&Session::spp_continue, this, _1, _2));
+       scoped_connect (_mmc_port->input()->stop, boost::bind (&Session::spp_stop, this, _1, _2));
 
        Config->set_mmc_port_name (port_tag);
 
index 5af0dc4caa873d3cc4cacdfeb10af4f330e73447..ec9220ed410d60a7958a210be5cdc3078f5a08a8 100644 (file)
@@ -16,6 +16,7 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 */
+#include <vector>
 
 #include "pbd/xml++.h"
 #include "pbd/compose.h"
@@ -73,7 +74,7 @@ SessionPlaylists::add (boost::shared_ptr<Playlist> playlist)
 
        if (!existing) {
                playlists.insert (playlists.begin(), playlist);
-               playlist->InUse.connect (sigc::bind (sigc::mem_fun (*this, &SessionPlaylists::track), boost::weak_ptr<Playlist>(playlist)));
+               scoped_connect (playlist->InUse, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr<Playlist>(playlist)));
        }
 
        return existing;
@@ -265,7 +266,7 @@ SessionPlaylists::add_state (XMLNode* node, bool full_state)
 
 /** @return true for `stop cleanup', otherwise false */
 bool
-SessionPlaylists::maybe_delete_unused (sigc::signal<int, boost::shared_ptr<Playlist> > ask)
+SessionPlaylists::maybe_delete_unused (boost::function<int(boost::shared_ptr<Playlist>)> ask)
 {
        vector<boost::shared_ptr<Playlist> > playlists_tbd;
 
index 3364de9815d54a8900a33f460d54d7b265126da2..4c7515f5e4e73e503caaa467c28768e13a336cb7 100644 (file)
@@ -30,7 +30,6 @@
 #include <string>
 #include <cerrno>
 
-#include <sigc++/bind.h>
 
 #include <cstdio> /* snprintf(3) ... grrr */
 #include <cmath>
@@ -165,7 +164,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        _base_frame_rate = _current_frame_rate;
 
        _tempo_map = new TempoMap (_current_frame_rate);
-       _tempo_map->StateChanged.connect (sigc::mem_fun (*this, &Session::tempo_map_changed));
+       scoped_connect (_tempo_map->StateChanged, boost::bind (&Session::tempo_map_changed, this, _1));
 
 
        _non_soloed_outs_muted = false;
@@ -267,20 +266,21 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        delta_accumulator_cnt = 0;
        _slave_state = Stopped;
 
-       _engine.GraphReordered.connect (sigc::mem_fun (*this, &Session::graph_reordered));
+       scoped_connect (_engine.GraphReordered, boost::bind (&Session::graph_reordered, this));
 
        /* These are all static "per-class" signals */
 
-       RegionFactory::CheckNewRegion.connect (sigc::mem_fun (*this, &Session::add_region));
-       SourceFactory::SourceCreated.connect (sigc::mem_fun (*this, &Session::add_source));
-       PlaylistFactory::PlaylistCreated.connect (sigc::mem_fun (*this, &Session::add_playlist));
-       Processor::ProcessorCreated.connect (sigc::mem_fun (*this, &Session::add_processor));
-       NamedSelection::NamedSelectionCreated.connect (sigc::mem_fun (*this, &Session::add_named_selection));
-       AutomationList::AutomationListCreated.connect (sigc::mem_fun (*this, &Session::add_automation_list));
+       scoped_connect (RegionFactory::CheckNewRegion, boost::bind (&Session::add_region, this, _1));
+       scoped_connect (SourceFactory::SourceCreated, boost::bind (&Session::add_source, this, _1));
+       scoped_connect (PlaylistFactory::PlaylistCreated, boost::bind (&Session::add_playlist, this, _1, _2));
+       scoped_connect (Processor::ProcessorCreated, boost::bind (&Session::add_processor, this, _1));
+       scoped_connect (NamedSelection::NamedSelectionCreated, boost::bind (&Session::add_named_selection, this, _1));
+       scoped_connect (AutomationList::AutomationListCreated, boost::bind (&Session::add_automation_list, this, _1));
 
-       Controllable::Destroyed.connect (sigc::mem_fun (*this, &Session::remove_controllable));
+       // BOOST SIGNALS
+       // scoped_connect (Controllable::Destroyed, boost::bind (&Session::remove_controllable, this, _1));
 
-       IO::PortCountChanged.connect (sigc::mem_fun (*this, &Session::ensure_buffers));
+       scoped_connect (IO::PortCountChanged, boost::bind (&Session::ensure_buffers, this, _1));
 
        /* stop IO objects from doing stuff until we're ready for them */
 
@@ -332,15 +332,15 @@ Session::second_stage_init (bool new_session)
        _state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave|Loading);
 
 
-       _locations.changed.connect (sigc::mem_fun (this, &Session::locations_changed));
-       _locations.added.connect (sigc::mem_fun (this, &Session::locations_added));
+       scoped_connect (_locations.changed, boost::bind (&Session::locations_changed, this));
+       scoped_connect (_locations.added, boost::bind (&Session::locations_added, this, _1));
        setup_click_sounds (0);
        setup_midi_control ();
 
        /* Pay attention ... */
 
-       _engine.Halted.connect (sigc::mem_fun (*this, &Session::engine_halted));
-       _engine.Xrun.connect (sigc::mem_fun (*this, &Session::xrun_recovery));
+       scoped_connect (_engine.Halted, boost::bind (&Session::engine_halted, this));
+       scoped_connect (_engine.Xrun, boost::bind (&Session::xrun_recovery, this));
 
        try {
                when_engine_running();
@@ -364,14 +364,14 @@ Session::second_stage_init (bool new_session)
        deliver_mmc (MIDI::MachineControl::cmdMmcReset, 0);
        deliver_mmc (MIDI::MachineControl::cmdLocate, 0);
 
-       MidiClockTicker::instance().set_session(*this);
-       MIDI::Name::MidiPatchManager::instance().set_session(*this);
+       MidiClockTicker::instance().set_session (this);
+       MIDI::Name::MidiPatchManager::instance().set_session (this);
 
        /* initial program change will be delivered later; see ::config_changed() */
 
        BootMessage (_("Reset Control Protocols"));
 
-       ControlProtocolManager::instance().set_session (*this);
+       ControlProtocolManager::instance().set_session (this);
 
        config.set_end_marker_is_free (new_session);
 
@@ -2311,11 +2311,12 @@ Session::cleanup_sources (CleanupReport& rep)
 
        /* step 1: consider deleting all unused playlists */
        
-       if (playlists->maybe_delete_unused (AskAboutPlaylistDeletion)) {
+/* BOOST SIGNALS
+       if (playlists->maybe_delete_unused (boost::bind (AskAboutPlaylistDeletion, _1));
                ret = 0;
                goto out;
        }
-
+*/
        /* step 2: find all un-used sources */
 
        rep.paths.clear ();
@@ -2334,7 +2335,7 @@ Session::cleanup_sources (CleanupReport& rep)
 
                if (!playlists->source_use_count(i->second) && i->second->length(i->second->timeline_position()) > 0) {
                        dead_sources.push_back (i->second);
-                       i->second->GoingAway();
+                       i->second->drop_references ();
                }
 
                i = tmp;
@@ -2653,8 +2654,7 @@ Session::remove_controllable (Controllable* c)
 
        Glib::Mutex::Lock lm (controllables_lock);
 
-       Controllables::iterator x = controllables.find(
-                boost::shared_ptr<Controllable>(c, null_deleter()));
+       Controllables::iterator x = controllables.find (boost::shared_ptr<Controllable>(c, null_deleter()));
 
        if (x != controllables.end()) {
                controllables.erase (x);
index 63bb4c4213138c21ee74b936483dc1c051f38d0d..0e808accb76a0da7f1f52269f16abcb6bb72d853 100644 (file)
@@ -21,8 +21,6 @@
 #include <cerrno>
 #include <unistd.h>
 
-#include <sigc++/bind.h>
-#include <sigc++/retype.h>
 
 #include "pbd/undo.h"
 #include "pbd/error.h"
index 7f66486425260c4fe4cee2915bb70926694e7f10..64cad0f2b614c90e695e3c9e3c11490126b1e885 100644 (file)
@@ -193,7 +193,7 @@ SndFileSource::init_sndfile ()
        }
 
        AudioFileSource::HeaderPositionOffsetChanged.connect (
-                       sigc::mem_fun (*this, &SndFileSource::handle_header_position_change));
+                       boost::bind (&SndFileSource::handle_header_position_change, this));
 }
 
 int
@@ -247,7 +247,7 @@ SndFileSource::open ()
 
 SndFileSource::~SndFileSource ()
 {
-       GoingAway (); /* EMIT SIGNAL */
+       drop_references ();
 
        if (sf) {
                sf_close (sf);
index 958bc2c1b5d623e4e885d3d962a8ab27f8767659..a8c4262a66ea9e4f487e8f221ce30f03a1e3e829 100644 (file)
@@ -76,7 +76,6 @@ Source::Source (Session& s, const XMLNode& node)
 Source::~Source ()
 {
        DEBUG_TRACE (DEBUG::Destruction, string_compose ("Source %1 destructor\n", _name));
-       notify_callbacks ();
 }
 
 
index a44a372726f79230b148e5e3ca1fcd8cd18f7f9e..e401b010eaa20fb2b217bd82d394e59e55d711e5 100644 (file)
@@ -50,7 +50,7 @@ using namespace ARDOUR;
 using namespace std;
 using namespace PBD;
 
-sigc::signal<void,boost::shared_ptr<Source> > SourceFactory::SourceCreated;
+boost::signals2::signal<void(boost::shared_ptr<Source>)> SourceFactory::SourceCreated;
 Glib::Cond* SourceFactory::PeaksToBuild;
 Glib::StaticMutex SourceFactory::peak_building_lock = GLIBMM_STATIC_MUTEX_INIT;
 std::list<boost::weak_ptr<AudioSource> > SourceFactory::files_with_peaks;
index 2dc5eeaada266ff4a8eb916b6a4602e09a14cafe..9536576713817e0e83f7315657805e468304858d 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <cmath>
 
-#include <sigc++/bind.h>
 
 #include <glibmm/thread.h>
 #include "pbd/xml++.h"
index ab0a7144a8088857949e46865f0bc845983b0fc4..0a6bb8b20ba5db2b65b8faaa441aa6b508c66af0 100644 (file)
 using namespace std;
 #endif
 
-namespace ARDOUR
-{
-
+using namespace ARDOUR;
 
-void Ticker::set_session(Session& s)
+void Ticker::set_session (Session* s)
 {
-        _session = &s;
+       SessionHandlePtr::set_session (s);
 
-        if (_session) {
-                _session->tick.connect(sigc::mem_fun (*this, &Ticker::tick));
-                _session->GoingAway.connect(sigc::mem_fun (*this, &Ticker::going_away));
-        }
+       if (_session) {
+               _session_connections.add_connection (_session->tick.connect (boost::bind (&Ticker::tick, this, _1, _2, _3)));
+       }
 }
 
-void MidiClockTicker::set_session(Session& s)
+void MidiClockTicker::set_session (Session* s)
 {
-        Ticker::set_session(s);
+        Ticker::set_session (s);
 
         if (_session) {
-                _session->MIDIClock_PortChanged.connect(
-                                sigc::mem_fun (*this, &MidiClockTicker::update_midi_clock_port));
-                _session->TransportStateChange.connect(
-                                sigc::mem_fun (*this, &MidiClockTicker::transport_state_changed));
-                _session->PositionChanged.connect(
-                                sigc::mem_fun (*this, &MidiClockTicker::position_changed));
-                _session->TransportLooped.connect(
-                                sigc::mem_fun (*this, &MidiClockTicker::transport_looped));
+                _session_connections.add_connection (_session->MIDIClock_PortChanged.connect (boost::bind (&MidiClockTicker::update_midi_clock_port, this)));
+                _session_connections.add_connection (_session->TransportStateChange.connect (boost::bind (&MidiClockTicker::transport_state_changed, this)));
+                _session_connections.add_connection (_session->PositionChanged.connect (boost::bind (&MidiClockTicker::position_changed, this, _1)));
+                _session_connections.add_connection (_session->TransportLooped.connect (boost::bind (&MidiClockTicker::transport_looped, this)));
                 update_midi_clock_port();
         }
 }
 
+void
+MidiClockTicker::session_going_away ()
+{
+       SessionHandlePtr::session_going_away(); 
+       _midi_port = 0; 
+}
+
 void MidiClockTicker::update_midi_clock_port()
 {
         _midi_port = _session->midi_clock_port();
@@ -225,5 +225,5 @@ void MidiClockTicker::send_stop_event(nframes_t offset)
        _midi_port->write(_midi_clock_tick, 1, offset);
 }
 
-}
+
 
index acfc9258b4e076cabc6a7b897d99fef0175e9762..7d19d23007d1e1449a59b84343c2958363b0cd42 100644 (file)
@@ -16,9 +16,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 #include "pbd/error.h"
-#include <sigc++/retype.h>
-#include <sigc++/retype_return.h>
-#include <sigc++/bind.h>
 
 #include "ardour/amp.h"
 #include "ardour/audioplaylist.h"
index 81e9674f1ab8e617ee0f40f02ba1581938c291c0..ee3ebd2ee3f2d83f2949152176781529cbebe4ce 100644 (file)
@@ -102,7 +102,7 @@ VSTPlugin::VSTPlugin (const VSTPlugin &other)
 VSTPlugin::~VSTPlugin ()
 {
        deactivate ();
-       GoingAway (); /* EMIT SIGNAL */
+       drop_references ();
        fst_close (_fst);
 }
 
index 0dcfea70567df8001f8830f7d5d2454354d2b382..97ad05cb68710c0815a8cb6d2b51582e2dcf0378 100644 (file)
@@ -164,6 +164,7 @@ libardour_sources = [
        'session_directory.cc',
        'session_events.cc',
        'session_export.cc',
+       'session_handle.cc',
        'session_metadata.cc',
        'session_midi.cc',
        'session_playlists.cc',
index d0696b105f85c8a0d4b63e1600167ed2948d9f28..140dea7e5b5bbe50e5035bdd9292f7e19cfad99e 100644 (file)
@@ -88,7 +88,7 @@ BindingProxy::button_press_handler (GdkEventButton *ev)
                        }
                        prompter->set_text (prompt);
                        prompter->touch (); // shows popup
-                       learning_connection = controllable->LearningFinished.connect (mem_fun (*this, &BindingProxy::learning_finished));
+                       learning_connection = controllable->LearningFinished.connect (boost::bind (&BindingProxy::learning_finished, this));
                }
                return true;
        }
index f684cce5c3e76e1e0d201cd237ac052c596ad2de..348f9f26499c59eb405f85bc0e65b7a4fbea17d4 100644 (file)
@@ -22,9 +22,9 @@
 #define __binding_proxy__
 
 #include <string>
-
 #include <gtkmm2ext/popup.h>
 #include <boost/shared_ptr.hpp>
+#include <boost/signals2.hpp>
 
 namespace PBD {
        class Controllable;
@@ -50,7 +50,7 @@ class BindingProxy : public sigc::trackable
        boost::shared_ptr<PBD::Controllable> controllable;
        guint bind_button;
        guint bind_statemask;
-       sigc::connection learning_connection;
+       boost::signals2::scoped_connection learning_connection;
        void learning_finished ();
        bool prompter_hiding (GdkEventAny *);
 };
index bac657a0288183be9bb968e12504b0d19910391b..1fbfb9d800cb04016dbf3a833bcebe0dd29733a3 100644 (file)
@@ -123,6 +123,10 @@ class UI : public Receiver, public AbstractUI<UIRequest>
                Glib::signal_idle().connect (bind (slot (&UI::idle_delete<T>), obj));
        }
 
+       template<class T> void delete_in_self (T *obj) {
+               call_slot (boost::bind (&UI::delete_in_self, this, obj));
+       }
+
        Gdk::Color get_color (const std::string& prompt, bool& picked, const Gdk::Color *initial = 0);
 
        /* starting is sent just before we enter the main loop,
index f19c913644cdac8fcb13b6cf07541e3d132356fb..9e339654b4f08ae56c5fd90b0f589c9276fa5b1b 100644 (file)
@@ -23,7 +23,6 @@
 #include "midi++/port.h"
 #include "midi++/channel.h"
 
-using namespace sigc;
 using namespace MIDI;
 
 Channel::Channel (byte channelnum, Port &p) : _port (p)
@@ -35,44 +34,45 @@ Channel::Channel (byte channelnum, Port &p) : _port (p)
 
 void
 Channel::connect_input_signals ()
-
 {
-       _port.input()->channel_pressure[_channel_number].connect
-               (mem_fun (*this, &Channel::process_chanpress));
-       _port.input()->channel_note_on[_channel_number].connect
-               (mem_fun (*this, &Channel::process_note_on));
-       _port.input()->channel_note_off[_channel_number].connect
-               (mem_fun (*this, &Channel::process_note_off));
-       _port.input()->channel_poly_pressure[_channel_number].connect
-               (mem_fun (*this, &Channel::process_polypress));
-       _port.input()->channel_program_change[_channel_number].connect
-               (mem_fun (*this, &Channel::process_program_change));
-       _port.input()->channel_controller[_channel_number].connect
-               (mem_fun (*this, &Channel::process_controller));
-       _port.input()->channel_pitchbend[_channel_number].connect
-               (mem_fun (*this, &Channel::process_pitchbend));
-       _port.input()->reset.connect (mem_fun (*this, &Channel::process_reset));
+       add_connection (_port.input()->channel_pressure[_channel_number].connect
+                       (boost::bind (&Channel::process_chanpress, this, _1, _2)));
+       add_connection (_port.input()->channel_note_on[_channel_number].connect
+                       (boost::bind (&Channel::process_note_on, this, _1, _2)));
+       add_connection (_port.input()->channel_note_off[_channel_number].connect
+                       (boost::bind (&Channel::process_note_off, this, _1, _2)));
+       add_connection (_port.input()->channel_poly_pressure[_channel_number].connect
+                       (boost::bind (&Channel::process_polypress, this, _1, _2)));
+       add_connection (_port.input()->channel_program_change[_channel_number].connect
+                       (boost::bind (&Channel::process_program_change, this, _1, _2)));
+       add_connection (_port.input()->channel_controller[_channel_number].connect
+                       (boost::bind (&Channel::process_controller, this, _1, _2)));
+       add_connection (_port.input()->channel_pitchbend[_channel_number].connect
+                       (boost::bind (&Channel::process_pitchbend, this, _1, _2)));
+
+       add_connection (_port.input()->reset.connect (boost::bind (&Channel::process_reset, this, _1)));
 }
 
 void
 Channel::connect_output_signals ()
 
 {
-       _port.output()->channel_pressure[_channel_number].connect
-               (mem_fun (*this, &Channel::process_chanpress));
-       _port.output()->channel_note_on[_channel_number].connect
-               (mem_fun (*this, &Channel::process_note_on));
-       _port.output()->channel_note_off[_channel_number].connect
-               (mem_fun (*this, &Channel::process_note_off));
-       _port.output()->channel_poly_pressure[_channel_number].connect
-               (mem_fun (*this, &Channel::process_polypress));
-       _port.output()->channel_program_change[_channel_number].connect
-               (mem_fun (*this, &Channel::process_program_change));
-       _port.output()->channel_controller[_channel_number].connect
-               (mem_fun (*this, &Channel::process_controller));
-       _port.output()->channel_pitchbend[_channel_number].connect
-               (mem_fun (*this, &Channel::process_pitchbend));
-       _port.output()->reset.connect (mem_fun (*this, &Channel::process_reset));
+       add_connection (_port.output()->channel_pressure[_channel_number].connect
+                       (boost::bind (&Channel::process_chanpress, this, _1, _2)));
+       add_connection (_port.output()->channel_note_on[_channel_number].connect
+                       (boost::bind (&Channel::process_note_on, this, _1, _2)));
+       add_connection (_port.output()->channel_note_off[_channel_number].connect
+                       (boost::bind (&Channel::process_note_off, this, _1, _2)));
+       add_connection (_port.output()->channel_poly_pressure[_channel_number].connect
+                       (boost::bind (&Channel::process_polypress, this, _1, _2)));
+       add_connection (_port.output()->channel_program_change[_channel_number].connect
+                       (boost::bind (&Channel::process_program_change, this, _1, _2)));
+       add_connection (_port.output()->channel_controller[_channel_number].connect
+                       (boost::bind (&Channel::process_controller, this, _1, _2)));
+       add_connection (_port.output()->channel_pitchbend[_channel_number].connect
+                       (boost::bind (&Channel::process_pitchbend, this, _1, _2)));
+
+       add_connection (_port.output()->reset.connect (boost::bind (&Channel::process_reset, this, _1)));
 }
 
 void
index 697f2a1e46b3618ddd28f57bf29c9527e265ddd0..617ae1443079d8514a95dba9cdbd8fa48994c478 100644 (file)
@@ -22,7 +22,8 @@
 
 #include <queue>
 
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
+#include "pbd/scoped_connections.h"
 
 #include "midi++/types.h"
 #include "midi++/parser.h"
@@ -36,7 +37,7 @@ class Port;
  * This remembers various useful information about the current 'state' of a
  * MIDI channel (eg current pitch bend value).
  */
-class Channel : public sigc::trackable {
+class Channel : public PBD::ScopedConnectionList {
 
   public:
        Channel (byte channel_number, Port &);
index 8c665d0086f1221f59a5b55ff29ba72f18def094..d451d234c88c94e97dc22ea1460ad4a130ff33df 100644 (file)
@@ -83,7 +83,7 @@ class Manager {
 
        int get_known_ports (std::vector<PortSet>&);
 
-       sigc::signal<void> PortsChanged;
+       boost::signals2::signal<void()> PortsChanged;
 
   private:
        /* This is a SINGLETON pattern */
index 4506bd8a4b0c19153ca9c1430e669506ae476141..0b062224386259e0861c3f5c5f65cff4c38c1679 100644 (file)
@@ -20,7 +20,8 @@
 #ifndef __midipp_mmc_h_h__
 #define __midipp_mmc_h_h__
 
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
+
 #include "midi++/types.h"
 
 namespace MIDI {
@@ -28,10 +29,10 @@ namespace MIDI {
 class Port;
 class Parser;
 
-class MachineControl : public sigc::trackable
-
+class MachineControl 
 {
   public:
+       typedef boost::signals2::signal<void(MachineControl&)> MMCSignal;
        typedef byte CommandSignature[60];
        typedef byte ResponseSignature[60];
 
@@ -102,63 +103,61 @@ class MachineControl : public sigc::trackable
           when certain MMC commands are received.
        */
                        
-       sigc::signal<void,MachineControl &> Stop;
-       sigc::signal<void,MachineControl &> Play;
-       sigc::signal<void,MachineControl &> DeferredPlay;
-       sigc::signal<void,MachineControl &> FastForward;
-       sigc::signal<void,MachineControl &> Rewind;
-       sigc::signal<void,MachineControl &> RecordStrobe;
-       sigc::signal<void,MachineControl &> RecordExit;
-       sigc::signal<void,MachineControl &> RecordPause;
-       sigc::signal<void,MachineControl &> Pause;
-       sigc::signal<void,MachineControl &> Eject;
-       sigc::signal<void,MachineControl &> Chase;
-       sigc::signal<void,MachineControl &> CommandErrorReset;
-       sigc::signal<void,MachineControl &> MmcReset;
-
-       sigc::signal<void,MachineControl &> JogStart;
-       sigc::signal<void,MachineControl &> JogStop;
-
-       sigc::signal<void,MachineControl &> Write;
-       sigc::signal<void,MachineControl &> MaskedWrite;
-       sigc::signal<void,MachineControl &> Read;
-       sigc::signal<void,MachineControl &> Update;
-       sigc::signal<void,MachineControl &> VariablePlay;
-       sigc::signal<void,MachineControl &> Search;
-       sigc::signal<void,MachineControl &> AssignSystemMaster;
-       sigc::signal<void,MachineControl &> GeneratorCommand;
-       sigc::signal<void,MachineControl &> MidiTimeCodeCommand;
-       sigc::signal<void,MachineControl &> Move;
-       sigc::signal<void,MachineControl &> Add;
-       sigc::signal<void,MachineControl &> Subtract;
-       sigc::signal<void,MachineControl &> DropFrameAdjust;
-       sigc::signal<void,MachineControl &> Procedure;
-       sigc::signal<void,MachineControl &> Event;
-       sigc::signal<void,MachineControl &> Group;
-       sigc::signal<void,MachineControl &> CommandSegment;
-       sigc::signal<void,MachineControl &> DeferredVariablePlay;
-       sigc::signal<void,MachineControl &> RecordStrobeVariable;
-       sigc::signal<void,MachineControl &> Wait;
-       sigc::signal<void,MachineControl &> Resume;
+       MMCSignal Stop;
+       MMCSignal Play;
+       MMCSignal DeferredPlay;
+       MMCSignal FastForward;
+       MMCSignal Rewind;
+       MMCSignal RecordStrobe;
+       MMCSignal RecordExit;
+       MMCSignal RecordPause;
+       MMCSignal Pause;
+       MMCSignal Eject;
+       MMCSignal Chase;
+       MMCSignal CommandErrorReset;
+       MMCSignal MmcReset;
+       MMCSignal JogStart;
+       MMCSignal JogStop;
+       MMCSignal Write;
+       MMCSignal MaskedWrite;
+       MMCSignal Read;
+       MMCSignal Update;
+       MMCSignal VariablePlay;
+       MMCSignal Search;
+       MMCSignal AssignSystemMaster;
+       MMCSignal GeneratorCommand;
+       MMCSignal MidiTimeCodeCommand;
+       MMCSignal Move;
+       MMCSignal Add;
+       MMCSignal Subtract;
+       MMCSignal DropFrameAdjust;
+       MMCSignal Procedure;
+       MMCSignal Event;
+       MMCSignal Group;
+       MMCSignal CommandSegment;
+       MMCSignal DeferredVariablePlay;
+       MMCSignal RecordStrobeVariable;
+       MMCSignal Wait;
+       MMCSignal Resume;
 
        /* The second argument is the shuttle speed, the third is
           true if the direction is "forwards", false for "reverse"
        */
        
-       sigc::signal<void,MachineControl &,float,bool> Shuttle;
+       boost::signals2::signal<void(MachineControl&,float,bool)> Shuttle;
 
        /* The second argument specifies the desired track record enabled
           status.
        */
 
-       sigc::signal<void,MachineControl &,size_t,bool
+       boost::signals2::signal<void(MachineControl &,size_t,bool)
                                             TrackRecordStatusChange;
        
        /* The second argument specifies the desired track record enabled
           status.
        */
 
-       sigc::signal<void,MachineControl &,size_t,bool
+       boost::signals2::signal<void(MachineControl &,size_t,bool)
                                             TrackMuteChange;
        
        /* The second argument points to a byte array containing
@@ -166,11 +165,11 @@ class MachineControl : public sigc::trackable
           format (5 bytes, roughly: hrs/mins/secs/frames/subframes)
        */
 
-       sigc::signal<void,MachineControl &, const byte *> Locate;
+       boost::signals2::signal<void(MachineControl &, const byte *)> Locate;
 
        /* The second argument is the number of steps to jump */
        
-       sigc::signal<void,MachineControl &, int> Step;
+       boost::signals2::signal<void(MachineControl &, int)> Step;
        
   protected:
 
@@ -258,7 +257,8 @@ class MachineControl : public sigc::trackable
        MIDI::Port &_port;
 
        void process_mmc_message (Parser &p, byte *, size_t len);
-       
+       boost::signals2::scoped_connection mmc_connection;
+
        int  do_masked_write (byte *, size_t len);
        int  do_locate (byte *, size_t len);
        int  do_step (byte *, size_t len);
index 365f2fb46a37652436f44534a5d9d33b729c4463..497a50abe8376ce2b0c0200744abbb03e8ae1ab2 100644 (file)
@@ -23,7 +23,7 @@
 #include <string>
 #include <iostream>
 
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
 
 #include "midi++/types.h"
 
@@ -32,12 +32,14 @@ namespace MIDI {
 class Port;
 class Parser;
 
-typedef sigc::signal<void, Parser &, byte>                 OneByteSignal;
-typedef sigc::signal<void, Parser &, EventTwoBytes *>      TwoByteSignal;
-typedef sigc::signal<void, Parser &, pitchbend_t>          PitchBendSignal;
-typedef sigc::signal<void, Parser &, byte *, size_t> Signal;
+typedef boost::signals2::signal<void(Parser&)>                   ZeroByteSignal;
+typedef boost::signals2::signal<void(Parser&,nframes_t)>         TimestampedSignal;
+typedef boost::signals2::signal<void(Parser&, byte)>             OneByteSignal;
+typedef boost::signals2::signal<void(Parser &, EventTwoBytes *)> TwoByteSignal;
+typedef boost::signals2::signal<void(Parser &, pitchbend_t)>     PitchBendSignal;
+typedef boost::signals2::signal<void(Parser &, byte *, size_t)>  Signal;
 
-class Parser : public sigc::trackable {
+class Parser {
  public:
        Parser (Port &p);
        ~Parser ();
@@ -69,8 +71,8 @@ class Parser : public sigc::trackable {
        OneByteSignal         channel_program_change[16];
        PitchBendSignal       channel_pitchbend[16];
        TwoByteSignal         channel_controller[16];
-       sigc::signal<void, Parser &>          channel_active_preparse[16];
-       sigc::signal<void, Parser &>          channel_active_postparse[16];
+       ZeroByteSignal        channel_active_preparse[16];
+       ZeroByteSignal        channel_active_postparse[16];
 
        OneByteSignal         mtc_quarter_frame; /* see below for more useful signals */
        Signal                mtc;
@@ -82,15 +84,16 @@ class Parser : public sigc::trackable {
        Signal                position;
        Signal                song;
 
-       sigc::signal<void, Parser &>                     all_notes_off;
-       sigc::signal<void, Parser &>                     tune;
-       sigc::signal<void, Parser &, nframes_t>          timing;
-       sigc::signal<void, Parser &, nframes_t>          start;
-       sigc::signal<void, Parser &, nframes_t>          stop;
-       sigc::signal<void, Parser &, nframes_t>          contineu;  /* note spelling */
-       sigc::signal<void, Parser &>          active_sense;
-       sigc::signal<void, Parser &>          reset;
-       sigc::signal<void, Parser &>          eox;
+       ZeroByteSignal        all_notes_off;
+       ZeroByteSignal        tune;
+       ZeroByteSignal        active_sense;
+       ZeroByteSignal        reset;
+       ZeroByteSignal        eox;
+
+       TimestampedSignal     timing;
+       TimestampedSignal     start;
+       TimestampedSignal     stop;
+       TimestampedSignal     contineu;  /* note spelling */
 
        /* This should really be protected, but then derivatives of Port
           can't access it.
@@ -106,9 +109,9 @@ class Parser : public sigc::trackable {
 
        void set_offline (bool);
        bool offline() const { return _offline; }
-       sigc::signal<void> OfflineStatusChanged;
+       boost::signals2::signal<void()> OfflineStatusChanged;
 
-       sigc::signal<int, byte *, size_t> edit;
+       boost::signals2::signal<int(byte *, size_t)> edit;
 
        void set_mmc_forwarding (bool yn) {
                _mmc_forward = yn;
@@ -121,10 +124,10 @@ class Parser : public sigc::trackable {
        const byte *mtc_current() const { return _mtc_time; }
        bool        mtc_locked() const  { return _mtc_locked; }
        
-       sigc::signal<void,Parser&,int,nframes_t>      mtc_qtr;
-       sigc::signal<void,const byte*,bool,nframes_t> mtc_time;
-       sigc::signal<void,MTC_Status>                 mtc_status;
-       sigc::signal<bool>                            mtc_skipped;
+       boost::signals2::signal<void(Parser&,int,nframes_t)>      mtc_qtr;
+       boost::signals2::signal<void(const byte*,bool,nframes_t)> mtc_time;
+       boost::signals2::signal<void(MTC_Status)>                 mtc_status;
+       boost::signals2::signal<bool()>                           mtc_skipped;
 
        void set_mtc_forwarding (bool yn) {
                _mtc_forward = yn;
@@ -139,7 +142,7 @@ class Parser : public sigc::trackable {
        std::ostream *trace_stream;
        std::string trace_prefix;
        void trace_event (Parser &p, byte *msg, size_t len);
-       sigc::connection trace_connection;
+       boost::signals2::scoped_connection trace_connection;
 
        size_t message_counter[256];
 
index 23a9a01200779001491555ae9d39fd10b25995c9..0c5fe4ae37570e7fe13faff47b82b8671442af7d 100644 (file)
@@ -22,7 +22,7 @@
 #include <string>
 #include <iostream>
 
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
 #include "pbd/xml++.h"
 
 #include "midi++/types.h"
@@ -33,7 +33,7 @@ namespace MIDI {
 class Channel;
 class PortRequest;
 
-class Port : public sigc::trackable {
+class Port {
   public:
        enum Type {
                Unknown,
@@ -168,7 +168,6 @@ class Port : public sigc::trackable {
        int              _mode;
        size_t           _number;
        Channel          *_channel[16];
-       sigc::connection thru_connection;
        unsigned int     bytes_written;
        unsigned int     bytes_read;
        Parser           *input_parser;
index 2e42bb59fc1933eef7256b8da707ea03a00c7f76..e496e37aa97a4e954d62859bea546b34c262718f 100644 (file)
@@ -206,8 +206,7 @@ MachineControl::MachineControl (Port &p, float /*version*/,
        _send_device_id = 0x7f;
        
        if ((parser = _port.input()) != 0) {
-               parser->mmc.connect 
-                       (mem_fun (*this, &MachineControl::process_mmc_message));
+               mmc_connection = parser->mmc.connect (boost::bind (&MachineControl::process_mmc_message, this, _1, _2, _3));
        } else {
                warning << "MMC connected to a non-input port: useless!"
                        << endmsg;
index 6daed45d2317eac49cee16358901d10cf3611cf5..4f19c40ebe79d273305d85aab7362a8921bdb01f 100644 (file)
@@ -35,7 +35,6 @@
 #include "pbd/transmitter.h"
 
 using namespace std;
-using namespace sigc;
 using namespace MIDI;
 
 const char *
@@ -317,7 +316,7 @@ Parser::trace (bool onoff, ostream *o, const string &prefix)
                cerr << "enabling tracing for port " << _port.name() << endl;
                trace_stream = o;
                trace_prefix = prefix;
-               trace_connection = any.connect (mem_fun (*this, &Parser::trace_event));
+               trace_connection = any.connect (boost::bind (&Parser::trace_event, this, _1, _2, _3));
        } else {
                trace_prefix = "";
                trace_stream = 0;
index 35f760554189d09d59195343f0a4100fff4ee780..369e2bd5451d13677b8b7720738f45636ec29520 100644 (file)
 using namespace PBD;
 using namespace std;
 
-sigc::signal<void,Controllable*> Controllable::Destroyed;
-sigc::signal<bool,Controllable*> Controllable::StartLearning;
-sigc::signal<void,Controllable*> Controllable::StopLearning;
-sigc::signal<void,Controllable*,int,int> Controllable::CreateBinding;
-sigc::signal<void,Controllable*> Controllable::DeleteBinding;
+boost::signals2::signal<void(Controllable*)> Controllable::Destroyed;
+boost::signals2::signal<bool(Controllable*)> Controllable::StartLearning;
+boost::signals2::signal<void(Controllable*)> Controllable::StopLearning;
+boost::signals2::signal<void(Controllable*,int,int)> Controllable::CreateBinding;
+boost::signals2::signal<void(Controllable*)> Controllable::DeleteBinding;
 
 Glib::StaticRWLock Controllable::registry_lock = GLIBMM_STATIC_RW_LOCK_INIT;
 Controllable::Controllables Controllable::registry;
@@ -41,45 +41,47 @@ Controllable::Controllable (const string& name, const string& uri)
        , _uri (uri)
        , _touching (false)
 {
-       add ();
+       add (*this);
 }
 
 void
-Controllable::add ()
+Controllable::add (Controllable& ctl)
 {
+       using namespace boost;
+
        Glib::RWLock::WriterLock lm (registry_lock);
-       registry.insert (this);
+       registry.insert (&ctl);
 
-       if (!_uri.empty()) {
+       if (!ctl.uri().empty()) {
                pair<string,Controllable*> newpair;
-               newpair.first = _uri;
-               newpair.second = this;
+               newpair.first = ctl.uri();
+               newpair.second = &ctl;
                registry_by_uri.insert (newpair);
        }
 
-       this->GoingAway.connect (mem_fun (this, &Controllable::remove));
+       /* Controllable::remove() is static - no need to manage this connection */
+
+       ctl.GoingAway.connect (boost::bind (&Controllable::remove, ref (ctl)));
 }
 
 void
-Controllable::remove ()
+Controllable::remove (Controllable& ctl)
 {
        Glib::RWLock::WriterLock lm (registry_lock);
 
        for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
-               if ((*i) == this) {
+               if ((*i) == &ctl) {
                        registry.erase (i);
                        break;
                }
        }
 
-       if (!_uri.empty()) {
-               ControllablesByURI::iterator i = registry_by_uri.find (_uri);
+       if (!ctl.uri().empty()) {
+               ControllablesByURI::iterator i = registry_by_uri.find (ctl.uri());
                if (i != registry_by_uri.end()) {
                        registry_by_uri.erase (i);
                }
        }
-
-
 }
 
 void
index 7af7f7bb98a9c3bbc256f3977a3aaf4402691ad9..5a7290bc89cab89cb740b15b1914575bf3fc2107 100644 (file)
@@ -1,3 +1,4 @@
+
 /* 
     Copyright (C) 2006 Paul Davis
     Author: Hans Fugal
index 9750ebe56ed1c66faccbc5d1f2fd934150bd035f..dbec03b3961b0ae87ff444f60ca0696afa98842c 100644 (file)
@@ -24,8 +24,7 @@ v    it under the terms of the GNU General Public License as published by
 #include <set>
 #include <map>
 
-#include <sigc++/trackable.h>
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
 #include <glibmm/thread.h>
 
 #include "pbd/statefuldestructible.h"
@@ -45,16 +44,16 @@ class Controllable : public PBD::StatefulDestructible {
        virtual void set_value (float) = 0;
        virtual float get_value (void) const = 0;
 
-       sigc::signal<void> LearningFinished;
-       static sigc::signal<void,PBD::Controllable*,int,int> CreateBinding;
-       static sigc::signal<void,PBD::Controllable*> DeleteBinding;
+       boost::signals2::signal<void()> LearningFinished;
+       static boost::signals2::signal<void(PBD::Controllable*,int,int)> CreateBinding;
+       static boost::signals2::signal<void(PBD::Controllable*)> DeleteBinding;
 
-       static sigc::signal<bool,PBD::Controllable*> StartLearning;
-       static sigc::signal<void,PBD::Controllable*> StopLearning;
+       static boost::signals2::signal<bool(PBD::Controllable*)> StartLearning;
+       static boost::signals2::signal<void(PBD::Controllable*)> StopLearning;
 
-       static sigc::signal<void,Controllable*> Destroyed;
-
-       sigc::signal<void> Changed;
+       static boost::signals2::signal<void(Controllable*)> Destroyed;
+       
+       boost::signals2::signal<void()> Changed;
 
        int set_state (const XMLNode&, int version);
        XMLNode& get_state ();
@@ -73,8 +72,8 @@ class Controllable : public PBD::StatefulDestructible {
        std::string _uri;
        bool        _touching;
 
-       void add ();
-       void remove ();
+       static void add (Controllable&);
+       static void remove (Controllable&);
 
        typedef std::set<PBD::Controllable*> Controllables;
        typedef std::map<std::string,PBD::Controllable*> ControllablesByURI;
index 827feb8fe5e759050800ea2ca324d726a52c29de..241d847aff1940c526aed4d051e914d0963f37cd 100644 (file)
 #ifndef __pbd_destructible_h__
 #define __pbd_destructible_h__
 
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
 
 namespace PBD {
 
-/* be very very careful using this class. it does not inherit from sigc::trackable and thus
-   should only be used in multiple-inheritance situations involving another type
-   that does inherit from sigc::trackable (or sigc::trackable itself)
-*/
-
-class ThingWithGoingAway {
-  public:
-       virtual ~ThingWithGoingAway () {}
-       sigc::signal<void> GoingAway;
-};
-
-class Destructible : public sigc::trackable, public ThingWithGoingAway {
+class Destructible {
   public:
+        Destructible() : refs_dropped (false){}
        virtual ~Destructible () {}
-       void drop_references () const { GoingAway(); }
+       
+       boost::signals2::signal<void ()> GoingAway;
+       void drop_references () { if (!refs_dropped) { GoingAway(); } refs_dropped = true; }
 
+  private:
+       bool refs_dropped;
 };
 
 }
index c1e5d75f9c15f4ff3e3208a1bd50f09a9605b23b..c5e8b19272d8356897d5578eac85e2f25c622269 100644 (file)
@@ -26,7 +26,6 @@
 #include "pbd/command.h"
 #include "pbd/stacktrace.h"
 #include "pbd/xml++.h"
-#include "pbd/shiva.h"
 
 #include <sigc++/slot.h>
 #include <typeinfo>
@@ -42,16 +41,20 @@ public:
        MementoCommand(obj_T& a_object, XMLNode* a_before, XMLNode* a_after) 
                : obj(a_object), before(a_before), after(a_after)
        {
-               /* catch destruction of the object */
-               new PBD::PairedShiva< obj_T,MementoCommand<obj_T> > (obj, *this);
+               /* if the object dies, make sure that we die and that everyone knows about it */
+               obj_death_connection = obj.GoingAway.connect (boost::bind (&MementoCommand::object_died, this));
        }
 
        ~MementoCommand () {
-               GoingAway(); /* EMIT SIGNAL */
+               drop_references ();
                delete before;
                delete after;
        }
 
+       void object_died () {
+               delete this;
+       }
+
        void operator() () {
                if (after) {
                        obj.set_state(*after, Stateful::current_state_version); 
@@ -94,6 +97,7 @@ protected:
        obj_T&   obj;
        XMLNode* before;
        XMLNode* after;
+       boost::signals2::scoped_connection obj_death_connection;
 };
 
 #endif // __lib_pbd_memento_h__
index 49a33ff4380591d42632085c53ec8165b372cece..36eb43147c88287b31997badc4888242878183db 100644 (file)
@@ -29,16 +29,6 @@ class StatefulDestructible : public Stateful, public Destructible
 {
 };
 
-/* be very very careful using this class. it does not inherit from sigc::trackable and thus
-   should only be used in multiple-inheritance situations involving another type
-   that does inherit from sigc::trackable (or sigc::trackable itself)
-*/
-
-class StatefulThingWithGoingAway : public Stateful, public ThingWithGoingAway
-{
-};
-
 }
 
-
 #endif /* __pbd_stateful_destructible_h__ */
index 0e48bea96238c7b414572d50815e818121c08aad..6340ef04b9e79263f98f1df14e4e693db4b9bbef 100644 (file)
 #include <sigc++/slot.h>
 #include <sigc++/bind.h>
 #include <sys/time.h>
+
+#include "pbd/scoped_connections.h"
 #include "pbd/command.h"
-#include "pbd/shiva.h"
 
 typedef sigc::slot<void> UndoAction;
 
-class UndoTransaction : public Command
+class UndoTransaction : public Command, public PBD::ScopedConnectionList
 {
   public:
        UndoTransaction ();
@@ -61,7 +62,6 @@ class UndoTransaction : public Command
 
   private:
        std::list<Command*>    actions;
-       std::list<PBD::ProxyShiva<Command,UndoTransaction>*> shivas;
        struct timeval        _timestamp;
        bool                  _clearing;
 
@@ -71,10 +71,9 @@ class UndoTransaction : public Command
 
        ~UndoTransaction ();
        void about_to_explicitly_delete ();
-       
 };
 
-class UndoHistory : public sigc::trackable
+class UndoHistory : public PBD::ScopedConnectionList
 {
   public:
        UndoHistory();
@@ -107,7 +106,7 @@ class UndoHistory : public sigc::trackable
 
        void set_depth (uint32_t);
 
-       sigc::signal<void> Changed;
+       boost::signals2::signal<void()> Changed;
        
   private:
        bool _clearing;
index 58be141a275a846c523b39e3fd5d9c3e61d4a814..596402576e6f133bf02513f2b35f347ba2afc53a 100644 (file)
@@ -21,6 +21,7 @@
 #include <unistd.h>
 
 #include "pbd/stateful.h"
+#include "pbd/destructible.h"
 #include "pbd/filesystem.h"
 #include "pbd/xml++.h"
 #include "pbd/error.h"
index a0e98f9a132029a2b62b06967cf22bf4546420dd..78c16291b7d58f25050cac85503c695d54e04066 100644 (file)
@@ -46,7 +46,7 @@ UndoTransaction::UndoTransaction (const UndoTransaction& rhs)
 
 UndoTransaction::~UndoTransaction ()
 {
-       GoingAway ();
+       drop_references ();
        clear ();
 }
 
@@ -78,9 +78,11 @@ void
 UndoTransaction::add_command (Command *const action)
 {
        /* catch death of command (e.g. caused by death of object to
-          which it refers.
+          which it refers. command_death() is a normal static function
+          so there is no need to manage this connection.
         */
-       shivas.push_back (new PBD::ProxyShiva<Command,UndoTransaction> (*action, *this, &command_death));
+
+       scoped_connect (action->GoingAway, boost::bind (&command_death, this, action));
        actions.push_back (action);
 }
 
@@ -90,21 +92,6 @@ UndoTransaction::remove_command (Command* const action)
        actions.remove (action);
 }
 
-void
-UndoTransaction::about_to_explicitly_delete ()
-{
-       /* someone is going to call our destructor and its not Shiva,
-          the god of destruction and chaos. This happens when an UndoHistory
-          is pruning itself. we must remove Shivas to avoid the god
-          striking us down a second time, unnecessarily and illegally.
-       */
-
-       for (list<PBD::ProxyShiva<Command,UndoTransaction>*>::iterator i = shivas.begin(); i != shivas.end(); ++i) {
-               delete *i;
-       }
-       shivas.clear ();
-}
-
 bool
 UndoTransaction::empty () const
 {
@@ -188,7 +175,6 @@ UndoHistory::set_depth (uint32_t d)
                while (cnt--) {
                        ut = UndoList.front();
                        UndoList.pop_front ();
-                       ut->about_to_explicitly_delete ();
                        delete ut;
                }
        }
@@ -199,7 +185,7 @@ UndoHistory::add (UndoTransaction* const ut)
 {
        uint32_t current_depth = UndoList.size();
 
-       ut->GoingAway.connect (bind (mem_fun (*this, &UndoHistory::remove), ut));
+       scoped_connect (ut->GoingAway, boost::bind (&UndoHistory::remove, this, ut));
 
        /* if the current undo history is larger than or equal to the currently
           requested depth, then pop off at least 1 element to make space
@@ -214,7 +200,6 @@ UndoHistory::add (UndoTransaction* const ut)
                        UndoTransaction* ut;
                        ut = UndoList.front ();
                        UndoList.pop_front ();
-                       ut->about_to_explicitly_delete ();
                        delete ut;
                }
        }
index 84c18cc899a826fd1861c956f74d8eee2e2ce301..aacbd990ad538525e23d1c7e13a3572808cf0bb0 100644 (file)
@@ -73,6 +73,7 @@ def build(bld):
                pool.cc
                pthread_utils.cc
                receiver.cc
+               scoped_connections.cc
                search_path.cc
                shortpath.cc
                stacktrace.cc
index 097dbc3aec845657841bc4ab4cb426684a1ce044..a20835dc051e8ede593f651617a0530a988a96a2 100644 (file)
@@ -175,11 +175,13 @@ GenericMidiControlProtocol::start_learning (Controllable* c)
        {
                Glib::Mutex::Lock lm (pending_lock);
 
-               std::pair<MIDIControllable *, sigc::connection> element;
+#if 0 // BOOST SIGNALS
+               std::pair<MIDIControllable *, boost::signals2::scoped_connection> element;
                element.first = mc;
                element.second = c->LearningFinished.connect (bind (mem_fun (*this, &GenericMidiControlProtocol::learning_stopped), mc));
 
                pending_controllables.push_back (element);
+#endif
        }
 
        mc->learn_about_external_control ();
index 124ef95615754603afbb89204eb883d33803279d..533bb6db21869854f51b58823eeb29a219371156 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "midicontrollable.h"
 
-using namespace sigc;
 using namespace std;
 using namespace MIDI;
 using namespace PBD;
@@ -110,7 +109,7 @@ void
 MIDIControllable::learn_about_external_control ()
 {
        drop_external_control ();
-       midi_learn_connection = _port.input()->any.connect (mem_fun (*this, &MIDIControllable::midi_receiver));
+       midi_learn_connection = _port.input()->any.connect (boost::bind (&MIDIControllable::midi_receiver, this, _1, _2, _3));
 }
 
 void
@@ -302,7 +301,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
        switch (ev) {
        case MIDI::off:
                midi_sense_connection[0] = p.channel_note_off[chn_i].connect
-                       (mem_fun (*this, &MIDIControllable::midi_sense_note_off));
+                       (boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2));
 
                /* if this is a bistate, connect to noteOn as well,
                   and we'll toggle back and forth between the two.
@@ -310,7 +309,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
 
                if (bistate) {
                        midi_sense_connection[1] = p.channel_note_on[chn_i].connect
-                               (mem_fun (*this, &MIDIControllable::midi_sense_note_on));
+                               (boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2));
                        connections = 2;
                } else {
                        connections = 1;
@@ -320,20 +319,20 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
 
        case MIDI::on:
                midi_sense_connection[0] = p.channel_note_on[chn_i].connect
-                       (mem_fun (*this, &MIDIControllable::midi_sense_note_on));
+                       (boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2));
                if (bistate) {
                        midi_sense_connection[1] = p.channel_note_off[chn_i].connect
-                               (mem_fun (*this, &MIDIControllable::midi_sense_note_off));
+                               (boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2));
                        connections = 2;
                } else {
                        connections = 1;
                }
                _control_description = "MIDI control: NoteOn";
                break;
-
+               
        case MIDI::controller:
                midi_sense_connection[0] = p.channel_controller[chn_i].connect
-                       (mem_fun (*this, &MIDIControllable::midi_sense_controller));
+                       (boost::bind (&MIDIControllable::midi_sense_controller, this, _1, _2));
                connections = 1;
                snprintf (buf, sizeof (buf), "MIDI control: Controller %d", control_additional);
                _control_description = buf;
@@ -342,8 +341,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
        case MIDI::program:
                if (!bistate) {
                        midi_sense_connection[0] = p.channel_program_change[chn_i].connect
-                               (mem_fun (*this,
-                                      &MIDIControllable::midi_sense_program_change));
+                               (boost::bind (&MIDIControllable::midi_sense_program_change, this, _1, _2));
                        connections = 1;
                        _control_description = "MIDI control: ProgramChange";
                }
@@ -352,7 +350,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
        case MIDI::pitchbend:
                if (!bistate) {
                        midi_sense_connection[0] = p.channel_pitchbend[chn_i].connect
-                               (mem_fun (*this, &MIDIControllable::midi_sense_pitchbend));
+                               (boost::bind (&MIDIControllable::midi_sense_pitchbend, this, _1, _2));
                        connections = 1;
                        _control_description = "MIDI control: Pitchbend";
                }
index a9a40944d8e99390bec9d507d2f48a710a484640..cc85cc42c198569f79397b1d7dc662fcc6c6a3b4 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <string>
 
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
 
 #include "midi++/types.h"
 #include "pbd/controllable.h"
@@ -82,8 +82,8 @@ class MIDIControllable : public PBD::Stateful
        MIDI::byte       last_value;
        bool             bistate;
        int              midi_msg_id;      /* controller ID or note number */
-       sigc::connection midi_sense_connection[2];
-       sigc::connection midi_learn_connection;
+       boost::signals2::connection midi_sense_connection[2];
+       boost::signals2::connection midi_learn_connection;
        size_t           connections;
        MIDI::eventType  control_type;
        MIDI::byte       control_additional;
index 84283f301697ea1299db941ebe7331de14ceb1e9..acd91e60470b1514d044c01d2a50944e94e80eca 100644 (file)
 #ifndef mackie_controls_h
 #define mackie_controls_h
 
-#include <sigc++/sigc++.h>
-
 #include <map>
 #include <vector>
 #include <string>
 
+#include <boost/signals2.hpp>
+
 #include "mackie_control_exception.h"
 
 namespace Mackie
@@ -228,7 +228,7 @@ public:
        virtual unsigned int in_use_timeout() { return _in_use_timeout; }
 
        /// Keep track of the timeout so it can be updated with more incoming events
-       sigc::connection in_use_connection;
+       boost::signals2::scoped_connection in_use_connection;
        
 private:
        int _id;
index 6e65308f33597da4c94044dde356c832d48472f8..7460b041ad7b930058a6bd9a38ec1a807067736e 100644 (file)
@@ -61,7 +61,6 @@
 
 using namespace ARDOUR;
 using namespace std;
-using namespace sigc;
 using namespace Mackie;
 using namespace PBD;
 
@@ -74,7 +73,6 @@ MackieMidiBuilder builder;
 MackieControlProtocol::MackieControlProtocol (Session& session)
        : ControlProtocol  (session, X_("Mackie"))
        , _current_initial_bank( 0 )
-       , connections_back( _connections )
        , _surface( 0 )
        , _ports_changed( false )
        , _polling( true )
@@ -564,23 +562,23 @@ void MackieControlProtocol::update_surface()
 void MackieControlProtocol::connect_session_signals()
 {
        // receive routes added
-       connections_back = session->RouteAdded.connect( ( mem_fun (*this, &MackieControlProtocol::notify_route_added) ) );
+       session_connections.add_connection (session->RouteAdded.connect(boost::bind (&MackieControlProtocol::notify_route_added, this, _1)));
        // receive record state toggled
-       connections_back = session->RecordStateChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_record_state_changed) ) );
+       session_connections.add_connection (session->RecordStateChanged.connect(boost::bind (&MackieControlProtocol::notify_record_state_changed, this)));
        // receive transport state changed
-       connections_back = session->TransportStateChange.connect( ( mem_fun (*this, &MackieControlProtocol::notify_transport_state_changed) ) );
+       session_connections.add_connection (session->TransportStateChange.connect(boost::bind (&MackieControlProtocol::notify_transport_state_changed, this)));
        // receive punch-in and punch-out
-       connections_back = Config->ParameterChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_parameter_changed) ) );
-       session->config.ParameterChanged.connect ( ( mem_fun (*this, &MackieControlProtocol::notify_parameter_changed) ) );
+       session_connections.add_connection (Config->ParameterChanged.connect(boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1)));
+       session_connections.add_connection (session->config.ParameterChanged.connect (boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1)));
        // receive rude solo changed
-       connections_back = session->SoloActive.connect( ( mem_fun (*this, &MackieControlProtocol::notify_solo_active_changed) ) );
+       session_connections.add_connection (session->SoloActive.connect(boost::bind (&MackieControlProtocol::notify_solo_active_changed, this, _1)));
 
        // make sure remote id changed signals reach here
        // see also notify_route_added
        Sorted sorted = get_sorted_routes();
        for ( Sorted::iterator it = sorted.begin(); it != sorted.end(); ++it )
        {
-               connections_back = (*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) );
+               session_connections.add_connection ((*it)->RemoteControlIDChanged.connect (boost::bind(&MackieControlProtocol::notify_remote_id_changed, this)));
        }
 }
 
@@ -603,27 +601,10 @@ void MackieControlProtocol::add_port( MIDI::Port & midi_port, int number )
        {
                MackiePort * sport = new MackiePort( *this, midi_port, number );
                _ports.push_back( sport );
-
-               connections_back = sport->init_event.connect(
-                       sigc::bind (
-                               mem_fun (*this, &MackieControlProtocol::handle_port_init)
-                               , sport
-                       )
-               );
-
-               connections_back = sport->active_event.connect(
-                       sigc::bind (
-                               mem_fun (*this, &MackieControlProtocol::handle_port_active)
-                               , sport
-                       )
-               );
-
-               connections_back = sport->inactive_event.connect(
-                       sigc::bind (
-                               mem_fun (*this, &MackieControlProtocol::handle_port_inactive)
-                               , sport
-                       )
-               );
+               
+               port_connections.add_connection (sport->init_event.connect (boost::bind (&MackieControlProtocol::handle_port_init, this, sport)));
+               port_connections.add_connection (sport->active_event.connect (boost::bind (&MackieControlProtocol::handle_port_active, this, sport)));
+               port_connections.add_connection (sport->inactive_event.connect (boost::bind (&MackieControlProtocol::handle_port_inactive, this, sport)));
 
                _ports_changed = true;
        }
@@ -699,9 +680,9 @@ void MackieControlProtocol::initialize_surface()
        _surface->init();
 
        // Connect events. Must be after route table otherwise there will be trouble
-       for( MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it )
-       {
-               connections_back = (*it)->control_event.connect( ( mem_fun (*this, &MackieControlProtocol::handle_control_event) ) );
+
+       for( MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it ) {
+               port_connections.add_connection ((*it)->control_event.connect(boost::bind (&MackieControlProtocol::handle_control_event, this, _1, _2, _3)));
        }
 }
 
@@ -713,18 +694,9 @@ void MackieControlProtocol::close()
        _polling = false;
        pthread_join( thread, 0 );
 
-       // TODO disconnect port active/inactive signals
-       // Or at least put a lock here
-
-       // disconnect global signals from Session
-       // TODO Since *this is a sigc::trackable, this shouldn't be necessary
-       // but it is for some reason
-#if 0
-       for( vector<sigc::connection>::iterator it = _connections.begin(); it != _connections.end(); ++it )
-       {
-               it->disconnect();
-       }
-#endif
+       port_connections.drop_connections ();
+       session_connections.drop_connections ();
+       route_connections.drop_connections ();
 
        if ( _surface != 0 )
        {
@@ -1471,9 +1443,9 @@ void MackieControlProtocol::notify_route_added( ARDOUR::RouteList & rl )
 
        // make sure remote id changes in the new route are handled
        typedef ARDOUR::RouteList ARS;
-       for ( ARS::iterator it = rl.begin(); it != rl.end(); ++it )
-       {
-               connections_back = (*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) );
+
+       for (ARS::iterator it = rl.begin(); it != rl.end(); ++it) {
+               route_connections.add_connection ((*it)->RemoteControlIDChanged.connect (boost::bind (&MackieControlProtocol::notify_remote_id_changed, this)));
        }
 }
 
index d220213d2d2d23e898026202ee5702bf941635ae..58d05f7b7fa0e99796ec29ca8bba26d09b339ccf 100644 (file)
@@ -335,12 +335,12 @@ class MackieControlProtocol
   
        /// Protects set_active, and allows waiting on the poll thread
        Glib::Cond update_cond;
-
-       // because sigc::trackable doesn't seem to be working
-       std::vector<sigc::connection> _connections;
-       std::back_insert_iterator<std::vector<sigc::connection> > connections_back;
-
-   /// The representation of the physical controls on the surface.
+       
+       PBD::ScopedConnectionList session_connections;
+       PBD::ScopedConnectionList port_connections;
+       PBD::ScopedConnectionList route_connections;
+       
+       /// The representation of the physical controls on the surface.
        Mackie::Surface * _surface;
        
        /// If a port is opened or closed, this will be
index 4413d3fc34ffa047e8a781c49a3aae24e7839a06..33164839142321116322f46d9d4a700558f5d2d4 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "midi++/types.h"
 #include "midi++/port.h"
-#include "sigc++/sigc++.h"
 #include "ardour/rc_configuration.h"
 
 #include "i18n.h"
@@ -95,7 +94,7 @@ void MackiePort::open()
 #ifdef PORT_DEBUG
        cout << "MackiePort::open " << *this << endl;
 #endif
-       _sysex = port().input()->sysex.connect( ( mem_fun (*this, &MackiePort::handle_midi_sysex) ) );
+       _sysex = port().input()->sysex.connect (boost::bind (&MackiePort::handle_midi_sysex, this, _1, _2, _3));
        
        // make sure the device is connected
        init();
@@ -301,7 +300,7 @@ void MackiePort::connect_any()
 #ifdef DEBUG
                cout << "connect input parser " << port().input() << " to handle_midi_any" << endl;
 #endif
-               _any = port().input()->any.connect( mem_fun( *this, &MackiePort::handle_midi_any ) );
+               _any = port().input()->any.connect (boost::bind (&MackiePort::handle_midi_any, this, _1, _2, _3));
 #ifdef DEBUG
                cout << "input parser any connections: " << port().input()->any.size() << endl;
 #endif
@@ -503,8 +502,9 @@ void MackiePort::handle_midi_any (MIDI::Parser &, MIDI::byte * raw_bytes, size_t
                                // first disconnect any previous timeouts
                                control.in_use_connection.disconnect();
                                
+#if 0 // BOOSTSIGNALS
                                // now connect a new timeout to call handle_control_timeout_event
-                               sigc::slot<bool> timeout_slot = sigc::bind(
+                               sigc::slot<bool> timeout_slot = sigc::bind (
                                        mem_fun( *this, &MackiePort::handle_control_timeout_event )
                                        , &control
                                );
@@ -512,7 +512,7 @@ void MackiePort::handle_midi_any (MIDI::Parser &, MIDI::byte * raw_bytes, size_t
                                        timeout_slot
                                        , control.in_use_timeout()
                                );
-                               
+#endif                         
                                // emit the control event
                                control_event( *this, control, state );
                                break;
index 26ec1ca799cc6e4d5701d4fc5484cf35bfdb26a6..639183d066524b5e4dcebf539bc890cbb2ae4eb1 100644 (file)
@@ -21,8 +21,7 @@
 #include "surface_port.h"
 
 #include <midi++/types.h>
-#include <sigc++/signal.h>
-#include <sigc++/connection.h>
+#include <boost/signals2.hpp>
 
 #include <glibmm/thread.h>
 
@@ -116,8 +115,8 @@ protected:
 private:
        MackieControlProtocol & _mcp;
        port_type_t _port_type;
-       sigc::connection _any;
-       sigc::connection _sysex;
+       boost::signals2::scoped_connection _any;
+       boost::signals2::scoped_connection _sysex;
        emulation_t _emulation;
 
        bool _initialising;
index af99e5d91bbf0924974c925fcbc88aaa5060f90f..fb6cf5b092c114938e81cd324020d69b078c4031 100644 (file)
@@ -31,34 +31,36 @@ using namespace std;
 
 void RouteSignal::connect()
 {
-       back_insert_iterator<Connections> cins = back_inserter( _connections );
+       if (_strip.has_solo()) {
+               connections.add_connection (_route->solo_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this)));
+       }
 
-       if ( _strip.has_solo() )
-               cins = _route->solo_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_solo_changed ), this ) );
-       
-       if ( _strip.has_mute() )
-               cins = _route->mute_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_mute_changed ), this ) );
-       
-       if ( _strip.has_gain() )
-               cins = _route->gain_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_gain_changed ), this, true ) );
-               
-       cins = _route->NameChanged.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), this ) );
+       if (_strip.has_mute()) {
+               connections.add_connection (_route->mute_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_mute_changed, &_mcp, this)));
+       }
+
+       if (_strip.has_gain()) {
+               connections.add_connection (_route->gain_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false)));
+       }
+
+       connections.add_connection (_route->NameChanged.connect (boost::bind (&MackieControlProtocol::notify_name_changed, &_mcp, this)));
        
        if (_route->panner()) {
-               cins = _route->panner()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
+               connections.add_connection (_route->panner()->Changed.connect(boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false)));
+               
                for ( unsigned int i = 0; i < _route->panner()->npanners(); ++i ) {
-                       cins = _route->panner()->streampanner (i).Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
+                       connections.add_connection (_route->panner()->streampanner(i).Changed.connect (boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false)));
                }
        }
        
        boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
        if (trk) {
-               cins = trk->rec_enable_control()->Changed .connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_record_enable_changed ), this));
+               connections.add_connection (trk->rec_enable_control()->Changed .connect(boost::bind (&MackieControlProtocol::notify_record_enable_changed, &_mcp, this)));
        }
        
        // TODO this works when a currently-banked route is made inactive, but not
        // when a route is activated which should be currently banked.
-       cins = _route->active_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_active_changed ), this ) );
+       connections.add_connection (_route->active_changed.connect (boost::bind (&MackieControlProtocol::notify_active_changed, &_mcp, this)));
 
        // TODO
        // SelectedChanged
@@ -67,10 +69,7 @@ void RouteSignal::connect()
 
 void RouteSignal::disconnect()
 {
-       for ( Connections::iterator it = _connections.begin(); it != _connections.end(); ++it )
-       {
-               it->disconnect();
-       }
+       connections.drop_connections ();
 }
 
 void RouteSignal::notify_all()
index a272449e52ca70d26ce048d54a61ea2cecbe3cb6..5b388a7da59e425207b8847e774a4c17617b5826 100644 (file)
 #ifndef route_signal_h
 #define route_signal_h
 
-#include <sigc++/sigc++.h>
+#include <vector>
 #include <boost/shared_ptr.hpp>
 
-#include <vector>
+#include "pbd/scoped_connections.h"
 
 #include "midi_byte_array.h"
 
@@ -79,8 +79,7 @@ private:
        Strip & _strip;
        SurfacePort & _port;
 
-       typedef std::vector<sigc::connection> Connections;
-       Connections _connections;
+       PBD::ScopedConnectionList connections;
 
        // Last written values for the gain and pan, to avoid overloading
        // the midi connection to the surface
index 421446df68b688a2bd13cb7847416e7bde9d748b..f41f2865bb0c5a0d23030c743c3d5c78820238a0 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef surface_port_h
 #define surface_port_h
 
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
 #include <glibmm/thread.h>
 
 #include "midi_byte_array.h"
@@ -34,7 +34,7 @@ namespace Mackie
 /**
        Make a relationship between a midi port and a Mackie device.
 */
-class SurfacePort : public sigc::trackable
+class SurfacePort
 {
 public:
        SurfacePort( MIDI::Port & port, int number );
@@ -64,19 +64,19 @@ public:
        const MIDI::Port & port() const { return *_port; }
        
        // all control notofications are sent from here
-       sigc::signal<void, SurfacePort &, Control &, const ControlState &> control_event;
+       boost::signals2::signal<void(SurfacePort &, Control &, const ControlState &)> control_event;
        
        // emitted just before the port goes into initialisation
        // where it tries to establish that its device is connected
-       sigc::signal<void> init_event;
+       boost::signals2::signal<void()> init_event;
        
        // emitted when the port completes initialisation successfully
-       sigc::signal<void> active_event;
+       boost::signals2::signal<void()> active_event;
 
        // emitted when the port goes inactive (ie a read or write failed)
-       sigc::signal<void> inactive_event;
+       boost::signals2::signal<void()> inactive_event;
        
-       // the port number - master is 0, extenders are 1,2,3,4
+       // the port number - master is 0(extenders are 1((,4
        virtual int number() const { return _number; }
        
        // number of strips handled by this port. Usually 8.
index 4a151d44d085a57faec4d71ee73b7cce429e7226..931a5c1a580f2a62433546c52fc396f36dc13574 100644 (file)
@@ -29,6 +29,7 @@
 #include <fcntl.h>
 
 #include <glibmm/miscutils.h>
+#include <boost/signals2.hpp>
 
 #include <pbd/pthread_utils.h>
 #include <pbd/file_utils.h>
@@ -82,7 +83,7 @@ OSC::OSC (Session& s, uint32_t port)
 
        // "Application Hooks"
        session_loaded (s);
-       session->Exported.connect (sigc::mem_fun (*this, &OSC::session_exported));
+       scoped_connect (session->Exported, boost::bind (&OSC::session_exported, this, _1, _2));
 }
 
 OSC::~OSC()
@@ -572,7 +573,7 @@ OSC::listen_to_route (boost::shared_ptr<Route> route, lo_address addr)
        */
        
        if (!route_exists) {
-               route->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &OSC::drop_route), boost::weak_ptr<Route> (route)));
+               scoped_connect (route->GoingAway, (boost::bind (&OSC::drop_route, this, boost::weak_ptr<Route> (route))));
        }
 }
 
index c0be2c0b18505a457f5b1b8bc136c5a3659c54ce..314d37c7bde4a460fbf7da0977961740cf8a1893 100644 (file)
@@ -31,9 +31,8 @@
 
 #include <glibmm/main.h>
 
-#include <sigc++/sigc++.h>
-
 #include "pbd/abstract_ui.h"
+#include "pbd/scoped_connections.h"
 
 #include "ardour/types.h"
 #include "control_protocol/control_protocol.h"
@@ -56,7 +55,7 @@ struct OSCUIRequest : public BaseUI::BaseRequestObject {
        ~OSCUIRequest() {}
 };
 
-class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
+class OSC : public ARDOUR::ControlProtocol, public PBD::ScopedConnectionList, public AbstractUI<OSCUIRequest>
 {
   public:
        OSC (ARDOUR::Session&, uint32_t port);