src/actionsEdit.cc

changeset 786
71d786ce0dcc
parent 780
b0d84fb70ea5
child 787
67cc5b47bbff
equal deleted inserted replaced
785:2a8e4bbb5a94 786:71d786ce0dcc
122 { 122 {
123 // Get the index of the subfile so we know where to insert the 123 // Get the index of the subfile so we know where to insert the
124 // inlined contents. 124 // inlined contents.
125 long idx = obj->lineNumber(); 125 long idx = obj->lineNumber();
126 126
127 if (idx == -1 || obj->type() != LDObject::ESubfile) 127 if (idx == -1 || obj->type() != OBJ_Subfile)
128 continue; 128 continue;
129 129
130 LDObjectList objs = obj.staticCast<LDSubfile>()->inlineContents (deep, false); 130 LDObjectList objs = obj.staticCast<LDSubfile>()->inlineContents (deep, false);
131 131
132 // Merge in the inlined objects 132 // Merge in the inlined objects
163 LDObjectList objs = selection(); 163 LDObjectList objs = selection();
164 int num = 0; 164 int num = 0;
165 165
166 for (LDObjectPtr obj : objs) 166 for (LDObjectPtr obj : objs)
167 { 167 {
168 if (obj->type() != LDObject::EQuad) 168 if (obj->type() != OBJ_Quad)
169 continue; 169 continue;
170 170
171 // Find the index of this quad 171 // Find the index of this quad
172 long index = obj->lineNumber(); 172 long index = obj->lineNumber();
173 173
199 Ui::EditRawUI ui; 199 Ui::EditRawUI ui;
200 200
201 ui.setupUi (dlg); 201 ui.setupUi (dlg);
202 ui.code->setText (obj->asText()); 202 ui.code->setText (obj->asText());
203 203
204 if (obj->type() == LDObject::EError) 204 if (obj->type() == OBJ_Error)
205 ui.errorDescription->setText (obj.staticCast<LDError>()->reason()); 205 ui.errorDescription->setText (obj.staticCast<LDError>()->reason());
206 else 206 else
207 { 207 {
208 ui.errorDescription->hide(); 208 ui.errorDescription->hide();
209 ui.errorIcon->hide(); 209 ui.errorIcon->hide();
256 LDObjectList objs = selection(); 256 LDObjectList objs = selection();
257 int num = 0; 257 int num = 0;
258 258
259 for (LDObjectPtr obj : objs) 259 for (LDObjectPtr obj : objs)
260 { 260 {
261 const LDObject::Type type = obj->type(); 261 const LDObjectType type = obj->type();
262 if (type != LDObject::EQuad && type != LDObject::ETriangle) 262
263 if (type != OBJ_Quad && type != OBJ_Triangle)
263 continue; 264 continue;
264 265
265 LDLinePtr lines[4]; 266 LDLinePtr lines[4];
266 267
267 if (type == LDObject::EQuad) 268 if (type == OBJ_Quad)
268 { 269 {
269 LDQuadPtr quad = obj.staticCast<LDQuad>(); 270 LDQuadPtr quad = obj.staticCast<LDQuad>();
270 lines[0] = spawn<LDLine> (quad->vertex (0), quad->vertex (1)); 271 lines[0] = spawn<LDLine> (quad->vertex (0), quad->vertex (1));
271 lines[1] = spawn<LDLine> (quad->vertex (1), quad->vertex (2)); 272 lines[1] = spawn<LDLine> (quad->vertex (1), quad->vertex (2));
272 lines[2] = spawn<LDLine> (quad->vertex (2), quad->vertex (3)); 273 lines[2] = spawn<LDLine> (quad->vertex (2), quad->vertex (3));
472 mo->setPosition (v); 473 mo->setPosition (v);
473 474
474 // Transform the matrix 475 // Transform the matrix
475 mo->setTransform (transform * mo->transform()); 476 mo->setTransform (transform * mo->transform());
476 } 477 }
477 elif (obj->type() == LDObject::EVertex) 478 elif (obj->type() == OBJ_Vertex)
478 { 479 {
479 LDVertexPtr vert = obj.staticCast<LDVertex>(); 480 LDVertexPtr vert = obj.staticCast<LDVertex>();
480 Vertex v = vert->pos; 481 Vertex v = vert->pos;
481 rotateVertex (v, rotpoint, transform); 482 rotateVertex (v, rotpoint, transform);
482 vert->pos = v; 483 vert->pos = v;
570 if (not obj->isColored()) 571 if (not obj->isColored())
571 continue; 572 continue;
572 573
573 int col = maincolor; 574 int col = maincolor;
574 575
575 if (obj->type() == LDObject::ELine || obj->type() == LDObject::ECondLine) 576 if (obj->type() == OBJ_Line || obj->type() == OBJ_CondLine)
576 col = edgecolor; 577 col = edgecolor;
577 578
578 obj->setColor (col); 579 obj->setColor (col);
579 num++; 580 num++;
580 } 581 }
678 LDObjectList sel = selection(); 679 LDObjectList sel = selection();
679 int num = 0; 680 int num = 0;
680 681
681 for (LDObjectPtr obj : sel) 682 for (LDObjectPtr obj : sel)
682 { 683 {
683 if (obj->type() != LDObject::ECondLine) 684 if (obj->type() != OBJ_CondLine)
684 continue; 685 continue;
685 686
686 obj.staticCast<LDCondLine>()->demote(); 687 obj.staticCast<LDCondLine>()->demote();
687 ++num; 688 ++num;
688 } 689 }

mercurial