src/document.h

changeset 607
353e418f161a
parent 606
3dd6f343ec06
child 609
a8dc74a809c6
equal deleted inserted replaced
606:3dd6f343ec06 607:353e418f161a
54 // ============================================================================= 54 // =============================================================================
55 class LDDocument : public QObject 55 class LDDocument : public QObject
56 { 56 {
57 properties: 57 properties:
58 Q_OBJECT 58 Q_OBJECT
59 PROPERTY (private, QList<LDObject*>, Objects, NO_OPS, STOCK_WRITE) 59 PROPERTY (private, QList<LDObject*>, Objects, LIST_OPS, STOCK_WRITE)
60 PROPERTY (private, History*, History, NO_OPS, STOCK_WRITE) 60 PROPERTY (private, History*, History, NO_OPS, STOCK_WRITE)
61 PROPERTY (private, QList<LDObject*>, Vertices, NO_OPS, STOCK_WRITE) 61 PROPERTY (private, QList<LDObject*>, Vertices, LIST_OPS, STOCK_WRITE)
62 PROPERTY (public, QString, Name, STR_OPS, STOCK_WRITE) 62 PROPERTY (private, QList<LDDocumentPointer*>, References, LIST_OPS, STOCK_WRITE)
63 PROPERTY (public, QString, FullPath, STR_OPS, STOCK_WRITE) 63 PROPERTY (public, QString, Name, STR_OPS, STOCK_WRITE)
64 PROPERTY (public, QString, DefaultName, STR_OPS, STOCK_WRITE) 64 PROPERTY (public, QString, FullPath, STR_OPS, STOCK_WRITE)
65 PROPERTY (public, bool, Implicit, BOOL_OPS, STOCK_WRITE) 65 PROPERTY (public, QString, DefaultName, STR_OPS, STOCK_WRITE)
66 PROPERTY (public, QList<LDObject*>, Cache, NO_OPS, STOCK_WRITE) 66 PROPERTY (public, bool, Implicit, BOOL_OPS, STOCK_WRITE)
67 PROPERTY (public, long, SavePosition, NUM_OPS, STOCK_WRITE) 67 PROPERTY (public, QList<LDObject*>, Cache, LIST_OPS, STOCK_WRITE)
68 PROPERTY (public, QListWidgetItem*, ListItem, NO_OPS, STOCK_WRITE) 68 PROPERTY (public, long, SavePosition, NUM_OPS, STOCK_WRITE)
69 PROPERTY (public, QListWidgetItem*, ListItem, NO_OPS, STOCK_WRITE)
69 70
70 public: 71 public:
71 LDDocument(); 72 LDDocument();
72 ~LDDocument(); 73 ~LDDocument();
73 74
86 void swapObjects (LDObject* one, LDObject* other); 87 void swapObjects (LDObject* one, LDObject* other);
87 bool isSafeToClose(); // Perform safety checks. Do this before closing any files! 88 bool isSafeToClose(); // Perform safety checks. Do this before closing any files!
88 void setObject (int idx, LDObject* obj); 89 void setObject (int idx, LDObject* obj);
89 void addReference (LDDocumentPointer* ptr); 90 void addReference (LDDocumentPointer* ptr);
90 void removeReference (LDDocumentPointer* ptr); 91 void removeReference (LDDocumentPointer* ptr);
91 int numReferences() const { return m_refs.size(); }
92 92
93 inline LDDocument& operator<< (LDObject* obj) 93 inline LDDocument& operator<< (LDObject* obj)
94 { 94 {
95 addObject (obj); 95 addObject (obj);
96 return *this; 96 return *this;
134 void addToSelection (LDObject* obj); 134 void addToSelection (LDObject* obj);
135 void removeFromSelection (LDObject* obj); 135 void removeFromSelection (LDObject* obj);
136 friend class LDObject; 136 friend class LDObject;
137 137
138 private: 138 private:
139 QList<LDObject*> m_sel; 139 QList<LDObject*> m_sel;
140 QList<LDDocumentPointer*> m_refs; 140
141 // If set to true, next inline of this document discards the cache and
142 // re-builds it.
143 bool m_needsCache;
141 144
142 static LDDocument* m_curdoc; 145 static LDDocument* m_curdoc;
143 }; 146 };
144 147
145 inline LDDocument* getCurrentDocument() 148 inline LDDocument* getCurrentDocument()

mercurial