use new syntax for connecting to backend signals that enforces explicit connection...
[ardour.git] / gtk2_ardour / route_time_axis.cc
index e46d31bf8d9faa72d99b1d149bdcca20dd1065e0..442fb959c42de85fd9847f4d6b90af91647961f1 100644 (file)
@@ -88,7 +88,6 @@ using namespace PBD;
 using namespace Gtkmm2ext;
 using namespace Gtk;
 using namespace Editing;
-using namespace sigc;
 using namespace std;
 
 Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider;
@@ -101,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)
@@ -190,13 +189,13 @@ 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);
-       _route->meter_change.connect (sigc::mem_fun(*this, &RouteTimeAxisView::meter_changed));
-       _route->input()->changed.connect (sigc::mem_fun(*this, &RouteTimeAxisView::io_changed));
-       _route->output()->changed.connect (sigc::mem_fun(*this, &RouteTimeAxisView::io_changed));
+       _route->meter_change.connect (*this, boost::bind (&RouteTimeAxisView::meter_changed, this, _1));
+       _route->input()->changed.connect (*this, boost::bind (&RouteTimeAxisView::io_changed, this, _1, _2));
+       _route->output()->changed.connect (*this, boost::bind (&RouteTimeAxisView::io_changed, this, _1, _2));
 
        controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
        controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
@@ -235,19 +234,19 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
 
        _y_position = -1;
 
-       _route->mute_changed.connect (sigc::mem_fun(*this, &RouteUI::mute_changed));
-       _route->solo_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed));
-       _route->processors_changed.connect (sigc::mem_fun(*this, &RouteTimeAxisView::processors_changed));
-       _route->NameChanged.connect (sigc::mem_fun(*this, &RouteTimeAxisView::route_name_changed));
-       _route->solo_isolated_changed.connect (sigc::mem_fun(*this, &RouteUI::solo_changed));
+       _route->mute_changed.connect (*this, boost::bind (&RouteUI::mute_changed, this, _1));
+       _route->solo_changed.connect (*this, boost::bind (&RouteUI::solo_changed, this, _1));
+       _route->processors_changed.connect (*this, boost::bind (&RouteTimeAxisView::processors_changed, this, _1));
+       _route->NameChanged.connect (*this, boost::bind (&RouteTimeAxisView::route_name_changed, this));
+       _route->solo_isolated_changed.connect (*this, boost::bind (&RouteUI::solo_changed, this, _1));
 
 
        if (is_track()) {
 
-               track()->TrackModeChanged.connect (sigc::mem_fun(*this, &RouteTimeAxisView::track_mode_changed));
-               track()->FreezeChange.connect (sigc::mem_fun(*this, &RouteTimeAxisView::map_frozen));
-               track()->DiskstreamChanged.connect (sigc::mem_fun(*this, &RouteTimeAxisView::diskstream_changed));
-               get_diskstream()->SpeedChanged.connect (sigc::mem_fun(*this, &RouteTimeAxisView::speed_changed));
+               track()->TrackModeChanged.connect (*this, boost::bind (&RouteTimeAxisView::track_mode_changed, this));
+               track()->FreezeChange.connect (*this, boost::bind (&RouteTimeAxisView::map_frozen, this));
+               track()->DiskstreamChanged.connect (*this, boost::bind (&RouteTimeAxisView::diskstream_changed, this));
+               get_diskstream()->SpeedChanged.connect (*this, boost::bind (&RouteTimeAxisView::speed_changed, this));
 
                /* pick up the correct freeze state */
                map_frozen ();
@@ -270,7 +269,8 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
 
 RouteTimeAxisView::~RouteTimeAxisView ()
 {
-       GoingAway (); /* EMIT_SIGNAL */
+       drop_references ();
+       drop_connections ();
 
        for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
                delete *i;
@@ -532,8 +532,7 @@ RouteTimeAxisView::build_display_menu ()
 
                if (!Profile->get_sae()) {
                        items.push_back (MenuElem (_("Alignment"), *alignment_menu));
-                       get_diskstream()->AlignmentStyleChanged.connect (
-                                       sigc::mem_fun(*this, &RouteTimeAxisView::align_style_changed));
+                       get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this));
 
                        RadioMenuItem::Group mode_group;
                        items.push_back (RadioMenuElem (mode_group, _("Normal mode"), sigc::bind (
@@ -565,8 +564,7 @@ RouteTimeAxisView::build_display_menu ()
                        }
                }
 
-               get_diskstream()->AlignmentStyleChanged.connect (
-                               sigc::mem_fun(*this, &RouteTimeAxisView::align_style_changed));
+               get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this));
 
                mode_menu = build_mode_menu();
                if (mode_menu)
@@ -1045,8 +1043,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
@@ -1097,8 +1095,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);
        }
 
 
@@ -1144,13 +1142,13 @@ RouteTimeAxisView::clear_playlist ()
 void
 RouteTimeAxisView::speed_changed ()
 {
-       Gtkmm2ext::UI::instance()->call_slot (sigc::mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
+       Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteTimeAxisView::reset_samples_per_unit, this));
 }
 
 void
 RouteTimeAxisView::diskstream_changed ()
 {
-       Gtkmm2ext::UI::instance()->call_slot (sigc::mem_fun(*this, &RouteTimeAxisView::update_diskstream_display));
+       Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteTimeAxisView::update_diskstream_display, this));
 }
 
 void
@@ -1177,33 +1175,23 @@ RouteTimeAxisView::selection_click (GdkEventButton* ev)
                return;
        }
 
-       PublicEditor::TrackViewList* tracks = _editor.get_valid_views (this, _route->route_group());
-
        switch (ArdourKeyboard::selection_type (ev->state)) {
        case Selection::Toggle:
-               _editor.get_selection().toggle (*tracks);
+               _editor.get_selection().toggle (this);
                break;
 
        case Selection::Set:
-               _editor.get_selection().set (*tracks);
+               _editor.get_selection().set (this);
                break;
 
        case Selection::Extend:
-               if (tracks->size() > 1) {
-                       /* add each one, do not "extend" */
-                       _editor.get_selection().add (*tracks);
-               } else {
-                       /* extend to the single track */
-                       _editor.extend_selection_to_track (*tracks->front());
-               }
+               _editor.extend_selection_to_track (*this);
                break;
 
        case Selection::Add:
-               _editor.get_selection().add (*tracks);
+               _editor.get_selection().add (this);
                break;
        }
-
-       delete tracks;
 }
 
 void
@@ -1336,10 +1324,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 {
@@ -1419,7 +1407,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;
@@ -1431,7 +1419,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;
                }
@@ -1463,7 +1451,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;
 }
@@ -1505,7 +1493,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) {
 
@@ -1595,7 +1583,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();