Tue, 07 May 2013 00:22:01 +0300
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
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 | |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
35 | class ForgeWindow; |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
36 | class color; |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
37 | class QSplitter; |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
38 | |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
39 | // Stuff for dialogs |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
40 | #define IMPLEMENT_DIALOG_BUTTONS \ |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
41 | bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
42 | connect (bbx_buttons, SIGNAL (accepted ()), this, SLOT (accept ())); \ |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
43 | 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
|
44 | |
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
|
45 | // ============================================================================= |
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
|
46 | // 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
|
47 | 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
|
48 | 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
|
49 | 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
|
50 | 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
|
51 | 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
|
52 | } 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
|
53 | |
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 | 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
|
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 | // ============================================================================= |
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 | // ============================================================================= |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
59 | #define MAKE_ACTION(NAME, DISPLAYNAME, ICONNAME, DESCR, DEFSHORTCUT) \ |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
60 | 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
|
61 | 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
|
62 | static void actionHandler_##NAME (); \ |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
63 | 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
|
64 | 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
|
65 | 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
|
66 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
67 | #define EXTERN_ACTION(NAME) extern QAction* ACTION (NAME); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
68 | #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
|
69 | |
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
|
70 | // 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
|
71 | #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
|
72 | #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
|
73 | #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
|
74 | #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
|
75 | |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
76 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
77 | typedef struct { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
78 | color* col; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
79 | QPushButton* btn; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
80 | bool bSeparator; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
81 | } quickColorMetaEntry; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
82 | |
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
|
83 | // ============================================================================= |
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
|
84 | // 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
|
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 | // 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
|
87 | // 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
|
88 | // 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
|
89 | // ============================================================================= |
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 | 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
|
91 | 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
|
92 | 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
|
93 | 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
|
94 | 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
|
95 | { |
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
|
96 | 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
|
97 | 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
|
98 | } |
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 | }; |
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 | // ============================================================================= |
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
|
102 | // 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
|
103 | // |
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 | // 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
|
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 | 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
|
107 | 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
|
108 | |
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 | 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
|
110 | 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
|
111 | }; |
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 | |
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 | // ============================================================================= |
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
|
114 | // 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
|
115 | // |
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 | // 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
|
117 | // 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
|
118 | // 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
|
119 | // ============================================================================= |
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
|
120 | class ForgeWindow : public QMainWindow { |
0 | 121 | Q_OBJECT |
122 | ||
123 | 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
|
124 | ForgeWindow (); |
0 | 125 | void buildObjList (); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
126 | void setTitle (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
127 | void refresh (); |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
128 | 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
|
129 | 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
|
130 | void updateToolBars (); |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
131 | void updateRecentFilesMenu (); |
104 | 132 | 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
|
133 | void updateGridToolBar (); |
105
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
134 | 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
|
135 | short getSelectedColor(); |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
136 | 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
|
137 | void scrollToSelection (); |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
138 | void spawnContextMenu (const QPoint pos); |
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
|
139 | 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
|
140 | 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
|
141 | 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
|
142 | 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
|
143 | } |
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
|
144 | |
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
|
145 | 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
|
146 | 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
|
147 | 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
|
148 | |
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
|
149 | 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
|
150 | friend void logf (LogType eType, const char* fmt, ...); |
161 | 151 | friend void warnf (const char* fmt, ...); |
152 | friend void infof (const char* fmt, ...); | |
153 | friend void succf (const char* fmt, ...); | |
154 | friend void errf (const char* fmt, ...); | |
155 | 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
|
156 | |
0 | 157 | 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
|
158 | 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
|
159 | 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
|
160 | QTextEdit* m_msglog; |
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
|
161 | QMenu* m_recentFilesMenu; |
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
|
162 | QSplitter* m_hsplit, *m_vsplit; |
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 | 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
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | 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
|
168 | 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
|
169 | 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
|
170 | |
0 | 171 | void createMenuActions (); |
172 | 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
|
173 | 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
|
174 | 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
|
175 | 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
|
176 | |
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
|
177 | 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
|
178 | void addMenuAction (const char* name); |
0 | 179 | |
180 | 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
|
181 | 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
|
182 | void slot_action (); |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
183 | void slot_recentFile (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
184 | 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
|
185 | void slot_lastSecondCleanup (); |
0 | 186 | }; |
187 | ||
165
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
188 | // ============================================================================= |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
189 | // LabeledWidget |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
190 | // |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
191 | // 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
|
192 | // ============================================================================= |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
193 | 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
|
194 | public: |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
195 | LabeledWidget (const char* labelstr, QWidget* parent) : QWidget (parent) { |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
196 | m_widget = new R (this); |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
197 | m_label = new QLabel (labelstr, this); |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
198 | |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
199 | m_layout = new QHBoxLayout; |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
200 | m_layout->addWidget (m_label); |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
201 | m_layout->addWidget (m_widget); |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
202 | setLayout (m_layout); |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
203 | } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
204 | |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
205 | 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
|
206 | 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
|
207 | 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
|
208 | 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
|
209 | 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
|
210 | 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
|
211 | operator R* () { return m_widget; } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
212 | |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
213 | private: |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
214 | R* m_widget; |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
215 | QLabel* m_label; |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
216 | QHBoxLayout* m_layout; |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
217 | }; |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
218 | |
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
|
219 | // ----------------------------------------------------------------------------- |
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
|
220 | // 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
|
221 | 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
|
222 | 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
|
223 | 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
|
224 | 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
|
225 | void critical (str msg); |
164 | 226 | QAction* findAction (str 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
|
227 | |
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
|
228 | // ----------------------------------------------------------------------------- |
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
|
229 | // 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
|
230 | 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
|
231 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
232 | #endif // GUI_H |