class Region;
class Location;
class TempoSection;
- class NamedSelection;
class Session;
class Filter;
class ChanCount;
+++ /dev/null
-/*
- 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;
- }
-}
-
+++ /dev/null
-/*
- 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__ */
-
class MidiRegion;
class MidiSource;
class MidiTrack;
-class NamedSelection;
class Playlist;
class PluginInsert;
class PluginInfo;
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*);
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;
+++ /dev/null
-/*
- 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__ */
+++ /dev/null
-/*
- 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;
-}
#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"
/* 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 ();
}
}
-
-/* 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 ()
{
#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"
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());
}
}
- 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;
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
{
'mtc_slave.cc',
'mtdm.cc',
'mute_master.cc',
- 'named_selection.cc',
'onset_detector.cc',
'operations.cc',
'pan_controllable.cc',