24 #include <QRadioButton> |
24 #include <QRadioButton> |
25 #include <QTreeWidget> |
25 #include <QTreeWidget> |
26 #include <QMetaMethod> |
26 #include <QMetaMethod> |
27 #include "linetypes/modelobject.h" |
27 #include "linetypes/modelobject.h" |
28 #include "colors.h" |
28 #include "colors.h" |
|
29 #include "glShared.h" |
29 |
30 |
|
31 class QMdiSubWindow; |
30 class QToolButton; |
32 class QToolButton; |
31 class Canvas; |
33 class Canvas; |
32 class Toolset; |
34 class Toolset; |
33 class PrimitiveManager; |
35 class PrimitiveManager; |
34 class Grid; |
36 class Grid; |
46 |
48 |
47 void applyToActions(function<void(QAction*)> function); |
49 void applyToActions(function<void(QAction*)> function); |
48 void changeDocument (LDDocument* f); |
50 void changeDocument (LDDocument* f); |
49 void clearSelection(); |
51 void clearSelection(); |
50 void createBlankDocument(); |
52 void createBlankDocument(); |
|
53 Canvas* createCameraForDocument(LDDocument* document, gl::CameraType cameraType); |
51 LDDocument* currentDocument(); |
54 LDDocument* currentDocument(); |
52 void currentDocumentClosed(); |
55 void currentDocumentClosed(); |
53 QItemSelectionModel* currentSelectionModel(); |
56 QItemSelectionModel* currentSelectionModel(); |
54 QKeySequence defaultShortcut (QAction* act); |
57 QKeySequence defaultShortcut (QAction* act); |
55 void deleteByColor (LDColor color); |
58 void deleteByColor (LDColor color); |
68 void refresh(); |
71 void refresh(); |
69 void replaceSelection(const QItemSelection& selection); |
72 void replaceSelection(const QItemSelection& selection); |
70 CircularSection circleToolSection() const; |
73 CircularSection circleToolSection() const; |
71 bool save (LDDocument* doc, bool saveAs); |
74 bool save (LDDocument* doc, bool saveAs); |
72 void select(const QModelIndex& objectIndex); |
75 void select(const QModelIndex& objectIndex); |
|
76 Canvas* selectCameraForDocument(LDDocument* document, gl::CameraType cameraType); |
73 QModelIndexList selectedIndexes() const; |
77 QModelIndexList selectedIndexes() const; |
74 QSet<LDObject*> selectedObjects() const; |
78 QSet<LDObject*> selectedObjects() const; |
75 void spawnContextMenu (const QPoint& position); |
79 void spawnContextMenu (const QPoint& position); |
76 int suggestInsertPoint(); |
80 int suggestInsertPoint(); |
77 Q_SLOT void updateActions(); |
81 Q_SLOT void updateActions(); |
94 void tabSelected(); |
98 void tabSelected(); |
95 void documentClosed(LDDocument* document); |
99 void documentClosed(LDDocument* document); |
96 void updateTitle(); |
100 void updateTitle(); |
97 void newDocument (LDDocument* document, bool cache = false); |
101 void newDocument (LDDocument* document, bool cache = false); |
98 void settingsChanged(); |
102 void settingsChanged(); |
|
103 void canvasClosed(); |
99 |
104 |
100 protected: |
105 protected: |
101 void closeEvent (QCloseEvent* event); |
106 void closeEvent (QCloseEvent* event); |
102 |
107 |
103 private: |
108 private: |
104 struct ToolInfo; |
109 struct ToolInfo; |
105 |
110 |
106 QMap<LDDocument*, Canvas*> m_renderers; |
111 QMap<LDDocument*, QStack<Canvas*>> m_renderers; |
107 QMap<LDDocument*, QItemSelectionModel*> m_selections; |
112 QMap<LDDocument*, QItemSelectionModel*> m_selectionModels; |
108 PrimitiveManager* m_primitives; |
113 PrimitiveManager* m_primitives; |
109 Grid* m_grid; |
114 Grid* m_grid; |
110 QVector<QToolButton*> m_colorButtons; |
115 QVector<QToolButton*> m_colorButtons; |
111 QVector<QAction*> m_recentFiles; |
116 QVector<QAction*> m_recentFiles; |
112 class Ui_MainWindow& ui; |
117 class Ui_MainWindow& ui; |
116 QMap<QAction*, ToolInfo> m_toolmap; |
121 QMap<QAction*, ToolInfo> m_toolmap; |
117 class ExtProgramToolset* m_externalPrograms; |
122 class ExtProgramToolset* m_externalPrograms; |
118 DocumentManager* m_documents; |
123 DocumentManager* m_documents; |
119 LDDocument* m_currentDocument; |
124 LDDocument* m_currentDocument; |
120 QMap<QAction*, QKeySequence> m_defaultShortcuts; |
125 QMap<QAction*, QKeySequence> m_defaultShortcuts; |
|
126 QMap<Canvas*, QMdiSubWindow*> m_subWindows; |
121 int previousDivisions = MediumResolution; |
127 int previousDivisions = MediumResolution; |
122 |
128 |
123 private slots: |
129 private slots: |
124 void finishInitialization(); |
130 void finishInitialization(); |
125 void recentFileClicked(); |
131 void recentFileClicked(); |
|
132 void canvasActivated(QMdiSubWindow* window); |
|
133 void mainModelLoaded(LDDocument* document); |
126 }; |
134 }; |