comparison framework/Document.h @ 72:4aa40182321f

* Merge from transforms branch -- switch over to using Transform object properly
author Chris Cannam
date Fri, 07 Dec 2007 16:47:31 +0000
parents a798f5e6fc5e
children 0535c49069ba
comparison
equal deleted inserted replaced
70:716e9d2f91c7 72:4aa40182321f
16 #ifndef _DOCUMENT_H_ 16 #ifndef _DOCUMENT_H_
17 #define _DOCUMENT_H_ 17 #define _DOCUMENT_H_
18 18
19 #include "layer/LayerFactory.h" 19 #include "layer/LayerFactory.h"
20 #include "plugin/transform/Transform.h" 20 #include "plugin/transform/Transform.h"
21 #include "plugin/transform/PluginTransformer.h"//!!!
22 #include "plugin/transform/ModelTransformer.h" 21 #include "plugin/transform/ModelTransformer.h"
23 #include "base/Command.h" 22 #include "base/Command.h"
24 23
25 #include <map> 24 #include <map>
26 #include <set> 25 #include <set>
112 /** 111 /**
113 * Create and return a suitable layer for the given transform, 112 * Create and return a suitable layer for the given transform,
114 * running the transform and associating the resulting model with 113 * running the transform and associating the resulting model with
115 * the new layer. 114 * the new layer.
116 */ 115 */
117 Layer *createDerivedLayer(TransformId, 116 Layer *createDerivedLayer(const Transform &,
118 Model *inputModel, 117 const ModelTransformer::Input &);
119 const PluginTransformer::ExecutionContext &context,
120 QString configurationXml);
121 118
122 /** 119 /**
123 * Delete the given layer, and also its associated model if no 120 * Delete the given layer, and also its associated model if no
124 * longer used by any other layer. In general, this should be the 121 * longer used by any other layer. In general, this should be the
125 * only method used to delete layers -- doing so directly is a bit 122 * only method used to delete layers -- doing so directly is a bit
142 /** 139 /**
143 * Get the main model (the source for playback sample rate, etc). 140 * Get the main model (the source for playback sample rate, etc).
144 */ 141 */
145 const WaveFileModel *getMainModel() const { return m_mainModel; } 142 const WaveFileModel *getMainModel() const { return m_mainModel; }
146 143
147 std::vector<Model *> getTransformerInputModels(); 144 std::vector<Model *> getTransformInputModels();
148 145
149 /** 146 /**
150 * Add a derived model associated with the given transform, 147 * Add a derived model associated with the given transform,
151 * running the transform and returning the resulting model. 148 * running the transform and returning the resulting model.
152 */ 149 */
153 Model *addDerivedModel(TransformId transform, 150 Model *addDerivedModel(const Transform &transform,
154 Model *inputModel, 151 const ModelTransformer::Input &input);
155 const PluginTransformer::ExecutionContext &context,
156 QString configurationXml);
157 152
158 /** 153 /**
159 * Add a derived model associated with the given transform. This 154 * Add a derived model associated with the given transform. This
160 * is necessary to register any derived model that was not created 155 * is necessary to register any derived model that was not created
161 * by the document using createDerivedModel or createDerivedLayer. 156 * by the document using createDerivedModel or createDerivedLayer.
162 */ 157 */
163 void addDerivedModel(TransformId, 158 void addDerivedModel(const Transform &transform,
164 Model *inputModel, 159 const ModelTransformer::Input &input,
165 const PluginTransformer::ExecutionContext &context, 160 Model *outputModelToAdd);
166 Model *outputModelToAdd,
167 QString configurationXml);
168 161
169 /** 162 /**
170 * Add an imported (non-derived, non-main) model. This is 163 * Add an imported (non-derived, non-main) model. This is
171 * necessary to register any imported model that is associated 164 * necessary to register any imported model that is associated
172 * with a layer. 165 * with a layer.
265 // model is derived from another, then source will be non-NULL 258 // model is derived from another, then source will be non-NULL
266 // and the transform name will be set appropriately. If the 259 // and the transform name will be set appropriately. If the
267 // transform name is set but source is NULL, then there was a 260 // transform name is set but source is NULL, then there was a
268 // transform involved but the (target) model has been modified 261 // transform involved but the (target) model has been modified
269 // since being generated from it. 262 // since being generated from it.
263
264 // This does not use ModelTransformer::Input, because it would
265 // be confusing to have Input objects hanging around with NULL
266 // models in them.
267
270 const Model *source; 268 const Model *source;
271 TransformId transform; 269 int channel;
272 PluginTransformer::ExecutionContext context; 270 Transform transform;
273 QString configurationXml;
274 271
275 // Count of the number of layers using this model. 272 // Count of the number of layers using this model.
276 int refcount; 273 int refcount;
277 }; 274 };
278 275
320 317
321 void addToLayerViewMap(Layer *, View *); 318 void addToLayerViewMap(Layer *, View *);
322 void removeFromLayerViewMap(Layer *, View *); 319 void removeFromLayerViewMap(Layer *, View *);
323 320
324 QString getUniqueLayerName(QString candidate); 321 QString getUniqueLayerName(QString candidate);
322 void writeBackwardCompatibleDerivation(QTextStream &, QString, Model *,
323 const ModelRecord &) const;
325 324
326 /** 325 /**
327 * And these are the layers. We also control the lifespans of 326 * And these are the layers. We also control the lifespans of
328 * these (usually through the commands used to add and remove them). 327 * these (usually through the commands used to add and remove them).
329 */ 328 */