Wed, 08 May 2013 01:12:23 +0300
Removed groups.. that was stupid. Intersector input now based on colors.
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
1 | /* |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
104 | 3 | * Copyright (C) 2013 Santeri Piippo |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
4 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
8 | * (at your option) any later version. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
9 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
13 | * GNU General Public License for more details. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
14 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
17 | */ |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
18 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
19 | #ifndef GUI_H |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
20 | #define GUI_H |
0 | 21 | |
22 | #include <QMainWindow> | |
23 | #include <QMenu> | |
24 | #include <QToolBar> | |
25 | #include <QAction> | |
26 | #include <QToolBar> | |
27 | #include <QTextEdit> | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
28 | #include <qpushbutton.h> |
151
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
29 | #include <qlistwidget.h> |
165
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
30 | #include <qlabel.h> |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
31 | #include <qboxlayout.h> |
26
83184d9407c7
Renamed io.cpp to file.cpp, draw.cpp to gldraw.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
32 | #include "gldraw.h" |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
77
diff
changeset
|
33 | #include "config.h" |
0 | 34 | |
175
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
35 | class QComboBox; |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
36 | class ForgeWindow; |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
37 | class color; |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
38 | class QSplitter; |
174
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
169
diff
changeset
|
39 | class DelHistory; |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
40 | |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
41 | // Stuff for dialogs |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
42 | #define IMPLEMENT_DIALOG_BUTTONS \ |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
43 | bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
44 | connect (bbx_buttons, SIGNAL (accepted ()), this, SLOT (accept ())); \ |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
45 | connect (bbx_buttons, SIGNAL (rejected ()), this, SLOT (reject ())); \ |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
46 | |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
47 | // ============================================================================= |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
48 | // Metadata for actions |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
49 | typedef struct { |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
50 | QAction** const qAct; |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
51 | keyseqconfig* const conf; |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
52 | const char* const name, *sDisplayName, *sIconName, *sDescription; |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
53 | void (*const handler) (); |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
54 | } actionmeta; |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
55 | |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
56 | extern vector<actionmeta> g_ActionMeta; |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
57 | |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
58 | // ============================================================================= |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
59 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
60 | // ============================================================================= |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
61 | #define MAKE_ACTION(NAME, DISPLAYNAME, ICONNAME, DESCR, DEFSHORTCUT) \ |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
62 | QAction* ACTION (NAME); \ |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
63 | cfg (keyseq, key_##NAME, DEFSHORTCUT); \ |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
64 | static void actionHandler_##NAME (); \ |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
65 | static ActionAdder ActionAdderInstance_##NAME (&ACTION(NAME), DISPLAYNAME, \ |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
66 | ICONNAME, DESCR, &key_##NAME, actionHandler_##NAME, #NAME); \ |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
67 | static void actionHandler_##NAME () |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
68 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
69 | #define EXTERN_ACTION(NAME) extern QAction* ACTION (NAME); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
70 | #define ACTION(N) LDForgeAction_##N |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
71 | |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
72 | // Convenience macros for key sequences. |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
73 | #define KEY(N) (Qt::Key_##N) |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
74 | #define CTRL(N) (Qt::CTRL | Qt::Key_##N) |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
75 | #define SHIFT(N) (Qt::SHIFT | Qt::Key_##N) |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
76 | #define CTRL_SHIFT(N) (Qt::CTRL | Qt::SHIFT | Qt::Key_##N) |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
77 | |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
78 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
79 | typedef struct { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
80 | color* col; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
81 | QPushButton* btn; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
82 | bool bSeparator; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
83 | } quickColorMetaEntry; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
84 | |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
85 | // ============================================================================= |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
86 | // ActionAdder |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
87 | // |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
88 | // The ACTION macro expands into - among other stuff - into an instance of this. |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
89 | // This class' constructor creates meta for the newly defined action and stores |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
90 | // it in g_ActionMeta. It is not supposed to be used directly! |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
91 | // ============================================================================= |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
92 | class ActionAdder { |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
93 | public: |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
94 | ActionAdder (QAction** qAct, const char* sDisplayName, const char* sIconName, |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
95 | const char* sDescription, keyseqconfig* conf, void (*const handler) (), |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
96 | const char* name) |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
97 | { |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
98 | actionmeta meta = {qAct, conf, name, sDisplayName, sIconName, sDescription, handler}; |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
99 | g_ActionMeta.push_back (meta); |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
100 | } |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
101 | }; |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
102 | |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
103 | // ============================================================================= |
151
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
104 | // ObjectList |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
105 | // |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
106 | // Object list class for ForgeWindow |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
107 | // ============================================================================= |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
108 | class ObjectList : public QListWidget { |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
109 | Q_OBJECT |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
110 | |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
111 | protected: |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
112 | void contextMenuEvent (QContextMenuEvent* ev); |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
113 | }; |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
114 | |
15fe6c51de54
Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
115 | // ============================================================================= |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
116 | // ForgeWindow |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
117 | // |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
118 | // The one main GUI class. Hosts the renderer, object list, message log. Contains |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
119 | // slot_action, which is what all actions connect to. Manages menus and toolbars. |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
120 | // Large and in charge. |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
121 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
122 | class ForgeWindow : public QMainWindow { |
0 | 123 | Q_OBJECT |
124 | ||
125 | public: | |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
126 | ForgeWindow (); |
0 | 127 | void buildObjList (); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
128 | void setTitle (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
129 | void refresh (); |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
130 | ulong getInsertionPoint (); |
94
a9e67f6e610e
Added history management for cut and paste, copy doesn't alter the object list by itself so it doesn't touch history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
131 | void deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects); |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
132 | void updateToolBars (); |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
133 | void updateRecentFilesMenu (); |
104 | 134 | void updateSelection (); |
125
7ee7aa5e28be
Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
135 | void updateGridToolBar (); |
105
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
136 | bool isSelected (LDObject* obj); |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
137 | short getSelectedColor(); |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
138 | LDObject::Type uniformSelectedType (); |
139
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
137
diff
changeset
|
139 | void scrollToSelection (); |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
140 | void spawnContextMenu (const QPoint pos); |
175
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
141 | DelHistory* deleteObjVector (const std::vector<LDObject*> objs); |
174
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
169
diff
changeset
|
142 | DelHistory* deleteSelection (); |
177
4cdd408f2863
Removed groups.. that was stupid. Intersector input now based on colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
176
diff
changeset
|
143 | DelHistory* deleteByColor (const short colnum); |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
144 | GLRenderer* R () { return m_renderer; } |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
145 | std::vector<LDObject*>& sel () { return m_sel; } |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
146 | void setQuickColorMeta (std::vector<quickColorMetaEntry>& quickColorMeta) { |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
147 | m_colorMeta = quickColorMeta; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
148 | } |
127
a6e2067bb2f1
Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
149 | |
a6e2067bb2f1
Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
150 | protected: |
a6e2067bb2f1
Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
151 | void closeEvent (QCloseEvent* ev); |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
152 | void logVA (LogType eType, const char* fmtstr, va_list va); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
153 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
154 | friend void logf (const char* fmt, ...); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
155 | friend void logf (LogType eType, const char* fmt, ...); |
161 | 156 | friend void warnf (const char* fmt, ...); |
157 | friend void infof (const char* fmt, ...); | |
158 | friend void succf (const char* fmt, ...); | |
159 | friend void errf (const char* fmt, ...); | |
160 | friend void devf (const char* fmt, ...); | |
127
a6e2067bb2f1
Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
161 | |
0 | 162 | private: |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
163 | GLRenderer* m_renderer; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
164 | ObjectList* m_objList; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
165 | QMenu* m_recentFilesMenu; |
176
84132e178d46
Removed the message log. I'll find a better way to convey messages at some point..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
166 | QSplitter* m_splitter; |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
167 | str m_msglogHTML; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
168 | QToolBar* m_colorToolBar; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
169 | std::vector<QToolBar*> m_toolBars; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
170 | std::vector<LDObject*> m_sel; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
171 | std::vector<quickColorMetaEntry> m_colorMeta; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
172 | std::vector<QPushButton*> m_colorButtons; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
173 | std::vector<QAction*> m_recentFiles; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
174 | |
0 | 175 | void createMenuActions (); |
176 | void createMenus (); | |
87
8dbf0fdf3374
Split some stuff out of the edit tool bar into move and object tool bars. The object tool bar is now located on the left side of the screen as the top one is running out of space.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
79
diff
changeset
|
177 | void createToolbars (); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
178 | void initSingleToolBar (const char* name); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
179 | void addToolBarAction (const char* name); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
180 | |
169
f562323760a2
Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents:
168
diff
changeset
|
181 | QMenu* initMenu (const char* name); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
182 | void addMenuAction (const char* name); |
0 | 183 | |
184 | private slots: | |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
13
diff
changeset
|
185 | void slot_selectionChanged (); |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
186 | void slot_action (); |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
187 | void slot_recentFile (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
188 | void slot_quickColor (); |
146
2ab24976acaa
Now capable of calculating coordinates based on mouse x and y and snapping them to the grid
Santeri Piippo <crimsondusk64@gmail.com>
parents:
145
diff
changeset
|
189 | void slot_lastSecondCleanup (); |
0 | 190 | }; |
191 | ||
165
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
192 | // ============================================================================= |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
193 | // LabeledWidget |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
194 | // |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
195 | // Convenience class for a widget with a label beside it. |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
196 | // ============================================================================= |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
197 | template<class R> class LabeledWidget : public QWidget { |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
198 | public: |
175
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
199 | explicit LabeledWidget (const char* labelstr, QWidget* parent = null) : QWidget (parent) { |
165
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
200 | m_widget = new R (this); |
175
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
201 | commonInit (labelstr); |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
202 | } |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
203 | |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
204 | explicit LabeledWidget (const char* labelstr, R* widget, QWidget* parent = null) : |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
205 | QWidget (parent), m_widget (widget) |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
206 | { |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
207 | commonInit (labelstr); |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
208 | } |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
209 | |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
210 | explicit LabeledWidget (QWidget* parent = 0, Qt::WindowFlags f = 0) { |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
211 | m_widget = new R (this); |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
212 | commonInit (""); |
165
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
213 | } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
214 | |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
215 | R* widget () const { return m_widget; } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
216 | R* w () const { return m_widget; } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
217 | QLabel* label () const { return m_label; } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
218 | QLabel* l () const { return m_label; } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
219 | void setWidget (R* widget) { m_widget = widget; } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
220 | void setLabel (QLabel* label) { m_label = label; } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
221 | operator R* () { return m_widget; } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
222 | |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
223 | private: |
175
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
224 | Q_DISABLE_COPY (LabeledWidget<R>) |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
225 | |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
226 | void commonInit (const char* labelstr) { |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
227 | m_label = new QLabel (labelstr, this); |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
228 | m_layout = new QHBoxLayout; |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
229 | m_layout->addWidget (m_label); |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
230 | m_layout->addWidget (m_widget); |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
231 | setLayout (m_layout); |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
232 | } |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
233 | |
165
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
234 | R* m_widget; |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
235 | QLabel* m_label; |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
236 | QHBoxLayout* m_layout; |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
237 | }; |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
238 | |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
239 | // ----------------------------------------------------------------------------- |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
240 | // Other GUI-related stuff not directly part of ForgeWindow: |
158
499286fcbf37
Compile the icon resources to a QRC file, so that they are embedded in the application
Santeri Piippo <crimsondusk64@gmail.com>
parents:
154
diff
changeset
|
241 | QPixmap getIcon (const char* sIconName); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
242 | std::vector<quickColorMetaEntry> parseQuickColorMeta (); |
127
a6e2067bb2f1
Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
243 | bool confirm (str title, str msg); |
a6e2067bb2f1
Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
125
diff
changeset
|
244 | bool confirm (str msg); |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
245 | void critical (str msg); |
164 | 246 | QAction* findAction (str name); |
177
4cdd408f2863
Removed groups.. that was stupid. Intersector input now based on colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
176
diff
changeset
|
247 | void makeColorSelector (QComboBox* box); |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
248 | |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
249 | // ----------------------------------------------------------------------------- |
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
250 | // Pointer to the instance of ForgeWindow. |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
251 | extern ForgeWindow* g_win; |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
252 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
253 | #endif // GUI_H |