comparison framework/Document.h @ 595:b23bebfdfaba

Untabify
author Chris Cannam
date Thu, 01 Mar 2018 18:02:22 +0000
parents d122d3595a32
children 021d42e6c8cb
comparison
equal deleted inserted replaced
594:72b4870f0e6b 595:b23bebfdfaba
67 * association between layers and views (addLayerToView, 67 * association between layers and views (addLayerToView,
68 * removeLayerFromView). 68 * removeLayerFromView).
69 */ 69 */
70 70
71 class Document : public QObject, 71 class Document : public QObject,
72 public XmlExportable 72 public XmlExportable
73 { 73 {
74 Q_OBJECT 74 Q_OBJECT
75 75
76 public: 76 public:
77 Document(); 77 Document();
348 */ 348 */
349 WaveFileModel *m_mainModel; 349 WaveFileModel *m_mainModel;
350 350
351 struct ModelRecord 351 struct ModelRecord
352 { 352 {
353 // Information associated with a non-main model. If this 353 // Information associated with a non-main model. If this
354 // model is derived from another, then source will be non-NULL 354 // model is derived from another, then source will be non-NULL
355 // and the transform name will be set appropriately. If the 355 // and the transform name will be set appropriately. If the
356 // transform name is set but source is NULL, then there was a 356 // transform name is set but source is NULL, then there was a
357 // transform involved but the (target) model has been modified 357 // transform involved but the (target) model has been modified
358 // since being generated from it. 358 // since being generated from it.
359 359
360 // This does not use ModelTransformer::Input, because it would 360 // This does not use ModelTransformer::Input, because it would
361 // be confusing to have Input objects hanging around with NULL 361 // be confusing to have Input objects hanging around with NULL
362 // models in them. 362 // models in them.
363 363
364 const Model *source; 364 const Model *source;
365 int channel; 365 int channel;
366 Transform transform; 366 Transform transform;
367 bool additional; 367 bool additional;
368 368
369 // Count of the number of layers using this model. 369 // Count of the number of layers using this model.
370 int refcount; 370 int refcount;
371 }; 371 };
372 372
373 typedef std::map<Model *, ModelRecord> ModelMap; 373 typedef std::map<Model *, ModelRecord> ModelMap;
374 ModelMap m_models; 374 ModelMap m_models;
375 375
382 std::set<Model *> m_aggregateModels; 382 std::set<Model *> m_aggregateModels;
383 383
384 class AddLayerCommand : public Command 384 class AddLayerCommand : public Command
385 { 385 {
386 public: 386 public:
387 AddLayerCommand(Document *d, View *view, Layer *layer); 387 AddLayerCommand(Document *d, View *view, Layer *layer);
388 virtual ~AddLayerCommand(); 388 virtual ~AddLayerCommand();
389 389
390 virtual void execute(); 390 virtual void execute();
391 virtual void unexecute(); 391 virtual void unexecute();
392 virtual QString getName() const; 392 virtual QString getName() const;
393 393
394 protected: 394 protected:
395 Document *m_d; 395 Document *m_d;
396 View *m_view; // I don't own this 396 View *m_view; // I don't own this
397 Layer *m_layer; // Document owns this, but I determine its lifespan 397 Layer *m_layer; // Document owns this, but I determine its lifespan
398 QString m_name; 398 QString m_name;
399 bool m_added; 399 bool m_added;
400 }; 400 };
401 401
402 class RemoveLayerCommand : public Command 402 class RemoveLayerCommand : public Command
403 { 403 {
404 public: 404 public:
405 RemoveLayerCommand(Document *d, View *view, Layer *layer); 405 RemoveLayerCommand(Document *d, View *view, Layer *layer);
406 virtual ~RemoveLayerCommand(); 406 virtual ~RemoveLayerCommand();
407 407
408 virtual void execute(); 408 virtual void execute();
409 virtual void unexecute(); 409 virtual void unexecute();
410 virtual QString getName() const; 410 virtual QString getName() const;
411 411
412 protected: 412 protected:
413 Document *m_d; 413 Document *m_d;
414 View *m_view; // I don't own this 414 View *m_view; // I don't own this
415 Layer *m_layer; // Document owns this, but I determine its lifespan 415 Layer *m_layer; // Document owns this, but I determine its lifespan
416 bool m_wasDormant; 416 bool m_wasDormant;
417 QString m_name; 417 QString m_name;
418 bool m_added; 418 bool m_added;
419 }; 419 };
420 420
421 typedef std::map<Layer *, std::set<View *> > LayerViewMap; 421 typedef std::map<Layer *, std::set<View *> > LayerViewMap;
422 LayerViewMap m_layerViewMap; 422 LayerViewMap m_layerViewMap;
423 423