src/document.h

changeset 191
d355d4c52d51
parent 188
64ea7282611e
child 197
0e729e681a2c
equal deleted inserted replaced
190:3dbdc243f053 191:d355d4c52d51
23 #include "ui/canvas.h" 23 #include "ui/canvas.h"
24 #include "model.h" 24 #include "model.h"
25 #include "vertexmap.h" 25 #include "vertexmap.h"
26 #include "edithistory.h" 26 #include "edithistory.h"
27 27
28 namespace Ui
29 {
30 class Document;
31 }
32
33 class Document : public QWidget 28 class Document : public QWidget
34 { 29 {
35 Q_OBJECT 30 Q_OBJECT
36 public: 31 public:
37 explicit Document( 32 explicit Document(
40 const ldraw::ColorTable& colorTable, 35 const ldraw::ColorTable& colorTable,
41 QWidget *parent = nullptr); 36 QWidget *parent = nullptr);
42 ~Document() override; 37 ~Document() override;
43 QByteArray saveSplitterState() const; 38 QByteArray saveSplitterState() const;
44 void restoreSplitterState(const QByteArray& state); 39 void restoreSplitterState(const QByteArray& state);
45 void setRenderPreferences(const gl::RenderPreferences& newPreferences);
46 void setCanvasOverpaintCallback(Canvas::OverpaintCallback fn);
47 std::unique_ptr<ModelEditor> editModel(); 40 std::unique_ptr<ModelEditor> editModel();
48 void applyToVertices(VertexMap::ApplyFunction fn) const; 41 void applyToVertices(VertexMap::ApplyFunction fn) const;
49 void handleKeyPress(QKeyEvent* event);
50 void adjustGridToView();
51 const glm::mat4& currentGrid() const;
52 const Model& getModel() const; 42 const Model& getModel() const;
53 const QSet<ldraw::id_t> selectedObjects() const; 43 const QSet<ldraw::id_t> selectedObjects() const;
54 const ldraw::ColorTable& colorTable; 44 const ldraw::ColorTable& colorTable;
45 Canvas* const canvas;
46 Q_SLOT void editingModeTriggered();
55 Q_SIGNALS: 47 Q_SIGNALS:
56 void newStatusText(const QString& newStatusText); 48 void newStatusText(const QString& newStatusText);
57 void splitterChanged(); 49 void splitterChanged();
58 void mouseClick(Document* document, Canvas* canvas, QMouseEvent* event);
59 void mouseMove(Document* document, Canvas* canvas, QMouseEvent* event);
60 private: 50 private:
61 void selectionChanged(const QSet<ldraw::id_t>& newSelection);
62 void initializeTools(); 51 void initializeTools();
63 Q_SLOT void toolActionTriggered();
64 void selectTool(class BaseTool* tool);
65 Model* model; 52 Model* model;
66 DocumentManager* const documents; 53 DocumentManager* const documents;
67 VertexMap vertexMap; 54 VertexMap vertexMap;
68 Canvas* renderer; 55 class Ui_Document& ui;
69 Ui::Document& ui;
70 QToolBar* toolsBar; 56 QToolBar* toolsBar;
71 QVector<class BaseTool*> tools; 57 std::vector<QAction*> toolActions;
72 BaseTool* selectedTool = nullptr; 58 class ObjectEditor* objectEditor;
73 QMap<BaseTool*, QAction*> toolActions;
74 /** 59 /**
75 * @brief History information of edits to this model 60 * @brief History information of edits to this model
76 */ 61 */
77 // EditHistory editHistory; 62 // EditHistory editHistory;
78 }; 63 };

mercurial