2 Copyright (C) 2000-2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_region_factory_h__
21 #define __ardour_region_factory_h__
27 #include "ardour/types.h"
28 #include "ardour/region.h"
41 static boost::shared_ptr<Region> region_by_id (const PBD::ID&);
42 static void clear_map ();
44 /** This is emitted only when a new id is assigned. Therefore,
45 in a pure Region copy, it will not be emitted.
47 It must be emitted using a derived instance of Region, not Region
48 itself, to permit dynamic_cast<> to be used to
49 infer the type of Region.
51 static PBD::Signal1<void,boost::shared_ptr<Region> > CheckNewRegion;
53 /** create a "pure copy" of Region @param other */
54 static boost::shared_ptr<Region> create (boost::shared_ptr<const Region> other);
56 /** create a region from a single Source */
57 static boost::shared_ptr<Region> create (boost::shared_ptr<Source>,
58 const PBD::PropertyList&, bool announce = true);
59 /** create a region from a multiple sources */
60 static boost::shared_ptr<Region> create (const SourceList &,
61 const PBD::PropertyList&, bool announce = true);
62 /** create a copy of @other starting at zero within @param other's sources */
63 static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other,
64 const PBD::PropertyList&, bool announce = true);
65 /** create a copy of @other starting at @param offset within @param other */
66 static boost::shared_ptr<Region> create (boost::shared_ptr<Region>, frameoffset_t offset,
67 const PBD::PropertyList&, bool announce = true);
68 /** create a "copy" of @param other but using a different set of sources @param srcs */
69 static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const SourceList& srcs,
70 const PBD::PropertyList&, bool announce = true);
72 /** create a region with no sources, using XML state */
73 static boost::shared_ptr<Region> create (Session&, XMLNode&, bool);
74 /** create a region with specified sources @param srcs and XML state */
75 static boost::shared_ptr<Region> create (SourceList& srcs, const XMLNode&);
78 static std::map<PBD::ID,boost::weak_ptr<Region> > region_map;
79 static void map_add (boost::shared_ptr<Region>);
84 #endif /* __ardour_region_factory_h__ */