From 572fa80aa713e723f63e1e1822db614307eea6af Mon Sep 17 00:00:00 2001 From: Sakari Bergen Date: Fri, 26 Sep 2008 08:29:30 +0000 Subject: Add Import from session -functionality git-svn-id: svn://localhost/ardour2/branches/3.0@3805 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/element_importer.h | 122 ++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 libs/ardour/ardour/element_importer.h (limited to 'libs/ardour/ardour/element_importer.h') diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h new file mode 100644 index 0000000000..34ab0a7cc6 --- /dev/null +++ b/libs/ardour/ardour/element_importer.h @@ -0,0 +1,122 @@ +/* + Copyright (C) 2008 Paul Davis + Author: Sakari Bergen + + 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_element_importer_h__ +#define __ardour_element_importer_h__ + +#include +#include + +#include + +#include + +using std::string; + +class XMLTree; +namespace ARDOUR { + +class Session; + +/// Virtual interface class for element importers +class ElementImporter +{ + public: + + ElementImporter (XMLTree const & source, ARDOUR::Session & session); + virtual ~ElementImporter () {}; + + /** Returns the element name + * @return the name of the element + */ + virtual string get_name () const { return name; }; + + /** Gets a textual representation of the element + * @return a textual representation on this specific element + */ + virtual string get_info () const = 0; + + /** Prepares to move element + * Should take care of all tasks that need to be done + * before moving the element. This includes prompting + * the user for more information if necessary. + * + * If the element can be moved, queued should be set to true. + * + * @return whther or not the element could be prepared for moving + */ + virtual bool prepare_move () = 0; + + /** Cancels moving of element + * If the element has been set to be moved, this cancels the move. + * queued should be set to false. + */ + virtual void cancel_move () = 0; + + /** Moves the element to the taget session + * In addition to actually adding the element to the session + * changing ids, renaming files etc. should be taken care of. + */ + virtual void move () = 0; + + /// Check if element is broken. Cannot be moved if broken. + bool broken () { return _broken; } + + /// Signal that requests for anew name + static sigc::signal , string, string> Rename; + + /// Signal for ok/cancel prompting + static sigc::signal Prompt; + + protected: + /// Source XML-tree + XMLTree const & source; + + /// Target session + ARDOUR::Session & session; + + /// Ture if the element has been prepared and queued for importing + bool queued; + + /// Name of element + string name; + + /// The sample rate of the session from which we are importing + nframes_t sample_rate; + + /// Converts smpte time to a string + string smpte_to_string(SMPTE::Time & time) const; + + /// Converts samples so that times match the sessions sample rate + nframes_t rate_convert_samples (nframes_t samples) const; + + /// Converts samples so that times match the sessions sample rate (for straight use in XML) + string rate_convert_samples (string const & samples) const; + + /// Set element broken + void set_broken () { _broken = true; } + + private: + bool _broken; +}; + +} // namespace ARDOUR + +#endif -- cgit v1.2.3