gui.cpp

Mon, 06 May 2013 03:31:03 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 06 May 2013 03:31:03 +0300
changeset 165
88a03c1a52d9
parent 164
8c93d8e38494
child 167
df78c894ae24
permissions
-rw-r--r--

Begin work on external program support (Ytruder partially supported)

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

mercurial