src/gui.cpp

changeset 421
7d26db0be944
parent 417
14bfeed046f3
child 438
2f9eade6eb6f
equal deleted inserted replaced
420:8d6af951b611 421:7d26db0be944
129 // Find out which action triggered this 129 // Find out which action triggered this
130 #define act(N) if (sender() == ui->action##N) invokeAction (ui->action##N, &actiondef_##N); 130 #define act(N) if (sender() == ui->action##N) invokeAction (ui->action##N, &actiondef_##N);
131 #include "actions.h" 131 #include "actions.h"
132 } 132 }
133 133
134 void ForgeWindow::invokeAction (QAction* act, void (*func) ()) { 134 void ForgeWindow::invokeAction (QAction* act, void (*func)()) {
135 beginAction (act); 135 beginAction (act);
136 (*func) (); 136 (*func)();
137 endAction(); 137 endAction();
138 } 138 }
139 139
140 // ============================================================================= 140 // =============================================================================
141 void ForgeWindow::slot_lastSecondCleanup() { 141 void ForgeWindow::slot_lastSecondCleanup() {
249 // ============================================================================= 249 // =============================================================================
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
251 // ============================================================================= 251 // =============================================================================
252 int ForgeWindow::deleteSelection() 252 int ForgeWindow::deleteSelection()
253 { 253 {
254 if( m_sel.size() == 0 ) 254 if (m_sel.size() == 0)
255 return 0; 255 return 0;
256 256
257 List<LDObject*> selCopy = m_sel; 257 List<LDObject*> selCopy = m_sel;
258 int num = 0; 258 int num = 0;
259 259
339 descr = LDBFCObject::statements[static_cast<LDBFCObject*> (obj)->type]; 339 descr = LDBFCObject::statements[static_cast<LDBFCObject*> (obj)->type];
340 break; 340 break;
341 341
342 case LDObject::Overlay: 342 case LDObject::Overlay:
343 { 343 {
344 LDOverlayObject* ovl = static_cast<LDOverlayObject*>( obj ); 344 LDOverlayObject* ovl = static_cast<LDOverlayObject*> (obj);
345 descr = fmt( "[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()], 345 descr = fmt ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()],
346 basename( ovl->filename() ), ovl->x(), ovl->y(), ovl->width(), ovl->height() ); 346 basename (ovl->filename()), ovl->x(), ovl->y(), ovl->width(), ovl->height());
347 } 347 }
348 break; 348 break;
349 349
350 default: 350 default:
351 descr = obj->typeName(); 351 descr = obj->typeName();
356 if (obj->hidden()) { 356 if (obj->hidden()) {
357 descr = fmt ("[[ %1 ]]", descr); 357 descr = fmt ("[[ %1 ]]", descr);
358 } 358 }
359 359
360 QListWidgetItem* item = new QListWidgetItem (descr); 360 QListWidgetItem* item = new QListWidgetItem (descr);
361 item->setIcon( getIcon( obj->typeName() )); 361 item->setIcon (getIcon (obj->typeName()));
362 362
363 // Color gibberish orange on red so it stands out. 363 // Color gibberish orange on red so it stands out.
364 if (obj->getType() == LDObject::Error) { 364 if (obj->getType() == LDObject::Error) {
365 item->setBackground (QColor ("#AA0000")); 365 item->setBackground (QColor ("#AA0000"));
366 item->setForeground (QColor ("#FFAA00")); 366 item->setForeground (QColor ("#FFAA00"));
464 for (LDObject* obj : m_sel) { 464 for (LDObject* obj : m_sel) {
465 if (obj->isColored() == false) 465 if (obj->isColored() == false)
466 continue; // uncolored object 466 continue; // uncolored object
467 467
468 obj->setColor (newColor); 468 obj->setColor (newColor);
469 R()->compileObject( obj ); 469 R()->compileObject (obj);
470 } 470 }
471 471
472 refresh(); 472 refresh();
473 endAction(); 473 endAction();
474 } 474 }
508 for (LDObject* obj : LDFile::current()->objs()) 508 for (LDObject* obj : LDFile::current()->objs())
509 obj->setSelected (false); 509 obj->setSelected (false);
510 510
511 ui->objectList->clearSelection(); 511 ui->objectList->clearSelection();
512 for (LDObject* obj : m_sel) { 512 for (LDObject* obj : m_sel) {
513 if( obj->qObjListEntry == null ) 513 if (obj->qObjListEntry == null)
514 continue; 514 continue;
515 515
516 obj->qObjListEntry->setSelected (true); 516 obj->qObjListEntry->setSelected (true);
517 obj->setSelected (true); 517 obj->setSelected (true);
518 } 518 }
677 void ForgeWindow::primitiveLoaderEnd() { 677 void ForgeWindow::primitiveLoaderEnd() {
678 QTimer* hidetimer = new QTimer; 678 QTimer* hidetimer = new QTimer;
679 connect (hidetimer, SIGNAL (timeout()), m_primLoaderWidget, SLOT (hide())); 679 connect (hidetimer, SIGNAL (timeout()), m_primLoaderWidget, SLOT (hide()));
680 hidetimer->setSingleShot (true); 680 hidetimer->setSingleShot (true);
681 hidetimer->start (1500); 681 hidetimer->start (1500);
682 m_primLoaderBar->setFormat( tr( "Done" )); 682 m_primLoaderBar->setFormat (tr ("Done"));
683 log (tr ("Primitives scanned: %1 primitives listed"), m_primLoaderBar->value()); 683 log (tr ("Primitives scanned: %1 primitives listed"), m_primLoaderBar->value());
684 } 684 }
685 685
686 // ============================================================================= 686 // =============================================================================
687 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 687 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

mercurial