cleanup up cleanup at session destruction; clarify the meaning of 3 signals (DropRefe...
[ardour.git] / gtk2_ardour / editor_selection_list.cc
index 1d75bf5d13e53248dbfad3aaf192a8493e5ee91b..62b04d8efa231a49b355ef3533f67b16863392f9 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2000 Paul Davis 
+    Copyright (C) 2000 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
@@ -23,9 +23,9 @@
 
 #include <gtkmm.h>
 
-#include <ardour/named_selection.h>
-#include <ardour/session_selection.h>
-#include <ardour/playlist.h>
+#include "ardour/named_selection.h"
+#include "ardour/session_selection.h"
+#include "ardour/playlist.h"
 
 #include <gtkmm2ext/stop_signal.h>
 
@@ -38,7 +38,7 @@
 
 #include "i18n.h"
 
-using namespace sigc;
+using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 using namespace Gtk;
@@ -47,15 +47,15 @@ using namespace Gtkmm2ext;
 void
 Editor::handle_new_named_selection ()
 {
-       ARDOUR_UI::instance()->call_slot (mem_fun(*this, &Editor::redisplay_named_selections));
+       ARDOUR_UI::instance()->call_slot (boost::bind (&Editor::redisplay_named_selections, this));
 }
 
 void
-Editor::add_named_selection_to_named_selection_display (NamedSelection& selection)
+Editor::add_named_selection_to_named_selection_display (boost::shared_ptr<NamedSelection> selection)
 {
         TreeModel::Row row = *(named_selection_model->append());
        row[named_selection_columns.text] = selection.name;
-       row[named_selection_columns.selection] = &selection;
+       row[named_selection_columns.selection] = selection;
 }
 
 void
@@ -153,7 +153,7 @@ Editor::create_named_selection ()
        if (selection->time.empty()) {
                return;
        }
-       
+
        TrackViewList *views = get_valid_views (selection->time.track, selection->time.group);
 
        if (views->empty()) {
@@ -165,9 +165,9 @@ Editor::create_named_selection ()
        list<boost::shared_ptr<Playlist> > thelist;
 
        for (TrackViewList::iterator i = views->begin(); i != views->end(); ++i) {
-               
+
                boost::shared_ptr<Playlist> pl = (*i)->playlist();
-               
+
                if (pl && (what_we_found = pl->copy (selection->time, false)) != 0) {
                        thelist.push_back (what_we_found);
                }
@@ -176,32 +176,33 @@ Editor::create_named_selection ()
        if (!thelist.empty()) {
 
                ArdourPrompter p;
-               
+
                p.set_prompt (_("Name for Chunk:"));
                p.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
                p.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
                p.change_labels (_("Create Chunk"), _("Forget it"));
                p.show_all ();
-               
+
                switch (p.run ()) {
-                       
+
                case Gtk::RESPONSE_ACCEPT:
                        p.get_result (name);
                        if (name.empty()) {
                                return;
-                       }       
+                       }
                        break;
                default:
                        return;
                }
 
-               new NamedSelection (name, thelist); // creation will add it to the model
-
-               /* make the one we just added be selected */
+               boost::shared_ptr<NamedSelection> ns (new NamedSelection (name, thelist));
                
+               /* make the one we just added be selected */
+
                TreeModel::Children::iterator added = named_selection_model->children().end();
                --added;
                named_selection_display.get_selection()->select (*added);
+
        } else {
                error << _("No selectable material found in the currently selected time range") << endmsg;
        }