32 class Toolset; |
32 class Toolset; |
33 class PrimitiveManager; |
33 class PrimitiveManager; |
34 class Grid; |
34 class Grid; |
35 class DocumentManager; |
35 class DocumentManager; |
36 class LDDocument; |
36 class LDDocument; |
37 |
|
38 class ColorToolbarItem |
|
39 { |
|
40 public: |
|
41 ColorToolbarItem (LDColor color = {}); |
|
42 LDColor color() const; |
|
43 bool isSeparator() const; |
|
44 void setColor (LDColor color); |
|
45 |
|
46 static ColorToolbarItem makeSeparator(); |
|
47 |
|
48 private: |
|
49 LDColor m_color; |
|
50 }; |
|
51 |
37 |
52 // LDForge's main GUI class. |
38 // LDForge's main GUI class. |
53 class MainWindow : public QMainWindow |
39 class MainWindow : public QMainWindow |
54 { |
40 { |
55 Q_OBJECT |
41 Q_OBJECT |
86 bool save (LDDocument* doc, bool saveAs); |
72 bool save (LDDocument* doc, bool saveAs); |
87 void saveShortcuts(); |
73 void saveShortcuts(); |
88 void select(const QModelIndex& objectIndex); |
74 void select(const QModelIndex& objectIndex); |
89 QModelIndexList selectedIndexes() const; |
75 QModelIndexList selectedIndexes() const; |
90 QSet<LDObject*> selectedObjects() const; |
76 QSet<LDObject*> selectedObjects() const; |
91 void setQuickColors (const QVector<ColorToolbarItem> &colors); |
|
92 void spawnContextMenu (const QPoint& position); |
77 void spawnContextMenu (const QPoint& position); |
93 int suggestInsertPoint(); |
78 int suggestInsertPoint(); |
94 Q_SLOT void updateActions(); |
79 Q_SLOT void updateActions(); |
95 void updateColorToolbar(); |
80 void updateColorToolbar(); |
96 void updateDocumentList(); |
81 void updateDocumentList(); |
110 void historyTraversed(); |
95 void historyTraversed(); |
111 void tabSelected(); |
96 void tabSelected(); |
112 void documentClosed(LDDocument* document); |
97 void documentClosed(LDDocument* document); |
113 void updateTitle(); |
98 void updateTitle(); |
114 void newDocument (LDDocument* document, bool cache = false); |
99 void newDocument (LDDocument* document, bool cache = false); |
|
100 void settingsChanged(); |
115 |
101 |
116 protected: |
102 protected: |
117 void closeEvent (QCloseEvent* event); |
103 void closeEvent (QCloseEvent* event); |
118 |
104 |
119 private: |
105 private: |
122 class GuiUtilities* m_guiUtilities; |
108 class GuiUtilities* m_guiUtilities; |
123 QMap<LDDocument*, Canvas*> m_renderers; |
109 QMap<LDDocument*, Canvas*> m_renderers; |
124 QMap<LDDocument*, QItemSelectionModel*> m_selections; |
110 QMap<LDDocument*, QItemSelectionModel*> m_selections; |
125 PrimitiveManager* m_primitives; |
111 PrimitiveManager* m_primitives; |
126 Grid* m_grid; |
112 Grid* m_grid; |
127 QVector<ColorToolbarItem> m_quickColors; |
|
128 QVector<QToolButton*> m_colorButtons; |
113 QVector<QToolButton*> m_colorButtons; |
129 QVector<QAction*> m_recentFiles; |
114 QVector<QAction*> m_recentFiles; |
130 class Ui_MainWindow& ui; |
115 class Ui_MainWindow& ui; |
131 QTabBar* m_tabs; |
116 QTabBar* m_tabs; |
132 bool m_updatingTabs; |
117 bool m_updatingTabs; |