gui.cpp

changeset 22
335e430a6b4f
parent 21
9aebaaafa5da
child 23
69a91c1ff583
equal deleted inserted replaced
21:9aebaaafa5da 22:335e430a6b4f
32 setCentralWidget (w); 32 setCentralWidget (w);
33 33
34 createMenuActions (); 34 createMenuActions ();
35 createMenus (); 35 createMenus ();
36 createToolbars (); 36 createToolbars ();
37
38 slot_selectionChanged ();
37 39
38 setTitle (); 40 setTitle ();
39 setMinimumSize (320, 200); 41 setMinimumSize (320, 200);
40 resize (800, 600); 42 resize (800, 600);
41 } 43 }
227 229
228 memset (line->vaCoords, 0, sizeof line->vaCoords); 230 memset (line->vaCoords, 0, sizeof line->vaCoords);
229 line->dColor = 24; 231 line->dColor = 24;
230 232
231 g_CurrentFile->objects.insert (g_CurrentFile->objects.begin() + ulSpot, line); 233 g_CurrentFile->objects.insert (g_CurrentFile->objects.begin() + ulSpot, line);
232 g_CurrentFile->objects[ulSpot].serialize ();
233 234
234 buildObjList (); 235 buildObjList ();
235 R->hardRefresh (); 236 R->hardRefresh ();
236 } 237 }
237 238
303 304
304 if (!bIsSelected) 305 if (!bIsSelected)
305 continue; // Was not selected 306 continue; // Was not selected
306 307
307 static_cast<LDQuad*> (obj)->splitToTriangles (); 308 static_cast<LDQuad*> (obj)->splitToTriangles ();
308 } 309 i++;// Skip past the second triangle
309 310 }
311
312 printf ("build obj list\n");
313 buildObjList ();
314
315 printf ("refresh teh renderer\n");
310 R->hardRefresh (); 316 R->hardRefresh ();
311 buildObjList ();
312 } 317 }
313 318
314 void LDForgeWindow::slot_setContents () { 319 void LDForgeWindow::slot_setContents () {
315 if (qObjList->selectedItems().size() != 1) 320 if (qObjList->selectedItems().size() != 1)
316 return; 321 return;
375 380
376 QList<QTreeWidgetItem*> qaItems; 381 QList<QTreeWidgetItem*> qaItems;
377 382
378 qObjList->clear (); 383 qObjList->clear ();
379 384
380 for (ushort i = 0; i < g_CurrentFile->objects.size(); ++i) { 385 for (ulong i = 0; i < g_CurrentFile->objects.size(); ++i) {
381 LDObject* obj = g_CurrentFile->objects[i]; 386 LDObject* obj = g_CurrentFile->objects[i];
387 printf ("%lu: %p\n", i, obj);
382 388
383 str zText; 389 str zText;
384 switch (obj->getType ()) { 390 switch (obj->getType ()) {
385 case OBJ_Comment: 391 case OBJ_Comment:
386 zText = static_cast<LDComment*> (obj)->zText.chars(); 392 zText = static_cast<LDComment*> (obj)->zText.chars();
461 } 467 }
462 468
463 void LDForgeWindow::slot_selectionChanged () { 469 void LDForgeWindow::slot_selectionChanged () {
464 // If the selection isn't 1 exact, disable setting contents 470 // If the selection isn't 1 exact, disable setting contents
465 qAct_setContents->setEnabled (qObjList->selectedItems().size() == 1); 471 qAct_setContents->setEnabled (qObjList->selectedItems().size() == 1);
472
473 // If we have no selection, disable splitting quads
474 qAct_splitQuads->setEnabled (qObjList->selectedItems().size() > 0);
466 } 475 }
467 476
468 // ============================================================================= 477 // =============================================================================
469 // ulong getInsertionPoint () 478 // ulong getInsertionPoint ()
470 // 479 //

mercurial