Remove unused named selection / chunk code.
authorCarl Hetherington <carl@carlh.net>
Tue, 26 Jun 2012 02:11:06 +0000 (02:11 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 26 Jun 2012 02:11:06 +0000 (02:11 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@12939 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor.h
gtk2_ardour/editor_selection_list.cc [deleted file]
libs/ardour/ardour/named_selection.h [deleted file]
libs/ardour/ardour/session.h
libs/ardour/ardour/session_selection.h [deleted file]
libs/ardour/named_selection.cc [deleted file]
libs/ardour/session.cc
libs/ardour/session_state.cc
libs/ardour/wscript

index 59014b04e7258f3997ce5a048a49cf83c06741e0..23da8d7c6d051bf230e113b92f7cb6c198096bd4 100644 (file)
@@ -83,7 +83,6 @@ namespace ARDOUR {
        class Region;
        class Location;
        class TempoSection;
-       class NamedSelection;
        class Session;
        class Filter;
        class ChanCount;
diff --git a/gtk2_ardour/editor_selection_list.cc b/gtk2_ardour/editor_selection_list.cc
deleted file mode 100644 (file)
index 3991dc5..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
-    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
-    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 <cstdlib>
-#include <cmath>
-#include <vector>
-
-#include <gtkmm.h>
-
-#include "ardour/named_selection.h"
-#include "ardour/session_selection.h"
-#include "ardour/playlist.h"
-
-#include "editor.h"
-#include "keyboard.h"
-#include "selection.h"
-#include "time_axis_view.h"
-#include "ardour_ui.h"
-#include "prompter.h"
-
-#include "i18n.h"
-
-using namespace std;
-using namespace ARDOUR;
-using namespace PBD;
-using namespace Gtk;
-using namespace Gtkmm2ext;
-
-void
-Editor::handle_new_named_selection ()
-{
-       ARDOUR_UI::instance()->call_slot (boost::bind (&Editor::redisplay_named_selections, this));
-}
-
-void
-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;
-}
-
-void
-Editor::redisplay_named_selections ()
-{
-       named_selection_model->clear ();
-       session->foreach_named_selection (*this, &Editor::add_named_selection_to_named_selection_display);
-}
-
-bool
-Editor::named_selection_display_key_release (GdkEventKey* ev)
-{
-       if (session == 0) {
-               return true;
-       }
-
-       switch (ev->keyval) {
-       case GDK_Delete:
-               remove_selected_named_selections ();
-               return true;
-               break;
-       default:
-               return false;
-               break;
-       }
-
-}
-
-void
-Editor::remove_selected_named_selections ()
-{
-       Glib::RefPtr<TreeSelection> selection = named_selection_display.get_selection();
-       TreeView::Selection::ListHandle_Path rows = selection->get_selected_rows ();
-
-       if (selection->count_selected_rows() == 0) {
-               return;
-       }
-
-       for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
-
-               TreeIter iter;
-
-               if ((iter = named_selection_model->get_iter (*i))) {
-                       session->remove_named_selection ((*iter)[named_selection_columns.selection]);
-               }
-       }
-}
-
-bool
-Editor::named_selection_display_button_release (GdkEventButton *ev)
-{
-       TreeModel::Children rows = named_selection_model->children();
-       TreeModel::Children::iterator i;
-       Glib::RefPtr<TreeSelection> selection = named_selection_display.get_selection();
-
-       for (i = rows.begin(); i != rows.end(); ++i) {
-               if (selection->is_selected (i)) {
-                       switch (ev->button) {
-                       case 1:
-                               if (Keyboard::is_delete_event (ev)) {
-                                       session->remove_named_selection ((*i)[named_selection_columns.selection]);
-                                       return true;
-                               }
-                               break;
-                       case 2:
-                               break;
-                       case 3:
-                               break;
-                       default:
-                               break;
-                       }
-               }
-       }
-
-       return false;
-}
-
-
-void
-Editor::named_selection_display_selection_changed ()
-{
-}
-
-void
-Editor::create_named_selection ()
-{
-       string name;
-
-       if (session == 0) {
-               return;
-       }
-
-       /* check for a range-based selection */
-
-       if (selection->time.empty()) {
-               return;
-       }
-
-       TrackViewList *views = get_valid_views (selection->time.track, selection->time.group);
-
-       if (views->empty()) {
-               delete views;
-               return;
-       }
-
-       boost::shared_ptr<Playlist>        what_we_found;
-       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);
-               }
-       }
-
-       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;
-               }
-
-               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;
-       }
-}
-
diff --git a/libs/ardour/ardour/named_selection.h b/libs/ardour/ardour/named_selection.h
deleted file mode 100644 (file)
index c120848..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-    Copyright (C) 2003 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 __ardour_named_selection_h__
-#define __ardour_named_selection_h__
-
-#include <string>
-#include <list>
-#include <boost/shared_ptr.hpp>
-
-#include "pbd/stateful.h"
-
-class XMLNode;
-
-namespace ARDOUR
-{
-
-class Session;
-class Playlist;
-
-class NamedSelection : public PBD::Stateful
-{
-public:
-       NamedSelection (std::string, std::list<boost::shared_ptr<Playlist> >&);
-       NamedSelection (Session&, const XMLNode&);
-       virtual ~NamedSelection ();
-
-       std::string name;
-       std::list<boost::shared_ptr<Playlist> > playlists;
-
-       XMLNode& get_state (void);
-
-       int set_state (const XMLNode&, int version);
-
-       static PBD::Signal1<void,NamedSelection*> NamedSelectionCreated;
-};
-
-}/* namespace ARDOUR */
-
-#endif /* __ardour_named_selection_h__ */
-
index 4c87b759b13405ffe306f6012e987e0dbfe753e8..518a99d961bd00b48d988e1b0616465ad6617aa1 100644 (file)
@@ -111,7 +111,6 @@ class MidiControlUI;
 class MidiRegion;
 class MidiSource;
 class MidiTrack;
-class NamedSelection;
 class Playlist;
 class PluginInsert;
 class PluginInfo;
@@ -578,16 +577,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        void add_playlist (boost::shared_ptr<Playlist>, bool unused = false);
 
-       /* named selections */
-
-       boost::shared_ptr<NamedSelection> named_selection_by_name (std::string name);
-       void add_named_selection (boost::shared_ptr<NamedSelection>);
-       void remove_named_selection (boost::shared_ptr<NamedSelection>);
-
-       template<class T> void foreach_named_selection (T& obj, void (T::*func)(boost::shared_ptr<NamedSelection>));
-       PBD::Signal0<void> NamedSelectionAdded;
-       PBD::Signal0<void> NamedSelectionRemoved;
-
        /* Curves and AutomationLists (TODO when they go away) */
        void add_automation_list(AutomationList*);
 
@@ -1306,17 +1295,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void playlist_ranges_moved (std::list<Evoral::RangeMove<framepos_t> > const &);
        void playlist_regions_extended (std::list<Evoral::Range<framepos_t> > const &);
 
-       /* NAMED SELECTIONS */
-
-       mutable Glib::Mutex named_selection_lock;
-       typedef std::set<boost::shared_ptr<NamedSelection> > NamedSelectionList;
-       NamedSelectionList named_selections;
-
-       int load_named_selections (const XMLNode&);
-
-       NamedSelection *named_selection_factory (std::string name);
-       NamedSelection *XMLNamedSelectionFactory (const XMLNode&);
-
        /* CURVES and AUTOMATION LISTS */
        std::map<PBD::ID, AutomationList*> automation_lists;
 
diff --git a/libs/ardour/ardour/session_selection.h b/libs/ardour/ardour/session_selection.h
deleted file mode 100644 (file)
index 52c7ab0..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-    Copyright (C) 2002 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 __ardour_session_named_selection_h__
-#define __ardour_session_named_selection_h__
-
-#include "ardour/session.h"
-#include "ardour/named_selection.h"
-
-namespace ARDOUR {
-
-template<class T> void
-Session::foreach_named_selection (T& obj, void (T::*func)(NamedSelection&))
-{
-       Glib::Mutex::Lock lm (named_selection_lock);
-       for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); i++) {
-               (obj.*func) (**i);
-       }
-}
-
-} /* namespace */
-
-#endif /* __ardour_session_named_selection_h__ */
diff --git a/libs/ardour/named_selection.cc b/libs/ardour/named_selection.cc
deleted file mode 100644 (file)
index 4bcc3f3..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-    Copyright (C) 2003 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/failed_constructor.h"
-#include "pbd/error.h"
-
-#include "ardour/session.h"
-#include "ardour/utils.h"
-#include "ardour/playlist.h"
-#include "ardour/named_selection.h"
-#include "ardour/session_playlists.h"
-
-#include "i18n.h"
-
-using namespace std;
-using namespace ARDOUR;
-using namespace PBD;
-
-PBD::Signal1<void,NamedSelection*> NamedSelection::NamedSelectionCreated;
-
-typedef std::list<boost::shared_ptr<Playlist> > PlaylistList;
-
-NamedSelection::NamedSelection (string n, PlaylistList& l)
-       : name (n)
-{
-       playlists = l;
-       for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
-               string new_name;
-
-               /* rename playlists to reflect our ownership */
-
-               new_name = name;
-               new_name += '/';
-               new_name += (*i)->name();
-
-               (*i)->set_name (new_name);
-               (*i)->use();
-       }
-}
-
-NamedSelection::NamedSelection (Session& session, const XMLNode& node)
-{
-       XMLNode* lists_node;
-       const XMLProperty* property;
-
-       if ((property = node.property ("name")) == 0) {
-               throw failed_constructor();
-       }
-
-       name = property->value();
-
-       if ((lists_node = find_named_node (node, "Playlists")) == 0) {
-               return;
-       }
-
-       XMLNodeList nlist = lists_node->children();
-       XMLNodeConstIterator niter;
-
-       for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
-
-               const XMLNode* plnode;
-               string playlist_name;
-               boost::shared_ptr<Playlist> playlist;
-
-               plnode = *niter;
-
-               if ((property = plnode->property ("name")) != 0) {
-                       if ((playlist = session.playlists->by_name (property->value())) != 0) {
-                               playlist->use();
-                               playlists.push_back (playlist);
-                       } else {
-                               warning << string_compose (_("Chunk %1 uses an unknown playlist \"%2\""), name, property->value()) << endmsg;
-                       }
-               } else {
-                       error << string_compose (_("Chunk %1 contains misformed playlist information"), name) << endmsg;
-                       throw failed_constructor();
-               }
-       }
-
-       NamedSelectionCreated (this);
-}
-
-NamedSelection::~NamedSelection ()
-{
-       for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
-               /* XXX who really owns these? us or the session? */
-               (*i)->drop_references ();
-               (*i)->release ();
-       }
-}
-
-int
-NamedSelection::set_state (const XMLNode& /*node*/, int /*version*/)
-{
-       return 0;
-}
-
-XMLNode&
-NamedSelection::get_state ()
-{
-       XMLNode* root = new XMLNode ("NamedSelection");
-       XMLNode* child;
-
-       root->add_property ("name", name);
-       child = root->add_child ("Playlists");
-
-       for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
-               XMLNode* plnode = new XMLNode ("Playlist");
-
-               plnode->add_property ("name", (*i)->name());
-               child->add_child_nocopy (*plnode);
-       }
-
-       return *root;
-}
index bcba42f01d6df9d5e563b773d6479dbb865439d3..9dacdc34cb950fc859d4faea9ec8ac31450d3dad 100644 (file)
@@ -68,7 +68,6 @@
 #include "ardour/graph.h"
 #include "ardour/midi_track.h"
 #include "ardour/midi_ui.h"
-#include "ardour/named_selection.h"
 #include "ardour/operations.h"
 #include "ardour/playlist.h"
 #include "ardour/plugin.h"
@@ -280,9 +279,6 @@ Session::destroy ()
 
        /* tell everyone to drop references and delete objects as we go */
 
-       DEBUG_TRACE (DEBUG::Destruction, "delete named selections\n");
-       named_selections.clear ();
-
        DEBUG_TRACE (DEBUG::Destruction, "delete regions\n");
        RegionFactory::delete_all_regions ();
 
@@ -3786,56 +3782,6 @@ Session::unmark_insert_id (uint32_t id)
        }
 }
 
-
-/* Named Selection management */
-
-boost::shared_ptr<NamedSelection>
-Session::named_selection_by_name (string name)
-{
-       Glib::Mutex::Lock lm (named_selection_lock);
-       for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ++i) {
-               if ((*i)->name == name) {
-                       return *i;
-               }
-       }
-       return boost::shared_ptr<NamedSelection>();
-}
-
-void
-Session::add_named_selection (boost::shared_ptr<NamedSelection> named_selection)
-{
-       {
-               Glib::Mutex::Lock lm (named_selection_lock);
-               named_selections.insert (named_selections.begin(), named_selection);
-       }
-
-       set_dirty();
-
-       NamedSelectionAdded (); /* EMIT SIGNAL */
-}
-
-void
-Session::remove_named_selection (boost::shared_ptr<NamedSelection> named_selection)
-{
-       bool removed = false;
-
-       {
-               Glib::Mutex::Lock lm (named_selection_lock);
-
-               NamedSelectionList::iterator i = find (named_selections.begin(), named_selections.end(), named_selection);
-
-               if (i != named_selections.end()) {
-                       named_selections.erase (i);
-                       set_dirty();
-                       removed = true;
-               }
-       }
-
-       if (removed) {
-                NamedSelectionRemoved (); /* EMIT SIGNAL */
-       }
-}
-
 void
 Session::reset_native_file_format ()
 {
index 1509a757ebf8cfd1428594666a8e7ee38fa6f00d..40cb364d732e865a1bcb14e56cf8029458f4d14c 100644 (file)
@@ -93,7 +93,6 @@
 #include "ardour/midi_region.h"
 #include "ardour/midi_source.h"
 #include "ardour/midi_track.h"
-#include "ardour/named_selection.h"
 #include "ardour/pannable.h"
 #include "ardour/playlist_factory.h"
 #include "ardour/port.h"
@@ -1159,15 +1158,6 @@ Session::state (bool full_state)
                gain_child->add_child_nocopy (_click_gain->state (full_state));
        }
 
-       if (full_state) {
-               XMLNode* ns_child = node->add_child ("NamedSelections");
-               for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ++i) {
-                       if (full_state) {
-                               ns_child->add_child_nocopy ((*i)->get_state());
-                       }
-               }
-       }
-
         node->add_child_nocopy (_speakers->get_state());
        node->add_child_nocopy (_tempo_map->get_state());
        node->add_child_nocopy (get_control_protocol_state());
@@ -1327,12 +1317,6 @@ Session::set_state (const XMLNode& node, int version)
                }
        }
 
-       if ((child = find_named_node (node, "NamedSelections")) != 0) {
-               if (load_named_selections (*child)) {
-                       goto out;
-               }
-       }
-
        if (version >= 3000) {
                if ((child = find_named_node (node, "Bundles")) == 0) {
                        warning << _("Session: XML state has no bundles section") << endmsg;
@@ -2224,39 +2208,6 @@ Session::get_best_session_directory_for_new_source ()
        return result;
 }
 
-int
-Session::load_named_selections (const XMLNode& node)
-{
-       XMLNodeList nlist;
-       XMLNodeConstIterator niter;
-       NamedSelection *ns;
-
-       nlist = node.children();
-
-       set_dirty();
-
-       for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
-
-               if ((ns = XMLNamedSelectionFactory (**niter)) == 0) {
-                       error << _("Session: cannot create Named Selection from XML description.") << endmsg;
-               }
-       }
-
-       return 0;
-}
-
-NamedSelection *
-Session::XMLNamedSelectionFactory (const XMLNode& node)
-{
-       try {
-               return new NamedSelection (*this, node);
-       }
-
-       catch (failed_constructor& err) {
-               return 0;
-       }
-}
-
 string
 Session::automation_dir () const
 {
index 4cece8f132589cb06f63876df1a7c0621e471c34..4c05af8c77bfc8a8a6e89ac7671668bfa6864f7c 100644 (file)
@@ -138,7 +138,6 @@ libardour_sources = [
         'mtc_slave.cc',
         'mtdm.cc',
         'mute_master.cc',
-        'named_selection.cc',
         'onset_detector.cc',
         'operations.cc',
         'pan_controllable.cc',