gui.cpp

Sun, 21 Apr 2013 16:46:42 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 21 Apr 2013 16:46:42 +0300
changeset 122
33c227d0fa1b
parent 120
607301744394
child 123
a54d9d5c0c1f
permissions
-rw-r--r--

Rotate subfiles and radials by their origin and not by their contents' bboxes.

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
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <QtGui>
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #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
22 #include "gldraw.h"
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #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
24 #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
25 #include "config.h"
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 73
diff changeset
26 #include "misc.h"
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 73
diff changeset
27 #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
28 #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
29 #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
30
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
31 EXTERN_ACTION (newFile)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
32 EXTERN_ACTION (open)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
33 EXTERN_ACTION (save)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
34 EXTERN_ACTION (saveAs)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
35 EXTERN_ACTION (settings)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
36 EXTERN_ACTION (exit)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
37 EXTERN_ACTION (cut)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
38 EXTERN_ACTION (copy)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
39 EXTERN_ACTION (paste)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
40 EXTERN_ACTION (del)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
41 EXTERN_ACTION (setColor)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
42 EXTERN_ACTION (inlineContents)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
43 EXTERN_ACTION (deepInline)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
44 EXTERN_ACTION (splitQuads)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
45 EXTERN_ACTION (setContents)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
46 EXTERN_ACTION (makeBorders)
103
b0a345196435 Added the ability to add vertices to object corners
Santeri Piippo <crimsondusk64@gmail.com>
parents: 102
diff changeset
47 EXTERN_ACTION (makeCornerVerts)
84
c9438ea54ed9 Added move up/down actions.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 79
diff changeset
48 EXTERN_ACTION (moveUp)
c9438ea54ed9 Added move up/down actions.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 79
diff changeset
49 EXTERN_ACTION (moveDown)
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
50 EXTERN_ACTION (newSubfile)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
51 EXTERN_ACTION (newLine)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
52 EXTERN_ACTION (newCondLine)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
53 EXTERN_ACTION (newTriangle)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
54 EXTERN_ACTION (newQuad)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
55 EXTERN_ACTION (newVertex)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
56 EXTERN_ACTION (newComment)
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 110
diff changeset
57 EXTERN_ACTION (newRadial)
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
58 EXTERN_ACTION (help)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
59 EXTERN_ACTION (about)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
60 EXTERN_ACTION (aboutQt)
85
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents: 84
diff changeset
61 EXTERN_ACTION (undo)
b1541b547c8c Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents: 84
diff changeset
62 EXTERN_ACTION (redo)
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 94
diff changeset
63 EXTERN_ACTION (showHistory)
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
64 EXTERN_ACTION (selectByColor)
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
65 EXTERN_ACTION (selectByType)
102
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
66 EXTERN_ACTION (moveXNeg)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
67 EXTERN_ACTION (moveYNeg)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
68 EXTERN_ACTION (moveZNeg)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
69 EXTERN_ACTION (moveXPos)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
70 EXTERN_ACTION (moveYPos)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
71 EXTERN_ACTION (moveZPos)
118
649110bb36a8 Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 117
diff changeset
72 EXTERN_ACTION (invert)
120
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
73 EXTERN_ACTION (rotateXNeg)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
74 EXTERN_ACTION (rotateYNeg)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
75 EXTERN_ACTION (rotateZNeg)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
76 EXTERN_ACTION (rotateXPos)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
77 EXTERN_ACTION (rotateYPos)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
78 EXTERN_ACTION (rotateZPos)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
79 EXTERN_ACTION (roundCoords)
102
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
80
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
81 #ifndef RELEASE
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
82 EXTERN_ACTION (addTestQuad)
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 110
diff changeset
83 EXTERN_ACTION (addTestRadial)
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
84 #endif // RELEASE
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
85
77
7c2f500405fe Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 76
diff changeset
86 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
87
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
88 static bool g_bSelectionLocked = false;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
89
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
90 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
91 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
92 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
93 extern_cfg (str, io_recentfiles);
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
94
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
95 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
97 // ========================================================================= //
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
98 ForgeWindow::ForgeWindow () {
108
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
99 g_ForgeWindow = this;
106
46e4202a44fc Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents: 105
diff changeset
100 R = new GLRenderer;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102 qObjList = new QTreeWidget;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 qObjList->setHeaderHidden (true);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 qObjList->setMaximumWidth (256);
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
105 qObjList->setSelectionMode (QTreeWidget::ExtendedSelection);
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
106 qObjList->setAlternatingRowColors (true);
17
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
107 connect (qObjList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selectionChanged ()));
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109 qMessageLog = new QTextEdit;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 qMessageLog->setReadOnly (true);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 qMessageLog->setMaximumHeight (96);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113 QWidget* w = new QWidget;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114 QGridLayout* layout = new QGridLayout;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 layout->setColumnMinimumWidth (0, 192);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 layout->setColumnStretch (0, 1);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117 layout->addWidget (R, 0, 0);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 layout->addWidget (qObjList, 0, 1);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119 layout->addWidget (qMessageLog, 1, 0, 1, 2);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120 w->setLayout (layout);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 setCentralWidget (w);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
123 quickColorMeta = parseQuickColorMeta ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
124
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 createMenuActions ();
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126 createMenus ();
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 createToolbars ();
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128
118
649110bb36a8 Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 117
diff changeset
129 setStatusBar (new QStatusBar);
649110bb36a8 Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 117
diff changeset
130
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
131 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
132
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
133 setWindowIcon (QIcon ("icons/ldforge.png"));
7
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
134 setTitle ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135 setMinimumSize (320, 200);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 resize (800, 600);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
139 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
141 // ========================================================================= //
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
142 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
143 // 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
144 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
145 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
146 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
147 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
148 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
149
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
150 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
151 }
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153 // things not implemented yet
77
7c2f500405fe Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 76
diff changeset
154 QAction* const qaDisabledActions[] = {
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
155 ACTION_NAME (newSubfile),
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
156 ACTION_NAME (about),
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
157 ACTION_NAME (help),
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
158 };
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
159
77
7c2f500405fe Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 76
diff changeset
160 for (QAction* act : qaDisabledActions)
7c2f500405fe Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 76
diff changeset
161 act->setEnabled (false);
92
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
162
586d294ca83f Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
163 History::updateActions ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
164 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
165
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
166 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
168 // ========================================================================= //
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
169 void ForgeWindow::createMenus () {
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
170 qRecentFilesMenu = new QMenu (tr ("Open &Recent"));
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
171 qRecentFilesMenu->setIcon (getIcon ("open-recent"));
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
172 updateRecentFilesMenu ();
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
173
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
174 // File menu
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
175 qFileMenu = menuBar ()->addMenu (tr ("&File"));
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
176 qFileMenu->addAction (ACTION_NAME (newFile)); // New
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
177 qFileMenu->addAction (ACTION_NAME (open)); // Open
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
178 qFileMenu->addMenu (qRecentFilesMenu); // Open Recent
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
179 qFileMenu->addAction (ACTION_NAME (save)); // Save
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
180 qFileMenu->addAction (ACTION_NAME (saveAs)); // Save As
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
181 qFileMenu->addSeparator (); // -------
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
182 qFileMenu->addAction (ACTION_NAME (settings)); // Settings
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
183 qFileMenu->addSeparator (); // -------
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
184 qFileMenu->addAction (ACTION_NAME (exit)); // Exit
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
185
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
186 // Insert menu
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
187 qInsertMenu = menuBar ()->addMenu (tr ("&Insert"));
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
188 qInsertMenu->addAction (ACTION_NAME (newSubfile)); // New Subfile
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
189 qInsertMenu->addAction (ACTION_NAME (newLine)); // New Line
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
190 qInsertMenu->addAction (ACTION_NAME (newTriangle)); // New Triangle
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
191 qInsertMenu->addAction (ACTION_NAME (newQuad)); // New Quad
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
192 qInsertMenu->addAction (ACTION_NAME (newCondLine)); // New Conditional Line
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
193 qInsertMenu->addAction (ACTION_NAME (newComment)); // New Comment
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
194 qInsertMenu->addAction (ACTION_NAME (newVertex)); // New Vertex
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 110
diff changeset
195 qInsertMenu->addAction (ACTION_NAME (newRadial)); // New Radial
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
196
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
197 // Edit menu
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
198 qEditMenu = menuBar ()->addMenu (tr ("&Edit"));
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
199 qEditMenu->addAction (ACTION_NAME (undo)); // Undo
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
200 qEditMenu->addAction (ACTION_NAME (redo)); // Redo
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
201 qEditMenu->addSeparator (); // -----
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
202 qEditMenu->addAction (ACTION_NAME (cut)); // Cut
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
203 qEditMenu->addAction (ACTION_NAME (copy)); // Copy
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
204 qEditMenu->addAction (ACTION_NAME (paste)); // Paste
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
205 qEditMenu->addAction (ACTION_NAME (del)); // Delete
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
206 qEditMenu->addSeparator (); // -----
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
207 qEditMenu->addAction (ACTION_NAME (selectByColor)); // Select by Color
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
208 qEditMenu->addAction (ACTION_NAME (selectByType)); // Select by Type
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
209 qEditMenu->addSeparator (); // -----
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
210 qEditMenu->addAction (ACTION_NAME (setColor)); // Set Color
118
649110bb36a8 Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 117
diff changeset
211 qEditMenu->addAction (ACTION_NAME (invert)); // Invert
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
212 qEditMenu->addAction (ACTION_NAME (inlineContents)); // Inline
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
213 qEditMenu->addAction (ACTION_NAME (deepInline)); // Deep Inline
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
214 qEditMenu->addAction (ACTION_NAME (splitQuads)); // Split Quads
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
215 qEditMenu->addAction (ACTION_NAME (setContents)); // Set Contents
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
216 qEditMenu->addAction (ACTION_NAME (makeBorders)); // Make Borders
103
b0a345196435 Added the ability to add vertices to object corners
Santeri Piippo <crimsondusk64@gmail.com>
parents: 102
diff changeset
217 qEditMenu->addAction (ACTION_NAME (makeCornerVerts)); // Make Corner Vertices
120
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
218 qEditMenu->addAction (ACTION_NAME (roundCoords)); // Round Coordinates
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
219
102
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
220 // Move menu
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
221 qMoveMenu = menuBar ()->addMenu (tr ("&Move"));
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
222 qMoveMenu->addAction (ACTION_NAME (moveUp)); // Move Up
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
223 qMoveMenu->addAction (ACTION_NAME (moveDown)); // Move Down
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
224 qMoveMenu->addSeparator (); // -----
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
225 qMoveMenu->addAction (ACTION_NAME (moveXPos)); // Move +X
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
226 qMoveMenu->addAction (ACTION_NAME (moveXNeg)); // Move -X
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
227 qMoveMenu->addAction (ACTION_NAME (moveYPos)); // Move +Y
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
228 qMoveMenu->addAction (ACTION_NAME (moveYNeg)); // Move -Y
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
229 qMoveMenu->addAction (ACTION_NAME (moveZPos)); // Move +Z
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
230 qMoveMenu->addAction (ACTION_NAME (moveZNeg)); // Move -Z
120
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
231 qMoveMenu->addSeparator (); // -----
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
232 qMoveMenu->addAction (ACTION_NAME (rotateXPos)); // Rotate +X
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
233 qMoveMenu->addAction (ACTION_NAME (rotateXNeg)); // Rotate -X
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
234 qMoveMenu->addAction (ACTION_NAME (rotateYPos)); // Rotate +Y
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
235 qMoveMenu->addAction (ACTION_NAME (rotateYNeg)); // Rotate -Y
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
236 qMoveMenu->addAction (ACTION_NAME (rotateZPos)); // Rotate +Z
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
237 qMoveMenu->addAction (ACTION_NAME (rotateZNeg)); // Rotate -Z
102
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
238
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
239 // Control menu
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 94
diff changeset
240 qControlMenu = menuBar ()->addMenu (tr ("&Control"));
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
241 qControlMenu->addAction (ACTION_NAME (showHistory)); // Show History
96
2f175b3d8211 Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 94
diff changeset
242
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
243 #ifndef RELEASE
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
244 // Debug menu
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
245 qDebugMenu = menuBar ()->addMenu (tr ("&Debug"));
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
246 qDebugMenu->addAction (ACTION_NAME (addTestQuad)); // Add Test Quad
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 110
diff changeset
247 qDebugMenu->addAction (ACTION_NAME (addTestRadial)); // Add Test Radial
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
248 #endif // RELEASE
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 96
diff changeset
249
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
250 // Help menu
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
251 qHelpMenu = menuBar ()->addMenu (tr ("&Help"));
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
252 qHelpMenu->addAction (ACTION_NAME (help)); // Help
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
253 qHelpMenu->addSeparator (); // -----
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
254 qHelpMenu->addAction (ACTION_NAME (about)); // About
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
255 qHelpMenu->addAction (ACTION_NAME (aboutQt)); // About Qt
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
256 }
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
257
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
258 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
260 // ========================================================================= //
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
261 void ForgeWindow::updateRecentFilesMenu () {
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
262 // First, clear any items in the recent files menu
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
263 for (QAction* qRecent : qaRecentFiles)
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
264 delete qRecent;
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
265 qaRecentFiles.clear ();
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
266
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
267 std::vector<str> zaFiles = io_recentfiles.value / "@";
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
268 for (long i = zaFiles.size() - 1; i >= 0; --i) {
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
269 str zFile = zaFiles[i];
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
270
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
271 QAction* qRecent = new QAction (getIcon ("open-recent"), zFile, this);
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
272
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
273 connect (qRecent, SIGNAL (triggered ()), this, SLOT (slot_recentFile ()));
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
274 qRecentFilesMenu->addAction (qRecent);
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
275 qaRecentFiles.push_back (qRecent);
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
276 }
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
277 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
278
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
279 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
281 // ========================================================================= //
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
282 #define ADD_TOOLBAR_ITEM(ACT) g_CurrentToolBar->addAction (ACTION_NAME (ACT));
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
283 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
284 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
285
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
286 void ForgeWindow::initSingleToolBar (const char* sName) {
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
287 QToolBar* qBar = new QToolBar (sName);
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
288 addToolBar (g_ToolBarArea, qBar);
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
289 qaToolBars.push_back (qBar);
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
290
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
291 g_CurrentToolBar = qBar;
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
292 }
77
7c2f500405fe Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 76
diff changeset
293
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
294 void ForgeWindow::createToolbars () {
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
295 initSingleToolBar ("File");
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 ADD_TOOLBAR_ITEM (newFile)
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
297 ADD_TOOLBAR_ITEM (open)
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
298 ADD_TOOLBAR_ITEM (save)
8dbf0fdf3374 Split some stuff out of the edit tool bar into move and object tool bars. The object tool bar is now located on the left side of the screen as the top one is running out of space.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
299 ADD_TOOLBAR_ITEM (saveAs)
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
300
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
301 initSingleToolBar ("Insert");
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
302 ADD_TOOLBAR_ITEM (newSubfile)
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
303 ADD_TOOLBAR_ITEM (newLine)
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
304 ADD_TOOLBAR_ITEM (newTriangle)
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
305 ADD_TOOLBAR_ITEM (newQuad)
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
306 ADD_TOOLBAR_ITEM (newCondLine)
8dbf0fdf3374 Split some stuff out of the edit tool bar into move and object tool bars. The object tool bar is now located on the left side of the screen as the top one is running out of space.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
307 ADD_TOOLBAR_ITEM (newComment)
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
308 ADD_TOOLBAR_ITEM (newVertex)
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 110
diff changeset
309 ADD_TOOLBAR_ITEM (newRadial)
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
310
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
311 initSingleToolBar ("Edit");
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
312 ADD_TOOLBAR_ITEM (undo)
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
313 ADD_TOOLBAR_ITEM (redo)
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
314 ADD_TOOLBAR_ITEM (cut)
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
315 ADD_TOOLBAR_ITEM (copy)
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
316 ADD_TOOLBAR_ITEM (paste)
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
317 ADD_TOOLBAR_ITEM (del)
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
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");
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
320 ADD_TOOLBAR_ITEM (selectByColor)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
321 ADD_TOOLBAR_ITEM (selectByType)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
322
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
323 addToolBarBreak (Qt::TopToolBarArea);
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
324
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
325 initSingleToolBar ("Move");
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
326 ADD_TOOLBAR_ITEM (moveUp)
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
327 ADD_TOOLBAR_ITEM (moveDown)
102
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
328 ADD_TOOLBAR_ITEM (moveXPos)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
329 ADD_TOOLBAR_ITEM (moveXNeg)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
330 ADD_TOOLBAR_ITEM (moveYPos)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
331 ADD_TOOLBAR_ITEM (moveYNeg)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
332 ADD_TOOLBAR_ITEM (moveZPos)
cacd4681ccb4 Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 101
diff changeset
333 ADD_TOOLBAR_ITEM (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
334
120
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
335 initSingleToolBar ("Rotate");
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
336 ADD_TOOLBAR_ITEM (rotateXPos)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
337 ADD_TOOLBAR_ITEM (rotateXNeg)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
338 ADD_TOOLBAR_ITEM (rotateYPos)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
339 ADD_TOOLBAR_ITEM (rotateYNeg)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
340 ADD_TOOLBAR_ITEM (rotateZPos)
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
341 ADD_TOOLBAR_ITEM (rotateZNeg)
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
342
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
343 // ==========================================
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
344 // Color toolbar
101
69d1464801d7 Remade vertex icons, the old ones sucked.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
345 qColorToolBar = new QToolBar ("Quick Colors");
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
346 addToolBar (Qt::RightToolBarArea, qColorToolBar);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
347
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
348 // ==========================================
87
8dbf0fdf3374 Split some stuff out of the edit tool bar into move and object tool bars. The object tool bar is now located on the left side of the screen as the top one is running out of space.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 85
diff changeset
349 // Left area toolbars
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
350 g_ToolBarArea = Qt::LeftToolBarArea;
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
351 initSingleToolBar ("Objects");
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
352 ADD_TOOLBAR_ITEM (setColor)
118
649110bb36a8 Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 117
diff changeset
353 ADD_TOOLBAR_ITEM (invert)
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
354 ADD_TOOLBAR_ITEM (inlineContents)
98
5dcc551f260a Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
355 ADD_TOOLBAR_ITEM (deepInline)
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
356 ADD_TOOLBAR_ITEM (splitQuads)
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
357 ADD_TOOLBAR_ITEM (setContents)
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
358 ADD_TOOLBAR_ITEM (makeBorders)
103
b0a345196435 Added the ability to add vertices to object corners
Santeri Piippo <crimsondusk64@gmail.com>
parents: 102
diff changeset
359 ADD_TOOLBAR_ITEM (makeCornerVerts)
120
607301744394 Rotation and rounding. Rotation needs work to get proper origin stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 118
diff changeset
360 ADD_TOOLBAR_ITEM (roundCoords)
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
361
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
362 updateToolBars ();
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
363 }
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
364
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
365 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
366 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
367 // ========================================================================= //
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
368 std::vector<quickColorMetaEntry> parseQuickColorMeta () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
369 std::vector<quickColorMetaEntry> meta;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
370
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
371 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
372 if (zColor == "|") {
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
373 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
374 } else {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
375 color* col = getColor (atoi (zColor));
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
376 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
377 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
378 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
379
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
380 return meta;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
381 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
382
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
383 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
384 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
385 // ========================================================================= //
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
386 void ForgeWindow::updateToolBars () {
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
387 for (QToolBar* qBar : qaToolBars)
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
388 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
389
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
390 // Update the quick color toolbar.
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
391 for (QPushButton* qButton : qaColorButtons)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
392 delete qButton;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
393
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
394 qaColorButtons.clear ();
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 // Clear the toolbar to remove separators
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
397 qColorToolBar->clear ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
398
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
399 for (quickColorMetaEntry& entry : quickColorMeta) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
400 if (entry.bSeparator)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
401 qColorToolBar->addSeparator ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
402 else {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
403 QPushButton* qColorButton = new QPushButton;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
404 qColorButton->setAutoFillBackground (true);
116
4fde8fdf258a Some renaming
Santeri Piippo <crimsondusk64@gmail.com>
parents: 114
diff changeset
405 qColorButton->setStyleSheet (format ("background-color: %s", entry.col->zColorString.chars()));
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
406 qColorButton->setToolTip (entry.col->zName);
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 connect (qColorButton, SIGNAL (clicked ()), this, SLOT (slot_quickColor ()));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
409 qColorToolBar->addWidget (qColorButton);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
410 qaColorButtons.push_back (qColorButton);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
411
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
412 entry.btn = qColorButton;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
413 }
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 87
diff changeset
414 }
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
415 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
416
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
417 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
418 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
419 // ========================================================================= //
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
420 void ForgeWindow::setTitle () {
7
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
421 str zTitle = APPNAME_DISPLAY " v" VERSION_STRING;
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
422
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
423 // Append our current file if we have one
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
424 if (g_CurrentFile) {
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
425 zTitle.appendformat (": %s", basename (g_CurrentFile->zFileName.chars()));
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
426
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
427 if (g_CurrentFile->objects.size() > 0 &&
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
428 g_CurrentFile->objects[0]->getType() == OBJ_Comment)
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
429 {
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
430 // Append title
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
431 LDComment* comm = static_cast<LDComment*> (g_CurrentFile->objects[0]);
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
432 zTitle.appendformat (": %s", comm->zText.chars());
7
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
433 }
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
434 }
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
435
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
436 setWindowTitle (zTitle.chars());
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
437 }
098e3c4949c6 Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
438
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
439 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
440 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
441 // ========================================================================= //
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
442 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
443 // 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
444 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
445
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
446 // Find the meta for the action.
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
447 actionmeta* pMeta = null;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
448
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
449 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
450 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
451 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
452 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
453 }
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
454 }
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
455
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
456 if (!pMeta) {
117
7eb7a43a511b Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
457 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
458 return;
499c25af0303 Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
459 }
499c25af0303 Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
460
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
461 // 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
462 (*pMeta->handler) ();
57
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 56
diff changeset
463 }
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 56
diff changeset
464
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
465 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
466 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
467 // ========================================================================= //
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
468 void ForgeWindow::deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects) {
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
469 if (selection ().size () == 0)
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
470 return;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
471
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
472 std::vector<LDObject*> sel = selection ();
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
473
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
474 // Delete the objects that were being selected
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
475 for (LDObject* obj : sel) {
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
476 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
477 papObjects->push_back (obj->clone ());
a9e67f6e610e Added history management for cut and paste, copy doesn't alter the object list by itself so it doesn't touch history
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
478 ulapIndices->push_back (obj->getIndex (g_CurrentFile));
a9e67f6e610e Added history management for cut and paste, copy doesn't alter the object list by itself so it doesn't touch history
Santeri Piippo <crimsondusk64@gmail.com>
parents: 92
diff changeset
479 }
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
480
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
481 g_CurrentFile->forgetObject (obj);
ada4679d5bce Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 63
diff changeset
482 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
483 }
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
484
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
485 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
486 }
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
487
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
488 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
489 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
490 // ========================================================================= //
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
491 void ForgeWindow::buildObjList () {
3
2b78cf8634c3 don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
492 if (!g_CurrentFile)
2b78cf8634c3 don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
493 return;
2b78cf8634c3 don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
494
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
495 // 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
496 // doesn't trigger selection updating so that the selection doesn't get lost
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
497 // while this is done
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
498 g_bSelectionLocked = true;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
499
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
500 QList<QTreeWidgetItem*> qaItems;
3
2b78cf8634c3 don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
501
2b78cf8634c3 don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
502 qObjList->clear ();
2b78cf8634c3 don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
503
70
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
504 for (LDObject* obj : g_CurrentFile->objects) {
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
505 str zText;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
506 switch (obj->getType ()) {
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
507 case OBJ_Comment:
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 11
diff changeset
508 zText = static_cast<LDComment*> (obj)->zText.chars();
10
5b0579997e9b remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents: 7
diff changeset
509
5b0579997e9b remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents: 7
diff changeset
510 // Remove leading whitespace
5b0579997e9b remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents: 7
diff changeset
511 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
512 zText -= -1;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
513 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
514
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
515 case OBJ_Empty:
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
516 break; // leave it empty
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
517
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
518 case OBJ_Line:
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
519 {
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
520 LDLine* line = static_cast<LDLine*> (obj);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
521 zText.format ("%s, %s",
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
522 line->vaCoords[0].getStringRep (true).chars(),
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
523 line->vaCoords[1].getStringRep (true).chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
524 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
525 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
526
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
527 case OBJ_Triangle:
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
528 {
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
529 LDTriangle* triangle = static_cast<LDTriangle*> (obj);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
530 zText.format ("%s, %s, %s",
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
531 triangle->vaCoords[0].getStringRep (true).chars(),
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
532 triangle->vaCoords[1].getStringRep (true).chars(),
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
533 triangle->vaCoords[2].getStringRep (true).chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
534 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
535 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
536
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
537 case OBJ_Quad:
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
538 {
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
539 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
540 zText.format ("%s, %s, %s, %s",
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
541 quad->vaCoords[0].getStringRep (true).chars(),
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
542 quad->vaCoords[1].getStringRep (true).chars(),
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
543 quad->vaCoords[2].getStringRep (true).chars(),
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
544 quad->vaCoords[3].getStringRep (true).chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
545 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
546 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
547
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
548 case OBJ_CondLine:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
549 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
550 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
551 zText.format ("%s, %s, %s, %s",
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
552 line->vaCoords[0].getStringRep (true).chars(),
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
553 line->vaCoords[1].getStringRep (true).chars(),
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
554 line->vaCoords[2].getStringRep (true).chars(),
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
555 line->vaCoords[3].getStringRep (true).chars());
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
556 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
557 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
558
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
559 case OBJ_Gibberish:
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
560 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
561 static_cast<LDGibberish*> (obj)->zContents.chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
562 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
563
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
564 case OBJ_Vertex:
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
565 zText.format ("%s", static_cast<LDVertex*> (obj)->vPosition.getStringRep (true).chars());
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
566 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
567
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
568 case OBJ_Subfile:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
569 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
570 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
571
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
572 zText.format ("%s %s, (",
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
573 ref->zFileName.chars(), ref->vPosition.getStringRep (true).chars());
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
574
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
575 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
576 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
577 ftoa (ref->mMatrix[i]).chars(),
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
578 (i != 8) ? " " : "");
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
579
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
580 zText += ')';
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 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
583
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
584 case OBJ_BFC:
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
585 {
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
586 LDBFC* bfc = static_cast<LDBFC*> (obj);
114
fe1bfc5f59ed Added functionality for getting a primitive name from a radial.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 113
diff changeset
587 zText = LDBFC::saStatements[bfc->eStatement];
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
588 }
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
589 break;
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
590
112
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
591 case OBJ_Radial:
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
592 {
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
593 LDRadial* pRad = static_cast<LDRadial*> (obj);
114
fe1bfc5f59ed Added functionality for getting a primitive name from a radial.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 113
diff changeset
594 zText.format ("%s: %d / %d %s", pRad->makeFileName ().chars (),
fe1bfc5f59ed Added functionality for getting a primitive name from a radial.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 113
diff changeset
595 pRad->dSegments, pRad->dDivisions, pRad->radialTypeName());
112
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
596
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
597 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
598 zText.appendformat (" %d", pRad->dRingNum);
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
599
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
600 zText.appendformat (" %s", pRad->vPosition.getStringRep (true).chars ());
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
601 }
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
602 break;
fa2f00081357 Added object list representation for radials
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
603
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
604 default:
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
605 zText = g_saObjTypeNames[obj->getType ()];
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
606 break;
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
607 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
608
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
609 QTreeWidgetItem* item = new QTreeWidgetItem ((QTreeWidget*) (null),
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
610 QStringList (zText.chars()), 0);
113
bbaa40226ec9 Radial saving and reading from files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 112
diff changeset
611 item->setIcon (0, getIcon (g_saObjTypeIcons[obj->getType ()]));
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
612
113
bbaa40226ec9 Radial saving and reading from files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 112
diff changeset
613 // 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
614 if (obj->getType() == OBJ_Gibberish) {
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
615 item->setBackground (0, QColor ("#AA0000"));
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
616 item->setForeground (0, QColor ("#FFAA00"));
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
617 } else if (lv_colorize &&
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
618 obj->dColor != -1 &&
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
619 obj->dColor != dMainColor &&
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
620 obj->dColor != dEdgeColor)
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
621 {
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
622 // 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
623 // 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
624 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
625 if (col)
72
5755c02d89f0 Added LDConfig.ldr parsing. All colors now available as long as LDConfig.ldr is provided.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
626 item->setForeground (0, 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
627 }
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
628
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
629 obj->qObjListEntry = item;
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
630
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
631 qaItems.append (item);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
632 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
633
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
634 qObjList->insertTopLevelItems (0, qaItems);
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
635
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
636 g_bSelectionLocked = false;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
637 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
638 }
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
639
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
640 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
641 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
642 // ========================================================================= //
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
643 void ForgeWindow::slot_selectionChanged () {
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
644 if (g_bSelectionLocked == true)
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
645 return;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
646
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
647 /*
17
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
648 // If the selection isn't 1 exact, disable setting contents
77
7c2f500405fe Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 76
diff changeset
649 ACTION (setContents)->setEnabled (qObjList->selectedItems().size() == 1);
22
335e430a6b4f So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 21
diff changeset
650
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
651 // If we have no selection, disable splitting quads
77
7c2f500405fe Systemized actions and added (for now no-op) key configurations for them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 76
diff changeset
652 ACTION (splitQuads)->setEnabled (qObjList->selectedItems().size() > 0);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
653 */
108
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
654
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
655 // Update the shared selection array, unless this was called during GL picking,
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
656 // in which case the GL renderer takes care of the selection.
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
657 if (R->bPicking == false) {
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
658 std::vector<LDObject*> paPriorSelection = paSelection;
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
659 paSelection = getSelectedObjects ();
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
660
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
661 // Update the GL renderer
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
662 for (LDObject* obj : paSelection)
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
663 R->recompileObject (obj);
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
664
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
665 for (LDObject* obj : paPriorSelection)
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
666 R->recompileObject (obj);
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
667
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
668 R->updateSelFlash ();
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
669 R->refresh ();
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
670 }
17
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
671 }
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
672
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
673 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
674 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
675 // ========================================================================= //
99
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
676 void ForgeWindow::slot_recentFile () {
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
677 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
678 openMainFile (qAct->text ());
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
679 }
920d51fec412 Recent files are now remembered and displayed in a submenu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 98
diff changeset
680
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
681 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
682 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
683 // ========================================================================= //
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
684 void ForgeWindow::slot_quickColor () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
685 QPushButton* qBtn = static_cast<QPushButton*> (sender ());
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
686 color* col = null;
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
687
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
688 for (quickColorMetaEntry entry : quickColorMeta) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
689 if (entry.btn == qBtn) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
690 col = entry.col;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
691 break;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
692 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
693 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
694
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
695 if (col == null)
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
696 return;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
697
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
698 std::vector<ulong> ulaIndices;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
699 std::vector<short> daColors;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
700 short dNewColor = col->index ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
701
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
702 for (LDObject* obj : paSelection) {
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
703 if (obj->dColor == -1)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
704 continue; // uncolored object
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
705
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
706 ulaIndices.push_back (obj->getIndex (g_CurrentFile));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
707 daColors.push_back (obj->dColor);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
708
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
709 obj->dColor = dNewColor;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
710 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
711
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
712 History::addEntry (new SetColorHistory (ulaIndices, daColors, dNewColor));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
713 refresh ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
714 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
715
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
716 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
717 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
718 // ========================================================================= //
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
719 ulong ForgeWindow::getInsertionPoint () {
17
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
720 ulong ulIndex;
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
721
17
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
722 if (qObjList->selectedItems().size() == 1) {
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
723 // If we have a selection, put the item after it.
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
724 for (ulIndex = 0; ulIndex < g_CurrentFile->objects.size(); ++ulIndex)
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
725 if (g_CurrentFile->objects[ulIndex]->qObjListEntry == qObjList->selectedItems()[0])
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
726 break;
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
727
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
728 if (ulIndex >= g_CurrentFile->objects.size())
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
729 return ulIndex + 1;
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
730 }
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
731
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
732 // Otherwise place the object at the end.
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
733 return g_CurrentFile->objects.size();
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
734 }
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
735
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
736 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
737 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
738 // ========================================================================= //
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
739 void ForgeWindow::refresh () {
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
740 buildObjList ();
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 28
diff changeset
741 R->hardRefresh ();
48
113eb6446c61 Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
742 }
113eb6446c61 Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
743
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
744 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
745 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
746 // ========================================================================= //
50
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 49
diff changeset
747 std::vector<LDObject*> ForgeWindow::getSelectedObjects () {
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 49
diff changeset
748 std::vector<LDObject*> objs;
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 49
diff changeset
749
108
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
750 if (g_CurrentFile == nullptr)
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
751 return objs;
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
752
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
753 QList<QTreeWidgetItem*> const qaItems = qObjList->selectedItems ();
351aef26f444 More selection work - selecting from GUI updates the GL renderer now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
754
70
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
755 for (LDObject* obj : g_CurrentFile->objects)
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
756 for (QTreeWidgetItem* qItem : qaItems) {
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
757 if (qItem == obj->qObjListEntry) {
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
758 objs.push_back (obj);
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
759 break;
50
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 49
diff changeset
760 }
49
242f6ea0f5e5 Finished with the color selection dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 48
diff changeset
761 }
50
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 49
diff changeset
762
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 49
diff changeset
763 return objs;
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
764 }
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
765
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
766 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
767 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
768 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
769 void ForgeWindow::updateSelection () {
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
770 g_bSelectionLocked = true;
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
771
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
772 for (LDObject* obj : paSelection)
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
773 obj->qObjListEntry->setSelected (true);
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
774
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
775 g_bSelectionLocked = false;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
776 slot_selectionChanged ();
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
777 }
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
778
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
779 // ========================================================================= //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
780 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
781 // ========================================================================= //
105
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
782 bool ForgeWindow::isSelected (LDObject* obj) {
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
783 LDObject* pNeedle = obj->topLevelParent ();
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
784
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
785 if (pNeedle == null)
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
786 pNeedle = obj;
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
787
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
788 for (LDObject* pHay : paSelection)
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
789 if (pHay == pNeedle)
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
790 return true;
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
791 return false;
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
792 }
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
793
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
794 short ForgeWindow::getSelectedColor() {
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
795 short dResult = -1;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
796
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
797 for (LDObject* obj : paSelection) {
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
798 if (obj->dColor == -1)
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
799 continue; // doesn't use color
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
800
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
801 if (dResult != -1 && obj->dColor != dResult)
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
802 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
803
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
804 if (dResult == -1)
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
805 dResult = obj->dColor;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
806 }
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
807
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
808 return dResult;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
809 }
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
810
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
811 // ========================================================================= //
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
812 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
813 // ========================================================================= //
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
814 LDObjectType_e ForgeWindow::getSelectedType () {
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
815 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
816
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
817 for (LDObject* obj : paSelection) {
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
818 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
819 return OBJ_Unidentified;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
820
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
821 if (eResult == OBJ_Unidentified)
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
822 eResult = obj->getType ();
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
823 }
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
824
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
825 return eResult;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
826 }
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
827
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
828 // ========================================================================= //
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
829 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
830 // ========================================================================= //
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
831 std::vector<LDObject*>& ForgeWindow::selection () {
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
832 return paSelection;
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
833 }
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 108
diff changeset
834
105
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
835 // ========================================================================= //
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
836 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53f95a6e351d Highlight selected objects with a different color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
837 // ========================================================================= //
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
838 QIcon getIcon (const char* sIconName) {
116
4fde8fdf258a Some renaming
Santeri Piippo <crimsondusk64@gmail.com>
parents: 114
diff changeset
839 return (QIcon (format ("./icons/%s.png", sIconName)));
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
840 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
841
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 103
diff changeset
842 // ========================================================================= //
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
843 bool confirm (str zMessage) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
844 return QMessageBox::question (g_ForgeWindow, "Confirm", zMessage,
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
845 (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
846 }

mercurial