zz_addObjectDialog.cpp

Wed, 20 Mar 2013 02:44:21 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Wed, 20 Mar 2013 02:44:21 +0200
changeset 42
499c25af0303
parent 41
4ca63da5546b
child 51
94c434a56961
permissions
-rw-r--r--

Added code for parsing vertices

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
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri `arezey` Piippo
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"
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
24 #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
25 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
26 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
27 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
28 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
29 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
30
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 // =============================================================================
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 // =============================================================================
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 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
35 QDialog (parent)
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 {
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
37 short dCoordCount = 0;
42
499c25af0303 Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
38 str zIconName = str::mkfmt ("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
39
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 qTypeIcon = new QLabel;
42
499c25af0303 Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
41 qTypeIcon->setPixmap (QPixmap (zIconName.chars ()));
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
43 switch (type) {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
44 case OBJ_Comment:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
45 qCommentLine = new QLineEdit;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
46 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
47 case OBJ_Line:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
48 dCoordCount = 6;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
49 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
50 case OBJ_Triangle:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
51 dCoordCount = 9;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
52 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
53 case OBJ_Quad:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
54 case OBJ_CondLine:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
55 dCoordCount = 12;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
56 break;
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
57 case OBJ_Vertex:
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
58 dCoordCount = 3;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
59 default:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
60 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
61 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
62
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
63 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
64 qaCoordinates[i] = new QDoubleSpinBox;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
65 qaCoordinates[i]->setMaximumWidth (96);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
66 qaCoordinates[i]->setMinimum (-fMaxCoord);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
67 qaCoordinates[i]->setMaximum (fMaxCoord);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
68 }
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 IMPLEMENT_DIALOG_BUTTONS
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
72 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
73 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
74
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
75 switch (type) {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
76 case OBJ_Comment:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
77 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
78 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
79 default:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
80 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
81 }
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
83 if (dCoordCount > 0) {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
84 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
85
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
86 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
87 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
88
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
89 qLayout->addLayout (qCoordLayout, 0, 1);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
90 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
91
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
92 qLayout->addWidget (qButtons, 1, 1);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
93 setLayout (qLayout);
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 setWindowTitle (str::mkfmt (APPNAME_DISPLAY " - new %s",
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 g_saObjTypeNames[type]).chars());
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96
42
499c25af0303 Added code for parsing vertices
Santeri Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
97 setWindowIcon (QIcon (zIconName.chars ()));
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 }
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 // =============================================================================
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102 // =============================================================================
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 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
104 AddObjectDialog dlg (type, window);
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 if (dlg.exec ()) {
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 switch (type) {
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108 case OBJ_Comment:
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109 {
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 LDComment* comm = new LDComment;
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 comm->zText = dlg.qCommentLine->text ();
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112 g_CurrentFile->addObject (comm);
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113 window->refresh ();
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
114 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
115 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
116
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
117 case OBJ_Line:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
118 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
119 LDLine* line = new LDLine;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
120 line->dColor = dEdgeColor;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
121
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
122 APPLY_COORDS (line, 2)
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
123
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
124 g_CurrentFile->addObject (line);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
125 window->refresh ();
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
126 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
127 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
128
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
129 case OBJ_Triangle:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
130 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
131 LDTriangle* tri = new LDTriangle;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
132 tri->dColor = dMainColor;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
133
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
134 APPLY_COORDS (tri, 3)
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
135
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
136 g_CurrentFile->addObject (tri);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
137 window->refresh ();
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 }
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
139 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
140
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
141 case OBJ_Quad:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
142 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
143 LDQuad* quad = new LDQuad;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
144 quad->dColor = dMainColor;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
145
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
146 APPLY_COORDS (quad, 4)
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
147
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
148 g_CurrentFile->addObject (quad);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
149 window->refresh ();
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
150 }
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
151 break;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
152
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
153 case OBJ_CondLine:
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
154 {
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
155 LDCondLine* line = new LDCondLine;
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
156 line->dColor = dEdgeColor;
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 APPLY_COORDS (line, 4)
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
159
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
160 g_CurrentFile->addObject (line);
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
161 window->refresh ();
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
162 }
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
163 break;
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
164
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
165 case OBJ_Vertex:
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
166 {
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
167 LDVertex* vert = new LDVertex;
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
168 vert->dColor = dMainColor;
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
169 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
170 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
171 vert->vPosition.z = dlg.qaCoordinates[2]->value ();
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
172
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
173 g_CurrentFile->addObject (vert);
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
174 window->refresh ();
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
175 }
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
176 break;
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
177
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
178 default:
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
179 break;
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
180 }
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
181 }
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
182 }

mercurial