32 public: \ |
32 public: \ |
33 virtual LDObject::Type type() const override \ |
33 virtual LDObject::Type type() const override \ |
34 { \ |
34 { \ |
35 return LDObject::E##T; \ |
35 return LDObject::E##T; \ |
36 } \ |
36 } \ |
37 virtual QString asText() const override; \ |
37 virtual String asText() const override; \ |
38 virtual void invert() override; |
38 virtual void invert() override; |
39 |
39 |
40 #define LDOBJ_NAME(N) virtual QString typeName() const override { return #N; } |
40 #define LDOBJ_NAME(N) virtual String typeName() const override { return #N; } |
41 #define LDOBJ_VERTICES(V) virtual int vertices() const override { return V; } |
41 #define LDOBJ_VERTICES(V) virtual int vertices() const override { return V; } |
42 #define LDOBJ_SETCOLORED(V) virtual bool isColored() const override { return V; } |
42 #define LDOBJ_SETCOLORED(V) virtual bool isColored() const override { return V; } |
43 #define LDOBJ_COLORED LDOBJ_SETCOLORED (true) |
43 #define LDOBJ_COLORED LDOBJ_SETCOLORED (true) |
44 #define LDOBJ_UNCOLORED LDOBJ_SETCOLORED (false) |
44 #define LDOBJ_UNCOLORED LDOBJ_SETCOLORED (false) |
45 |
45 |
110 |
110 |
111 // Get a vertex by index |
111 // Get a vertex by index |
112 const Vertex& vertex (int i) const; |
112 const Vertex& vertex (int i) const; |
113 |
113 |
114 // Type name of this object |
114 // Type name of this object |
115 virtual QString typeName() const = 0; |
115 virtual String typeName() const = 0; |
116 |
116 |
117 // Does this object have a matrix and position? (see LDMatrixObject) |
117 // Does this object have a matrix and position? (see LDMatrixObject) |
118 virtual bool hasMatrix() const = 0; |
118 virtual bool hasMatrix() const = 0; |
119 |
119 |
120 // Inverts this object (winding is reversed) |
120 // Inverts this object (winding is reversed) |
134 |
134 |
135 // Object prior to this in the current file |
135 // Object prior to this in the current file |
136 LDObject* previous() const; |
136 LDObject* previous() const; |
137 |
137 |
138 // This object as LDraw code |
138 // This object as LDraw code |
139 virtual QString asText() const = 0; |
139 virtual String asText() const = 0; |
140 |
140 |
141 // Replace this LDObject with another LDObject. Object is deleted in the process. |
141 // Replace this LDObject with another LDObject. Object is deleted in the process. |
142 void replace (LDObject* other); |
142 void replace (LDObject* other); |
143 |
143 |
144 // Selects this object. |
144 // Selects this object. |
161 |
161 |
162 // Number of vertices this object has // TODO: rename to getNumVertices |
162 // Number of vertices this object has // TODO: rename to getNumVertices |
163 virtual int vertices() const = 0; |
163 virtual int vertices() const = 0; |
164 |
164 |
165 // Get type name by enumerator |
165 // Get type name by enumerator |
166 static QString typeName (LDObject::Type type); |
166 static String typeName (LDObject::Type type); |
167 |
167 |
168 // Returns a default-constructed LDObject by the given type |
168 // Returns a default-constructed LDObject by the given type |
169 static LDObject* getDefault (const LDObject::Type type); |
169 static LDObject* getDefault (const LDObject::Type type); |
170 |
170 |
171 // TODO: move this to LDDocument? |
171 // TODO: move this to LDDocument? |
172 static void moveObjects (LDObjectList objs, const bool up); |
172 static void moveObjects (LDObjectList objs, const bool up); |
173 |
173 |
174 // Get a description of a list of LDObjects |
174 // Get a description of a list of LDObjects |
175 static QString describeObjects (const LDObjectList& objs); |
175 static String describeObjects (const LDObjectList& objs); |
176 static LDObject* fromID (int id); |
176 static LDObject* fromID (int id); |
177 LDPolygon* getPolygon(); |
177 LDPolygon* getPolygon(); |
178 |
178 |
179 // TODO: make these private! |
179 // TODO: make these private! |
180 // OpenGL list for this object |
180 // OpenGL list for this object |
292 LDOBJ_NAME (error) |
292 LDOBJ_NAME (error) |
293 LDOBJ_VERTICES (0) |
293 LDOBJ_VERTICES (0) |
294 LDOBJ_UNCOLORED |
294 LDOBJ_UNCOLORED |
295 LDOBJ_SCEMANTIC |
295 LDOBJ_SCEMANTIC |
296 LDOBJ_NO_MATRIX |
296 LDOBJ_NO_MATRIX |
297 PROPERTY (public, QString, fileReferenced, setFileReferenced, STOCK_WRITE) |
297 PROPERTY (public, String, fileReferenced, setFileReferenced, STOCK_WRITE) |
298 PROPERTY (private, QString, contents, setContents, STOCK_WRITE) |
298 PROPERTY (private, String, contents, setContents, STOCK_WRITE) |
299 PROPERTY (private, QString, reason, setReason, STOCK_WRITE) |
299 PROPERTY (private, String, reason, setReason, STOCK_WRITE) |
300 |
300 |
301 public: |
301 public: |
302 LDError(); |
302 LDError(); |
303 LDError (QString contents, QString reason) : |
303 LDError (String contents, String reason) : |
304 m_contents (contents), |
304 m_contents (contents), |
305 m_reason (reason) {} |
305 m_reason (reason) {} |
306 }; |
306 }; |
307 |
307 |
308 // ============================================================================= |
308 // ============================================================================= |
323 // |
323 // |
324 // Represents a code-0 comment in the LDraw code file. |
324 // Represents a code-0 comment in the LDraw code file. |
325 // |
325 // |
326 class LDComment : public LDObject |
326 class LDComment : public LDObject |
327 { |
327 { |
328 PROPERTY (public, QString, text, setText, STOCK_WRITE) |
328 PROPERTY (public, String, text, setText, STOCK_WRITE) |
329 LDOBJ (Comment) |
329 LDOBJ (Comment) |
330 LDOBJ_NAME (comment) |
330 LDOBJ_NAME (comment) |
331 LDOBJ_VERTICES (0) |
331 LDOBJ_VERTICES (0) |
332 LDOBJ_UNCOLORED |
332 LDOBJ_UNCOLORED |
333 LDOBJ_NON_SCEMANTIC |
333 LDOBJ_NON_SCEMANTIC |
334 LDOBJ_NO_MATRIX |
334 LDOBJ_NO_MATRIX |
335 |
335 |
336 public: |
336 public: |
337 LDComment() {} |
337 LDComment() {} |
338 LDComment (QString text) : m_text (text) {} |
338 LDComment (String text) : m_text (text) {} |
339 }; |
339 }; |
340 |
340 |
341 // ============================================================================= |
341 // ============================================================================= |
342 // |
342 // |
343 // Represents a 0 BFC statement in the LDraw code. eStatement contains the type |
343 // Represents a 0 BFC statement in the LDraw code. eStatement contains the type |
550 PROPERTY (public, int, camera, setCamera, STOCK_WRITE) |
550 PROPERTY (public, int, camera, setCamera, STOCK_WRITE) |
551 PROPERTY (public, int, x, setX, STOCK_WRITE) |
551 PROPERTY (public, int, x, setX, STOCK_WRITE) |
552 PROPERTY (public, int, y, setY, STOCK_WRITE) |
552 PROPERTY (public, int, y, setY, STOCK_WRITE) |
553 PROPERTY (public, int, width, setWidth, STOCK_WRITE) |
553 PROPERTY (public, int, width, setWidth, STOCK_WRITE) |
554 PROPERTY (public, int, height, setHeight, STOCK_WRITE) |
554 PROPERTY (public, int, height, setHeight, STOCK_WRITE) |
555 PROPERTY (public, QString, fileName, setFileName, STOCK_WRITE) |
555 PROPERTY (public, String, fileName, setFileName, STOCK_WRITE) |
556 }; |
556 }; |
557 |
557 |
558 // Other common LDraw stuff |
558 // Other common LDraw stuff |
559 static const QString g_CALicense ("!LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt"); |
559 static const String g_CALicense ("!LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt"); |
560 static const QString g_nonCALicense ("!LICENSE Not redistributable : see NonCAreadme.txt"); |
560 static const String g_nonCALicense ("!LICENSE Not redistributable : see NonCAreadme.txt"); |
561 static const int g_lores = 16; |
561 static const int g_lores = 16; |
562 static const int g_hires = 48; |
562 static const int g_hires = 48; |
563 |
563 |
564 QString getLicenseText (int id); |
564 String getLicenseText (int id); |