comparison layer/LayerFactory.h @ 17:0183ebb725ca

* Add ability to create empty layers for editing * Add first basic editing capability (adding points to a time instant layer) * Add various keyboard and mouse shortcuts for navigation &c * Add ability to resize a selection by dragging its edges * Add maximum zoom level
author Chris Cannam
date Thu, 26 Jan 2006 16:15:40 +0000
parents 02aaea1ffaf7
children ea6fe8cfcdd5
comparison
equal deleted inserted replaced
16:02a718909b2d 17:0183ebb725ca
41 41
42 virtual ~LayerFactory(); 42 virtual ~LayerFactory();
43 43
44 typedef std::set<LayerType> LayerTypeSet; 44 typedef std::set<LayerType> LayerTypeSet;
45 LayerTypeSet getValidLayerTypes(Model *model); 45 LayerTypeSet getValidLayerTypes(Model *model);
46 LayerTypeSet getValidEmptyLayerTypes();
46 47
47 LayerType getLayerType(const Layer *); 48 LayerType getLayerType(const Layer *);
48 49
49 Layer *createLayer(LayerType type, View *view, 50 Layer *createLayer(LayerType type, View *view,
50 Model *model = 0, int channel = -1); 51 Model *model = 0, int channel = -1);
51 52
52 QString getLayerPresentationName(LayerType type); 53 QString getLayerPresentationName(LayerType type);
53 54
54 void setModel(Layer *layer, Model *model); 55 void setModel(Layer *layer, Model *model);
56 Model *createEmptyModel(LayerType type, Model *baseModel);
55 57
58 QString getLayerIconName(LayerType);
56 QString getLayerTypeName(LayerType); 59 QString getLayerTypeName(LayerType);
57 LayerType getLayerTypeForName(QString); 60 LayerType getLayerTypeForName(QString);
58 61
59 protected: 62 protected:
60 template <typename LayerClass, typename ModelClass> 63 template <typename LayerClass, typename ModelClass>
61 bool trySetModel(Layer *layerBase, Model *modelBase) { 64 bool trySetModel(Layer *layerBase, Model *modelBase) {
62 LayerClass *layer = dynamic_cast<LayerClass *>(layerBase); 65 LayerClass *layer = dynamic_cast<LayerClass *>(layerBase);
63 if (!layer) return false; 66 if (!layer) return false;
64 ModelClass *model = dynamic_cast<ModelClass *>(modelBase); 67 ModelClass *model = dynamic_cast<ModelClass *>(modelBase);
68 if (!model) return false;
65 layer->setModel(model); 69 layer->setModel(model);
66 return true; 70 return true;
67 } 71 }
68 72
69 static LayerFactory *m_instance; 73 static LayerFactory *m_instance;