src/lddocument.h

changeset 1269
ec691d9472b3
parent 1263
0256edecda54
child 1272
bf0ac547b934
equal deleted inserted replaced
1268:7cbdaefda950 1269:ec691d9472b3
45 public: 45 public:
46 LDDocument (DocumentManager* parent); 46 LDDocument (DocumentManager* parent);
47 ~LDDocument(); 47 ~LDDocument();
48 48
49 void addHistoryStep(); 49 void addHistoryStep();
50 void addToHistory (AbstractHistoryEntry* entry);
51 void clearHistory(); 50 void clearHistory();
52 void close(); 51 void close();
53 QString defaultName() const; 52 QString defaultName() const;
54 QString fullPath(); 53 QString fullPath();
55 QString getDisplayName(); 54 QString getDisplayName();
57 EditHistory* history() const; 56 EditHistory* history() const;
58 void initializeCachedData(); 57 void initializeCachedData();
59 void inlineContents(Model& model, bool deep, bool renderinline); 58 void inlineContents(Model& model, bool deep, bool renderinline);
60 QList<LDPolygon> inlinePolygons(); 59 QList<LDPolygon> inlinePolygons();
61 const QSet<Vertex>& inlineVertices(); 60 const QSet<Vertex>& inlineVertices();
62 void insertObject (int pos, LDObject* obj);
63 bool isFrozen() const; 61 bool isFrozen() const;
64 bool isSafeToClose(); 62 bool isSafeToClose();
65 QString name() const; 63 QString name() const;
66 void objectRemoved(LDObject* object, int index); 64 void objectRemoved(LDObject* object, int index);
67 const QList<LDPolygon>& polygonData() const; 65 const QList<LDPolygon>& polygonData() const;
81 void undo(); 79 void undo();
82 void vertexChanged (const Vertex& a, const Vertex& b); 80 void vertexChanged (const Vertex& a, const Vertex& b);
83 81
84 static QString shortenName (QString a); // Turns a full path into a relative path 82 static QString shortenName (QString a); // Turns a full path into a relative path
85 83
86 public slots:
87 void objectChanged(QString before, QString after);
88
89 protected: 84 protected:
90 LDObject* withdrawAt(int position); 85 LDObject* withdrawAt(int position);
91 86
92 private: 87 private:
93 QString m_name; 88 QString m_name;
103 int m_triangleCount; 98 int m_triangleCount;
104 QList<LDPolygon> m_polygonData; 99 QList<LDPolygon> m_polygonData;
105 QMap<LDObject*, QSet<Vertex>> m_objectVertices; 100 QMap<LDObject*, QSet<Vertex>> m_objectVertices;
106 QSet<Vertex> m_vertices; 101 QSet<Vertex> m_vertices;
107 DocumentManager* m_manager; 102 DocumentManager* m_manager;
103
104 template<typename T, typename... Args>
105 void addToHistory(Args&&... args)
106 {
107 m_history->add<T>(args...);
108 }
109
110 private slots:
111 void objectChanged(const LDObjectState &before, const LDObjectState &after);
112 void handleNewObject(const QModelIndex& index);
113 void handleImminentObjectRemoval(const QModelIndex& index);
108 }; 114 };
109 115
110 // Parses a string line containing an LDraw object and returns the object parsed. 116 // Parses a string line containing an LDraw object and returns the object parsed.
111 LDObject* ParseLine (QString line); 117 LDObject* ParseLine (QString line);

mercurial