Sat, 04 May 2013 04:19:03 +0300
Compile the icon resources to a QRC file, so that they are embedded in the application
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 | |
137
2b8b63be67fb
Fixed additive selection; use a green selection area background instead of blue when selecting additive; selection area borders now appear black on bright backgrounds; single additive picking an already-selected object un-selects it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
19 | #include <qgridlayout.h> |
2b8b63be67fb
Fixed additive selection; use a green selection area background instead of blue when selecting additive; selection area borders now appear black on bright backgrounds; single additive picking an already-selected object un-selects it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
20 | #include <qmessagebox.h> |
2b8b63be67fb
Fixed additive selection; use a green selection area background instead of blue when selecting additive; selection area borders now appear black on bright backgrounds; single additive picking an already-selected object un-selects it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
21 | #include <qevent.h> |
2b8b63be67fb
Fixed additive selection; use a green selection area background instead of blue when selecting additive; selection area borders now appear black on bright backgrounds; single additive picking an already-selected object un-selects it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
22 | #include <qmenubar.h> |
2b8b63be67fb
Fixed additive selection; use a green selection area background instead of blue when selecting additive; selection area borders now appear black on bright backgrounds; single additive picking an already-selected object un-selects it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
23 | #include <qstatusbar.h> |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
24 | #include <qsplitter.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:
150
diff
changeset
|
25 | #include <qlistwidget.h> |
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
|
26 | #include <qcoreapplication.h> |
0 | 27 | #include "common.h" |
26
83184d9407c7
Renamed io.cpp to file.cpp, draw.cpp to gldraw.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
28 | #include "gldraw.h" |
0 | 29 | #include "gui.h" |
26
83184d9407c7
Renamed io.cpp to file.cpp, draw.cpp to gldraw.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
30 | #include "file.h" |
69
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
31 | #include "config.h" |
76
42284126072a
Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
32 | #include "misc.h" |
42284126072a
Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
33 | #include "colors.h" |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
34 | #include "history.h" |
77
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
35 | #include "config.h" |
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
36 | |
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
|
37 | EXTERN_ACTION (newFile) |
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
|
38 | EXTERN_ACTION (open) |
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
|
39 | EXTERN_ACTION (save) |
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
|
40 | EXTERN_ACTION (saveAs) |
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
|
41 | EXTERN_ACTION (settings) |
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
|
42 | EXTERN_ACTION (exit) |
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
|
43 | EXTERN_ACTION (cut) |
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
|
44 | EXTERN_ACTION (copy) |
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 | EXTERN_ACTION (paste) |
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 | EXTERN_ACTION (del) |
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 | EXTERN_ACTION (setColor) |
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 | EXTERN_ACTION (inlineContents) |
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 | EXTERN_ACTION (deepInline) |
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 | EXTERN_ACTION (splitQuads) |
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 | EXTERN_ACTION (setContents) |
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 | EXTERN_ACTION (makeBorders) |
103
b0a345196435
Added the ability to add vertices to object corners
Santeri Piippo <crimsondusk64@gmail.com>
parents:
102
diff
changeset
|
53 | EXTERN_ACTION (makeCornerVerts) |
84
c9438ea54ed9
Added move up/down actions.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
79
diff
changeset
|
54 | EXTERN_ACTION (moveUp) |
c9438ea54ed9
Added move up/down actions.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
79
diff
changeset
|
55 | EXTERN_ACTION (moveDown) |
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
|
56 | EXTERN_ACTION (newSubfile) |
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 | EXTERN_ACTION (newLine) |
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 | EXTERN_ACTION (newCondLine) |
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 | EXTERN_ACTION (newTriangle) |
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 | EXTERN_ACTION (newQuad) |
150
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
147
diff
changeset
|
61 | EXTERN_ACTION (newComment) |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
147
diff
changeset
|
62 | EXTERN_ACTION (newBFC) |
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 | EXTERN_ACTION (newVertex) |
111
125e8031dbf1
Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
64 | EXTERN_ACTION (newRadial) |
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 | EXTERN_ACTION (help) |
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 | EXTERN_ACTION (about) |
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 | EXTERN_ACTION (aboutQt) |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
84
diff
changeset
|
68 | EXTERN_ACTION (undo) |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
84
diff
changeset
|
69 | EXTERN_ACTION (redo) |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
94
diff
changeset
|
70 | EXTERN_ACTION (showHistory) |
155 | 71 | EXTERN_ACTION (selectAll) |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
72 | EXTERN_ACTION (selectByColor) |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
73 | EXTERN_ACTION (selectByType) |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
74 | EXTERN_ACTION (moveXNeg) |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
75 | EXTERN_ACTION (moveYNeg) |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
76 | EXTERN_ACTION (moveZNeg) |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
77 | EXTERN_ACTION (moveXPos) |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
78 | EXTERN_ACTION (moveYPos) |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
79 | EXTERN_ACTION (moveZPos) |
118
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
80 | EXTERN_ACTION (invert) |
120
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
81 | EXTERN_ACTION (rotateXNeg) |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
82 | EXTERN_ACTION (rotateYNeg) |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
83 | EXTERN_ACTION (rotateZNeg) |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
84 | EXTERN_ACTION (rotateXPos) |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
85 | EXTERN_ACTION (rotateYPos) |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
86 | EXTERN_ACTION (rotateZPos) |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
87 | EXTERN_ACTION (roundCoords) |
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
|
88 | EXTERN_ACTION (gridCoarse) |
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
|
89 | EXTERN_ACTION (gridMedium) |
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
|
90 | EXTERN_ACTION (gridFine) |
132
577e8e89d8de
Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents:
127
diff
changeset
|
91 | EXTERN_ACTION (resetView) |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
92 | EXTERN_ACTION (insertFrom) |
142
6e8aee653dab
Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
93 | EXTERN_ACTION (insertRaw) |
143
e3c37b950a68
Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
142
diff
changeset
|
94 | EXTERN_ACTION (screencap) |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
95 | EXTERN_ACTION (editObject) |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
96 | EXTERN_ACTION (uncolorize) |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
97 | EXTERN_ACTION (axes) |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
98 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
99 | #ifndef RELEASE |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
100 | EXTERN_ACTION (addTestQuad) |
111
125e8031dbf1
Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
101 | EXTERN_ACTION (addTestRadial) |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
102 | #endif // RELEASE |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
103 | |
77
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
104 | vector<actionmeta> g_ActionMeta; |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
105 | |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
106 | static bool g_bSelectionLocked = false; |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
107 | |
69
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
108 | cfg (bool, lv_colorize, true); |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
109 | cfg (int, gui_toolbar_iconsize, 24); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
110 | cfg (str, gui_colortoolbar, "16:24:|:0:1:2:3:4:5:6:7"); |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
111 | extern_cfg (str, io_recentfiles); |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
112 | extern_cfg (bool, gl_axes); |
69
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
113 | |
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
|
114 | // ============================================================================= |
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
|
115 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
116 | // ============================================================================= |
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
|
117 | ForgeWindow::ForgeWindow () { |
108
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
118 | g_ForgeWindow = this; |
106
46e4202a44fc
Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents:
105
diff
changeset
|
119 | R = new GLRenderer; |
0 | 120 | |
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:
150
diff
changeset
|
121 | objList = new 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:
150
diff
changeset
|
122 | objList->setSelectionMode (QListWidget::ExtendedSelection); |
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:
150
diff
changeset
|
123 | objList->setAlternatingRowColors (true); |
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:
150
diff
changeset
|
124 | connect (objList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selectionChanged ())); |
0 | 125 | |
126 | qMessageLog = new QTextEdit; | |
127 | qMessageLog->setReadOnly (true); | |
128 | qMessageLog->setMaximumHeight (96); | |
129 | ||
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
130 | hsplit = new QSplitter; |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
131 | hsplit->addWidget (R); |
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:
150
diff
changeset
|
132 | hsplit->addWidget (objList); |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
133 | |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
134 | vsplit = new QSplitter (Qt::Vertical); |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
135 | vsplit->addWidget (hsplit); |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
136 | vsplit->addWidget (qMessageLog); |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
137 | |
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
138 | setCentralWidget (vsplit); |
0 | 139 | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
140 | quickColorMeta = parseQuickColorMeta (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
141 | |
0 | 142 | createMenuActions (); |
143 | createMenus (); | |
144 | createToolbars (); | |
145 | ||
22
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
146 | slot_selectionChanged (); |
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
147 | |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
148 | setStatusBar (new QStatusBar); |
158
499286fcbf37
Compile the icon resources to a QRC file, so that they are embedded in the application
Santeri Piippo <crimsondusk64@gmail.com>
parents:
156
diff
changeset
|
149 | setWindowIcon (getIcon ("ldforge")); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
150 | setTitle (); |
0 | 151 | setMinimumSize (320, 200); |
152 | resize (800, 600); | |
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
|
153 | |
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
|
154 | connect (QCoreApplication::instance (), SIGNAL (aboutToQuit ()), this, SLOT (slot_lastSecondCleanup ())); |
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
|
155 | } |
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
|
156 | |
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
|
157 | // ============================================================================= |
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
|
158 | void ForgeWindow::slot_lastSecondCleanup () { |
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
|
159 | R->setParent (null); |
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
|
160 | delete R; |
0 | 161 | } |
162 | ||
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
|
163 | // ============================================================================= |
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
|
164 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
165 | // ============================================================================= |
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
|
166 | void ForgeWindow::createMenuActions () { |
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
|
167 | // Create the actions based on stored 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
|
168 | for (actionmeta meta : 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
|
169 | QAction*& qAct = *meta.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
|
170 | qAct = new QAction (getIcon (meta.sIconName), meta.sDisplayName, 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
|
171 | qAct->setStatusTip (meta.sDescription); |
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
|
172 | qAct->setShortcut (*meta.conf); |
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
|
173 | |
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
|
174 | connect (qAct, SIGNAL (triggered ()), this, SLOT (slot_action ())); |
77
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
175 | } |
0 | 176 | |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
177 | // Grid actions and axes are checkable |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
178 | ACTION (gridCoarse)->setCheckable (true); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
179 | ACTION (gridMedium)->setCheckable (true); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
180 | ACTION (gridFine)->setCheckable (true); |
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
|
181 | |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
182 | ACTION (axes)->setCheckable (true); |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
183 | ACTION (axes)->setChecked (gl_axes); |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
184 | |
0 | 185 | // things not implemented yet |
77
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
186 | QAction* const qaDisabledActions[] = { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
187 | ACTION (help), |
0 | 188 | }; |
189 | ||
77
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
190 | for (QAction* act : qaDisabledActions) |
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
191 | act->setEnabled (false); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
192 | |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
193 | History::updateActions (); |
0 | 194 | } |
195 | ||
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
|
196 | // ============================================================================= |
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
|
197 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
198 | // ============================================================================= |
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
|
199 | void ForgeWindow::createMenus () { |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
200 | qRecentFilesMenu = new QMenu (tr ("Open &Recent")); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
201 | qRecentFilesMenu->setIcon (getIcon ("open-recent")); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
202 | updateRecentFilesMenu (); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
203 | |
0 | 204 | // File menu |
205 | qFileMenu = menuBar ()->addMenu (tr ("&File")); | |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
206 | qFileMenu->addAction (ACTION (newFile)); // New |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
207 | qFileMenu->addAction (ACTION (open)); // Open |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
208 | qFileMenu->addMenu (qRecentFilesMenu); // Open Recent |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
209 | qFileMenu->addAction (ACTION (save)); // Save |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
210 | qFileMenu->addAction (ACTION (saveAs)); // Save As |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
211 | qFileMenu->addSeparator (); // ------- |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
212 | qFileMenu->addAction (ACTION (settings)); // Settings |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
213 | qFileMenu->addSeparator (); // ------- |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
214 | qFileMenu->addAction (ACTION (exit)); // Exit |
0 | 215 | |
132
577e8e89d8de
Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents:
127
diff
changeset
|
216 | // View menu |
577e8e89d8de
Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents:
127
diff
changeset
|
217 | qViewMenu = menuBar ()->addMenu (tr ("&View")); |
143
e3c37b950a68
Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
142
diff
changeset
|
218 | qViewMenu->addAction (ACTION (resetView)); // Reset View |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
219 | qViewMenu->addAction (ACTION (axes)); // Draw Axes |
143
e3c37b950a68
Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
142
diff
changeset
|
220 | qViewMenu->addSeparator (); // ----- |
e3c37b950a68
Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
142
diff
changeset
|
221 | qViewMenu->addAction (ACTION (screencap)); // Screencap Part |
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
|
222 | qViewMenu->addAction (ACTION (showHistory)); // Edit History |
132
577e8e89d8de
Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents:
127
diff
changeset
|
223 | |
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
|
224 | // Insert menu |
0 | 225 | qInsertMenu = menuBar ()->addMenu (tr ("&Insert")); |
143
e3c37b950a68
Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
142
diff
changeset
|
226 | qInsertMenu->addAction (ACTION (insertFrom)); // Insert from File |
142
6e8aee653dab
Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
227 | qInsertMenu->addAction (ACTION (insertRaw)); // Insert Raw |
6e8aee653dab
Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
228 | qInsertMenu->addSeparator (); // ------- |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
229 | qInsertMenu->addAction (ACTION (newSubfile)); // New Subfile |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
230 | qInsertMenu->addAction (ACTION (newLine)); // New Line |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
231 | qInsertMenu->addAction (ACTION (newTriangle)); // New Triangle |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
232 | qInsertMenu->addAction (ACTION (newQuad)); // New Quad |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
233 | qInsertMenu->addAction (ACTION (newCondLine)); // New Conditional Line |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
234 | qInsertMenu->addAction (ACTION (newComment)); // New Comment |
150
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
147
diff
changeset
|
235 | qInsertMenu->addAction (ACTION (newBFC)); // New BFC Statment |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
236 | qInsertMenu->addAction (ACTION (newVertex)); // New Vertex |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
237 | qInsertMenu->addAction (ACTION (newRadial)); // New Radial |
0 | 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 | // Edit menu |
0 | 240 | qEditMenu = menuBar ()->addMenu (tr ("&Edit")); |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
241 | qEditMenu->addAction (ACTION (undo)); // Undo |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
242 | qEditMenu->addAction (ACTION (redo)); // Redo |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
243 | qEditMenu->addSeparator (); // ----- |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
244 | qEditMenu->addAction (ACTION (cut)); // Cut |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
245 | qEditMenu->addAction (ACTION (copy)); // Copy |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
246 | qEditMenu->addAction (ACTION (paste)); // Paste |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
247 | qEditMenu->addAction (ACTION (del)); // Delete |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
248 | qEditMenu->addSeparator (); // ----- |
155 | 249 | qEditMenu->addAction (ACTION (selectAll)); // Select All |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
250 | qEditMenu->addAction (ACTION (selectByColor)); // Select by Color |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
251 | qEditMenu->addAction (ACTION (selectByType)); // Select by Type |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
252 | qEditMenu->addSeparator (); // ----- |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
253 | |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
254 | QMenu* toolsMenu = menuBar ()->addMenu (tr ("&Tools")); |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
255 | toolsMenu->addAction (ACTION (setColor)); // Set Color |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
256 | toolsMenu->addAction (ACTION (invert)); // Invert |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
257 | toolsMenu->addAction (ACTION (inlineContents)); // Inline |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
258 | toolsMenu->addAction (ACTION (deepInline)); // Deep Inline |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
259 | toolsMenu->addAction (ACTION (splitQuads)); // Split Quads |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
260 | toolsMenu->addAction (ACTION (setContents)); // Set Contents |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
261 | toolsMenu->addAction (ACTION (makeBorders)); // Make Borders |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
262 | toolsMenu->addAction (ACTION (makeCornerVerts)); // Make Corner Vertices |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
263 | toolsMenu->addAction (ACTION (roundCoords)); // Round Coordinates |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
264 | toolsMenu->addAction (ACTION (uncolorize)); // Uncolorize |
0 | 265 | |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
266 | // Move menu |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
267 | qMoveMenu = menuBar ()->addMenu (tr ("&Move")); |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
268 | qMoveMenu->addAction (ACTION (moveUp)); // Move Up |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
269 | qMoveMenu->addAction (ACTION (moveDown)); // Move Down |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
270 | qMoveMenu->addSeparator (); // ----- |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
271 | qMoveMenu->addAction (ACTION (gridCoarse)); // Coarse Grid |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
272 | qMoveMenu->addAction (ACTION (gridMedium)); // Medium Grid |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
273 | qMoveMenu->addAction (ACTION (gridFine)); // Fine Grid |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
274 | qMoveMenu->addSeparator (); // ----- |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
275 | qMoveMenu->addAction (ACTION (moveXPos)); // Move +X |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
276 | qMoveMenu->addAction (ACTION (moveXNeg)); // Move -X |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
277 | qMoveMenu->addAction (ACTION (moveYPos)); // Move +Y |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
278 | qMoveMenu->addAction (ACTION (moveYNeg)); // Move -Y |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
279 | qMoveMenu->addAction (ACTION (moveZPos)); // Move +Z |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
280 | qMoveMenu->addAction (ACTION (moveZNeg)); // Move -Z |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
281 | qMoveMenu->addSeparator (); // ----- |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
282 | qMoveMenu->addAction (ACTION (rotateXPos)); // Rotate +X |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
283 | qMoveMenu->addAction (ACTION (rotateXNeg)); // Rotate -X |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
284 | qMoveMenu->addAction (ACTION (rotateYPos)); // Rotate +Y |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
285 | qMoveMenu->addAction (ACTION (rotateYNeg)); // Rotate -Y |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
286 | qMoveMenu->addAction (ACTION (rotateZPos)); // Rotate +Z |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
287 | qMoveMenu->addAction (ACTION (rotateZNeg)); // Rotate -Z |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
288 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
289 | #ifndef RELEASE |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
290 | // Debug menu |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
291 | qDebugMenu = menuBar ()->addMenu (tr ("&Debug")); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
292 | qDebugMenu->addAction (ACTION (addTestQuad)); // Add Test Quad |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
293 | qDebugMenu->addAction (ACTION (addTestRadial)); // Add Test Radial |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
294 | #endif // RELEASE |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
295 | |
0 | 296 | // Help menu |
297 | qHelpMenu = menuBar ()->addMenu (tr ("&Help")); | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
298 | qHelpMenu->addAction (ACTION (help)); // Help |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
299 | qHelpMenu->addSeparator (); // ----- |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
300 | qHelpMenu->addAction (ACTION (about)); // About |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
301 | qHelpMenu->addAction (ACTION (aboutQt)); // About Qt |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
302 | } |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
303 | |
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
|
304 | // ============================================================================= |
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
|
305 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
306 | // ============================================================================= |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
307 | void ForgeWindow::updateRecentFilesMenu () { |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
308 | // First, clear any items in the recent files menu |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
309 | for (QAction* qRecent : qaRecentFiles) |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
310 | delete qRecent; |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
311 | qaRecentFiles.clear (); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
312 | |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
313 | std::vector<str> zaFiles = io_recentfiles.value / "@"; |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
314 | for (long i = zaFiles.size() - 1; i >= 0; --i) { |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
315 | str zFile = zaFiles[i]; |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
316 | |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
317 | QAction* qRecent = new QAction (getIcon ("open-recent"), zFile, this); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
318 | |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
319 | connect (qRecent, SIGNAL (triggered ()), this, SLOT (slot_recentFile ())); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
320 | qRecentFilesMenu->addAction (qRecent); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
321 | qaRecentFiles.push_back (qRecent); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
322 | } |
0 | 323 | } |
324 | ||
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
|
325 | // ============================================================================= |
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
|
326 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
327 | // ============================================================================= |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
328 | static QToolBar* g_CurrentToolBar; |
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:
85
diff
changeset
|
329 | static Qt::ToolBarArea g_ToolBarArea = Qt::TopToolBarArea; |
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:
85
diff
changeset
|
330 | |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
331 | void ForgeWindow::initSingleToolBar (const char* sName) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
332 | QToolBar* toolbar = new QToolBar (sName); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
333 | addToolBar (g_ToolBarArea, toolbar); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
334 | qaToolBars.push_back (toolbar); |
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:
85
diff
changeset
|
335 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
336 | g_CurrentToolBar = toolbar; |
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:
85
diff
changeset
|
337 | } |
77
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
338 | |
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
|
339 | void ForgeWindow::createToolbars () { |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
340 | initSingleToolBar ("File"); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
341 | g_CurrentToolBar->addAction (ACTION (newFile)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
342 | g_CurrentToolBar->addAction (ACTION (open)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
343 | g_CurrentToolBar->addAction (ACTION (save)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
344 | g_CurrentToolBar->addAction (ACTION (saveAs)); |
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:
85
diff
changeset
|
345 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
346 | // ========================================== |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
347 | initSingleToolBar ("Insert"); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
348 | g_CurrentToolBar->addAction (ACTION (newSubfile)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
349 | g_CurrentToolBar->addAction (ACTION (newLine)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
350 | g_CurrentToolBar->addAction (ACTION (newTriangle)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
351 | g_CurrentToolBar->addAction (ACTION (newQuad)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
352 | g_CurrentToolBar->addAction (ACTION (newCondLine)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
353 | g_CurrentToolBar->addAction (ACTION (newComment)); |
150
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
147
diff
changeset
|
354 | g_CurrentToolBar->addAction (ACTION (newBFC)); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
355 | g_CurrentToolBar->addAction (ACTION (newVertex)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
356 | g_CurrentToolBar->addAction (ACTION (newRadial)); |
0 | 357 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
358 | // ========================================== |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
359 | initSingleToolBar ("Edit"); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
360 | g_CurrentToolBar->addAction (ACTION (undo)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
361 | g_CurrentToolBar->addAction (ACTION (redo)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
362 | g_CurrentToolBar->addAction (ACTION (cut)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
363 | g_CurrentToolBar->addAction (ACTION (copy)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
364 | g_CurrentToolBar->addAction (ACTION (paste)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
365 | g_CurrentToolBar->addAction (ACTION (del)); |
0 | 366 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
367 | // ========================================== |
120
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
368 | initSingleToolBar ("Select"); |
155 | 369 | g_CurrentToolBar->addAction (ACTION (selectAll)); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
370 | g_CurrentToolBar->addAction (ACTION (selectByColor)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
371 | g_CurrentToolBar->addAction (ACTION (selectByType)); |
120
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
372 | |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
373 | addToolBarBreak (Qt::TopToolBarArea); |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
374 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
375 | // ========================================== |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
376 | initSingleToolBar ("Move"); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
377 | g_CurrentToolBar->addAction (ACTION (moveUp)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
378 | g_CurrentToolBar->addAction (ACTION (moveDown)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
379 | g_CurrentToolBar->addAction (ACTION (moveXPos)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
380 | g_CurrentToolBar->addAction (ACTION (moveXNeg)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
381 | g_CurrentToolBar->addAction (ACTION (moveYPos)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
382 | g_CurrentToolBar->addAction (ACTION (moveYNeg)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
383 | g_CurrentToolBar->addAction (ACTION (moveZPos)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
384 | g_CurrentToolBar->addAction (ACTION (moveZNeg)); |
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:
85
diff
changeset
|
385 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
386 | // ========================================== |
120
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
387 | initSingleToolBar ("Rotate"); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
388 | g_CurrentToolBar->addAction (ACTION (rotateXPos)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
389 | g_CurrentToolBar->addAction (ACTION (rotateXNeg)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
390 | g_CurrentToolBar->addAction (ACTION (rotateYPos)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
391 | g_CurrentToolBar->addAction (ACTION (rotateYNeg)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
392 | g_CurrentToolBar->addAction (ACTION (rotateZPos)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
393 | g_CurrentToolBar->addAction (ACTION (rotateZNeg)); |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
394 | |
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:
85
diff
changeset
|
395 | // ========================================== |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
396 | // Grid toolbar |
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
|
397 | initSingleToolBar ("Grids"); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
398 | g_CurrentToolBar->addAction (ACTION (gridCoarse)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
399 | g_CurrentToolBar->addAction (ACTION (gridMedium)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
400 | g_CurrentToolBar->addAction (ACTION (gridFine)); |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
401 | addToolBarBreak (Qt::TopToolBarArea); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
402 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
403 | // ========================================== |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
404 | initSingleToolBar ("View"); |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
405 | g_CurrentToolBar->addAction (ACTION (axes)); |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
406 | |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
407 | // ========================================== |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
408 | // Color toolbar |
101
69d1464801d7
Remade vertex icons, the old ones sucked.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
100
diff
changeset
|
409 | qColorToolBar = new QToolBar ("Quick Colors"); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
410 | addToolBar (Qt::RightToolBarArea, qColorToolBar); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
411 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
412 | // ========================================== |
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:
85
diff
changeset
|
413 | // Left area toolbars |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
414 | //g_ToolBarArea = Qt::LeftToolBarArea; |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
415 | initSingleToolBar ("Tools"); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
416 | g_CurrentToolBar->addAction (ACTION (setColor)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
417 | g_CurrentToolBar->addAction (ACTION (invert)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
418 | g_CurrentToolBar->addAction (ACTION (inlineContents)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
419 | g_CurrentToolBar->addAction (ACTION (deepInline)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
420 | g_CurrentToolBar->addAction (ACTION (splitQuads)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
421 | g_CurrentToolBar->addAction (ACTION (setContents)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
422 | g_CurrentToolBar->addAction (ACTION (makeBorders)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
423 | g_CurrentToolBar->addAction (ACTION (makeCornerVerts)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
424 | g_CurrentToolBar->addAction (ACTION (roundCoords)); |
143
e3c37b950a68
Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
142
diff
changeset
|
425 | g_CurrentToolBar->addAction (ACTION (screencap)); |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
426 | g_CurrentToolBar->addAction (ACTION (uncolorize)); |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
427 | |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
428 | |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
429 | updateToolBars (); |
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
430 | } |
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
431 | |
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
|
432 | // ============================================================================= |
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
|
433 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
434 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
435 | std::vector<quickColorMetaEntry> parseQuickColorMeta () { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
436 | std::vector<quickColorMetaEntry> meta; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
437 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
438 | for (str zColor : gui_colortoolbar.value / ":") { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
439 | if (zColor == "|") { |
104 | 440 | meta.push_back ({null, null, true}); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
441 | } else { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
442 | color* col = getColor (atoi (zColor)); |
104 | 443 | meta.push_back ({col, null, false}); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
444 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
445 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
446 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
447 | return meta; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
448 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
449 | |
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
|
450 | // ============================================================================= |
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
|
451 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
452 | // ============================================================================= |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
453 | void ForgeWindow::updateToolBars () { |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
454 | for (QToolBar* qBar : qaToolBars) |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
455 | qBar->setIconSize (QSize (gui_toolbar_iconsize, gui_toolbar_iconsize)); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
456 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
457 | // Update the quick color toolbar. |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
458 | for (QPushButton* qButton : qaColorButtons) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
459 | delete qButton; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
460 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
461 | qaColorButtons.clear (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
462 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
463 | // Clear the toolbar to remove separators |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
464 | qColorToolBar->clear (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
465 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
466 | for (quickColorMetaEntry& entry : quickColorMeta) { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
467 | if (entry.bSeparator) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
468 | qColorToolBar->addSeparator (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
469 | else { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
470 | QPushButton* qColorButton = new QPushButton; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
471 | qColorButton->setAutoFillBackground (true); |
116 | 472 | qColorButton->setStyleSheet (format ("background-color: %s", entry.col->zColorString.chars())); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
473 | qColorButton->setToolTip (entry.col->zName); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
474 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
475 | connect (qColorButton, SIGNAL (clicked ()), this, SLOT (slot_quickColor ())); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
476 | qColorToolBar->addWidget (qColorButton); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
477 | qaColorButtons.push_back (qColorButton); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
478 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
479 | entry.btn = qColorButton; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
480 | } |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
481 | } |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
482 | |
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
|
483 | updateGridToolBar (); |
0 | 484 | } |
485 | ||
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
|
486 | // ============================================================================= |
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
|
487 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
488 | // ============================================================================= |
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
|
489 | void ForgeWindow::updateGridToolBar () { |
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
|
490 | // Ensure that the current grid - and only the current grid - is selected. |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
491 | ACTION (gridCoarse)->setChecked (grid == Grid::Coarse); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
492 | ACTION (gridMedium)->setChecked (grid == Grid::Medium); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
493 | ACTION (gridFine)->setChecked (grid == Grid::Fine); |
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
|
494 | } |
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
|
495 | |
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
|
496 | // ============================================================================= |
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
|
497 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
498 | // ============================================================================= |
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
|
499 | void ForgeWindow::setTitle () { |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
500 | str title = APPNAME_DISPLAY " v"; |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
501 | title += versionString; |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
502 | |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
503 | // Append our current file if we have one |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
504 | if (g_CurrentFile) { |
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
|
505 | title += format (": %s", basename (g_CurrentFile->zFileName.chars())); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
506 | |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
507 | if (g_CurrentFile->objects.size() > 0 && |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
508 | g_CurrentFile->objects[0]->getType() == OBJ_Comment) |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
509 | { |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
510 | // Append title |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
511 | LDComment* comm = static_cast<LDComment*> (g_CurrentFile->objects[0]); |
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
|
512 | title += format (": %s", comm->zText.chars()); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
513 | } |
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
|
514 | |
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
|
515 | if (History::pos () != g_CurrentFile->savePos) |
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
|
516 | title += '*'; |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
517 | } |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
518 | |
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
|
519 | setWindowTitle (title); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
520 | } |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
521 | |
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
|
522 | // ============================================================================= |
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
|
523 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
524 | // ============================================================================= |
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
|
525 | void ForgeWindow::slot_action () { |
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
|
526 | // Get the action that triggered this slot. |
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
|
527 | QAction* qAct = static_cast<QAction*> (sender ()); |
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
|
528 | |
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
|
529 | // Find the meta for the action. |
104 | 530 | actionmeta* pMeta = null; |
0 | 531 | |
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
|
532 | for (actionmeta meta : 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
|
533 | if (*meta.qAct == 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
|
534 | pMeta = &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
|
535 | break; |
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
|
536 | } |
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
|
537 | } |
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
|
538 | |
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
|
539 | if (!pMeta) { |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
540 | logf (LOG_Warning, "unknown signal sender %p!\n", qAct); |
42
499c25af0303
Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents:
41
diff
changeset
|
541 | return; |
499c25af0303
Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents:
41
diff
changeset
|
542 | } |
499c25af0303
Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents:
41
diff
changeset
|
543 | |
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
|
544 | // We have the meta, now call the 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
|
545 | (*pMeta->handler) (); |
57
6e89589f1fe8
Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
56
diff
changeset
|
546 | } |
6e89589f1fe8
Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
56
diff
changeset
|
547 | |
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
|
548 | // ============================================================================= |
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
|
549 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
550 | // ============================================================================= |
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:
92
diff
changeset
|
551 | void ForgeWindow::deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
552 | if (sel.size () == 0) |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
553 | return; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
554 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
555 | std::vector<LDObject*> selCopy = sel; |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
556 | |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
557 | // Delete the objects that were being selected |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
558 | for (LDObject* obj : selCopy) { |
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:
92
diff
changeset
|
559 | if (papObjects && ulapIndices) { |
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:
92
diff
changeset
|
560 | papObjects->push_back (obj->clone ()); |
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:
92
diff
changeset
|
561 | ulapIndices->push_back (obj->getIndex (g_CurrentFile)); |
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:
92
diff
changeset
|
562 | } |
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:
92
diff
changeset
|
563 | |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
564 | g_CurrentFile->forgetObject (obj); |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
565 | delete obj; |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
566 | } |
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
|
567 | |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
568 | refresh (); |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
569 | } |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
570 | |
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
|
571 | // ============================================================================= |
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
|
572 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
573 | // ============================================================================= |
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
|
574 | void ForgeWindow::buildObjList () { |
3
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
575 | if (!g_CurrentFile) |
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
576 | return; |
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
577 | |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
578 | // Lock the selection while we do this so that refreshing the object list |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
579 | // doesn't trigger selection updating so that the selection doesn't get lost |
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:
150
diff
changeset
|
580 | // while this is done. |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
581 | g_bSelectionLocked = true; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
582 | |
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:
150
diff
changeset
|
583 | objList->clear (); |
3
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
584 | |
70
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
585 | for (LDObject* obj : g_CurrentFile->objects) { |
0 | 586 | str zText; |
587 | switch (obj->getType ()) { | |
588 | case OBJ_Comment: | |
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:
11
diff
changeset
|
589 | zText = static_cast<LDComment*> (obj)->zText.chars(); |
10
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
590 | |
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
591 | // Remove leading whitespace |
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
592 | while (~zText && zText[0] == ' ') |
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
593 | zText -= -1; |
0 | 594 | break; |
595 | ||
596 | case OBJ_Empty: | |
597 | break; // leave it empty | |
598 | ||
599 | case OBJ_Line: | |
600 | { | |
601 | LDLine* line = static_cast<LDLine*> (obj); | |
602 | zText.format ("%s, %s", | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
603 | line->vaCoords[0].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
604 | line->vaCoords[1].stringRep (true).chars()); |
0 | 605 | } |
606 | break; | |
607 | ||
608 | case OBJ_Triangle: | |
609 | { | |
610 | LDTriangle* triangle = static_cast<LDTriangle*> (obj); | |
611 | zText.format ("%s, %s, %s", | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
612 | triangle->vaCoords[0].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
613 | triangle->vaCoords[1].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
614 | triangle->vaCoords[2].stringRep (true).chars()); |
0 | 615 | } |
616 | break; | |
617 | ||
618 | case OBJ_Quad: | |
619 | { | |
620 | LDQuad* quad = static_cast<LDQuad*> (obj); | |
10
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
621 | zText.format ("%s, %s, %s, %s", |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
622 | quad->vaCoords[0].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
623 | quad->vaCoords[1].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
624 | quad->vaCoords[2].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
625 | quad->vaCoords[3].stringRep (true).chars()); |
0 | 626 | } |
627 | break; | |
628 | ||
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
629 | case OBJ_CondLine: |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
630 | { |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
631 | LDCondLine* line = static_cast<LDCondLine*> (obj); |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
632 | zText.format ("%s, %s, %s, %s", |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
633 | line->vaCoords[0].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
634 | line->vaCoords[1].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
635 | line->vaCoords[2].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
636 | line->vaCoords[3].stringRep (true).chars()); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
637 | } |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
638 | break; |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
639 | |
0 | 640 | case OBJ_Gibberish: |
641 | zText.format ("ERROR: %s", | |
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:
11
diff
changeset
|
642 | static_cast<LDGibberish*> (obj)->zContents.chars()); |
0 | 643 | break; |
644 | ||
645 | case OBJ_Vertex: | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
646 | zText.format ("%s", static_cast<LDVertex*> (obj)->vPosition.stringRep (true).chars()); |
0 | 647 | break; |
648 | ||
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
649 | case OBJ_Subfile: |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
650 | { |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
651 | LDSubfile* ref = static_cast<LDSubfile*> (obj); |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
652 | |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
653 | zText.format ("%s %s, (", |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
654 | ref->zFileName.chars(), ref->vPosition.stringRep (true).chars()); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
655 | |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
656 | for (short i = 0; i < 9; ++i) |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
657 | zText.appendformat ("%s%s", |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
658 | ftoa (ref->mMatrix[i]).chars(), |
41
4ca63da5546b
Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
659 | (i != 8) ? " " : ""); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
660 | |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
661 | zText += ')'; |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
662 | } |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
663 | break; |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
664 | |
73
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
665 | case OBJ_BFC: |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
666 | { |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
667 | LDBFC* bfc = static_cast<LDBFC*> (obj); |
114
fe1bfc5f59ed
Added functionality for getting a primitive name from a radial.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
113
diff
changeset
|
668 | zText = LDBFC::saStatements[bfc->eStatement]; |
73
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
669 | } |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
670 | break; |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
671 | |
112
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
672 | case OBJ_Radial: |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
673 | { |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
674 | LDRadial* pRad = static_cast<LDRadial*> (obj); |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
675 | zText.format ("%d / %d %s", pRad->dSegments, pRad->dDivisions, pRad->radialTypeName()); |
112
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
676 | |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
677 | if (pRad->eRadialType == LDRadial::Ring || pRad->eRadialType == LDRadial::Cone) |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
678 | zText.appendformat (" %d", pRad->dRingNum); |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
679 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
680 | zText.appendformat (" %s", pRad->vPosition.stringRep (true).chars ()); |
112
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
681 | } |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
682 | break; |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
683 | |
0 | 684 | default: |
685 | zText = g_saObjTypeNames[obj->getType ()]; | |
686 | break; | |
687 | } | |
688 | ||
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:
150
diff
changeset
|
689 | QListWidgetItem* item = new QListWidgetItem (zText.chars()); |
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:
150
diff
changeset
|
690 | item->setIcon (getIcon (g_saObjTypeIcons[obj->getType ()])); |
0 | 691 | |
113
bbaa40226ec9
Radial saving and reading from files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
112
diff
changeset
|
692 | // Color gibberish orange on red so it stands out. |
11
323390a03294
Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
693 | if (obj->getType() == OBJ_Gibberish) { |
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:
150
diff
changeset
|
694 | item->setBackground (QColor ("#AA0000")); |
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:
150
diff
changeset
|
695 | item->setForeground (QColor ("#FFAA00")); |
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:
150
diff
changeset
|
696 | } else if (lv_colorize && obj->dColor != -1 && |
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:
150
diff
changeset
|
697 | obj->dColor != maincolor && obj->dColor != edgecolor) |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
50
diff
changeset
|
698 | { |
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
50
diff
changeset
|
699 | // If the object isn't in the main or edge color, draw this |
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
50
diff
changeset
|
700 | // list entry in said color. |
68
c637b172d565
Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
67
diff
changeset
|
701 | color* col = getColor (obj->dColor); |
67
d523a370a17a
57181.dat (Philo's model of the XL-motor) showcased a new problem.. there was no handling of unknown colors which led into crashes. Added stdout warnings, also added mid and dark stone colors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
702 | if (col) |
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:
150
diff
changeset
|
703 | item->setForeground (col->qColor); |
11
323390a03294
Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
704 | } |
323390a03294
Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
705 | |
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:
11
diff
changeset
|
706 | obj->qObjListEntry = item; |
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:
150
diff
changeset
|
707 | objList->insertItem (objList->count (), item); |
0 | 708 | } |
709 | ||
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
710 | g_bSelectionLocked = false; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
711 | updateSelection (); |
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:
11
diff
changeset
|
712 | } |
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:
11
diff
changeset
|
713 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
714 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
715 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
716 | // ============================================================================= |
139
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
717 | void ForgeWindow::scrollToSelection () { |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
718 | if (sel.size() == 0) |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
719 | return; |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
720 | |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
721 | LDObject* obj = sel[sel.size () - 1]; |
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:
150
diff
changeset
|
722 | objList->scrollToItem (obj->qObjListEntry); |
139
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
723 | } |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
724 | |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
725 | // ============================================================================= |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
726 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
727 | // ============================================================================= |
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
|
728 | void ForgeWindow::slot_selectionChanged () { |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
729 | if (g_bSelectionLocked == true) |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
730 | return; |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
731 | |
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
|
732 | /* |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
733 | // If the selection isn't 1 exact, disable setting contents |
77
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
734 | ACTION (setContents)->setEnabled (qObjList->selectedItems().size() == 1); |
22
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
735 | |
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
736 | // If we have no selection, disable splitting quads |
77
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
737 | ACTION (splitQuads)->setEnabled (qObjList->selectedItems().size() > 0); |
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
|
738 | */ |
108
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
739 | |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
740 | // Update the shared selection array, unless this was called during GL picking, |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
741 | // in which case the GL renderer takes care of the selection. |
132
577e8e89d8de
Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents:
127
diff
changeset
|
742 | if (R->picking == false) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
743 | std::vector<LDObject*> paPriorSelection = sel; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
744 | sel = getSelectedObjects (); |
108
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
745 | |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
746 | // Update the GL renderer |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
747 | for (LDObject* obj : sel) |
108
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
748 | R->recompileObject (obj); |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
749 | |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
750 | for (LDObject* obj : paPriorSelection) |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
751 | R->recompileObject (obj); |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
752 | |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
753 | R->updateSelFlash (); |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
754 | R->refresh (); |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
755 | } |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
756 | } |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
757 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
758 | // ============================================================================= |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
759 | void ForgeWindow::slot_recentFile () { |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
760 | QAction* qAct = static_cast<QAction*> (sender ()); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
761 | openMainFile (qAct->text ()); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
762 | } |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
763 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
764 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
765 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
766 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
767 | void ForgeWindow::slot_quickColor () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
768 | QPushButton* button = static_cast<QPushButton*> (sender ()); |
104 | 769 | color* col = null; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
770 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
771 | for (quickColorMetaEntry entry : quickColorMeta) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
772 | if (entry.btn == button) { |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
773 | col = entry.col; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
774 | break; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
775 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
776 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
777 | |
104 | 778 | if (col == null) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
779 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
780 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
781 | std::vector<ulong> indices; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
782 | std::vector<short> colors; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
783 | short newColor = col->index (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
784 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
785 | for (LDObject* obj : sel) { |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
786 | if (obj->dColor == -1) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
787 | continue; // uncolored object |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
788 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
789 | indices.push_back (obj->getIndex (g_CurrentFile)); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
790 | colors.push_back (obj->dColor); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
791 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
792 | obj->dColor = newColor; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
793 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
794 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
795 | History::addEntry (new SetColorHistory (indices, colors, newColor)); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
796 | refresh (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
797 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
798 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
799 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
800 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
801 | // ============================================================================= |
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
|
802 | ulong ForgeWindow::getInsertionPoint () { |
139
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
803 | if (sel.size () > 0) { |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
804 | // If we have a selection, put the item after it. |
139
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
805 | return (sel[sel.size() - 1]->getIndex (g_CurrentFile)) + 1; |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
806 | } |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
807 | |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
808 | // Otherwise place the object at the end. |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
809 | return g_CurrentFile->objects.size(); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
810 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
811 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
812 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
813 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
814 | // ============================================================================= |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
815 | void ForgeWindow::refresh () { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
816 | buildObjList (); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
817 | R->hardRefresh (); |
48
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
818 | } |
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
819 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
820 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
821 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
822 | // ============================================================================= |
50
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
49
diff
changeset
|
823 | std::vector<LDObject*> ForgeWindow::getSelectedObjects () { |
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
49
diff
changeset
|
824 | std::vector<LDObject*> objs; |
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
49
diff
changeset
|
825 | |
108
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
826 | if (g_CurrentFile == nullptr) |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
827 | return objs; |
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
828 | |
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:
150
diff
changeset
|
829 | QList<QListWidgetItem*> const qaItems = objList->selectedItems (); |
108
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
830 | |
70
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
831 | for (LDObject* obj : g_CurrentFile->objects) |
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:
150
diff
changeset
|
832 | for (QListWidgetItem* qItem : qaItems) { |
70
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
833 | if (qItem == obj->qObjListEntry) { |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
834 | objs.push_back (obj); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
835 | break; |
50
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
49
diff
changeset
|
836 | } |
49
242f6ea0f5e5
Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
837 | } |
50
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
49
diff
changeset
|
838 | |
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
49
diff
changeset
|
839 | return objs; |
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
|
840 | } |
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
|
841 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
842 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
843 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
844 | // ============================================================================= |
104 | 845 | void ForgeWindow::updateSelection () { |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
846 | g_bSelectionLocked = true; |
104 | 847 | |
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:
150
diff
changeset
|
848 | objList->clearSelection (); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
849 | for (LDObject* obj : sel) |
104 | 850 | obj->qObjListEntry->setSelected (true); |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
851 | |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
852 | g_bSelectionLocked = false; |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
853 | slot_selectionChanged (); |
104 | 854 | } |
855 | ||
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
856 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
857 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
858 | // ============================================================================= |
105
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
859 | bool ForgeWindow::isSelected (LDObject* obj) { |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
860 | LDObject* pNeedle = obj->topLevelParent (); |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
861 | |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
862 | if (pNeedle == null) |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
863 | pNeedle = obj; |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
864 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
865 | for (LDObject* pHay : sel) |
105
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
866 | if (pHay == pNeedle) |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
867 | return true; |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
868 | return false; |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
869 | } |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
870 | |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
871 | short ForgeWindow::getSelectedColor() { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
872 | short result = -1; |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
873 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
874 | for (LDObject* obj : sel) { |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
875 | if (obj->dColor == -1) |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
876 | continue; // doesn't use color |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
877 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
878 | if (result != -1 && obj->dColor != result) |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
879 | return -1; // No consensus in object color |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
880 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
881 | if (result == -1) |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
882 | result = obj->dColor; |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
883 | } |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
884 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
885 | return result; |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
886 | } |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
887 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
888 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
889 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
890 | // ============================================================================= |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
891 | LDObjectType_e ForgeWindow::uniformSelectedType () { |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
892 | LDObjectType_e eResult = OBJ_Unidentified; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
893 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
894 | for (LDObject* obj : sel) { |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
895 | if (eResult != OBJ_Unidentified && obj->dColor != eResult) |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
896 | return OBJ_Unidentified; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
897 | |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
898 | if (eResult == OBJ_Unidentified) |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
899 | eResult = obj->getType (); |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
900 | } |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
901 | |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
902 | return eResult; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
903 | } |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
904 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
905 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
906 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
907 | // ============================================================================= |
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
|
908 | void ForgeWindow::closeEvent (QCloseEvent* ev) { |
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
|
909 | // Check whether it's safe to close all files. |
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
|
910 | for (OpenFile* f : g_LoadedFiles) { |
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
|
911 | if (!f->safeToClose ()) { |
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
|
912 | ev->ignore (); |
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
|
913 | return; |
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
|
914 | } |
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
|
915 | } |
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
|
916 | |
134
7fd0784471df
Save the configuration before exiting so that grid choice is preserved.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
917 | // Save the configuration before leaving so that, for instance, grid choice |
7fd0784471df
Save the configuration before exiting so that grid choice is preserved.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
918 | // is preserved across instances. |
7fd0784471df
Save the configuration before exiting so that grid choice is preserved.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
919 | config::save (); |
7fd0784471df
Save the configuration before exiting so that grid choice is preserved.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
920 | |
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
|
921 | ev->accept (); |
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
|
922 | } |
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
|
923 | |
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
|
924 | // ============================================================================= |
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
|
925 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
926 | // ============================================================================= |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
927 | void ForgeWindow::spawnContextMenu (const QPoint pos) { |
155 | 928 | const bool single = (g_ForgeWindow->sel.size () == 1); |
929 | ||
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
930 | QMenu* contextMenu = new QMenu; |
155 | 931 | |
932 | if (single) { | |
933 | contextMenu->addAction (ACTION (editObject)); | |
934 | contextMenu->addSeparator (); | |
935 | } | |
936 | ||
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
937 | contextMenu->addAction (ACTION (cut)); |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
938 | contextMenu->addAction (ACTION (copy)); |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
939 | contextMenu->addAction (ACTION (paste)); |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
940 | contextMenu->addAction (ACTION (del)); |
155 | 941 | contextMenu->addSeparator (); |
942 | contextMenu->addAction (ACTION (setColor)); | |
943 | if (single) | |
944 | contextMenu->addAction (ACTION (setContents)); | |
945 | contextMenu->addAction (ACTION (makeBorders)); | |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
946 | |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
947 | contextMenu->exec (pos); |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
948 | } |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
949 | |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
950 | // ============================================================================= |
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:
150
diff
changeset
|
951 | void ObjectList::contextMenuEvent (QContextMenuEvent* ev) { |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
952 | g_ForgeWindow->spawnContextMenu (ev->globalPos ()); |
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:
150
diff
changeset
|
953 | } |
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:
150
diff
changeset
|
954 | |
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:
150
diff
changeset
|
955 | // ============================================================================= |
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:
150
diff
changeset
|
956 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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:
150
diff
changeset
|
957 | // ============================================================================= |
158
499286fcbf37
Compile the icon resources to a QRC file, so that they are embedded in the application
Santeri Piippo <crimsondusk64@gmail.com>
parents:
156
diff
changeset
|
958 | QPixmap getIcon (const char* sIconName) { |
499286fcbf37
Compile the icon resources to a QRC file, so that they are embedded in the application
Santeri Piippo <crimsondusk64@gmail.com>
parents:
156
diff
changeset
|
959 | return (QPixmap (format (":/icons/%s.png", sIconName))); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
960 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
961 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
962 | // ============================================================================= |
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
|
963 | bool confirm (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
|
964 | return confirm ("Confirm", 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
|
965 | } |
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
|
966 | |
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
|
967 | 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
|
968 | return QMessageBox::question (g_ForgeWindow, title, msg, |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
969 | (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes; |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
970 | } |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
971 | |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
972 | // ============================================================================= |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
973 | void critical (str msg) { |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
974 | QMessageBox::critical (g_ForgeWindow, APPNAME_DISPLAY ": Critical Error", msg, |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
975 | (QMessageBox::Close), QMessageBox::Close); |
0 | 976 | } |