src/Document.h

changeset 681
c1cc036c6e1f
parent 629
b75c6cce02e2
child 688
2f4dcc323a85
equal deleted inserted replaced
680:bf6323f2b1be 681:c1cc036c6e1f
21 21
22 #include <QObject> 22 #include <QObject>
23 #include "Main.h" 23 #include "Main.h"
24 #include "LDObject.h" 24 #include "LDObject.h"
25 #include "EditHistory.h" 25 #include "EditHistory.h"
26 #include "GLShared.h"
26 27
27 class History; 28 class History;
28 class OpenProgressDialog; 29 class OpenProgressDialog;
29 class LDDocumentPointer; 30 class LDDocumentPointer;
30 struct LDGLData; 31 struct LDGLData;
63 PROPERTY (private, QList<LDDocumentPointer*>, References, LIST_OPS, STOCK_WRITE) 64 PROPERTY (private, QList<LDDocumentPointer*>, References, LIST_OPS, STOCK_WRITE)
64 PROPERTY (public, QString, Name, STR_OPS, STOCK_WRITE) 65 PROPERTY (public, QString, Name, STR_OPS, STOCK_WRITE)
65 PROPERTY (public, QString, FullPath, STR_OPS, STOCK_WRITE) 66 PROPERTY (public, QString, FullPath, STR_OPS, STOCK_WRITE)
66 PROPERTY (public, QString, DefaultName, STR_OPS, STOCK_WRITE) 67 PROPERTY (public, QString, DefaultName, STR_OPS, STOCK_WRITE)
67 PROPERTY (public, bool, Implicit, BOOL_OPS, STOCK_WRITE) 68 PROPERTY (public, bool, Implicit, BOOL_OPS, STOCK_WRITE)
68 PROPERTY (public, LDObjectList, Cache, LIST_OPS, STOCK_WRITE) 69 PROPERTY (public, QList<LDPolygon>, PolygonData, NO_OPS, STOCK_WRITE)
69 PROPERTY (public, long, SavePosition, NUM_OPS, STOCK_WRITE) 70 PROPERTY (public, long, SavePosition, NUM_OPS, STOCK_WRITE)
70 PROPERTY (public, QListWidgetItem*, ListItem, NO_OPS, STOCK_WRITE) 71 PROPERTY (public, QListWidgetItem*, ListItem, NO_OPS, STOCK_WRITE)
71 72
72 public: 73 public:
73 LDDocument(); 74 LDDocument();
78 void clearSelection(); 79 void clearSelection();
79 void forgetObject (LDObject* obj); // Deletes the given object from the object chain. 80 void forgetObject (LDObject* obj); // Deletes the given object from the object chain.
80 QString getDisplayName(); 81 QString getDisplayName();
81 const LDObjectList& getSelection() const; 82 const LDObjectList& getSelection() const;
82 bool hasUnsavedChanges() const; // Does this Document.have unsaved changes? 83 bool hasUnsavedChanges() const; // Does this Document.have unsaved changes?
83 LDObjectList inlineContents (LDSubfile::InlineFlags flags); 84 void initializeGLData();
85 LDObjectList inlineContents (bool deep, bool renderinline);
84 void insertObj (int pos, LDObject* obj); 86 void insertObj (int pos, LDObject* obj);
85 int getObjectCount() const; 87 int getObjectCount() const;
86 LDObject* getObject (int pos) const; 88 LDObject* getObject (int pos) const;
87 bool save (QString path = ""); // Saves this file to disk. 89 bool save (QString path = ""); // Saves this file to disk.
88 void swapObjects (LDObject* one, LDObject* other); 90 void swapObjects (LDObject* one, LDObject* other);
89 bool isSafeToClose(); // Perform safety checks. Do this before closing any files! 91 bool isSafeToClose(); // Perform safety checks. Do this before closing any files!
90 void setObject (int idx, LDObject* obj); 92 void setObject (int idx, LDObject* obj);
91 void addReference (LDDocumentPointer* ptr); 93 void addReference (LDDocumentPointer* ptr);
92 void removeReference (LDDocumentPointer* ptr); 94 void removeReference (LDDocumentPointer* ptr);
95 QList<LDPolygon> inlinePolygons();
93 96
94 inline LDDocument& operator<< (LDObject* obj) 97 inline LDDocument& operator<< (LDObject* obj)
95 { 98 {
96 addObject (obj); 99 addObject (obj);
97 return *this; 100 return *this;
145 148
146 private: 149 private:
147 LDObjectList m_sel; 150 LDObjectList m_sel;
148 LDGLData* m_gldata; 151 LDGLData* m_gldata;
149 152
150 // If set to true, next inline of this document discards the cache and 153 // If set to true, next polygon inline of this document discards the
151 // re-builds it. 154 // stored polygon data and re-builds it.
152 bool m_needsCache; 155 bool m_needsGLReInit;
153 156
154 static LDDocument* m_curdoc; 157 static LDDocument* m_curdoc;
155 }; 158 };
156 159
157 inline LDDocument* getCurrentDocument() 160 inline LDDocument* getCurrentDocument()

mercurial