diff layer/LayerFactory.cpp @ 1426:e1a08da75427 single-point

Update following FlexiNoteModel removal, using new NoteModel API where flexi was previously used
author Chris Cannam
date Thu, 14 Mar 2019 15:32:58 +0000
parents 62e908518c71
children 9e846af73f3e
line wrap: on
line diff
--- a/layer/LayerFactory.cpp	Thu Mar 14 13:12:25 2019 +0000
+++ b/layer/LayerFactory.cpp	Thu Mar 14 15:32:58 2019 +0000
@@ -37,7 +37,6 @@
 #include "data/model/SparseOneDimensionalModel.h"
 #include "data/model/SparseTimeValueModel.h"
 #include "data/model/NoteModel.h"
-#include "data/model/FlexiNoteModel.h"
 #include "data/model/RegionModel.h"
 #include "data/model/TextModel.h"
 #include "data/model/ImageModel.h"
@@ -162,12 +161,12 @@
     }
 
     if (dynamic_cast<NoteModel *>(model)) {
-        types.insert(Notes);
-    }
-
-    // NOTE: GF: types is a set, so order of insertion does not matter
-    if (dynamic_cast<FlexiNoteModel *>(model)) {
-        types.insert(FlexiNotes);
+        NoteModel *nm = dynamic_cast<NoteModel *>(model);
+        if (nm->getSubtype() == NoteModel::FLEXI_NOTE) {
+            types.insert(FlexiNotes);
+        } else {
+            types.insert(Notes);
+        }
     }
 
     if (dynamic_cast<RegionModel *>(model)) {
@@ -327,8 +326,7 @@
     if (trySetModel<NoteLayer, NoteModel>(layer, model)) 
         return; 
 
-    // GF: added FlexiNoteLayer
-    if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) 
+    if (trySetModel<FlexiNoteLayer, NoteModel>(layer, model)) 
         return; 
         
     if (trySetModel<RegionLayer, RegionModel>(layer, model))
@@ -361,7 +359,7 @@
     } else if (layerType == TimeValues) {
         return new SparseTimeValueModel(baseModel->getSampleRate(), 1, true);
     } else if (layerType == FlexiNotes) {
-        return new FlexiNoteModel(baseModel->getSampleRate(), 1, true);
+        return new NoteModel(baseModel->getSampleRate(), 1, true);
     } else if (layerType == Notes) {
         return new NoteModel(baseModel->getSampleRate(), 1, true);
     } else if (layerType == Regions) {