Tue, 09 Sep 2014 02:39:04 +0300
- removed the clock timer I forgot in the previous commit
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
844
11587d419d2f
- changed copyright lines to use my legal name instead of my nickname
Teemu Piippo <crimsondusk64@gmail.com>
parents:
841
diff
changeset
|
3 | * Copyright (C) 2013, 2014 Teemu Piippo |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
804
diff
changeset
|
20 | #include <functional> |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include <QMainWindow> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include <QAction> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include <QListWidget> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include <QRadioButton> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include "configuration.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #include "ldObject.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | #include "ui_ldforge.h" |
795
195fa1fff9c3
- changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
28 | #include "colors.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | class MessageManager; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | class MainWindow; |
795
195fa1fff9c3
- changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
32 | class LDColorData; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | class QToolButton; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | class QDialogButtonBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | class GLRenderer; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | class QComboBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | class QProgressBar; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | class Ui_LDForgeUI; |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
39 | class Primitive; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | // Stuff for dialogs |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | #define IMPLEMENT_DIALOG_BUTTONS \ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); \ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); \ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | class LDQuickColor |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | { |
795
195fa1fff9c3
- changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
49 | PROPERTY (public, LDColor, color, setColor, STOCK_WRITE) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | PROPERTY (public, QToolButton*, toolButton, setToolButton, STOCK_WRITE) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | public: |
795
195fa1fff9c3
- changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
53 | LDQuickColor (LDColor color, QToolButton* toolButton); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | bool isSeparator() const; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | static LDQuickColor getSeparator(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | |
794 | 59 | // |
60 | // Object list class for MainWindow | |
61 | // | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | class ObjectList : public QListWidget |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | Q_OBJECT |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | protected: |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | void contextMenuEvent (QContextMenuEvent* ev); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | |
794 | 70 | // |
71 | // LDForge's main GUI class. | |
72 | // | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | class MainWindow : public QMainWindow |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | { |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
804
diff
changeset
|
75 | Q_OBJECT |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | |
794 | 77 | public: |
78 | explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0); | |
857
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
844
diff
changeset
|
79 | ~MainWindow(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | |
794 | 81 | // Rebuilds the object list. |
82 | void buildObjList(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | |
794 | 84 | // Updates the window title. |
85 | void updateTitle(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | |
794 | 87 | // Builds the object list and tells the GL renderer to init a full |
88 | // refresh. | |
89 | void doFullRefresh(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | |
794 | 91 | // Builds the object list and tells the GL renderer to do a soft update. |
92 | void refresh(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | |
794 | 94 | // Returns the suggested position to place a new object at. |
95 | int getInsertionPoint(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | |
794 | 97 | // Updates the quick color toolbar |
98 | void updateColorToolbar(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | |
794 | 100 | // Rebuilds the recent files submenu |
101 | void updateRecentFilesMenu(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | |
794 | 103 | // Sets the selection based on what's selected in the object list. |
104 | void updateSelection(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | |
794 | 106 | // Updates the grids, selects the selected grid and deselects others. |
107 | void updateGridToolBar(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | |
794 | 109 | // Updates the edit modes, current one is selected and others are deselected. |
110 | void updateEditModeActions(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | |
794 | 112 | // Rebuilds the document tab list. |
113 | void updateDocumentList(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | |
794 | 115 | // Updates the document tab for \c doc. If no such tab exists, the |
116 | // document list is rebuilt instead. | |
117 | void updateDocumentListItem (LDDocumentPtr doc); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | |
794 | 119 | // Returns the uniform selected color (i.e. 4 if everything selected is |
120 | // red), -1 if there is no such consensus. | |
795
195fa1fff9c3
- changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
121 | LDColor getSelectedColor(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | |
794 | 123 | // Automatically scrolls the object list so that it points to the first |
124 | // selected object. | |
125 | void scrollToSelection(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | |
794 | 127 | // Spawns the context menu at the given position. |
128 | void spawnContextMenu (const QPoint pos); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | |
794 | 130 | // Deletes all selected objects, returns the count of deleted objects. |
131 | int deleteSelection(); | |
132 | ||
133 | // Deletes all objects by the given color number. | |
795
195fa1fff9c3
- changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
794
diff
changeset
|
134 | void deleteByColor (LDColor color); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | |
794 | 136 | // Tries to save the given document. |
137 | bool save (LDDocumentPtr doc, bool saveAs); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | |
794 | 139 | // Updates various actions, undo/redo are set enabled/disabled where |
140 | // appropriate, togglable actions are updated based on configuration, | |
141 | // etc. | |
142 | void updateActions(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | |
794 | 144 | // Returns a pointer to the renderer |
145 | inline GLRenderer* R() | |
146 | { | |
147 | return m_renderer; | |
148 | } | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | |
794 | 150 | // Sets the quick color list to the given list of colors. |
151 | inline void setQuickColors (const QList<LDQuickColor>& colors) | |
152 | { | |
153 | m_quickColors = colors; | |
154 | updateColorToolbar(); | |
155 | } | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | |
794 | 157 | // Adds a message to the renderer's message manager. |
158 | void addMessage (QString msg); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | |
794 | 160 | // Updates the object list. Right now this just rebuilds it. |
161 | void refreshObjectList(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
162 | |
794 | 163 | void endAction(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | |
794 | 165 | inline QTreeWidget* getPrimitivesTree() const |
166 | { | |
167 | return ui->primitives; | |
168 | } | |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
169 | |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
804
diff
changeset
|
170 | static QKeySequence defaultShortcut (QAction* act); |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
804
diff
changeset
|
171 | void loadShortcuts (QSettings const* settings); |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
804
diff
changeset
|
172 | void saveShortcuts (QSettings* settings); |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
804
diff
changeset
|
173 | void applyToActions (std::function<void(QAction*)> function); |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
804
diff
changeset
|
174 | |
866
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
175 | bool ringToolHiRes() const; |
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
176 | int ringToolSegments() const; |
865
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
177 | |
794 | 178 | public slots: |
179 | void updatePrimitives(); | |
180 | void changeCurrentFile(); | |
798
88d4973cfe1a
- added close buttons to tabs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
181 | void closeTab (int tabindex); |
866
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
182 | void ringToolHiResClicked (bool clicked); |
871
a860edb4210b
- display a label next to the spinbox showing the fraction
Teemu Piippo <crimsondusk64@gmail.com>
parents:
866
diff
changeset
|
183 | void circleToolSegmentsChanged(); |
794 | 184 | void slot_action(); |
185 | void slot_actionNew(); | |
186 | void slot_actionNewFile(); | |
187 | void slot_actionOpen(); | |
188 | void slot_actionDownloadFrom(); | |
189 | void slot_actionSave(); | |
190 | void slot_actionSaveAs(); | |
191 | void slot_actionSaveAll(); | |
192 | void slot_actionClose(); | |
193 | void slot_actionCloseAll(); | |
194 | void slot_actionInsertFrom(); | |
195 | void slot_actionExportTo(); | |
196 | void slot_actionSettings(); | |
197 | void slot_actionSetLDrawPath(); | |
198 | void slot_actionScanPrimitives(); | |
199 | void slot_actionExit(); | |
200 | void slot_actionResetView(); | |
201 | void slot_actionAxes(); | |
202 | void slot_actionWireframe(); | |
203 | void slot_actionBFCView(); | |
204 | void slot_actionSetOverlay(); | |
205 | void slot_actionClearOverlay(); | |
206 | void slot_actionScreenshot(); | |
207 | void slot_actionInsertRaw(); | |
208 | void slot_actionNewSubfile(); | |
209 | void slot_actionNewLine(); | |
210 | void slot_actionNewTriangle(); | |
211 | void slot_actionNewQuad(); | |
212 | void slot_actionNewCLine(); | |
213 | void slot_actionNewComment(); | |
214 | void slot_actionNewBFC(); | |
215 | void slot_actionNewVertex(); | |
216 | void slot_actionUndo(); | |
217 | void slot_actionRedo(); | |
218 | void slot_actionCut(); | |
219 | void slot_actionCopy(); | |
220 | void slot_actionPaste(); | |
221 | void slot_actionDelete(); | |
222 | void slot_actionSelectAll(); | |
223 | void slot_actionSelectByColor(); | |
224 | void slot_actionSelectByType(); | |
225 | void slot_actionModeDraw(); | |
226 | void slot_actionModeSelect(); | |
841
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
818
diff
changeset
|
227 | void slot_actionModeRectangle(); |
794 | 228 | void slot_actionModeCircle(); |
818
748ba8818af8
- added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
815
diff
changeset
|
229 | void slot_actionModeMagicWand(); |
876
f040f0fb3795
- renamed line loop to line path, updated changelog
Teemu Piippo <crimsondusk64@gmail.com>
parents:
874
diff
changeset
|
230 | void slot_actionModeLinePath(); |
794 | 231 | void slot_actionSetDrawDepth(); |
232 | void slot_actionSetColor(); | |
233 | void slot_actionAutocolor(); | |
234 | void slot_actionUncolor(); | |
235 | void slot_actionInline(); | |
236 | void slot_actionInlineDeep(); | |
237 | void slot_actionInvert(); | |
238 | void slot_actionMakePrimitive(); | |
239 | void slot_actionSplitQuads(); | |
240 | void slot_actionEditRaw(); | |
241 | void slot_actionBorders(); | |
242 | void slot_actionCornerVerts(); | |
243 | void slot_actionRoundCoordinates(); | |
244 | void slot_actionVisibilityHide(); | |
245 | void slot_actionVisibilityReveal(); | |
246 | void slot_actionVisibilityToggle(); | |
247 | void slot_actionReplaceCoords(); | |
248 | void slot_actionFlip(); | |
249 | void slot_actionDemote(); | |
250 | void slot_actionYtruder(); | |
251 | void slot_actionRectifier(); | |
252 | void slot_actionIntersector(); | |
253 | void slot_actionIsecalc(); | |
254 | void slot_actionCoverer(); | |
255 | void slot_actionEdger2(); | |
256 | void slot_actionHelp(); | |
257 | void slot_actionAbout(); | |
258 | void slot_actionAboutQt(); | |
259 | void slot_actionGridCoarse(); | |
260 | void slot_actionGridMedium(); | |
261 | void slot_actionGridFine(); | |
262 | void slot_actionEdit(); | |
263 | void slot_actionMoveUp(); | |
264 | void slot_actionMoveDown(); | |
265 | void slot_actionMoveXNeg(); | |
266 | void slot_actionMoveXPos(); | |
267 | void slot_actionMoveYNeg(); | |
268 | void slot_actionMoveYPos(); | |
269 | void slot_actionMoveZNeg(); | |
270 | void slot_actionMoveZPos(); | |
271 | void slot_actionRotateXNeg(); | |
272 | void slot_actionRotateXPos(); | |
273 | void slot_actionRotateYNeg(); | |
274 | void slot_actionRotateYPos(); | |
275 | void slot_actionRotateZNeg(); | |
276 | void slot_actionRotateZPos(); | |
277 | void slot_actionRotationPoint(); | |
278 | void slot_actionAddHistoryLine(); | |
279 | void slot_actionJumpTo(); | |
280 | void slot_actionSubfileSelection(); | |
281 | void slot_actionDrawAngles(); | |
282 | void slot_actionRandomColors(); | |
283 | void slot_actionOpenSubfiles(); | |
804
d8589e8e2973
- added split lines action, doesn't yet work very well
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
284 | void slot_actionSplitLines(); |
815
efe34366e56a
- added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
285 | void slot_actionDrawSurfaces(); |
efe34366e56a
- added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
286 | void slot_actionDrawEdgeLines(); |
efe34366e56a
- added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
287 | void slot_actionDrawConditionalLines(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
288 | |
794 | 289 | protected: |
290 | void closeEvent (QCloseEvent* ev); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
291 | |
794 | 292 | private: |
293 | GLRenderer* m_renderer; | |
294 | LDObjectList m_sel; | |
295 | QList<LDQuickColor> m_quickColors; | |
296 | QList<QToolButton*> m_colorButtons; | |
297 | QList<QAction*> m_recentFiles; | |
298 | MessageManager* m_msglog; | |
299 | Ui_LDForgeUI* ui; | |
300 | QTabBar* m_tabs; | |
301 | bool m_updatingTabs; | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
302 | |
794 | 303 | private slots: |
304 | void slot_selectionChanged(); | |
305 | void slot_recentFile(); | |
306 | void slot_quickColor(); | |
307 | void slot_lastSecondCleanup(); | |
308 | void slot_editObject (QListWidgetItem* listitem); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
309 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
310 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
311 | //! Pointer to the instance of MainWindow. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
312 | extern MainWindow* g_win; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
313 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
314 | //! Get an icon by name from the resources directory. |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
315 | QPixmap GetIcon (QString iconName); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
316 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
317 | //! \returns a list of quick colors based on the configuration entry. |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
318 | QList<LDQuickColor> LoadQuickColorList(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
319 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
320 | //! Asks the user a yes/no question with the given \c message and the given |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
321 | //! window \c title. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
322 | //! \returns true if the user answered yes, false if no. |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
323 | bool Confirm (const QString& title, const QString& message); // Generic confirm prompt |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
324 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
325 | //! An overload of \c confirm(), this asks the user a yes/no question with the |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
326 | //! given \c message. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
327 | //! \returns true if the user answered yes, false if no. |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
328 | bool Confirm (const QString& message); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
329 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
330 | //! Displays an error prompt with the given \c message |
882
2f3cc8e045d5
- fixed compilation on windows
Teemu Piippo <crimsondusk64@gmail.com>
parents:
876
diff
changeset
|
331 | void Critical (const QString& message); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
332 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
333 | //! Makes an icon of \c size x \c size pixels to represent \c colinfo |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
334 | QIcon MakeColorIcon (LDColor colinfo, const int size); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
335 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
336 | //! Fills the given combo-box with color information |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
337 | void MakeColorComboBox (QComboBox* box); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
338 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
339 | //! \returns a QImage from the given raw GL \c data |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
340 | QImage GetImageFromScreencap (uchar* data, int w, int h); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
341 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
342 | //! |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
343 | //! Takes in pairs of radio buttons and respective values and finds the first |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
344 | //! selected one. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
345 | //! \returns returns the value of the first found radio button that was checked |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
346 | //! \returns by the user. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
347 | //! |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
348 | template<class T> |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
349 | T RadioSwitch (const T& defval, QList<Pair<QRadioButton*, T>> haystack) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
350 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
351 | for (Pair<QRadioButton*, const T&> i : haystack) |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
352 | { |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
353 | if (i.first->isChecked()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
354 | return i.second; |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
355 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
356 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
357 | return defval; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
358 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
359 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
360 | //! |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
361 | //! Takes in pairs of radio buttons and respective values and checks the first |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
362 | //! found radio button whose respsective value matches \c expr have the given value. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
363 | //! |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
364 | template<class T> |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
365 | void RadioDefault (const T& expr, QList<Pair<QRadioButton*, T>> haystack) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
366 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
367 | for (Pair<QRadioButton*, const T&> i : haystack) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
368 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
369 | if (i.second == expr) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
370 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
371 | i.first->setChecked (true); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
372 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
373 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
374 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
375 | } |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
376 | |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
377 | // ============================================================================= |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
378 | // |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
379 | class SubfileListItem : public QTreeWidgetItem |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
380 | { |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
381 | PROPERTY (public, Primitive*, primitive, setPrimitive, STOCK_WRITE) |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
382 | |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
383 | public: |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
384 | SubfileListItem (QTreeWidgetItem* parent, Primitive* info) : |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
385 | QTreeWidgetItem (parent), |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
386 | m_primitive (info) {} |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
387 | |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
388 | SubfileListItem (QTreeWidget* parent, Primitive* info) : |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
389 | QTreeWidgetItem (parent), |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
390 | m_primitive (info) {} |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
391 | }; |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
392 | |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
393 | void PopulatePrimitives (QTreeWidget* tw, const QString& selectByDefault = QString()); |