62 // |
62 // |
63 class LDDocument : public QObject |
63 class LDDocument : public QObject |
64 { |
64 { |
65 public: |
65 public: |
66 PROPERTY (public, QString, name, setName, STOCK_WRITE) |
66 PROPERTY (public, QString, name, setName, STOCK_WRITE) |
67 PROPERTY (private, LDObjectList, objects, setObjects, STOCK_WRITE) |
|
68 PROPERTY (private, LDObjectList, cache, setCache, STOCK_WRITE) |
67 PROPERTY (private, LDObjectList, cache, setCache, STOCK_WRITE) |
69 PROPERTY (private, History*, history, setHistory, STOCK_WRITE) |
68 PROPERTY (private, History*, history, setHistory, STOCK_WRITE) |
70 PROPERTY (public, QString, fullPath, setFullPath, STOCK_WRITE) |
69 PROPERTY (public, QString, fullPath, setFullPath, STOCK_WRITE) |
71 PROPERTY (public, QString, defaultName, setDefaultName, STOCK_WRITE) |
70 PROPERTY (public, QString, defaultName, setDefaultName, STOCK_WRITE) |
72 PROPERTY (public, bool, isImplicit, setImplicit, CUSTOM_WRITE) |
71 PROPERTY (public, bool, isImplicit, setImplicit, CUSTOM_WRITE) |
88 int addObject (LDObjectPtr obj); // Adds an object to this file at the end of the file. |
87 int addObject (LDObjectPtr obj); // Adds an object to this file at the end of the file. |
89 void addObjects (const LDObjectList& objs); |
88 void addObjects (const LDObjectList& objs); |
90 void clearSelection(); |
89 void clearSelection(); |
91 void forgetObject (LDObjectPtr obj); // Deletes the given object from the object chain. |
90 void forgetObject (LDObjectPtr obj); // Deletes the given object from the object chain. |
92 QString getDisplayName(); |
91 QString getDisplayName(); |
93 const LDObjectList& getSelection() const; |
92 const LDObjectList& getSelection(); |
94 bool hasUnsavedChanges() const; // Does this document have unsaved changes? |
93 bool hasUnsavedChanges() const; // Does this document have unsaved changes? |
95 void initializeCachedData(); |
94 void initializeCachedData(); |
96 LDObjectList inlineContents (bool deep, bool renderinline); |
95 LDObjectList inlineContents (bool deep, bool renderinline); |
97 void insertObj (int pos, LDObjectPtr obj); |
96 void insertObj (int pos, LDObjectPtr obj); |
98 int getObjectCount() const; |
97 int getObjectCount() const; |
99 LDObjectPtr getObject (int pos) const; |
98 LDObjectPtr getObject (int pos); |
100 bool save (QString path = "", int64* sizeptr = null); // Saves this file to disk. |
99 bool save (QString path = "", int64* sizeptr = null); // Saves this file to disk. |
101 void swapObjects (LDObjectPtr one, LDObjectPtr other); |
100 void swapObjects (LDObjectPtr one, LDObjectPtr other); |
102 bool isSafeToClose(); // Perform safety checks. Do this before closing any files! |
101 bool isSafeToClose(); // Perform safety checks. Do this before closing any files! |
103 void setObject (int idx, LDObjectPtr obj); |
102 void setObject (int idx, LDObjectPtr obj); |
104 QList<LDPolygon> inlinePolygons(); |
103 QList<LDPolygon> inlinePolygons(); |
168 |
174 |
169 friend class LDObject; |
175 friend class LDObject; |
170 friend class GLRenderer; |
176 friend class GLRenderer; |
171 |
177 |
172 private: |
178 private: |
|
179 LDObjectList m_objects; |
173 LDObjectList m_sel; |
180 LDObjectList m_sel; |
174 LDGLData* m_gldata; |
181 LDGLData* m_gldata; |
175 |
182 |
176 // If set to true, next polygon inline of this document discards the |
183 // If set to true, next polygon inline of this document discards the |
177 // stored polygon data and re-builds it. |
184 // stored polygon data and re-builds it. |
178 bool m_needsReCache; |
185 bool m_needsReCache; |
|
186 |
|
187 // If set to true, next object reference request causes BFC sweep. |
|
188 bool m_needBFCSweep; |
179 }; |
189 }; |
180 |
190 |
181 inline LDDocumentPtr CurrentDocument() |
191 inline LDDocumentPtr CurrentDocument() |
182 { |
192 { |
183 return LDDocument::current(); |
193 return LDDocument::current(); |