src/gui_editactions.cpp

changeset 508
7ace3537a560
parent 504
6a1fa662bfc1
child 522
afa691788bdb
equal deleted inserted replaced
507:fc76d38c3530 508:7ace3537a560
505 DEFINE_ACTION (RoundCoordinates, 0) 505 DEFINE_ACTION (RoundCoordinates, 0)
506 { setlocale (LC_ALL, "C"); 506 { setlocale (LC_ALL, "C");
507 int num = 0; 507 int num = 0;
508 508
509 for (LDObject* obj : g_win->sel()) 509 for (LDObject* obj : g_win->sel())
510 for (short i = 0; i < obj->vertices(); ++i) 510 { for (short i = 0; i < obj->vertices(); ++i)
511 { vertex v = obj->getVertex (i); 511 { vertex v = obj->getVertex (i);
512 512
513 for (const Axis ax : g_Axes) 513 for (const Axis ax : g_Axes)
514 { // HACK: .. should find a better way to do this 514 { // HACK: .. should find a better way to do this
515 char valstr[64]; 515 str valstr;
516 sprintf (valstr, "%.3f", v[ax]); 516 valstr.sprintf ("%.3f", v[ax]);
517 v[ax] = atof (valstr); 517 v[ax] = valstr.toDouble();
518 } 518 }
519 519
520 obj->setVertex (i, v); 520 obj->setVertex (i, v);
521 g_win->R()->compileObject (obj); 521 g_win->R()->compileObject (obj);
522 num += 3; 522 num += 3;
523 } 523 }
524 }
524 525
525 log (ForgeWindow::tr ("Rounded %1 coordinates"), num); 526 log (ForgeWindow::tr ("Rounded %1 coordinates"), num);
526 g_win->refresh(); 527 g_win->refresh();
527 } 528 }
528 529

mercurial