gui.cpp

Tue, 07 May 2013 23:37:46 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 07 May 2013 23:37:46 +0300
changeset 176
84132e178d46
parent 175
b094d5e9d6e0
child 177
4cdd408f2863
permissions
-rw-r--r--

Removed the message log. I'll find a better way to convey messages at some point..

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
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
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>
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
26 #include <qtoolbutton.h>
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
27 #include <qcombobox.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
28 #include <qcoreapplication.h>
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 #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
30 #include "gldraw.h"
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 #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
32 #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
33 #include "config.h"
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 73
diff changeset
34 #include "misc.h"
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 73
diff changeset
35 #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
36 #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
37 #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
38
7c2f500405fe Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 76
diff changeset
39 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
40
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
41 static bool g_bSelectionLocked = false;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
42
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
43 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
44 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
45 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
46 extern_cfg (str, io_recentfiles);
156
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
47 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
48
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
49 const QColor g_GroupBackgrounds[] = {
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
50 QColor (0, 192, 255), // blue
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
51 QColor (144, 255, 0), // green
172
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
52 QColor (255, 128, 0), // orange
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
53 QColor (255, 255, 0), // yellow
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
54 QColor (160, 64, 255), // purple
172
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
55 QColor (0, 255, 160), // emerald
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
56 };
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
57
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
58 QIcon g_groupSelectorIcons[6];
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
59
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
60 const ushort g_numGroups = 2;
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
61
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
62 // =============================================================================
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
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
64 // =============================================================================
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
65 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
66 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
67 m_renderer = new GLRenderer;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68
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
69 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
70 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
71 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
72 connect (m_objList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selectionChanged ()));
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73
176
84132e178d46 Removed the message log. I'll find a better way to convey messages at some point..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 175
diff changeset
74 m_splitter = new QSplitter;
84132e178d46 Removed the message log. I'll find a better way to convey messages at some point..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 175
diff changeset
75 m_splitter->addWidget (m_renderer);
84132e178d46 Removed the message log. I'll find a better way to convey messages at some point..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 175
diff changeset
76 m_splitter->addWidget (m_objList);
84132e178d46 Removed the message log. I'll find a better way to convey messages at some point..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 175
diff changeset
77 setCentralWidget (m_splitter);
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78
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
79 m_colorMeta = parseQuickColorMeta ();
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
80
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 createMenuActions ();
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 createMenus ();
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 createToolbars ();
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84
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
85 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
86
145
ddf24c380be6 Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents: 143
diff changeset
87 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
88 setWindowIcon (getIcon ("ldforge"));
7
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
89 setTitle ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 setMinimumSize (320, 200);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 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
92
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
93 // Init group bg icons
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
94 for (uchar i = 0; i < LDObject::NumGroups; ++i) {
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
95 QImage img (16, 16, QImage::Format_ARGB32);
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
96 QPainter paint (&img);
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
97 paint.fillRect (0, 0, 16, 16, Qt::black);
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
98 paint.fillRect (1, 1, 14, 14, g_GroupBackgrounds[i]);
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
99
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
100 g_groupSelectorIcons[i] = QIcon (QPixmap::fromImage (img));
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
101 }
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
102
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
103 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
104 }
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
105
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
106 // =============================================================================
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
107 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
108 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
109 delete m_renderer;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111
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
112 // =============================================================================
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
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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 // =============================================================================
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
115 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
116 // 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
117 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
118 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
119 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
120 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
121 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
122
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
123 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
124 }
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125
156
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
126 // 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
127 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
128 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
129 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
130
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
131 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
132 findAction ("axes")->setChecked (gl_axes);
156
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
133
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134 // 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
135 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
136
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
137 History::updateActions ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
139
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
140 // =============================================================================
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
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
142 // =============================================================================
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
143 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
144
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
145 QMenu* ForgeWindow::initMenu (const char* name) {
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
146 return g_CurrentMenu = menuBar ()->addMenu (tr (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
147 }
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
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 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
150 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
151 }
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
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
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 // =============================================================================
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
155 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
156 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
157 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
158 updateRecentFilesMenu ();
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
159
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
160 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
161
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
162 // 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
163 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
164 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
165 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
166 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
167 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
168 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
169 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
170 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
171 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
172 addMenuAction ("exit"); // Exit
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
173
132
577e8e89d8de Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents: 127
diff changeset
174 // 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
175 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
176 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
177 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
178 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
179 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
180 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
181
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
182 // 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
183 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
184 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
185 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
186 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
187 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
188 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
189 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
190 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
191 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
192 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
193 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
194 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
195 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
196 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
197 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
198 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
199 addMenuAction ("cancelDraw"); // Done Drawing
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
200
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
201 // 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
202 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
203 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
204 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
205 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
206 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
207 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
208 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
209 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
210 menu->addSeparator (); // -----
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
211
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 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
213 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
214 addMenuAction ("selectByType"); // Select by Type
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
215
172
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
216 initMenu ("&Groups");
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
217 for (uchar i = 0; i < LDObject::NumGroups; ++i)
172
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
218 addMenuAction (fmt ("group%c", 'A' + i)); // Group *
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
219
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
220 menu->addSeparator (); // -----
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
221 addMenuAction ("ungroup"); // Ungroup
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
222 menu->addSeparator (); // -----
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
223 for (uchar i = 0; i < LDObject::NumGroups; ++i)
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
224 addMenuAction (fmt ("selGroup%c", 'A' + i)); // Select Group *
154
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 151
diff changeset
225
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
226 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
227 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
228 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
229 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
230 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
231 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
232 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
233 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
234 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
235 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
236 addMenuAction ("uncolorize"); // Uncolorize
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
237 addMenuAction ("visibility"); // Toggle Visibility
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
238
102
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
239 // 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
240 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
241 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
242 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
243 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
244 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
245 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
246 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
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 ("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
249 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
250 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
251 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
252 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
253 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
254 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
255 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
256 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
257 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
258 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
259 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
260 addMenuAction ("rotateZNeg"); // Rotate -Z
102
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
261
167
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
262 initMenu ("E&xternal Programs");
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
263 addMenuAction ("ytruder");
174
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
264 addMenuAction ("rectifier");
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
265 addMenuAction ("intersector");
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
266
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
267 // 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
268 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
269 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
270 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
271 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
272 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
273 }
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
274
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
275
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
276 // =============================================================================
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
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
278 // =============================================================================
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
279 void ForgeWindow::updateRecentFilesMenu () {
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
280 // 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
281 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
282 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
283 m_recentFiles.clear ();
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
284
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
285 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
286 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
287 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
288
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
289 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
290
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
291 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
292 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
293 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
294 }
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
295 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
296
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
297 // =============================================================================
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
298 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
299 // =============================================================================
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
300 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
301 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
302
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
303 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
304 QToolBar* toolbar = new QToolBar (name);
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
305 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
306 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
307
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
308 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
309 }
77
7c2f500405fe Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 76
diff changeset
310
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
311 // =============================================================================
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
312 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
313 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
314 }
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
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 // =============================================================================
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
317 void ForgeWindow::createToolbars () {
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
318 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
319 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
320 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
321 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
322 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
323
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
324 // ==========================================
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
325 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
326 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
327 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
328 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
329 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
330 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
331 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
332 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
333 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
334 addToolBarAction ("newRadial");
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
335
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
336 // ==========================================
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
337 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
338 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
339 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
340 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
341 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
342 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
343 addToolBarAction ("del");
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
344
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
345 // ==========================================
120
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
346 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
347 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
348 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
349 addToolBarAction ("selectByType");
120
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
350
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
351 addToolBarBreak (Qt::TopToolBarArea);
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
352
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
353 // ==========================================
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
354 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
355 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
356 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
357 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
358 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
359 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
360 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
361 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
362 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
363
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
364 // ==========================================
120
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
365 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
366 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
367 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
368 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
369 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
370 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
371 addToolBarAction ("rotateZNeg");
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
372
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
373 // ==========================================
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
374 // 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
375 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
376 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
377 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
378 addToolBarAction ("gridFine");
145
ddf24c380be6 Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents: 143
diff changeset
379 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
380
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
381 // ==========================================
156
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
382 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
383 addToolBarAction ("axes");
156
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
384
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
385 // ==========================================
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
386 // 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
387 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
388 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
389
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
390 // ==========================================
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
391 // Left area toolbars
145
ddf24c380be6 Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents: 143
diff changeset
392 //g_ToolBarArea = Qt::LeftToolBarArea;
154
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 151
diff changeset
393 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
394 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
395 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
396 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
397 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
398 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
399 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
400 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
401 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
402 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
403 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
404 addToolBarAction ("uncolorize");
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
405 addToolBarAction ("visibility");
167
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
406
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
407 initSingleToolBar ("External Programs");
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
408 addToolBarAction ("ytruder");
174
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
409 addToolBarAction ("rectifier");
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
410 addToolBarAction ("intersector");
156
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
411
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
412 initSingleToolBar ("Groups");
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
413
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
414 // We need to create the group toolbar buttons manually so that we can
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
415 // set a custom background for them.
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
416 for (uchar i = 0; i < LDObject::NumGroups; ++i) {
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
417 QToolButton* btn = new QToolButton (this);
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
418 QColor col = g_GroupBackgrounds[i];
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
419
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
420 btn->setDefaultAction (findAction (fmt ("group%c", 'A' + i)));
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
421 btn->setStyleSheet (fmt ("QToolButton { background-color: \"#%.2X%.2X%.2X\"; }",
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
422 col.red (), col.green (), col.blue ()));
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
423 g_CurrentToolBar->addWidget (btn);
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
424 }
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
425
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
426 addToolBarAction ("ungroup");
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
427 updateToolBars ();
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
428 }
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
429
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
430 // =============================================================================
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
431 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
432 // =============================================================================
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
433 std::vector<quickColorMetaEntry> parseQuickColorMeta () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
434 std::vector<quickColorMetaEntry> meta;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
435
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
436 for (str colorname : gui_colortoolbar.value / ":") {
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
437 if (colorname == "|") {
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
438 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
439 } else {
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
440 color* col = getColor (atoi (colorname));
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
441 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
442 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
443 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
444
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
445 return meta;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
446 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
447
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
448 // =============================================================================
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
449 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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 // =============================================================================
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
451 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
452 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
453 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
454
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
455 // 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
456 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
457 delete qButton;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
458
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
459 m_colorButtons.clear ();
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
460
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
461 // 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
462 m_colorToolBar->clear ();
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
463
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
464 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
465 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
466 m_colorToolBar->addSeparator ();
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
467 else {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
468 QPushButton* qColorButton = new QPushButton;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
469 qColorButton->setAutoFillBackground (true);
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
470 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
471 qColorButton->setToolTip (entry.col->zName);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
472
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
473 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
474 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
475 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
476
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
477 entry.btn = qColorButton;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
478 }
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
479 }
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
480
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
481 updateGridToolBar ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
482 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
483
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
484 // =============================================================================
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
485 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
486 // =============================================================================
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
487 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
488 // 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
489 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
490 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
491 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
492 }
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
493
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
494 // =============================================================================
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
495 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
496 // =============================================================================
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
497 void ForgeWindow::setTitle () {
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
498 str title = APPNAME " v";
147
291a1fe2d278 Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents: 146
diff changeset
499 title += versionString;
7
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
500
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
501 // 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
502 if (g_curfile) {
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
503 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
504
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
505 if (g_curfile->m_objs.size() > 0 &&
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
506 g_curfile->m_objs[0]->getType() == LDObject::Comment)
7
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
507 {
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
508 // 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
509 LDComment* comm = static_cast<LDComment*> (g_curfile->m_objs[0]);
164
8c93d8e38494 cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
510 title += fmt (": %s", comm->text.chars());
7
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
511 }
127
a6e2067bb2f1 Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
512
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
513 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
514 title += '*';
7
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
515 }
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
516
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
517 setWindowTitle (title);
7
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
518 }
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
519
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
520 // =============================================================================
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
521 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
522 // =============================================================================
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 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
524 // 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
525 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
526
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
527 // Find the meta for the action.
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
528 actionmeta* pMeta = null;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
529
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
530 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
531 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
532 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
533 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
534 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
535 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
536
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
537 if (!pMeta) {
117
7eb7a43a511b Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
538 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
539 return;
499c25af0303 Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
540 }
499c25af0303 Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
541
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
542 // 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
543 (*pMeta->handler) ();
57
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 56
diff changeset
544 }
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 56
diff changeset
545
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
546 // =============================================================================
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
547 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
548 // =============================================================================
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
549 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
550 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
551 return;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
552
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
553 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
554
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
555 // Delete the objects that were being selected
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
556 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
557 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
558 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
559 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
560 }
a9e67f6e610e Added history management for cut and paste, copy doesn't alter the object list by itself so it doesn't touch history
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
561
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
562 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
563 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
564 }
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
565
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
566 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
567 }
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
568
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
569 // =============================================================================
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
570 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
571 // =============================================================================
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
572 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
573 if (!g_curfile)
3
2b78cf8634c3 don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
574 return;
2b78cf8634c3 don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
575
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
576 // 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
577 // 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
578 // 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
579 g_bSelectionLocked = true;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
580
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
581 m_objList->clear ();
3
2b78cf8634c3 don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
582
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
583 for (LDObject* obj : g_curfile->m_objs) {
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
584 str descr;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
585 switch (obj->getType ()) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
586 case LDObject::Comment:
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
587 descr = 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
588
5b0579997e9b remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents: 7
diff changeset
589 // Remove leading whitespace
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
590 while (~descr && descr[0] == ' ')
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
591 descr -= -1;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
592 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
593
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
594 case LDObject::Empty:
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
595 break; // leave it empty
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
596
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
597 case LDObject::Line:
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
598 {
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
599 LDLine* line = static_cast<LDLine*> (obj);
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
600 descr.format ("%s, %s",
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
601 line->vaCoords[0].stringRep (true).chars(),
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
602 line->vaCoords[1].stringRep (true).chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
603 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
604 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
605
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
606 case LDObject::Triangle:
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
607 {
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
608 LDTriangle* triangle = static_cast<LDTriangle*> (obj);
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
609 descr.format ("%s, %s, %s",
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
610 triangle->vaCoords[0].stringRep (true).chars(),
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
611 triangle->vaCoords[1].stringRep (true).chars(),
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
612 triangle->vaCoords[2].stringRep (true).chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
613 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
614 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
615
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
616 case LDObject::Quad:
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
617 {
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
618 LDQuad* quad = static_cast<LDQuad*> (obj);
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
619 descr.format ("%s, %s, %s, %s",
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
620 quad->vaCoords[0].stringRep (true).chars(),
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
621 quad->vaCoords[1].stringRep (true).chars(),
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
622 quad->vaCoords[2].stringRep (true).chars(),
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
623 quad->vaCoords[3].stringRep (true).chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
624 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
625 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
626
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
627 case LDObject::CondLine:
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
628 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
629 LDCondLine* line = static_cast<LDCondLine*> (obj);
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
630 descr.format ("%s, %s, %s, %s",
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
631 line->vaCoords[0].stringRep (true).chars(),
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
632 line->vaCoords[1].stringRep (true).chars(),
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
633 line->vaCoords[2].stringRep (true).chars(),
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
634 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
635 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
636 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
637
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
638 case LDObject::Gibberish:
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
639 descr.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
640 static_cast<LDGibberish*> (obj)->zContents.chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
641 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
642
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
643 case LDObject::Vertex:
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
644 descr.format ("%s", static_cast<LDVertex*> (obj)->vPosition.stringRep (true).chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
645 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
646
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
647 case LDObject::Subfile:
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
648 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
649 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
650
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
651 descr.format ("%s %s, (",
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
652 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
653
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
654 for (short i = 0; i < 9; ++i)
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
655 descr.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
656 ftoa (ref->mMatrix[i]).chars(),
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
657 (i != 8) ? " " : "");
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
658
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
659 descr += ')';
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
660 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
661 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
662
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
663 case LDObject::BFC:
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
664 {
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
665 LDBFC* bfc = static_cast<LDBFC*> (obj);
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
666 descr = LDBFC::statements[bfc->type];
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
667 }
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
668 break;
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
669
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
670 case LDObject::Radial:
112
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
671 {
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
672 LDRadial* pRad = static_cast<LDRadial*> (obj);
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
673 descr.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
674
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
675 if (pRad->eRadialType == LDRadial::Ring || pRad->eRadialType == LDRadial::Cone)
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
676 descr.appendformat (" %d", pRad->dRingNum);
112
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
677
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
678 descr.appendformat (" %s", pRad->vPosition.stringRep (true).chars ());
112
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
679 }
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
680 break;
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
681
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
682 default:
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
683 descr = g_saObjTypeNames[obj->getType ()];
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
684 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
685 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
686
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
687 // Put it into brackets if it's hidden
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
688 if (obj->hidden ()) {
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
689 str copy = descr.chars ();
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
690 descr.format ("[[ %s ]]", copy.chars ());
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
691 }
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
692
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 169
diff changeset
693 QListWidgetItem* item = new QListWidgetItem (descr.chars());
151
15fe6c51de54 Switched the object list from a QTreeWidget to a QListWidget-derivative. Derivative because I'm going to add a context menu.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 150
diff changeset
694 item->setIcon (getIcon (g_saObjTypeIcons[obj->getType ()]));
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
695
113
bbaa40226ec9 Radial saving and reading from files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 112
diff changeset
696 // Color gibberish orange on red so it stands out.
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
697 if (obj->getType() == LDObject::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
698 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
699 item->setForeground (QColor ("#FFAA00"));
164
8c93d8e38494 cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
700 } 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
701 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
702 {
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
703 // 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
704 // 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
705 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
706 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
707 item->setForeground (col->qColor);
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
708 } else if (obj->group () != LDObject::NoGroup) {
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
709 item->setBackground (g_GroupBackgrounds[obj->group ()]);
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
710 }
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
711
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 11
diff changeset
712 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
713 m_objList->insertItem (m_objList->count (), item);
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
714 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
715
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
716 g_bSelectionLocked = false;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
717 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
718 }
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
719
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
720 // =============================================================================
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
721 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
722 // =============================================================================
139
5e31a96adaa2 Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
723 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
724 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
725 return;
5e31a96adaa2 Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
726
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
727 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
728 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
729 }
5e31a96adaa2 Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
730
5e31a96adaa2 Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
731 // =============================================================================
5e31a96adaa2 Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
732 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5e31a96adaa2 Insertion point calculations fixed, make pasting objects cause the new objects be selected.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
733 // =============================================================================
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
734 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
735 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
736 return;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
737
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
738 /*
17
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
739 // 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
740 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
741
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
742 // 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
743 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
744 */
108
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
745
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
746 // 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
747 // 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
748 // 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
749 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
750 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
751
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
752 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
753
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 // 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
755 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
756 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
757
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 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
759 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
760 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
761 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
762 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
763 }
108
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
764 }
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
765
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
766 // 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
767 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
768 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
769
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
770 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
771 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
772
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
773 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
774 m_renderer->refresh ();
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
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
777 // =============================================================================
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
778 void ForgeWindow::slot_recentFile () {
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
779 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
780 openMainFile (qAct->text ());
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
781 }
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
782
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
783 // =============================================================================
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
784 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
785 // =============================================================================
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
786 void ForgeWindow::slot_quickColor () {
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
787 QPushButton* button = static_cast<QPushButton*> (sender ());
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
788 color* col = null;
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
789
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
790 for (quickColorMetaEntry entry : m_colorMeta) {
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
791 if (entry.btn == button) {
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
792 col = entry.col;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
793 break;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
794 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
795 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
796
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
797 if (col == null)
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
798 return;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
799
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
800 std::vector<ulong> indices;
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
801 std::vector<short> colors;
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
802 short newColor = col->index ();
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
803
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
804 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
805 if (obj->dColor == -1)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
806 continue; // uncolored object
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
807
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
808 indices.push_back (obj->getIndex (g_curfile));
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
809 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
810
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
811 obj->dColor = newColor;
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
812 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
813
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
814 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
815 refresh ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
816 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
817
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
818 // =============================================================================
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
819 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7962744759ad Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 123
diff changeset
820 // =============================================================================
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
821 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
822 if (m_sel.size () > 0) {
17
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
823 // 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
824 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
825 }
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
826
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
827 // 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
828 return g_curfile->m_objs.size();
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
829 }
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
830
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
831 // =============================================================================
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
832 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
833 // =============================================================================
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
834 void ForgeWindow::refresh () {
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
835 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
836 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
837 }
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
838
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
839 // =============================================================================
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
840 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
841 // =============================================================================
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
842 void ForgeWindow::updateSelection () {
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
843 g_bSelectionLocked = true;
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
844
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
845 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
846 for (LDObject* obj : m_sel)
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
847 obj->qObjListEntry->setSelected (true);
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
848
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
849 g_bSelectionLocked = false;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
850 slot_selectionChanged ();
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
851 }
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
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 // =============================================================================
105
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
856 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
857 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
858
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
859 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
860 needle = obj;
105
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
861
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
862 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
863 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
864 return true;
105
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
865
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
866 return false;
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
867 }
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
868
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
869 short ForgeWindow::getSelectedColor() {
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
870 short result = -1;
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
871
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
872 for (LDObject* obj : m_sel) {
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
873 if (obj->dColor == -1)
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
874 continue; // doesn't use color
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
875
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
876 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
877 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
878
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
879 if (result == -1)
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
880 result = obj->dColor;
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
881 }
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
882
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 134
diff changeset
883 return result;
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
884 }
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
885
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
886 // =============================================================================
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
887 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7962744759ad Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 123
diff changeset
888 // =============================================================================
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
889 LDObject::Type ForgeWindow::uniformSelectedType () {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
890 LDObject::Type eResult = LDObject::Unidentified;
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
891
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
892 for (LDObject* obj : m_sel) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
893 if (eResult != LDObject::Unidentified && obj->dColor != eResult)
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
894 return LDObject::Unidentified;
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
895
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
896 if (eResult == LDObject::Unidentified)
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
897 eResult = obj->getType ();
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
898 }
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
899
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
900 return eResult;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
901 }
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
902
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
903 // =============================================================================
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
904 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7962744759ad Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 123
diff changeset
905 // =============================================================================
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
906 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
907 // 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
908 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
909 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
910 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
911 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
912 }
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
134
7fd0784471df Save the configuration before exiting so that grid choice is preserved.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
915 // 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
916 // 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
917 config::save ();
7fd0784471df Save the configuration before exiting so that grid choice is preserved.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
918
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
919 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
920 }
a6e2067bb2f1 Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
921
a6e2067bb2f1 Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
922 // =============================================================================
a6e2067bb2f1 Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
923 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
a6e2067bb2f1 Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
924 // =============================================================================
154
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 151
diff changeset
925 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
926 const bool single = (g_win->sel ().size () == 1);
172
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
927 LDObject* singleObj = (single) ? g_win->sel ()[0] : null;
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
928
154
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 151
diff changeset
929 QMenu* contextMenu = new QMenu;
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
930
172
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
931 if (single && singleObj->getType () != LDObject::Empty) {
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
932 contextMenu->addAction (findAction ("editObject"));
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
933 contextMenu->addSeparator ();
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
934 }
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
935
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
936 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
937 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
938 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
939 contextMenu->addAction (findAction ("del"));
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
940 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
941 contextMenu->addAction (findAction ("setColor"));
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
942 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
943 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
944 contextMenu->addAction (findAction ("makeBorders"));
154
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 151
diff changeset
945
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 151
diff changeset
946 contextMenu->exec (pos);
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 151
diff changeset
947 }
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 151
diff changeset
948
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
949 // ========================================================================================================================================
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
950 DelHistory* ForgeWindow::deleteObjVector (const std::vector<LDObject*> objs) {
174
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
951 vector<ulong> indices;
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
952 vector<LDObject*> cache;
174
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
953
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
954 for (LDObject* obj : objs) {
174
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
955 indices.push_back (obj->getIndex (g_curfile));
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
956 cache.push_back (obj->clone ());
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
957
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
958 g_curfile->forgetObject (obj);
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
959 delete obj;
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
960 }
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
961
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
962 if (indices.size () > 0)
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
963 return new DelHistory (indices, cache);
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
964
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
965 return null;
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
966 }
963697b36118 Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
967
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
968 // ========================================================================================================================================
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
969 DelHistory* ForgeWindow::deleteSelection () {
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
970 return deleteObjVector (sel ());
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
971 }
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
972
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
973 // ========================================================================================================================================
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
974 DelHistory* ForgeWindow::deleteGroup (const LDObject::Group group) {
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
975 vector<LDObject*> objs;
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
976 for (LDObject* obj : g_curfile->m_objs) {
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
977 if (obj->group () != group)
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
978 continue;
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
979
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
980 objs.push_back (obj);
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
981 }
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
982
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
983 return deleteObjVector (objs);
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
984 }
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
985
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
986 // ========================================================================================================================================
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
987 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
988 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
989 }
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
990
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
991 // =============================================================================
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
992 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
993 // =============================================================================
164
8c93d8e38494 cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
994 QPixmap getIcon (const char* iconName) {
8c93d8e38494 cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
995 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
996 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
997
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
998 // =============================================================================
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
999 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
1000 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
1001 }
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
1002
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
1003 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
1004 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
1005 (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
1006 }
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 139
diff changeset
1007
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 139
diff changeset
1008 // =============================================================================
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 139
diff changeset
1009 void critical (str msg) {
176
84132e178d46 Removed the message log. I'll find a better way to convey messages at some point..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 175
diff changeset
1010 QMessageBox::critical (g_win, "Error", msg,
140
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 139
diff changeset
1011 (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
1012 }
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
1013
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
1014 // =============================================================================
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
1015 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
1016 // =============================================================================
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
1017 // Print to message log
172
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
1018 // TODO: I don't think that the message log being a widget in the window
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
1019 // is a very good idea... maybe this should log into the renderer? Or into
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
1020 // another dialog that can be popped up?
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
1021 void ForgeWindow::logVA (LogType type, const char* fmtstr, va_list va) {
172
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
1022 (void) type;
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
1023 (void) fmtstr;
a65547b84ef8 Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 170
diff changeset
1024 (void) va;
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
1025 }
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
1026
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
1027 // =============================================================================
164
8c93d8e38494 cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
1028 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
1029 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
1030 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
1031 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
1032
169
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
1033 fprintf (stderr, "%s: couldn't find action named `%s'!\n", __func__, name.chars ());
f562323760a2 Added grouping basics - will be needed for ext programs (Intersector, Isecalc and a lot of others use 2 or more inputs, need to get all of those in somehow...) plus I think they can be useful for the actual authoring process
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
1034 assert (false);
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
1035 return null;
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1036 }
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1037
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1038 // =============================================================================
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1039 void makeGroupSelector (QComboBox* box) {
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1040 ulong counts[6];
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1041 uchar selGroup = 0;
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1042 memset (&counts[0], 0, sizeof counts);
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1043
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1044 for (LDObject* obj : g_curfile->m_objs)
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1045 if (obj->group () != LDObject::NoGroup)
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1046 counts[obj->group ()]++;
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1047
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1048 box->clear ();
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1049 for (uchar i = 0; i < LDObject::NumGroups; ++i) {
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1050 box->addItem (g_groupSelectorIcons[i], fmt ("%c (%lu objects)", QChar ('A' + i), counts[i]));
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1051
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1052 if (counts[i] > 0 && selGroup == 0)
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1053 selGroup = i;
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1054 }
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1055
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 174
diff changeset
1056 box->setCurrentIndex (selGroup);
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1057 }

mercurial