Fri, 03 May 2013 18:30:38 +0300
Camera is now stored to configuration so it is preserved across program shutdown. I don't know how significant this is but eh
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 | 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> |
136
13db97be14cb
Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
20 | #include <qradiobutton.h> |
13db97be14cb
Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
21 | #include <qcheckbox.h> |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "gui.h" |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "zz_addObjectDialog.h" |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include "file.h" |
51
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
25 | #include "colors.h" |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
26 | #include "zz_colorSelectDialog.h" |
95
0a8ad4e3e7c1
Added history support for adding objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
27 | #include "history.h" |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
29 | #define APPLY_COORDS(OBJ, N) \ |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
30 | for (short i = 0; i < N; ++i) \ |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
31 | for (const Axis ax : g_Axes) \ |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
32 | OBJ->vaCoords[i][ax] = dlg.dsb_coords[(i * 3) + ax]->value (); |
40
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 | // ============================================================================= |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
35 | class SubfileListItem : public QTreeWidgetItem { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
36 | public: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
37 | SubfileListItem (QTreeWidgetItem* parent, int subfileID) : |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
38 | QTreeWidgetItem (parent), subfileID (subfileID) {} |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
39 | SubfileListItem (QTreeWidget* parent, int subfileID) : |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
40 | QTreeWidgetItem (parent), subfileID (subfileID) {} |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
41 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
42 | int subfileID; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
43 | }; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
44 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
45 | // ============================================================================= |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | // ============================================================================= |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
48 | AddObjectDialog::AddObjectDialog (const LDObjectType_e type, LDObject* obj, QWidget* parent) : |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | QDialog (parent) |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | { |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
51 | short coordCount = 0; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
52 | str iconName = format ("icons/add-%s.png", g_saObjTypeIcons[type]); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
53 | LDObject* defaults = LDObject::getDefault (type); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
54 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
55 | lb_typeIcon = new QLabel; |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
56 | lb_typeIcon->setPixmap (QPixmap (iconName)); |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
58 | switch (type) { |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
59 | case OBJ_Comment: |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
60 | le_comment = new QLineEdit; |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
61 | if (obj) |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
62 | le_comment->setText (static_cast<LDComment*> (obj)->zText); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
63 | 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
|
64 | |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
65 | case OBJ_Line: |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
66 | coordCount = 6; |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
67 | 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
|
68 | |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
69 | case OBJ_Triangle: |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
70 | coordCount = 9; |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
71 | 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
|
72 | |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
73 | case OBJ_Quad: |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
74 | case OBJ_CondLine: |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
75 | coordCount = 12; |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
76 | 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
|
77 | |
41
4ca63da5546b
Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
78 | case OBJ_Vertex: |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
79 | coordCount = 3; |
150
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
80 | break; |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
81 | |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
82 | case OBJ_BFC: |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
83 | bb_bfcType = new ButtonBox<QRadioButton> ("Statement", {}, 0, Qt::Horizontal); |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
84 | |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
85 | for (int i = 0; i < LDBFC::NumStatements; ++i) { |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
86 | if (i % (LDBFC::NumStatements / 2) == 0) |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
87 | bb_bfcType->rowBreak (); |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
88 | |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
89 | bb_bfcType->addButton (new QRadioButton (LDBFC::saStatements[i])); |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
90 | } |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
91 | break; |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
92 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
93 | case OBJ_Subfile: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
94 | coordCount = 3; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
95 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
96 | enum { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
97 | Parts, |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
98 | Subparts, |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
99 | Primitives, |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
100 | HiRes, |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
101 | }; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
102 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
103 | tw_subfileList = new QTreeWidget (); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
104 | for (int i : vector<int> ({Parts, Subparts, Primitives, HiRes})) { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
105 | SubfileListItem* parentItem = new SubfileListItem (tw_subfileList, -1); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
106 | parentItem->setText (0, (i == Parts) ? "Parts" : |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
107 | (i == Subparts) ? "Subparts" : |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
108 | (i == Primitives) ? "Primitives" : |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
109 | "Hi-Res"); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
110 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
111 | ulong j = 0; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
112 | for (partListEntry& part : g_PartList) { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
113 | QList<QTreeWidgetItem*> subfileItems; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
114 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
115 | str fileName = part.sName; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
116 | const bool isSubpart = fileName.substr (0, 2) == "s\\"; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
117 | const bool isPrimitive = str (part.sTitle).substr (0, 9) == "Primitive"; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
118 | const bool isHiRes = fileName.substr (0, 3) == "48\\"; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
119 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
120 | if ((i == Subparts && isSubpart) || |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
121 | (i == Primitives && isPrimitive) || |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
122 | (i == HiRes && isHiRes) || |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
123 | (i == Parts && !isSubpart && !isPrimitive && !isHiRes)) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
124 | { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
125 | SubfileListItem* item = new SubfileListItem (parentItem, j); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
126 | item->setText (0, format ("%s - %s", part.sName, part.sTitle)); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
127 | subfileItems.append (item); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
128 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
129 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
130 | j++; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
131 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
132 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
133 | tw_subfileList->addTopLevelItem (parentItem); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
134 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
135 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
136 | connect (tw_subfileList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_subfileTypeChanged ())); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
137 | le_subfileName = new QLineEdit (); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
138 | 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
|
139 | |
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 | case OBJ_Radial: |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
141 | coordCount = 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
|
142 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
143 | lb_radType = new QLabel ("Type:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
144 | lb_radResolution = new QLabel ("Resolution:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
145 | lb_radSegments = new QLabel ("Segments:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
146 | lb_radRingNum = new QLabel ("Ring number:"); |
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
|
147 | |
136
13db97be14cb
Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
148 | bb_radType = new ButtonBox<QRadioButton> ("Type", {}, 0, Qt::Vertical); |
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
|
149 | |
136
13db97be14cb
Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
150 | for (int i = 0; i < LDRadial::NumTypes; ++i) { |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
151 | if (i % (LDRadial::NumTypes / 2) == 0) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
152 | bb_radType->rowBreak (); |
136
13db97be14cb
Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
153 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
154 | bb_radType->addButton (new QRadioButton (LDRadial::radialTypeName ((LDRadial::Type) i))); |
136
13db97be14cb
Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
155 | } |
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
|
156 | |
136
13db97be14cb
Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
157 | connect (bb_radType->buttonGroup, SIGNAL (buttonPressed (int)), this, SLOT (slot_radialTypeChanged (int))); |
13db97be14cb
Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
158 | |
13db97be14cb
Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
159 | cb_radHiRes = new QCheckBox ("Hi-Res"); |
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
|
160 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
161 | sb_radSegments = new QSpinBox; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
162 | sb_radSegments->setMinimum (1); |
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
|
163 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
164 | sb_radRingNum = new QSpinBox; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
165 | sb_radRingNum->setEnabled (false); |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
166 | |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
167 | if (obj) { |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
168 | LDRadial* rad = static_cast<LDRadial*> (obj); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
169 | |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
170 | bb_radType->setValue (rad->eRadialType); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
171 | sb_radSegments->setValue (rad->dSegments); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
172 | cb_radHiRes->setChecked ((rad->dDivisions == 48) ? Qt::Checked : Qt::Unchecked); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
173 | sb_radRingNum->setValue (rad->dRingNum); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
174 | } |
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
|
175 | 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
|
176 | |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
177 | default: |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
178 | break; |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
179 | } |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
180 | |
51
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
181 | // Show a color edit dialog for the types that actually use the color |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
182 | if (defaults->isColored ()) { |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
183 | dColor = (type == OBJ_CondLine || type == OBJ_Line) ? edgecolor : maincolor; |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
184 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
185 | pb_color = new QPushButton; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
186 | setButtonBackground (pb_color, dColor); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
187 | connect (pb_color, SIGNAL (clicked ()), this, SLOT (slot_colorButtonClicked ())); |
51
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
188 | } |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
189 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
190 | for (short i = 0; i < coordCount; ++i) { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
191 | dsb_coords[i] = new QDoubleSpinBox; |
148
ecfbb598db14
Added icons to the renderer for switching between cameras. It works! Yay!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
147
diff
changeset
|
192 | dsb_coords[i]->setMinimum (-10000.0); |
ecfbb598db14
Added icons to the renderer for switching between cameras. It works! Yay!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
147
diff
changeset
|
193 | dsb_coords[i]->setMaximum (10000.0); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
194 | } |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
195 | |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
196 | IMPLEMENT_DIALOG_BUTTONS |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
197 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
198 | QGridLayout* const layout = new QGridLayout; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
199 | layout->addWidget (lb_typeIcon, 0, 0); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
200 | |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
201 | switch (type) { |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
202 | case OBJ_Line: |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
203 | case OBJ_CondLine: |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
204 | case OBJ_Triangle: |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
205 | case OBJ_Quad: |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
206 | // Apply coordinates |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
207 | if (obj) { |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
208 | for (short i = 0; i < coordCount / 3; ++i) |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
209 | for (short j = 0; j < 3; ++j) |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
210 | dsb_coords[(i * 3) + j]->setValue (obj->vaCoords[i].coord (j)); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
211 | } |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
212 | break; |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
213 | |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
214 | case OBJ_Comment: |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
215 | layout->addWidget (le_comment, 0, 1); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
216 | 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
|
217 | |
150
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
218 | case OBJ_BFC: |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
219 | layout->addWidget (bb_bfcType, 0, 1); |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
220 | break; |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
221 | |
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
|
222 | case OBJ_Radial: |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
223 | layout->addWidget (bb_radType, 1, 1, 3, 1); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
224 | layout->addWidget (cb_radHiRes, 1, 2); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
225 | layout->addWidget (lb_radSegments, 2, 2); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
226 | layout->addWidget (sb_radSegments, 2, 3); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
227 | layout->addWidget (lb_radRingNum, 3, 2); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
228 | layout->addWidget (sb_radRingNum, 3, 3); |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
229 | |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
230 | if (obj) |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
231 | for (short i = 0; i < 3; ++i) |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
232 | dsb_coords[0]->setValue (static_cast<LDRadial*> (obj)->vPosition.coord (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
|
233 | 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
|
234 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
235 | case OBJ_Subfile: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
236 | layout->addWidget (tw_subfileList, 1, 1); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
237 | layout->addWidget (le_subfileName, 2, 1); |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
238 | |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
239 | if (obj) |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
240 | for (short i = 0; i < 3; ++i) |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
241 | dsb_coords[0]->setValue (static_cast<LDSubfile*> (obj)->vPosition.coord (i)); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
242 | break; |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
243 | |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
244 | default: |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
245 | break; |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
246 | } |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
247 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
248 | if (defaults->isColored ()) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
249 | layout->addWidget (pb_color, 1, 0); |
51
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
250 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
251 | if (coordCount > 0) { |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
252 | 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
|
253 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
254 | for (short i = 0; i < coordCount; ++i) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
255 | qCoordLayout->addWidget (dsb_coords[i], (i / 3), (i % 3)); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
256 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
257 | layout->addLayout (qCoordLayout, 0, 1, (coordCount / 3), 3); |
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
258 | } |
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
259 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
260 | layout->addWidget (bbx_buttons, 5, 0, 1, 4); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
261 | setLayout (layout); |
150
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
262 | 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
|
263 | g_saObjTypeNames[type]).chars()); |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
264 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
265 | setWindowIcon (QIcon (iconName.chars ())); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
266 | delete defaults; |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
267 | } |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
268 | |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
269 | // ============================================================================= |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
270 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
271 | // ============================================================================= |
150
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
272 | void AddObjectDialog::setButtonBackground (QPushButton* button, short color) { |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
273 | button->setIcon (QIcon ("icons/palette.png")); |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
274 | button->setAutoFillBackground (true); |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
275 | button->setStyleSheet ( |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
276 | format ("background-color: %s", getColor (color)->zColorString.chars()).chars() |
51
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
277 | ); |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
278 | } |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
279 | |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
280 | // ============================================================================= |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
281 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
282 | // ============================================================================= |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
283 | char* AddObjectDialog::currentSubfileName() { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
284 | SubfileListItem* item = static_cast<SubfileListItem*> (tw_subfileList->currentItem ()); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
285 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
286 | if (item->subfileID == -1) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
287 | return null; // selected a heading |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
288 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
289 | return g_PartList[item->subfileID].sName; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
290 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
291 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
292 | // ============================================================================= |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
293 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
294 | // ============================================================================= |
51
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
295 | void AddObjectDialog::slot_colorButtonClicked () { |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
296 | ColorSelectDialog::staticDialog (dColor, dColor, this); |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
297 | setButtonBackground (pb_color, dColor); |
51
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
298 | } |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
299 | |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
300 | // ============================================================================= |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
301 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
94c434a56961
Added color selectors for the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
42
diff
changeset
|
302 | // ============================================================================= |
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
|
303 | 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
|
304 | LDRadial::Type eType = (LDRadial::Type) dType; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
116
diff
changeset
|
305 | sb_radRingNum->setEnabled (eType == LDRadial::Ring || eType == LDRadial::Cone); |
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
|
306 | } |
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
|
307 | |
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
|
308 | // ============================================================================= |
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
|
309 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
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
|
310 | // ============================================================================= |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
311 | void AddObjectDialog::slot_subfileTypeChanged () { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
312 | char* name = currentSubfileName (); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
313 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
314 | if (name) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
315 | le_subfileName->setText (name); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
316 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
317 | |
150
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
318 | // ============================================================================= |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
319 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
320 | // ============================================================================= |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
321 | template<class T> T* initObj (LDObject*& obj) { |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
322 | if (obj == null) |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
323 | obj = new T; |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
324 | |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
325 | return static_cast<T*> (obj); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
326 | } |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
327 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
328 | // ============================================================================= |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
329 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
330 | // ============================================================================= |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
331 | void AddObjectDialog::staticDialog (const LDObjectType_e type, LDObject* obj) { |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
332 | AddObjectDialog dlg (type, obj); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
333 | |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
334 | if (obj) |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
335 | assert (obj->getType () == type); |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
336 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
337 | if (dlg.exec () == false) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
338 | return; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
339 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
340 | switch (type) { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
341 | case OBJ_Comment: |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
342 | { |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
343 | LDComment* comm = initObj<LDComment> (obj); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
344 | comm->zText = dlg.le_comment->text (); |
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
345 | } |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
346 | break; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
347 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
348 | case OBJ_Line: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
349 | { |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
350 | LDLine* line = initObj<LDLine> (obj); |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
351 | line->dColor = dlg.dColor; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
352 | APPLY_COORDS (line, 2) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
353 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
354 | break; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
355 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
356 | case OBJ_Triangle: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
357 | { |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
358 | LDTriangle* tri = initObj<LDTriangle> (obj); |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
359 | tri->dColor = dlg.dColor; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
360 | APPLY_COORDS (tri, 3) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
361 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
362 | break; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
363 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
364 | case OBJ_Quad: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
365 | { |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
366 | LDQuad* quad = initObj<LDQuad> (obj); |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
367 | quad->dColor = dlg.dColor; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
368 | APPLY_COORDS (quad, 4) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
369 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
370 | break; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
371 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
372 | case OBJ_CondLine: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
373 | { |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
374 | LDCondLine* line = initObj<LDCondLine> (obj); |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
375 | line->dColor = dlg.dColor; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
376 | APPLY_COORDS (line, 4) |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
377 | } |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
378 | break; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
379 | |
150
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
380 | case OBJ_BFC: |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
381 | { |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
382 | LDBFC* bfc = initObj<LDBFC> (obj); |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
383 | bfc->eStatement = (LDBFC::Type) dlg.bb_bfcType->value (); |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
384 | } |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
385 | break; |
bcbbdc5454e6
Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
148
diff
changeset
|
386 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
387 | case OBJ_Vertex: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
388 | { |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
389 | LDVertex* vert = initObj<LDVertex> (obj); |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
390 | vert->dColor = dlg.dColor; |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
391 | |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
392 | for (const Axis ax : g_Axes) |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
393 | vert->vPosition[ax] = dlg.dsb_coords[ax]->value (); |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
394 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
395 | break; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
396 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
397 | case OBJ_Radial: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
398 | { |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
399 | LDRadial* pRad = initObj<LDRadial> (obj); |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
400 | pRad->dColor = dlg.dColor; |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
401 | |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
402 | for (const Axis ax : g_Axes) |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
403 | pRad->vPosition[ax] = dlg.dsb_coords[ax]->value (); |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
404 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
405 | pRad->dDivisions = (dlg.cb_radHiRes->checkState () != Qt::Checked) ? 16 : 48; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
406 | pRad->dSegments = min<short> (dlg.sb_radSegments->value (), pRad->dDivisions); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
407 | pRad->eRadialType = (LDRadial::Type) dlg.bb_radType->value (); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
408 | pRad->dRingNum = dlg.sb_radRingNum->value (); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
409 | pRad->mMatrix = g_mIdentity; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
410 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
411 | break; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
412 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
413 | case OBJ_Subfile: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
414 | { |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
415 | str name = dlg.le_subfileName->text (); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
416 | if (~name == 0) |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
417 | return; // no subfile filename |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
418 | |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
419 | LDSubfile* ref = initObj<LDSubfile> (obj); |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
420 | ref->dColor = dlg.dColor; |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
421 | |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
422 | for (const Axis ax : g_Axes) |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
423 | ref->vPosition[ax] = dlg.dsb_coords[ax]->value (); |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
424 | |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
425 | ref->zFileName = name; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
426 | ref->mMatrix = g_mIdentity; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
427 | ref->pFile = loadSubfile (name); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
428 | } |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
429 | break; |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
430 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
431 | default: |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
432 | break; |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
433 | } |
138
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
434 | |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
435 | ulong idx = g_CurrentFile->addObject (obj); |
d22d5c1d9e8a
Added new subfile dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
136
diff
changeset
|
436 | History::addEntry (new AddHistory ({idx}, {obj->clone ()})); |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
138
diff
changeset
|
437 | g_ForgeWindow->refresh (); |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
438 | } |