Mon, 06 May 2013 12:50:20 +0300
Further ytruder support
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 | |
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
37 | 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
|
38 | |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
39 | static bool g_bSelectionLocked = false; |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
40 | |
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
|
41 | 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
|
42 | 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
|
43 | 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
|
44 | extern_cfg (str, io_recentfiles); |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
45 | 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
|
46 | |
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
|
47 | // ============================================================================= |
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
|
48 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
49 | // ============================================================================= |
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
|
50 | ForgeWindow::ForgeWindow () { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
51 | g_win = this; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
52 | m_renderer = new GLRenderer; |
0 | 53 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
54 | m_objList = new ObjectList; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
55 | m_objList->setSelectionMode (QListWidget::ExtendedSelection); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
56 | m_objList->setAlternatingRowColors (true); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
57 | connect (m_objList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selectionChanged ())); |
0 | 58 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
59 | m_msglog = new QTextEdit; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
60 | m_msglog->setReadOnly (true); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
61 | m_msglog->setMaximumHeight (96); |
0 | 62 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
63 | m_hsplit = new QSplitter; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
64 | m_hsplit->addWidget (m_renderer); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
65 | m_hsplit->addWidget (m_objList); |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
66 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
67 | m_vsplit = new QSplitter (Qt::Vertical); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
68 | m_vsplit->addWidget (m_hsplit); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
69 | m_vsplit->addWidget (m_msglog); |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
70 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
71 | setCentralWidget (m_vsplit); |
0 | 72 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
73 | m_colorMeta = parseQuickColorMeta (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
74 | |
0 | 75 | createMenuActions (); |
76 | createMenus (); | |
77 | createToolbars (); | |
78 | ||
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
|
79 | 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
|
80 | |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
81 | 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
|
82 | setWindowIcon (getIcon ("ldforge")); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
83 | setTitle (); |
0 | 84 | setMinimumSize (320, 200); |
85 | 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
|
86 | |
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
|
87 | 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
|
88 | } |
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
|
89 | |
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
|
90 | // ============================================================================= |
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
|
91 | void ForgeWindow::slot_lastSecondCleanup () { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
92 | m_renderer->setParent (null); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
93 | delete m_renderer; |
0 | 94 | } |
95 | ||
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
|
96 | // ============================================================================= |
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
|
97 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
98 | // ============================================================================= |
79
f8917e9d07f6
Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
99 | 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
|
100 | // 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
|
101 | 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
|
102 | 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
|
103 | 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
|
104 | 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
|
105 | 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
|
106 | |
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
|
107 | 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
|
108 | } |
0 | 109 | |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
110 | // Grid actions and axes are checkable |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
111 | findAction ("gridCoarse")->setCheckable (true); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
112 | findAction ("gridMedium")->setCheckable (true); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
113 | findAction ("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
|
114 | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
115 | findAction ("axes")->setCheckable (true); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
116 | findAction ("axes")->setChecked (gl_axes); |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
117 | |
0 | 118 | // things not implemented yet |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
119 | findAction ("help")->setEnabled (false); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
120 | |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
121 | History::updateActions (); |
0 | 122 | } |
123 | ||
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
|
124 | // ============================================================================= |
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
|
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
|
126 | // ============================================================================= |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
127 | QMenu* g_CurrentMenu; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
128 | |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
129 | void ForgeWindow::initMenu (const char* name) { |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
130 | g_CurrentMenu = menuBar ()->addMenu (tr (name)); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
131 | } |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
132 | |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
133 | void ForgeWindow::addMenuAction (const char* name) { |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
134 | g_CurrentMenu->addAction (findAction (name)); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
135 | } |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
136 | |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
137 | |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
138 | // ============================================================================= |
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
|
139 | void ForgeWindow::createMenus () { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
140 | m_recentFilesMenu = new QMenu (tr ("Open &Recent")); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
141 | m_recentFilesMenu->setIcon (getIcon ("open-recent")); |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
142 | updateRecentFilesMenu (); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
143 | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
144 | QMenu*& menu = g_CurrentMenu; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
145 | |
0 | 146 | // File menu |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
147 | initMenu ("&File"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
148 | addMenuAction ("newFile"); // New |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
149 | addMenuAction ("open"); // Open |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
150 | menu->addMenu (m_recentFilesMenu); // Open Recent |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
151 | addMenuAction ("save"); // Save |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
152 | addMenuAction ("saveAs"); // Save As |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
153 | menu->addSeparator (); // ------- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
154 | addMenuAction ("settings"); // Settings |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
155 | menu->addSeparator (); // ------- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
156 | addMenuAction ("exit"); // Exit |
0 | 157 | |
132
577e8e89d8de
Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents:
127
diff
changeset
|
158 | // View menu |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
159 | initMenu ("&View"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
160 | addMenuAction ("resetView"); // Reset View |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
161 | addMenuAction ("axes"); // Draw Axes |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
162 | menu->addSeparator (); // ----- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
163 | addMenuAction ("screencap"); // Screencap Part |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
164 | addMenuAction ("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
|
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 | // Insert menu |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
167 | initMenu ("&Insert"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
168 | addMenuAction ("insertFrom"); // Insert from File |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
169 | addMenuAction ("insertRaw"); // Insert Raw |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
170 | menu->addSeparator (); // ------- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
171 | addMenuAction ("newSubfile"); // New Subfile |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
172 | addMenuAction ("newLine"); // New Line |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
173 | addMenuAction ("newTriangle"); // New Triangle |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
174 | addMenuAction ("newQuad"); // New Quad |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
175 | addMenuAction ("newCondLine"); // New Conditional Line |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
176 | addMenuAction ("newComment"); // New Comment |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
177 | addMenuAction ("newBFC"); // New BFC Statment |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
178 | addMenuAction ("newVertex"); // New Vertex |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
179 | addMenuAction ("newRadial"); // New Radial |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
180 | menu->addSeparator (); // ----- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
181 | addMenuAction ("beginDraw"); // Begin Drawing |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
182 | addMenuAction ("doneDraw"); // Cancel Drawing |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
183 | addMenuAction ("cancelDraw"); // Done Drawing |
0 | 184 | |
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
|
185 | // Edit menu |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
186 | initMenu ("&Edit"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
187 | addMenuAction ("undo"); // Undo |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
188 | addMenuAction ("redo"); // Redo |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
189 | menu->addSeparator (); // ----- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
190 | addMenuAction ("cut"); // Cut |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
191 | addMenuAction ("copy"); // Copy |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
192 | addMenuAction ("paste"); // Paste |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
193 | addMenuAction ("del"); // Delete |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
194 | menu->addSeparator (); // ----- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
195 | addMenuAction ("selectAll"); // Select All |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
196 | addMenuAction ("selectByColor"); // Select by Color |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
197 | addMenuAction ("selectByType"); // Select by Type |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
198 | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
199 | initMenu ("&Tools"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
200 | addMenuAction ("setColor"); // Set Color |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
201 | addMenuAction ("invert"); // Invert |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
202 | addMenuAction ("inlineContents"); // Inline |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
203 | addMenuAction ("deepInline"); // Deep Inline |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
204 | addMenuAction ("splitQuads"); // Split Quads |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
205 | addMenuAction ("setContents"); // Set Contents |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
206 | addMenuAction ("makeBorders"); // Make Borders |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
207 | addMenuAction ("makeCornerVerts"); // Make Corner Vertices |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
208 | addMenuAction ("roundCoords"); // Round Coordinates |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
209 | addMenuAction ("uncolorize"); // Uncolorize |
0 | 210 | |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
211 | // Move menu |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
212 | initMenu ("&Move"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
213 | addMenuAction ("moveUp"); // Move Up |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
214 | addMenuAction ("moveDown"); // Move Down |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
215 | menu->addSeparator (); // ----- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
216 | addMenuAction ("gridCoarse"); // Coarse Grid |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
217 | addMenuAction ("gridMedium"); // Medium Grid |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
218 | addMenuAction ("gridFine"); // Fine Grid |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
219 | menu->addSeparator (); // ----- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
220 | addMenuAction ("moveXPos"); // Move +X |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
221 | addMenuAction ("moveXNeg"); // Move -X |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
222 | addMenuAction ("moveYPos"); // Move +Y |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
223 | addMenuAction ("moveYNeg"); // Move -Y |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
224 | addMenuAction ("moveZPos"); // Move +Z |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
225 | addMenuAction ("moveZNeg"); // Move -Z |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
226 | menu->addSeparator (); // ----- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
227 | addMenuAction ("rotateXPos"); // Rotate +X |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
228 | addMenuAction ("rotateXNeg"); // Rotate -X |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
229 | addMenuAction ("rotateYPos"); // Rotate +Y |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
230 | addMenuAction ("rotateYNeg"); // Rotate -Y |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
231 | addMenuAction ("rotateZPos"); // Rotate +Z |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
232 | addMenuAction ("rotateZNeg"); // Rotate -Z |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
233 | |
167
df78c894ae24
Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
234 | initMenu ("E&xternal Programs"); |
df78c894ae24
Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
235 | addMenuAction ("ytruder"); |
df78c894ae24
Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
236 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
237 | #ifndef RELEASE |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
238 | // Debug menu |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
239 | initMenu ("&Debug"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
240 | addMenuAction ("addTestQuad"); // Add Test Quad |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
241 | addMenuAction ("addTestRadial"); // Add Test Radial |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
242 | #endif // RELEASE |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
243 | |
0 | 244 | // Help menu |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
245 | initMenu ("&Help"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
246 | addMenuAction ("help"); // Help |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
247 | menu->addSeparator (); // ----- |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
248 | addMenuAction ("about"); // About |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
249 | addMenuAction ("aboutQt"); // About Qt |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
250 | } |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
251 | |
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
|
252 | // ============================================================================= |
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
|
253 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
254 | // ============================================================================= |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
255 | void ForgeWindow::updateRecentFilesMenu () { |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
256 | // First, clear any items in the recent files menu |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
257 | for (QAction* recent : m_recentFiles) |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
258 | delete recent; |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
259 | m_recentFiles.clear (); |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
260 | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
261 | std::vector<str> files = io_recentfiles.value / "@"; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
262 | for (long i = files.size() - 1; i >= 0; --i) { |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
263 | str file = files[i]; |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
264 | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
265 | QAction* recent = new QAction (getIcon ("open-recent"), file, this); |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
266 | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
267 | connect (recent, SIGNAL (triggered ()), this, SLOT (slot_recentFile ())); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
268 | m_recentFilesMenu->addAction (recent); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
269 | m_recentFiles.push_back (recent); |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
270 | } |
0 | 271 | } |
272 | ||
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
|
273 | // ============================================================================= |
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
|
274 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
275 | // ============================================================================= |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
276 | 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
|
277 | 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
|
278 | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
279 | void ForgeWindow::initSingleToolBar (const char* name) { |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
280 | QToolBar* toolbar = new QToolBar (name); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
281 | addToolBar (g_ToolBarArea, toolbar); |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
282 | m_toolBars.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
|
283 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
284 | 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
|
285 | } |
77
7c2f500405fe
Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
286 | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
287 | // ============================================================================= |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
288 | void ForgeWindow::addToolBarAction (const char* name) { |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
289 | g_CurrentToolBar->addAction (findAction (name)); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
290 | } |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
291 | |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
292 | // ============================================================================= |
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
|
293 | void ForgeWindow::createToolbars () { |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
294 | initSingleToolBar ("File"); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
295 | addToolBarAction ("newFile"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
296 | addToolBarAction ("open"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
297 | addToolBarAction ("save"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
298 | addToolBarAction ("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
|
299 | |
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
|
300 | // ========================================== |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
301 | initSingleToolBar ("Insert"); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
302 | addToolBarAction ("newSubfile"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
303 | addToolBarAction ("newLine"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
304 | addToolBarAction ("newTriangle"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
305 | addToolBarAction ("newQuad"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
306 | addToolBarAction ("newCondLine"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
307 | addToolBarAction ("newComment"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
308 | addToolBarAction ("newBFC"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
309 | addToolBarAction ("newVertex"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
310 | addToolBarAction ("newRadial"); |
0 | 311 | |
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
|
312 | // ========================================== |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
313 | initSingleToolBar ("Edit"); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
314 | addToolBarAction ("undo"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
315 | addToolBarAction ("redo"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
316 | addToolBarAction ("cut"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
317 | addToolBarAction ("copy"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
318 | addToolBarAction ("paste"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
319 | addToolBarAction ("del"); |
0 | 320 | |
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
|
321 | // ========================================== |
120
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
322 | initSingleToolBar ("Select"); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
323 | addToolBarAction ("selectAll"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
324 | addToolBarAction ("selectByColor"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
325 | addToolBarAction ("selectByType"); |
120
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
326 | |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
327 | addToolBarBreak (Qt::TopToolBarArea); |
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
328 | |
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
|
329 | // ========================================== |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
330 | initSingleToolBar ("Move"); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
331 | addToolBarAction ("moveUp"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
332 | addToolBarAction ("moveDown"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
333 | addToolBarAction ("moveXPos"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
334 | addToolBarAction ("moveXNeg"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
335 | addToolBarAction ("moveYPos"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
336 | addToolBarAction ("moveYNeg"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
337 | addToolBarAction ("moveZPos"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
338 | addToolBarAction ("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
|
339 | |
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
|
340 | // ========================================== |
120
607301744394
Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
341 | initSingleToolBar ("Rotate"); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
342 | addToolBarAction ("rotateXPos"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
343 | addToolBarAction ("rotateXNeg"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
344 | addToolBarAction ("rotateYPos"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
345 | addToolBarAction ("rotateYNeg"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
346 | addToolBarAction ("rotateZPos"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
347 | addToolBarAction ("rotateZNeg"); |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
348 | |
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
|
349 | // ========================================== |
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
|
350 | // 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
|
351 | initSingleToolBar ("Grids"); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
352 | addToolBarAction ("gridCoarse"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
353 | addToolBarAction ("gridMedium"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
354 | addToolBarAction ("gridFine"); |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
355 | 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
|
356 | |
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
|
357 | // ========================================== |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
358 | initSingleToolBar ("View"); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
359 | addToolBarAction ("axes"); |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
360 | |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
361 | // ========================================== |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
362 | // Color toolbar |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
363 | m_colorToolBar = new QToolBar ("Quick Colors"); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
364 | addToolBar (Qt::RightToolBarArea, m_colorToolBar); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
365 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
366 | // ========================================== |
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
|
367 | // Left area toolbars |
145
ddf24c380be6
Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
143
diff
changeset
|
368 | //g_ToolBarArea = Qt::LeftToolBarArea; |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
369 | initSingleToolBar ("Tools"); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
370 | addToolBarAction ("setColor"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
371 | addToolBarAction ("invert"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
372 | addToolBarAction ("inlineContents"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
373 | addToolBarAction ("deepInline"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
374 | addToolBarAction ("splitQuads"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
375 | addToolBarAction ("setContents"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
376 | addToolBarAction ("makeBorders"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
377 | addToolBarAction ("makeCornerVerts"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
378 | addToolBarAction ("roundCoords"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
379 | addToolBarAction ("screencap"); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
380 | addToolBarAction ("uncolorize"); |
167
df78c894ae24
Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
381 | |
df78c894ae24
Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
382 | initSingleToolBar ("External Programs"); |
df78c894ae24
Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
383 | addToolBarAction ("ytruder"); |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
155
diff
changeset
|
384 | |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
385 | updateToolBars (); |
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
386 | } |
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
387 | |
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
|
388 | // ============================================================================= |
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
|
389 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
390 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
391 | std::vector<quickColorMetaEntry> parseQuickColorMeta () { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
392 | std::vector<quickColorMetaEntry> meta; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
393 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
394 | 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
|
395 | if (zColor == "|") { |
104 | 396 | 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
|
397 | } else { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
398 | color* col = getColor (atoi (zColor)); |
104 | 399 | 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
|
400 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
401 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
402 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
403 | return meta; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
404 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
405 | |
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
|
406 | // ============================================================================= |
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
|
407 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
408 | // ============================================================================= |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
409 | void ForgeWindow::updateToolBars () { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
410 | for (QToolBar* qBar : m_toolBars) |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
411 | 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
|
412 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
413 | // Update the quick color toolbar. |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
414 | for (QPushButton* qButton : m_colorButtons) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
415 | delete qButton; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
416 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
417 | m_colorButtons.clear (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
418 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
419 | // Clear the toolbar to remove separators |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
420 | m_colorToolBar->clear (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
421 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
422 | for (quickColorMetaEntry& entry : m_colorMeta) { |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
423 | if (entry.bSeparator) |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
424 | m_colorToolBar->addSeparator (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
425 | else { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
426 | QPushButton* qColorButton = new QPushButton; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
427 | qColorButton->setAutoFillBackground (true); |
161 | 428 | qColorButton->setStyleSheet (fmt ("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
|
429 | qColorButton->setToolTip (entry.col->zName); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
430 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
431 | connect (qColorButton, SIGNAL (clicked ()), this, SLOT (slot_quickColor ())); |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
432 | m_colorToolBar->addWidget (qColorButton); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
433 | m_colorButtons.push_back (qColorButton); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
434 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
435 | entry.btn = qColorButton; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
436 | } |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
87
diff
changeset
|
437 | } |
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
|
438 | |
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
|
439 | updateGridToolBar (); |
0 | 440 | } |
441 | ||
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
|
442 | // ============================================================================= |
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
|
443 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
444 | // ============================================================================= |
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
|
445 | 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
|
446 | // Ensure that the current grid - and only the current grid - is selected. |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
447 | findAction ("gridCoarse")->setChecked (grid == Grid::Coarse); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
448 | findAction ("gridMedium")->setChecked (grid == Grid::Medium); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
449 | findAction ("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
|
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 | // ============================================================================= |
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
|
453 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
454 | // ============================================================================= |
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
|
455 | void ForgeWindow::setTitle () { |
161 | 456 | str title = APPNAME " v"; |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
146
diff
changeset
|
457 | title += versionString; |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
458 | |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
459 | // Append our current file if we have one |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
460 | if (g_curfile) { |
161 | 461 | title += fmt (": %s", basename (g_curfile->m_filename.chars())); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
462 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
463 | if (g_curfile->m_objs.size() > 0 && |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
464 | g_curfile->m_objs[0]->getType() == OBJ_Comment) |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
465 | { |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
466 | // Append title |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
467 | LDComment* comm = static_cast<LDComment*> (g_curfile->m_objs[0]); |
164 | 468 | title += fmt (": %s", comm->text.chars()); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
469 | } |
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
|
470 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
471 | if (History::pos () != g_curfile->savePos) |
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
|
472 | title += '*'; |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
473 | } |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
474 | |
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
|
475 | setWindowTitle (title); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
476 | } |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
477 | |
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
|
478 | // ============================================================================= |
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
|
479 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
480 | // ============================================================================= |
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
|
481 | 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
|
482 | // 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
|
483 | 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
|
484 | |
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
|
485 | // Find the meta for the action. |
104 | 486 | actionmeta* pMeta = null; |
0 | 487 | |
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
|
488 | 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
|
489 | 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
|
490 | 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
|
491 | 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
|
492 | } |
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
|
493 | } |
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
|
494 | |
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
|
495 | if (!pMeta) { |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
496 | 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
|
497 | return; |
499c25af0303
Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents:
41
diff
changeset
|
498 | } |
499c25af0303
Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents:
41
diff
changeset
|
499 | |
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
|
500 | // 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
|
501 | (*pMeta->handler) (); |
57
6e89589f1fe8
Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
56
diff
changeset
|
502 | } |
6e89589f1fe8
Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
56
diff
changeset
|
503 | |
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
|
504 | // ============================================================================= |
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
|
505 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
506 | // ============================================================================= |
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
|
507 | void ForgeWindow::deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects) { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
508 | if (m_sel.size () == 0) |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
509 | return; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
510 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
511 | std::vector<LDObject*> selCopy = m_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
|
512 | |
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
|
513 | // Delete the objects that were being selected |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
514 | 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
|
515 | 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
|
516 | papObjects->push_back (obj->clone ()); |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
517 | ulapIndices->push_back (obj->getIndex (g_curfile)); |
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
|
518 | } |
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
|
519 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
520 | g_curfile->forgetObject (obj); |
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
|
521 | 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
|
522 | } |
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
|
523 | |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
524 | 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
|
525 | } |
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
|
526 | |
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
|
527 | // ============================================================================= |
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
|
528 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
529 | // ============================================================================= |
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
|
530 | void ForgeWindow::buildObjList () { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
531 | if (!g_curfile) |
3
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
532 | return; |
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
533 | |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
534 | // 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
|
535 | // 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
|
536 | // 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
|
537 | g_bSelectionLocked = true; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
538 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
539 | m_objList->clear (); |
3
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
540 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
541 | for (LDObject* obj : g_curfile->m_objs) { |
0 | 542 | str zText; |
543 | switch (obj->getType ()) { | |
544 | case OBJ_Comment: | |
164 | 545 | zText = static_cast<LDComment*> (obj)->text.chars(); |
10
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
546 | |
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
547 | // Remove leading whitespace |
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
548 | 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
|
549 | zText -= -1; |
0 | 550 | break; |
551 | ||
552 | case OBJ_Empty: | |
553 | break; // leave it empty | |
554 | ||
555 | case OBJ_Line: | |
556 | { | |
557 | LDLine* line = static_cast<LDLine*> (obj); | |
558 | zText.format ("%s, %s", | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
559 | line->vaCoords[0].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
560 | line->vaCoords[1].stringRep (true).chars()); |
0 | 561 | } |
562 | break; | |
563 | ||
564 | case OBJ_Triangle: | |
565 | { | |
566 | LDTriangle* triangle = static_cast<LDTriangle*> (obj); | |
567 | zText.format ("%s, %s, %s", | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
568 | triangle->vaCoords[0].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
569 | triangle->vaCoords[1].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
570 | triangle->vaCoords[2].stringRep (true).chars()); |
0 | 571 | } |
572 | break; | |
573 | ||
574 | case OBJ_Quad: | |
575 | { | |
576 | 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
|
577 | zText.format ("%s, %s, %s, %s", |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
578 | quad->vaCoords[0].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
579 | quad->vaCoords[1].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
580 | quad->vaCoords[2].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
581 | quad->vaCoords[3].stringRep (true).chars()); |
0 | 582 | } |
583 | break; | |
584 | ||
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
585 | case OBJ_CondLine: |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
586 | { |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
587 | 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
|
588 | zText.format ("%s, %s, %s, %s", |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
589 | line->vaCoords[0].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
590 | line->vaCoords[1].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
591 | line->vaCoords[2].stringRep (true).chars(), |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
592 | 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
|
593 | } |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
594 | break; |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
595 | |
0 | 596 | case OBJ_Gibberish: |
597 | 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
|
598 | static_cast<LDGibberish*> (obj)->zContents.chars()); |
0 | 599 | break; |
600 | ||
601 | case OBJ_Vertex: | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
602 | zText.format ("%s", static_cast<LDVertex*> (obj)->vPosition.stringRep (true).chars()); |
0 | 603 | break; |
604 | ||
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
605 | case OBJ_Subfile: |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
606 | { |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
607 | 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
|
608 | |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
609 | zText.format ("%s %s, (", |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
610 | 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
|
611 | |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
612 | 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
|
613 | 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
|
614 | ftoa (ref->mMatrix[i]).chars(), |
41
4ca63da5546b
Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
615 | (i != 8) ? " " : ""); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
616 | |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
617 | zText += ')'; |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
618 | } |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
619 | break; |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
620 | |
73
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
621 | case OBJ_BFC: |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
622 | { |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
623 | LDBFC* bfc = static_cast<LDBFC*> (obj); |
164 | 624 | zText = LDBFC::statements[bfc->type]; |
73
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
625 | } |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
626 | break; |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
627 | |
112
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
628 | case OBJ_Radial: |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
629 | { |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
630 | LDRadial* pRad = static_cast<LDRadial*> (obj); |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
631 | 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
|
632 | |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
633 | 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
|
634 | zText.appendformat (" %d", pRad->dRingNum); |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
635 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
636 | 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
|
637 | } |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
638 | break; |
fa2f00081357
Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents:
111
diff
changeset
|
639 | |
0 | 640 | default: |
641 | zText = g_saObjTypeNames[obj->getType ()]; | |
642 | break; | |
643 | } | |
644 | ||
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
|
645 | 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
|
646 | item->setIcon (getIcon (g_saObjTypeIcons[obj->getType ()])); |
0 | 647 | |
113
bbaa40226ec9
Radial saving and reading from files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
112
diff
changeset
|
648 | // 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
|
649 | 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
|
650 | 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
|
651 | item->setForeground (QColor ("#FFAA00")); |
164 | 652 | } else if (lv_colorize && obj->isColored () && |
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
|
653 | 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
|
654 | { |
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
|
655 | // 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
|
656 | // 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
|
657 | 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
|
658 | 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
|
659 | 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
|
660 | } |
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
|
661 | |
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
|
662 | obj->qObjListEntry = item; |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
663 | m_objList->insertItem (m_objList->count (), item); |
0 | 664 | } |
665 | ||
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
666 | g_bSelectionLocked = false; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
667 | 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
|
668 | } |
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
|
669 | |
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
|
670 | // ============================================================================= |
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
|
671 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
672 | // ============================================================================= |
139
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
673 | void ForgeWindow::scrollToSelection () { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
674 | if (m_sel.size() == 0) |
139
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
675 | return; |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
676 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
677 | LDObject* obj = m_sel[m_sel.size () - 1]; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
678 | m_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
|
679 | } |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
680 | |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
681 | // ============================================================================= |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
682 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e31a96adaa2
Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
683 | // ============================================================================= |
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
|
684 | void ForgeWindow::slot_selectionChanged () { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
685 | if (g_bSelectionLocked == true || g_curfile == null) |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
686 | return; |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
687 | |
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
|
688 | /* |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
689 | // If the selection isn't 1 exact, disable setting contents |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
690 | findAction ("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
|
691 | |
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
|
692 | // If we have no selection, disable splitting quads |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
693 | findAction ("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
|
694 | */ |
108
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
695 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
696 | // Update the shared selection array, though don't do this if this was |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
697 | // called during GL picking, in which case the GL renderer takes care |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
698 | // of the selection. |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
699 | if (m_renderer->picking ()) |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
700 | return; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
701 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
702 | std::vector<LDObject*> priorSelection = m_sel; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
703 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
704 | // Get the objects from the object list selection |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
705 | m_sel.clear (); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
706 | const QList<QListWidgetItem*> items = m_objList->selectedItems (); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
707 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
708 | for (LDObject* obj : g_curfile->m_objs) |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
709 | for (QListWidgetItem* qItem : items) { |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
710 | if (qItem == obj->qObjListEntry) { |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
711 | m_sel.push_back (obj); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
712 | break; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
713 | } |
108
351aef26f444
More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
106
diff
changeset
|
714 | } |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
715 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
716 | // Update the GL renderer |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
717 | for (LDObject* obj : m_sel) |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
718 | m_renderer->recompileObject (obj); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
719 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
720 | for (LDObject* obj : priorSelection) |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
721 | m_renderer->recompileObject (obj); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
722 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
723 | m_renderer->updateSelFlash (); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
724 | m_renderer->refresh (); |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
725 | } |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
726 | |
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
|
727 | // ============================================================================= |
99
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
728 | void ForgeWindow::slot_recentFile () { |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
729 | 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
|
730 | openMainFile (qAct->text ()); |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
731 | } |
920d51fec412
Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
732 | |
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
|
733 | // ============================================================================= |
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
|
734 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
735 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
736 | void ForgeWindow::slot_quickColor () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
737 | QPushButton* button = static_cast<QPushButton*> (sender ()); |
104 | 738 | color* col = null; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
739 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
740 | for (quickColorMetaEntry entry : m_colorMeta) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
741 | if (entry.btn == button) { |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
742 | col = entry.col; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
743 | break; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
744 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
745 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
746 | |
104 | 747 | if (col == null) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
748 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
749 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
750 | std::vector<ulong> indices; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
751 | std::vector<short> colors; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
752 | short newColor = col->index (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
753 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
754 | for (LDObject* obj : m_sel) { |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
755 | if (obj->dColor == -1) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
756 | continue; // uncolored object |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
757 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
758 | indices.push_back (obj->getIndex (g_curfile)); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
759 | 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
|
760 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
761 | obj->dColor = newColor; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
762 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
763 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
764 | 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
|
765 | refresh (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
766 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
767 | |
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
|
768 | // ============================================================================= |
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
|
769 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
770 | // ============================================================================= |
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
|
771 | ulong ForgeWindow::getInsertionPoint () { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
772 | if (m_sel.size () > 0) { |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
773 | // If we have a selection, put the item after it. |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
774 | return (m_sel[m_sel.size() - 1]->getIndex (g_curfile)) + 1; |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
775 | } |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
776 | |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
777 | // Otherwise place the object at the end. |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
778 | return g_curfile->m_objs.size(); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
779 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
780 | |
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
|
781 | // ============================================================================= |
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
|
782 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
783 | // ============================================================================= |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
784 | void ForgeWindow::refresh () { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
785 | buildObjList (); |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
786 | m_renderer->hardRefresh (); |
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
|
787 | } |
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
|
788 | |
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
|
789 | // ============================================================================= |
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
|
790 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
791 | // ============================================================================= |
104 | 792 | void ForgeWindow::updateSelection () { |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
793 | g_bSelectionLocked = true; |
104 | 794 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
795 | m_objList->clearSelection (); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
796 | for (LDObject* obj : m_sel) |
104 | 797 | obj->qObjListEntry->setSelected (true); |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
798 | |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
799 | g_bSelectionLocked = false; |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
800 | slot_selectionChanged (); |
104 | 801 | } |
802 | ||
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
|
803 | // ============================================================================= |
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
|
804 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
805 | // ============================================================================= |
105
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
806 | bool ForgeWindow::isSelected (LDObject* obj) { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
807 | LDObject* needle = obj->topLevelParent (); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
808 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
809 | if (needle == null) |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
810 | needle = obj; |
105
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
811 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
812 | for (LDObject* hay : m_sel) |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
813 | if (hay == needle) |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
814 | return true; |
105
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
815 | |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
816 | return false; |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
817 | } |
53f95a6e351d
Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
818 | |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
819 | short ForgeWindow::getSelectedColor() { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
820 | short result = -1; |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
821 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
822 | for (LDObject* obj : m_sel) { |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
823 | if (obj->dColor == -1) |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
824 | continue; // doesn't use color |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
825 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
826 | 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
|
827 | 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
|
828 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
829 | if (result == -1) |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
830 | result = obj->dColor; |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
831 | } |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
832 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
833 | return result; |
109
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
834 | } |
f40b35142586
Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
108
diff
changeset
|
835 | |
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
|
836 | // ============================================================================= |
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
|
837 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
838 | // ============================================================================= |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
839 | 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
|
840 | 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
|
841 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
842 | for (LDObject* obj : m_sel) { |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
843 | 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
|
844 | return OBJ_Unidentified; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
845 | |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
846 | if (eResult == OBJ_Unidentified) |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
847 | eResult = obj->getType (); |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
848 | } |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
849 | |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
850 | return eResult; |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
851 | } |
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
852 | |
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
|
853 | // ============================================================================= |
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
|
854 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
855 | // ============================================================================= |
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
|
856 | 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
|
857 | // Check whether it's safe to close all files. |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
858 | for (OpenFile* f : g_loadedFiles) { |
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
|
859 | 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
|
860 | 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
|
861 | 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
|
862 | } |
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
|
863 | } |
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
|
864 | |
134
7fd0784471df
Save the configuration before exiting so that grid choice is preserved.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
865 | // 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
|
866 | // 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
|
867 | config::save (); |
7fd0784471df
Save the configuration before exiting so that grid choice is preserved.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
868 | |
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
|
869 | 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
|
870 | } |
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
|
871 | |
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
|
872 | // ============================================================================= |
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
|
873 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
874 | // ============================================================================= |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
875 | void ForgeWindow::spawnContextMenu (const QPoint pos) { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
876 | const bool single = (g_win->sel ().size () == 1); |
155 | 877 | |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
878 | QMenu* contextMenu = new QMenu; |
155 | 879 | |
880 | if (single) { | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
881 | contextMenu->addAction (findAction ("editObject")); |
155 | 882 | contextMenu->addSeparator (); |
883 | } | |
884 | ||
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
885 | contextMenu->addAction (findAction ("cut")); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
886 | contextMenu->addAction (findAction ("copy")); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
887 | contextMenu->addAction (findAction ("paste")); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
888 | contextMenu->addAction (findAction ("del")); |
155 | 889 | contextMenu->addSeparator (); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
890 | contextMenu->addAction (findAction ("setColor")); |
155 | 891 | if (single) |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
892 | contextMenu->addAction (findAction ("setContents")); |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
893 | contextMenu->addAction (findAction ("makeBorders")); |
154
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
894 | |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
895 | contextMenu->exec (pos); |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
896 | } |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
897 | |
cc53e5cbad54
Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
151
diff
changeset
|
898 | // ============================================================================= |
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
|
899 | void ObjectList::contextMenuEvent (QContextMenuEvent* ev) { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
900 | g_win->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
|
901 | } |
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
|
902 | |
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
|
903 | // ============================================================================= |
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
|
904 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
905 | // ============================================================================= |
164 | 906 | QPixmap getIcon (const char* iconName) { |
907 | return (QPixmap (fmt (":/icons/%s.png", iconName))); | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
908 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
909 | |
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
|
910 | // ============================================================================= |
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
|
911 | 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
|
912 | 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
|
913 | } |
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 | bool confirm (str title, str msg) { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
916 | return QMessageBox::question (g_win, title, msg, |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
99
diff
changeset
|
917 | (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
|
918 | } |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
919 | |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
920 | // ============================================================================= |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
921 | void critical (str msg) { |
161 | 922 | QMessageBox::critical (g_win, APPNAME ": Critical Error", msg, |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
139
diff
changeset
|
923 | (QMessageBox::Close), QMessageBox::Close); |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
924 | } |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
925 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
926 | // ============================================================================= |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
927 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
928 | // ============================================================================= |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
929 | // Print to message log |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
930 | void ForgeWindow::logVA (LogType type, const char* fmtstr, va_list va) { |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
931 | return; // FIXME: crashes for some reason o_O |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
932 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
933 | char* buf = vdynformat (fmtstr, va, 128); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
934 | str zText (buf); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
935 | delete[] buf; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
936 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
937 | // Log it to standard output |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
938 | printf ("%s", zText.chars ()); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
939 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
940 | // Replace some things out with HTML entities |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
941 | zText.replace ("<", "<"); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
942 | zText.replace (">", ">"); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
943 | zText.replace ("\n", "<br />"); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
944 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
945 | str& log = m_msglogHTML; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
946 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
947 | switch (type) { |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
948 | case LOG_Normal: |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
949 | log.append (zText); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
950 | break; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
951 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
952 | case LOG_Error: |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
953 | log.appendformat ("<span style=\"color: #F8F8F8; background-color: #800\"><b>[ERROR]</b> %s</span>", |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
954 | zText.chars()); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
955 | break; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
956 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
957 | case LOG_Info: |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
958 | log.appendformat ("<span style=\"color: #0AC\"><b>[INFO]</b> %s</span>", |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
959 | zText.chars()); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
960 | break; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
961 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
962 | case LOG_Success: |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
963 | log.appendformat ("<span style=\"color: #6A0\"><b>[SUCCESS]</b> %s</span>", |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
964 | zText.chars()); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
965 | break; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
966 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
967 | case LOG_Warning: |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
968 | log.appendformat ("<span style=\"color: #C50\"><b>[WARNING]</b> %s</span>", |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
969 | zText.chars()); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
970 | break; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
971 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
972 | case LOG_Dev: |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
973 | #ifndef RELEASE |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
974 | log.appendformat ("<span style=\"color: #0AC\"><b>[DEV]</b> %s</span>", |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
975 | zText.chars()); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
976 | #endif // RELEASE |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
977 | break; |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
978 | } |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
979 | |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
980 | m_msglog->setHtml (log); |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
981 | } |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
982 | |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
983 | // ============================================================================= |
164 | 984 | QAction* findAction (str name) { |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
985 | for (actionmeta& meta : g_ActionMeta) |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
986 | if (name == meta.name) |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
987 | return *meta.qAct; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
988 | |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
989 | return null; |
0 | 990 | } |