zz_addObjectDialog.cpp

Sat, 20 Apr 2013 04:26:36 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 20 Apr 2013 04:26:36 +0300
changeset 119
b93a64f5ee67
parent 116
4fde8fdf258a
child 135
c243df39913e
permissions
-rw-r--r--

some GUI tweaks

39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <qgridlayout.h>
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include "gui.h"
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "zz_addObjectDialog.h"
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "file.h"
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
23 #include "colors.h"
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
24 #include "zz_colorSelectDialog.h"
95
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
25 #include "history.h"
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
27 #define APPLY_COORDS(OBJ, N) \
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
28 for (short i = 0; i < N; ++i) { \
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
29 OBJ->vaCoords[i].x = dlg.qaCoordinates[(i * 3) + 0]->value (); \
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
30 OBJ->vaCoords[i].y = dlg.qaCoordinates[(i * 3) + 1]->value (); \
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
31 OBJ->vaCoords[i].z = dlg.qaCoordinates[(i * 3) + 2]->value (); \
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
32 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
33
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 // =============================================================================
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 // =============================================================================
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 AddObjectDialog::AddObjectDialog (const LDObjectType_e type, QWidget* parent) :
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 QDialog (parent)
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 {
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
40 short dCoordCount = 0;
116
4fde8fdf258a Some renaming
Santeri Piippo <crimsondusk64@gmail.com>
parents: 113
diff changeset
41 str zIconName = format ("icons/add-%s.png", g_saObjTypeIcons[type]);
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
42
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 qTypeIcon = new QLabel;
42
499c25af0303 Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
44 qTypeIcon->setPixmap (QPixmap (zIconName.chars ()));
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
46 switch (type) {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
47 case OBJ_Comment:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
48 qCommentLine = new QLineEdit;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
49 break;
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
50
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
51 case OBJ_Line:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
52 dCoordCount = 6;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
53 break;
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
54
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
55 case OBJ_Triangle:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
56 dCoordCount = 9;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
57 break;
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
58
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
59 case OBJ_Quad:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
60 case OBJ_CondLine:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
61 dCoordCount = 12;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
62 break;
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
63
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
64 case OBJ_Vertex:
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
65 dCoordCount = 3;
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
66
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
67 case OBJ_Radial:
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
68 dCoordCount = 3;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
69
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
70 qRadialTypeLabel = new QLabel ("Type:");
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
71 qRadialResolutionLabel = new QLabel ("Resolution:");
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
72 qRadialSegmentsLabel = new QLabel ("Segments:");
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
73 qRadialRingNumLabel = new QLabel ("Ring number:");
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
74
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
75 qRadialType = new QComboBox;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
76
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
77 for (int i = 0; i < LDRadial::NumTypes; ++i)
113
bbaa40226ec9 Radial saving and reading from files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
78 qRadialType->addItem (LDRadial::radialTypeName ((LDRadial::Type) i));
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
79
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
80 connect (qRadialType, SIGNAL (currentIndexChanged (int)), this, SLOT (slot_radialTypeChanged (int)));
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
81
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
82 qRadialResolution = new QComboBox;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
83 qRadialResolution->addItems ({"Normal (16)", "Hi-Res (48)"});
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
84
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
85 qRadialSegments = new QSpinBox;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
86 qRadialSegments->setMinimum (1);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
87
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
88 qRadialRingNum = new QSpinBox;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
89 qRadialRingNum->setEnabled (false);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
90 break;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
91
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
92 default:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
93 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
94 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
95
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
96 // Show a color edit dialog for the types that actually use the color
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
97 bool bUsesColor = false;
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
98 switch (type) {
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
99 case OBJ_CondLine:
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
100 case OBJ_Line:
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
101 case OBJ_Quad:
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
102 case OBJ_Triangle:
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
103 case OBJ_Vertex:
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
104 case OBJ_Subfile:
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
105 case OBJ_Radial:
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
106 bUsesColor = true;
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
107 break;
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
108 default:
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
109 break;
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
110 }
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
111
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
112 if (bUsesColor) {
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
113 dColor = (type == OBJ_CondLine || type == OBJ_Line) ? dEdgeColor : dMainColor;
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
114
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
115 qColorButton = new QPushButton;
72
5755c02d89f0 Added LDConfig.ldr parsing. All colors now available as long as LDConfig.ldr is provided.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
116 setButtonBackground (qColorButton, dColor);
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
117 connect (qColorButton, SIGNAL (clicked ()), this, SLOT (slot_colorButtonClicked ()));
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
118 }
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
119
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
120 for (short i = 0; i < dCoordCount; ++i) {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
121 qaCoordinates[i] = new QDoubleSpinBox;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
122 qaCoordinates[i]->setMaximumWidth (96);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
123 qaCoordinates[i]->setMinimum (-fMaxCoord);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
124 qaCoordinates[i]->setMaximum (fMaxCoord);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
125 }
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 IMPLEMENT_DIALOG_BUTTONS
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
129 QGridLayout* const qLayout = new QGridLayout;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
130 qLayout->addWidget (qTypeIcon, 0, 0);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
131
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
132 switch (type) {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
133 case OBJ_Comment:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
134 qLayout->addWidget (qCommentLine, 0, 1);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
135 break;
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
136
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
137 case OBJ_Radial:
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
138 qLayout->addWidget (qRadialTypeLabel, 1, 1);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
139 qLayout->addWidget (qRadialType, 1, 2);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
140 qLayout->addWidget (qRadialResolutionLabel, 2, 1);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
141 qLayout->addWidget (qRadialResolution, 2, 2);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
142 qLayout->addWidget (qRadialSegmentsLabel, 3, 1);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
143 qLayout->addWidget (qRadialSegments, 3, 2);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
144 qLayout->addWidget (qRadialRingNumLabel, 4, 1);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
145 qLayout->addWidget (qRadialRingNum, 4, 2);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
146 break;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
147
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
148 default:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
149 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
150 }
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
151
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
152 if (bUsesColor)
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
153 qLayout->addWidget (qColorButton, 1, 0);
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
154
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
155 if (dCoordCount > 0) {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
156 QGridLayout* const qCoordLayout = new QGridLayout;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
157
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
158 for (short i = 0; i < dCoordCount; ++i)
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
159 qCoordLayout->addWidget (qaCoordinates[i], (i / 3), (i % 3));
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
160
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
161 qLayout->addLayout (qCoordLayout, 0, 1, 2, 2);
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
162 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
163
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
164 qLayout->addWidget (qButtons, 5, 1);
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
165 setLayout (qLayout);
116
4fde8fdf258a Some renaming
Santeri Piippo <crimsondusk64@gmail.com>
parents: 113
diff changeset
166 setWindowTitle (format (APPNAME_DISPLAY " - new %s",
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
167 g_saObjTypeNames[type]).chars());
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
168
42
499c25af0303 Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
169 setWindowIcon (QIcon (zIconName.chars ()));
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
170 }
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
171
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
172 // =============================================================================
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
174 // =============================================================================
72
5755c02d89f0 Added LDConfig.ldr parsing. All colors now available as long as LDConfig.ldr is provided.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
175 void AddObjectDialog::setButtonBackground (QPushButton* qButton, short dColor) {
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
176 qButton->setIcon (QIcon ("icons/palette.png"));
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
177 qButton->setAutoFillBackground (true);
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
178 qButton->setStyleSheet (
116
4fde8fdf258a Some renaming
Santeri Piippo <crimsondusk64@gmail.com>
parents: 113
diff changeset
179 format ("background-color: %s", getColor (dColor)->zColorString.chars()).chars()
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
180 );
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
181 }
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
182
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
183 // =============================================================================
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
185 // =============================================================================
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
186 void AddObjectDialog::slot_colorButtonClicked () {
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
187 ColorSelectDialog::staticDialog (dColor, dColor, this);
72
5755c02d89f0 Added LDConfig.ldr parsing. All colors now available as long as LDConfig.ldr is provided.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
188 setButtonBackground (qColorButton, dColor);
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
189 }
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
190
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
191 // =============================================================================
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
193 // =============================================================================
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
194 void AddObjectDialog::slot_radialTypeChanged (int dType) {
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
195 LDRadial::Type eType = (LDRadial::Type) dType;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
196 qRadialRingNum->setEnabled (eType == LDRadial::Ring || eType == LDRadial::Cone);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
197 }
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
198
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
199 // =============================================================================
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
201 // =============================================================================
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
202 void AddObjectDialog::staticDialog (const LDObjectType_e type, ForgeWindow* window) {
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
203 AddObjectDialog dlg (type, window);
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 97
diff changeset
204 LDObject* obj = null;
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
205
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
206 if (dlg.exec ()) {
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
207 switch (type) {
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
208 case OBJ_Comment:
95
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
209 obj = new LDComment (dlg.qCommentLine->text ());
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
210 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
211
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
212 case OBJ_Line:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
213 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
214 LDLine* line = new LDLine;
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
215 line->dColor = dlg.dColor;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
216 APPLY_COORDS (line, 2)
95
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
217 obj = line;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
218 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
219 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
220
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
221 case OBJ_Triangle:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
222 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
223 LDTriangle* tri = new LDTriangle;
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
224 tri->dColor = dlg.dColor;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
225 APPLY_COORDS (tri, 3)
95
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
226 obj = tri;
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
227 }
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
228 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
229
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
230 case OBJ_Quad:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
231 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
232 LDQuad* quad = new LDQuad;
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
233 quad->dColor = dlg.dColor;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
234 APPLY_COORDS (quad, 4)
95
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
235 obj = quad;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
236 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
237 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
238
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
239 case OBJ_CondLine:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
240 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
241 LDCondLine* line = new LDCondLine;
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
242 line->dColor = dlg.dColor;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
243 APPLY_COORDS (line, 4)
95
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
244 obj = line;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
245 }
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
246 break;
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
247
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
248 case OBJ_Vertex:
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
249 {
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
250 LDVertex* vert = new LDVertex;
51
94c434a56961 Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
251 vert->dColor = dlg.dColor;
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
252 vert->vPosition.x = dlg.qaCoordinates[0]->value ();
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
253 vert->vPosition.y = dlg.qaCoordinates[1]->value ();
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
254 vert->vPosition.z = dlg.qaCoordinates[2]->value ();
95
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
255 obj = vert;
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
256 }
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
257 break;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
258
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
259 case OBJ_Radial:
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
260 {
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
261 LDRadial* pRad = new LDRadial;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
262 pRad->dColor = dlg.dColor;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
263 pRad->vPosition.x = dlg.qaCoordinates[0]->value ();
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
264 pRad->vPosition.y = dlg.qaCoordinates[1]->value ();
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
265 pRad->vPosition.z = dlg.qaCoordinates[2]->value ();
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
266 pRad->dDivisions = (dlg.qRadialResolution->currentIndex () == 0) ? 16 : 48;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
267 pRad->dSegments = min<short> (dlg.qRadialSegments->value (), pRad->dDivisions);
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
268 pRad->eRadialType = (LDRadial::Type) dlg.qRadialType->currentIndex ();
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
269 pRad->dRingNum = dlg.qRadialRingNum->value ();
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
270 pRad->mMatrix = g_mIdentity;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
271
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
272 obj = pRad;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
273 }
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
274 break;
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
275
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
276 default:
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
277 break;
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
278 }
95
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
279
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
280 ulong idx = g_CurrentFile->addObject (obj);
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 95
diff changeset
281 History::addEntry (new AddHistory ({idx}, {obj->clone ()}));
95
0a8ad4e3e7c1 Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 72
diff changeset
282 window->refresh ();
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
283 }
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
284 }

mercurial