Sat, 14 Jun 2014 09:48:55 +0300
- added close buttons to tabs
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 |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013, 2014 Santeri Piippo |
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 |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include <QMainWindow> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include <QAction> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include <QListWidget> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include <QRadioButton> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include "configuration.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include "ldObject.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #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
|
27 | #include "colors.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | class MessageManager; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | 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
|
31 | class LDColorData; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | class QToolButton; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | class QDialogButtonBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | class GLRenderer; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | class QComboBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | class QProgressBar; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | class Ui_LDForgeUI; |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
38 | class Primitive; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | // Stuff for dialogs |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | #define IMPLEMENT_DIALOG_BUTTONS \ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); \ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); \ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | |
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 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | #define DEFINE_ACTION(NAME, DEFSHORTCUT) \ |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
50 | CFGENTRY (KeySequence, action##NAME##Shortcut, DEFSHORTCUT); \ |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | void MainWindow::slot_action##NAME() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | // Convenience macros for key sequences. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | #define KEY(N) (Qt::Key_##N) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | #define CTRL(N) (Qt::CTRL | Qt::Key_##N) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | #define SHIFT(N) (Qt::SHIFT | Qt::Key_##N) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | #define CTRL_SHIFT(N) (Qt::CTRL | Qt::SHIFT | Qt::Key_##N) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | class LDQuickColor |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | { |
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
|
62 | PROPERTY (public, LDColor, color, setColor, STOCK_WRITE) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | PROPERTY (public, QToolButton*, toolButton, setToolButton, STOCK_WRITE) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | 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
|
66 | LDQuickColor (LDColor color, QToolButton* toolButton); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | bool isSeparator() const; |
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 | static LDQuickColor getSeparator(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | |
794 | 72 | // |
73 | // Object list class for MainWindow | |
74 | // | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | class ObjectList : public QListWidget |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | Q_OBJECT |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | protected: |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | void contextMenuEvent (QContextMenuEvent* ev); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | |
794 | 83 | // |
84 | // LDForge's main GUI class. | |
85 | // | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | class MainWindow : public QMainWindow |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | { |
794 | 88 | Q_OBJECT |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | |
794 | 90 | public: |
91 | explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | |
794 | 93 | // Rebuilds the object list. |
94 | void buildObjList(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | |
794 | 96 | // Updates the window title. |
97 | void updateTitle(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | |
794 | 99 | // Builds the object list and tells the GL renderer to init a full |
100 | // refresh. | |
101 | void doFullRefresh(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | |
794 | 103 | // Builds the object list and tells the GL renderer to do a soft update. |
104 | void refresh(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | |
794 | 106 | // Returns the suggested position to place a new object at. |
107 | int getInsertionPoint(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | |
794 | 109 | // Updates the quick color toolbar |
110 | void updateColorToolbar(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | |
794 | 112 | // Rebuilds the recent files submenu |
113 | void updateRecentFilesMenu(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | |
794 | 115 | // Sets the selection based on what's selected in the object list. |
116 | void updateSelection(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | |
794 | 118 | // Updates the grids, selects the selected grid and deselects others. |
119 | void updateGridToolBar(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | |
794 | 121 | // Updates the edit modes, current one is selected and others are deselected. |
122 | void updateEditModeActions(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | |
794 | 124 | // Rebuilds the document tab list. |
125 | void updateDocumentList(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | |
794 | 127 | // Updates the document tab for \c doc. If no such tab exists, the |
128 | // document list is rebuilt instead. | |
129 | void updateDocumentListItem (LDDocumentPtr doc); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | |
794 | 131 | // Returns the uniform selected color (i.e. 4 if everything selected is |
132 | // 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
|
133 | LDColor getSelectedColor(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | |
794 | 135 | // Automatically scrolls the object list so that it points to the first |
136 | // selected object. | |
137 | void scrollToSelection(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | |
794 | 139 | // Spawns the context menu at the given position. |
140 | void spawnContextMenu (const QPoint pos); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | |
794 | 142 | // Deletes all selected objects, returns the count of deleted objects. |
143 | int deleteSelection(); | |
144 | ||
145 | // 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
|
146 | void deleteByColor (LDColor color); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | |
794 | 148 | // Tries to save the given document. |
149 | bool save (LDDocumentPtr doc, bool saveAs); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
150 | |
794 | 151 | // Updates various actions, undo/redo are set enabled/disabled where |
152 | // appropriate, togglable actions are updated based on configuration, | |
153 | // etc. | |
154 | void updateActions(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | |
794 | 156 | // Returns a pointer to the renderer |
157 | inline GLRenderer* R() | |
158 | { | |
159 | return m_renderer; | |
160 | } | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | |
794 | 162 | // Sets the quick color list to the given list of colors. |
163 | inline void setQuickColors (const QList<LDQuickColor>& colors) | |
164 | { | |
165 | m_quickColors = colors; | |
166 | updateColorToolbar(); | |
167 | } | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | |
794 | 169 | // Adds a message to the renderer's message manager. |
170 | void addMessage (QString msg); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | |
794 | 172 | // Updates the object list. Right now this just rebuilds it. |
173 | void refreshObjectList(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | |
794 | 175 | // Updates all actions to ensure they have the correct shortcut as |
176 | // defined in the configuration entries. | |
177 | void updateActionShortcuts(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | |
794 | 179 | // Gets the shortcut configuration for the given \c action |
180 | KeySequenceConfigEntry* shortcutForAction (QAction* action); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | |
794 | 182 | void endAction(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
183 | |
794 | 184 | inline QTreeWidget* getPrimitivesTree() const |
185 | { | |
186 | return ui->primitives; | |
187 | } | |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
188 | |
794 | 189 | public slots: |
190 | void updatePrimitives(); | |
191 | void changeCurrentFile(); | |
798
88d4973cfe1a
- added close buttons to tabs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
192 | void closeTab (int tabindex); |
794 | 193 | void slot_action(); |
194 | void slot_actionNew(); | |
195 | void slot_actionNewFile(); | |
196 | void slot_actionOpen(); | |
197 | void slot_actionDownloadFrom(); | |
198 | void slot_actionSave(); | |
199 | void slot_actionSaveAs(); | |
200 | void slot_actionSaveAll(); | |
201 | void slot_actionClose(); | |
202 | void slot_actionCloseAll(); | |
203 | void slot_actionInsertFrom(); | |
204 | void slot_actionExportTo(); | |
205 | void slot_actionSettings(); | |
206 | void slot_actionSetLDrawPath(); | |
207 | void slot_actionScanPrimitives(); | |
208 | void slot_actionExit(); | |
209 | void slot_actionResetView(); | |
210 | void slot_actionAxes(); | |
211 | void slot_actionWireframe(); | |
212 | void slot_actionBFCView(); | |
213 | void slot_actionSetOverlay(); | |
214 | void slot_actionClearOverlay(); | |
215 | void slot_actionScreenshot(); | |
216 | void slot_actionInsertRaw(); | |
217 | void slot_actionNewSubfile(); | |
218 | void slot_actionNewLine(); | |
219 | void slot_actionNewTriangle(); | |
220 | void slot_actionNewQuad(); | |
221 | void slot_actionNewCLine(); | |
222 | void slot_actionNewComment(); | |
223 | void slot_actionNewBFC(); | |
224 | void slot_actionNewVertex(); | |
225 | void slot_actionUndo(); | |
226 | void slot_actionRedo(); | |
227 | void slot_actionCut(); | |
228 | void slot_actionCopy(); | |
229 | void slot_actionPaste(); | |
230 | void slot_actionDelete(); | |
231 | void slot_actionSelectAll(); | |
232 | void slot_actionSelectByColor(); | |
233 | void slot_actionSelectByType(); | |
234 | void slot_actionModeDraw(); | |
235 | void slot_actionModeSelect(); | |
236 | void slot_actionModeCircle(); | |
237 | void slot_actionSetDrawDepth(); | |
238 | void slot_actionSetColor(); | |
239 | void slot_actionAutocolor(); | |
240 | void slot_actionUncolor(); | |
241 | void slot_actionInline(); | |
242 | void slot_actionInlineDeep(); | |
243 | void slot_actionInvert(); | |
244 | void slot_actionMakePrimitive(); | |
245 | void slot_actionSplitQuads(); | |
246 | void slot_actionEditRaw(); | |
247 | void slot_actionBorders(); | |
248 | void slot_actionCornerVerts(); | |
249 | void slot_actionRoundCoordinates(); | |
250 | void slot_actionVisibilityHide(); | |
251 | void slot_actionVisibilityReveal(); | |
252 | void slot_actionVisibilityToggle(); | |
253 | void slot_actionReplaceCoords(); | |
254 | void slot_actionFlip(); | |
255 | void slot_actionDemote(); | |
256 | void slot_actionYtruder(); | |
257 | void slot_actionRectifier(); | |
258 | void slot_actionIntersector(); | |
259 | void slot_actionIsecalc(); | |
260 | void slot_actionCoverer(); | |
261 | void slot_actionEdger2(); | |
262 | void slot_actionHelp(); | |
263 | void slot_actionAbout(); | |
264 | void slot_actionAboutQt(); | |
265 | void slot_actionGridCoarse(); | |
266 | void slot_actionGridMedium(); | |
267 | void slot_actionGridFine(); | |
268 | void slot_actionEdit(); | |
269 | void slot_actionMoveUp(); | |
270 | void slot_actionMoveDown(); | |
271 | void slot_actionMoveXNeg(); | |
272 | void slot_actionMoveXPos(); | |
273 | void slot_actionMoveYNeg(); | |
274 | void slot_actionMoveYPos(); | |
275 | void slot_actionMoveZNeg(); | |
276 | void slot_actionMoveZPos(); | |
277 | void slot_actionRotateXNeg(); | |
278 | void slot_actionRotateXPos(); | |
279 | void slot_actionRotateYNeg(); | |
280 | void slot_actionRotateYPos(); | |
281 | void slot_actionRotateZNeg(); | |
282 | void slot_actionRotateZPos(); | |
283 | void slot_actionRotationPoint(); | |
284 | void slot_actionAddHistoryLine(); | |
285 | void slot_actionJumpTo(); | |
286 | void slot_actionSubfileSelection(); | |
287 | void slot_actionDrawAngles(); | |
288 | void slot_actionRandomColors(); | |
289 | void slot_actionOpenSubfiles(); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
290 | |
794 | 291 | protected: |
292 | void closeEvent (QCloseEvent* ev); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
293 | |
794 | 294 | private: |
295 | GLRenderer* m_renderer; | |
296 | LDObjectList m_sel; | |
297 | QList<LDQuickColor> m_quickColors; | |
298 | QList<QToolButton*> m_colorButtons; | |
299 | QList<QAction*> m_recentFiles; | |
300 | MessageManager* m_msglog; | |
301 | Ui_LDForgeUI* ui; | |
302 | QTabBar* m_tabs; | |
303 | bool m_updatingTabs; | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
304 | |
794 | 305 | private slots: |
306 | void slot_selectionChanged(); | |
307 | void slot_recentFile(); | |
308 | void slot_quickColor(); | |
309 | void slot_lastSecondCleanup(); | |
310 | void slot_editObject (QListWidgetItem* listitem); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
311 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
312 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
313 | //! Pointer to the instance of MainWindow. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
314 | extern MainWindow* g_win; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
315 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
316 | //! Get an icon by name from the resources directory. |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
788
diff
changeset
|
317 | QPixmap getIcon (QString iconName); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
318 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
319 | //! \returns a list of quick colors based on the configuration entry. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
320 | QList<LDQuickColor> quickColorsFromConfig(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
321 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
322 | //! 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
|
323 | //! window \c title. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
324 | //! \returns true if the user answered yes, false if no. |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
788
diff
changeset
|
325 | 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
|
326 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
327 | //! 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
|
328 | //! given \c message. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
329 | //! \returns true if the user answered yes, false if no. |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
788
diff
changeset
|
330 | bool confirm (const QString& message); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
331 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
332 | //! Displays an error prompt with the given \c message |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
788
diff
changeset
|
333 | void critical (const QString& message); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
334 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
335 | //! Makes an icon of \c size x \c size pixels to represent \c colinfo |
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
|
336 | QIcon makeColorIcon (LDColor colinfo, const int size); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
337 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
338 | //! Fills the given combo-box with color information |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
339 | void makeColorComboBox (QComboBox* box); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
340 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
341 | //! \returns a QImage from the given raw GL \c data |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
342 | QImage imageFromScreencap (uchar* data, int w, int h); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
343 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
344 | //! |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
345 | //! 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
|
346 | //! selected one. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
347 | //! \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
|
348 | //! \returns by the user. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
349 | //! |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
350 | template<class T> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
351 | T radioSwitch (const T& defval, QList<Pair<QRadioButton*, T>> haystack) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
352 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
353 | for (Pair<QRadioButton*, const T&> i : haystack) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
354 | if (i.first->isChecked()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
355 | return i.second; |
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> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
365 | void radioDefault (const T& expr, QList<Pair<QRadioButton*, T>> haystack) |
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 | |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
383 | public: |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
384 | SubfileListItem (QTreeWidgetItem* parent, Primitive* info) : |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
385 | QTreeWidgetItem (parent), |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
386 | m_primitive (info) {} |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
387 | |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
388 | SubfileListItem (QTreeWidget* parent, Primitive* info) : |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
389 | QTreeWidgetItem (parent), |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
390 | m_primitive (info) {} |
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 | |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
393 | void populatePrimitives (QTreeWidget* tw, const QString& selectByDefault = QString()); |