gui.cpp

changeset 21
9aebaaafa5da
parent 20
2ca638886082
child 22
335e430a6b4f
equal deleted inserted replaced
20:2ca638886082 21:9aebaaafa5da
61 MAKE_ACTION (copy, "Copy", "copy", "Copy the current selection to clipboard.") 61 MAKE_ACTION (copy, "Copy", "copy", "Copy the current selection to clipboard.")
62 MAKE_ACTION (paste, "Paste", "paste", "Paste clipboard contents.") 62 MAKE_ACTION (paste, "Paste", "paste", "Paste clipboard contents.")
63 MAKE_ACTION (about, sAboutText, "about", "Shows information about " APPNAME_DISPLAY ".") 63 MAKE_ACTION (about, sAboutText, "about", "Shows information about " APPNAME_DISPLAY ".")
64 MAKE_ACTION (aboutQt, "About Qt", "aboutQt", "Shows information about Qt.") 64 MAKE_ACTION (aboutQt, "About Qt", "aboutQt", "Shows information about Qt.")
65 65
66 MAKE_ACTION (splitQuads, "Split Quads", "quad-split", "Split quads into triangles.")
66 MAKE_ACTION (setContents, "Set Contents", "set-contents", "Set the raw code of this object.") 67 MAKE_ACTION (setContents, "Set Contents", "set-contents", "Set the raw code of this object.")
67 68
68 MAKE_ACTION (newSubfile, "New Subfile", "add-subfile", "Creates a new subfile reference.") 69 MAKE_ACTION (newSubfile, "New Subfile", "add-subfile", "Creates a new subfile reference.")
69 MAKE_ACTION (newLine, "New Line", "add-line", "Creates a new line.") 70 MAKE_ACTION (newLine, "New Line", "add-line", "Creates a new line.")
70 MAKE_ACTION (newTriangle, "New Triangle", "add-triangle", "Creates a new triangle.") 71 MAKE_ACTION (newTriangle, "New Triangle", "add-triangle", "Creates a new triangle.")
128 qEditMenu = menuBar ()->addMenu (tr ("&Edit")); 129 qEditMenu = menuBar ()->addMenu (tr ("&Edit"));
129 qEditMenu->addAction (qAct_cut); // Cut 130 qEditMenu->addAction (qAct_cut); // Cut
130 qEditMenu->addAction (qAct_copy); // Copy 131 qEditMenu->addAction (qAct_copy); // Copy
131 qEditMenu->addAction (qAct_paste); // Paste 132 qEditMenu->addAction (qAct_paste); // Paste
132 qEditMenu->addSeparator (); // ----- 133 qEditMenu->addSeparator (); // -----
134 qEditMenu->addAction (qAct_splitQuads); // Split Quads
133 qEditMenu->addAction (qAct_setContents); // Set Contents 135 qEditMenu->addAction (qAct_setContents); // Set Contents
134 136
135 // Help menu 137 // Help menu
136 qHelpMenu = menuBar ()->addMenu (tr ("&Help")); 138 qHelpMenu = menuBar ()->addMenu (tr ("&Help"));
137 qHelpMenu->addAction (qAct_about); // About 139 qHelpMenu->addAction (qAct_about); // About
159 161
160 qEditToolBar = new QToolBar ("Edit"); 162 qEditToolBar = new QToolBar ("Edit");
161 qEditToolBar->addAction (qAct_cut); 163 qEditToolBar->addAction (qAct_cut);
162 qEditToolBar->addAction (qAct_copy); 164 qEditToolBar->addAction (qAct_copy);
163 qEditToolBar->addAction (qAct_paste); 165 qEditToolBar->addAction (qAct_paste);
166 qEditToolBar->addAction (qAct_splitQuads);
164 qEditToolBar->addAction (qAct_setContents); 167 qEditToolBar->addAction (qAct_setContents);
165 addToolBar (qEditToolBar); 168 addToolBar (qEditToolBar);
166 } 169 }
167 170
168 void LDForgeWindow::setTitle () { 171 void LDForgeWindow::setTitle () {
272 275
273 } 276 }
274 277
275 void LDForgeWindow::slot_newVertex () { 278 void LDForgeWindow::slot_newVertex () {
276 279
280 }
281
282 void LDForgeWindow::slot_splitQuads () {
283 if (qObjList->selectedItems().size() == 0)
284 return;
285
286 const QList<QTreeWidgetItem*> qaItems = qObjList->selectedItems();
287
288 for (ulong i = 0; i < g_CurrentFile->objects.size(); ++i) {
289 LDObject* obj = g_CurrentFile->objects[i];
290
291 // Don't even consider non-quads
292 if (obj->getType() != OBJ_Quad)
293 continue;
294
295 bool bIsSelected = false;
296
297 for (long j = 0; j < qaItems.size(); ++j) {
298 if (qaItems[j] == obj->qObjListEntry) {
299 bIsSelected = true;
300 break;
301 }
302 }
303
304 if (!bIsSelected)
305 continue; // Was not selected
306
307 static_cast<LDQuad*> (obj)->splitToTriangles ();
308 }
309
310 R->hardRefresh ();
311 buildObjList ();
277 } 312 }
278 313
279 void LDForgeWindow::slot_setContents () { 314 void LDForgeWindow::slot_setContents () {
280 if (qObjList->selectedItems().size() != 1) 315 if (qObjList->selectedItems().size() != 1)
281 return; 316 return;

mercurial