diff document/Document.cpp @ 27:61259228d029

* More to do with passing around step/blocksize etc from plugin dialog to plugins. Still some puzzling unresolved details.
author Chris Cannam
date Tue, 19 Sep 2006 14:37:06 +0000
parents 40116f709d3b
children 56e1d4242bb4
line wrap: on
line diff
--- a/document/Document.cpp	Mon Sep 18 16:43:17 2006 +0000
+++ b/document/Document.cpp	Tue Sep 19 14:37:06 2006 +0000
@@ -161,11 +161,11 @@
 Layer *
 Document::createDerivedLayer(TransformName transform,
                              Model *inputModel, 
-                             int channel,
+                             const PluginTransform::ExecutionContext &context,
                              QString configurationXml)
 {
     Model *newModel = createModelForTransform(transform, inputModel,
-                                              channel, configurationXml);
+                                              context, configurationXml);
     if (!newModel) {
         // error already printed to stderr by createModelForTransform
         emit modelGenerationFailed(transform);
@@ -252,12 +252,12 @@
 	    // model: regenerate it.
 	    
 	    TransformName transform = m_models[model].transform;
-            int channel = m_models[model].channel;
+            PluginTransform::ExecutionContext context = m_models[model].context;
 	    
 	    Model *replacementModel =
                 createModelForTransform(transform,
                                         m_mainModel,
-                                        channel,
+                                        context,
                                         m_models[model].configurationXml);
 	    
 	    if (!replacementModel) {
@@ -288,7 +288,7 @@
 void
 Document::addDerivedModel(TransformName transform,
                           Model *inputModel,
-                          int channel,
+                          const PluginTransform::ExecutionContext &context,
                           Model *outputModelToAdd,
                           QString configurationXml)
 {
@@ -301,7 +301,7 @@
     ModelRecord rec;
     rec.source = inputModel;
     rec.transform = transform;
-    rec.channel = channel;
+    rec.context = context;
     rec.configurationXml = configurationXml;
     rec.refcount = 0;
 
@@ -323,7 +323,6 @@
     ModelRecord rec;
     rec.source = 0;
     rec.transform = "";
-    rec.channel = -1;
     rec.refcount = 0;
 
     m_models[model] = rec;
@@ -334,7 +333,7 @@
 Model *
 Document::createModelForTransform(TransformName transform,
                                   Model *inputModel,
-                                  int channel,
+                                  const PluginTransform::ExecutionContext &context,
                                   QString configurationXml)
 {
     Model *model = 0;
@@ -342,19 +341,19 @@
     for (ModelMap::iterator i = m_models.begin(); i != m_models.end(); ++i) {
 	if (i->second.transform == transform &&
 	    i->second.source == inputModel && 
-            i->second.channel == channel &&
+            i->second.context == context &&
             i->second.configurationXml == configurationXml) {
 	    return i->first;
 	}
     }
 
     model = TransformFactory::getInstance()->transform
-	(transform, inputModel, channel, configurationXml);
+	(transform, inputModel, context, configurationXml);
 
     if (!model) {
 	std::cerr << "WARNING: Document::createModelForTransform: no output model for transform " << transform.toStdString() << std::endl;
     } else {
-	addDerivedModel(transform, inputModel, channel, model, configurationXml);
+	addDerivedModel(transform, inputModel, context, model, configurationXml);
     }
 
     return model;
@@ -696,11 +695,13 @@
 
 	if (rec.source && rec.transform != "") {
 	    
+            //!!! stream the rest of the execution context in both directions (i.e. not just channel)
+
 	    out << indent;
 	    out << QString("  <derivation source=\"%1\" model=\"%2\" channel=\"%3\" transform=\"%4\"")
 		.arg(XmlExportable::getObjectExportId(rec.source))
 		.arg(XmlExportable::getObjectExportId(i->first))
-                .arg(rec.channel)
+                .arg(rec.context.channel)
 		.arg(XmlExportable::encodeEntities(rec.transform));
 
             if (rec.configurationXml != "") {