145 QGridLayout* const layout = new QGridLayout; |
145 QGridLayout* const layout = new QGridLayout; |
146 layout->addWidget (lb_typeIcon, 0, 0); |
146 layout->addWidget (lb_typeIcon, 0, 0); |
147 |
147 |
148 switch (type) |
148 switch (type) |
149 { |
149 { |
150 case OBJ_Line: |
150 case OBJ_Line: |
151 case OBJ_CondLine: |
151 case OBJ_CondLine: |
152 case OBJ_Triangle: |
152 case OBJ_Triangle: |
153 case OBJ_Quad: |
153 case OBJ_Quad: |
154 // Apply coordinates |
154 // Apply coordinates |
155 if (obj) |
155 if (obj) |
156 { |
156 { |
157 for (int i = 0; i < coordCount / 3; ++i) |
157 LDVertexObject* vo = static_cast<LDVertexObject*> (obj); |
|
158 |
|
159 for (int i = 0; i < coordCount / 3; ++i) |
|
160 { |
|
161 vo->vertex (i).apply ([&](Axis ax, double value) |
158 { |
162 { |
159 obj->vertex (i).apply ([&](Axis ax, double value) |
163 dsb_coords[(i * 3) + ax]->setValue (value); |
160 { |
164 }); |
161 dsb_coords[(i * 3) + ax]->setValue (value); |
|
162 }); |
|
163 } |
|
164 } |
165 } |
165 break; |
166 } |
166 |
167 break; |
167 case OBJ_Comment: |
168 |
168 layout->addWidget (le_comment, 0, 1); |
169 case OBJ_Comment: |
169 break; |
170 layout->addWidget (le_comment, 0, 1); |
170 |
171 break; |
171 case OBJ_Bfc: |
172 |
172 layout->addWidget (rb_bfcType, 0, 1); |
173 case OBJ_Bfc: |
173 break; |
174 layout->addWidget (rb_bfcType, 0, 1); |
174 |
175 break; |
175 case OBJ_Subfile: |
176 |
176 layout->addWidget (tw_subfileList, 1, 1, 1, 2); |
177 case OBJ_Subfile: |
177 layout->addWidget (lb_subfileName, 2, 1); |
178 layout->addWidget (tw_subfileList, 1, 1, 1, 2); |
178 layout->addWidget (le_subfileName, 2, 2); |
179 layout->addWidget (lb_subfileName, 2, 1); |
179 break; |
180 layout->addWidget (le_subfileName, 2, 2); |
180 |
181 break; |
181 default: |
182 |
182 break; |
183 default: |
|
184 break; |
183 } |
185 } |
184 |
186 |
185 if (defaults->hasMatrix()) |
187 if (defaults->hasMatrix()) |
186 { |
188 { |
187 LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); |
189 LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); |
195 mo->position().apply ([&](Axis ax, double value) |
197 mo->position().apply ([&](Axis ax, double value) |
196 { |
198 { |
197 dsb_coords[ax]->setValue (value); |
199 dsb_coords[ax]->setValue (value); |
198 }); |
200 }); |
199 |
201 |
200 defaultMatrix = mo->transform(); |
202 defaultMatrix = mo->transformationMatrix(); |
201 } |
203 } |
202 |
204 |
203 le_matrix->setText (defaultMatrix.toString()); |
205 le_matrix->setText (defaultMatrix.toString()); |
204 layout->addWidget (lb_matrix, 4, 1); |
206 layout->addWidget (lb_matrix, 4, 1); |
205 layout->addWidget (le_matrix, 4, 2, 1, 3); |
207 layout->addWidget (le_matrix, 4, 2, 1, 3); |
220 |
222 |
221 QDialogButtonBox* bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
223 QDialogButtonBox* bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
222 QWidget::connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); |
224 QWidget::connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); |
223 QWidget::connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); |
225 QWidget::connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); |
224 layout->addWidget (bbx_buttons, 5, 0, 1, 4); |
226 layout->addWidget (bbx_buttons, 5, 0, 1, 4); |
|
227 defaults->destroy(); |
225 setLayout (layout); |
228 setLayout (layout); |
226 setWindowTitle (format (tr ("Edit %1"), typeName)); |
229 setWindowTitle (format (tr ("Edit %1"), typeName)); |
227 setWindowIcon (icon); |
230 setWindowIcon (icon); |
228 } |
231 } |
229 |
232 |
333 case OBJ_CondLine: |
336 case OBJ_CondLine: |
334 { |
337 { |
335 if (not obj) |
338 if (not obj) |
336 obj = LDObject::getDefault (type); |
339 obj = LDObject::getDefault (type); |
337 |
340 |
338 for (int i = 0; i < obj->numVertices(); ++i) |
341 LDVertexObject* vo = static_cast<LDVertexObject*> (obj); |
|
342 for (int i = 0; i < vo->numVertices(); ++i) |
339 { |
343 { |
340 Vertex v; |
344 Vertex v; |
341 |
345 |
342 v.apply ([&](Axis ax, double& value) |
346 v.apply ([&](Axis ax, double& value) |
343 { |
347 { |
344 value = dlg.dsb_coords[(i * 3) + ax]->value(); |
348 value = dlg.dsb_coords[(i * 3) + ax]->value(); |
345 }); |
349 }); |
346 |
350 |
347 obj->setVertex (i, v); |
351 vo->setVertex (i, v); |
348 } |
352 } |
349 } break; |
353 } break; |
350 |
354 |
351 case OBJ_Bfc: |
355 case OBJ_Bfc: |
352 { |
356 { |