diff layer/LayerFactory.cpp @ 625:1336439dc055 tonioni

fixed flexi note layer and propagated model selection to analyser
author gyorgyf
date Sat, 13 Apr 2013 13:39:17 +0100
parents 49afde2dd704
children 7256926d3af1
line wrap: on
line diff
--- a/layer/LayerFactory.cpp	Tue Mar 26 20:14:08 2013 +0000
+++ b/layer/LayerFactory.cpp	Sat Apr 13 13:39:17 2013 +0100
@@ -75,7 +75,7 @@
     case TimeInstants: return Layer::tr("Time Instants");
     case TimeValues:   return Layer::tr("Time Values");
     case Notes:        return Layer::tr("Notes");
-    case FlexiNotes:   return Layer::tr("flexible Notes");
+    case FlexiNotes:   return Layer::tr("Flexible Notes");
     case Regions:      return Layer::tr("Regions");
     case Text:         return Layer::tr("Text");
     case Image:        return Layer::tr("Images");
@@ -161,13 +161,13 @@
     }
 
     if (dynamic_cast<NoteModel *>(model)) {
-	types.insert(FlexiNotes);
+	// types.insert(FlexiNotes);
 	types.insert(Notes);
     }
 
     if (dynamic_cast<FlexiNoteModel *>(model)) {
 	types.insert(FlexiNotes);
-	types.insert(Notes);
+	// types.insert(Notes);
     }
 
     if (dynamic_cast<RegionModel *>(model)) {
@@ -295,6 +295,8 @@
 {
 //    if (trySetModel<WaveformLayer, RangeSummarisableTimeValueModel>(layer, model))
 //	return;
+	
+	std::cerr << "LayerFactory::setModel called... " << std::endl;
 
     if (trySetModel<WaveformLayer, WaveFileModel>(layer, model))
 	return;
@@ -314,11 +316,19 @@
     if (trySetModel<TimeValueLayer, SparseTimeValueModel>(layer, model))
 	return;
 
-    if (trySetModel<NoteLayer, NoteModel>(layer, model))
-	return;
+    if (trySetModel<NoteLayer, NoteModel>(layer, model)) {
+		std::cerr << "trying to set note layer model" << std::endl;
+	return; }
 
-    if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model))
-	return;
+    if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) {
+		std::cerr << "trying to set flexi note layer model" << std::endl;
+	return; }
+	
+	FlexiNoteLayer *clayer = dynamic_cast<FlexiNoteLayer *>(layer);
+	if (!clayer) { std::cerr << "layer cast failed" << std::endl; return; }
+	FlexiNoteModel *cmodel = dynamic_cast<FlexiNoteModel *>(model);
+	if (!cmodel) { std::cerr << "model cast failed" << std::endl; return; }
+	clayer->setModel(cmodel);
 
     if (trySetModel<RegionLayer, RegionModel>(layer, model))
 	return;
@@ -340,6 +350,7 @@
 
 //    if (trySetModel<SliceLayer, DenseThreeDimensionalModel>(layer, model)) 
 //        return;
+	std::cerr << "LayerFactory::setModel done... " << std::endl;
 }
 
 Model *