Sat, 06 Jul 2013 03:06:00 +0300
Further verbosity, #ifdef the test axle pic out of release builds
src/gui.cpp | file | annotate | diff | comparison | revisions | |
src/gui.h | file | annotate | diff | comparison | revisions | |
src/gui_actions.cpp | file | annotate | diff | comparison | revisions | |
src/gui_editactions.cpp | file | annotate | diff | comparison | revisions |
--- a/src/gui.cpp Sat Jul 06 02:52:54 2013 +0300 +++ b/src/gui.cpp Sat Jul 06 03:06:00 2013 +0300 @@ -190,7 +190,9 @@ addMenuAction ("settings"); addMenuAction ("setLDrawPath"); menu->addSeparator (); +#ifndef RELEASE addMenuAction ("testpic"); +#endif addMenuAction ("reloadPrimitives"); menu->addSeparator (); addMenuAction ("exit"); @@ -580,19 +582,24 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -void ForgeWindow::deleteSelection () { - if (m_sel.size () == 0) - return; +int ForgeWindow::deleteSelection() +{ + if( m_sel.size() == 0 ) + return 0; vector<LDObject*> selCopy = m_sel; + int num = 0; // Delete the objects that were being selected - for (LDObject* obj : selCopy) { - g_curfile->forgetObject (obj); + for( LDObject * obj : selCopy ) + { + g_curfile->forgetObject( obj ); + ++num; delete obj; } - refresh (); + refresh(); + return num; } // =============================================================================
--- a/src/gui.h Sat Jul 06 02:52:54 2013 +0300 +++ b/src/gui.h Sat Jul 06 03:06:00 2013 +0300 @@ -122,7 +122,7 @@ void scrollToSelection (); void spawnContextMenu (const QPoint pos); void deleteObjVector (vector< LDObject* > objs); - void deleteSelection (); + int deleteSelection (); void deleteByColor (const short int colnum); void save( LDOpenFile* f, bool saveAs ); GLRenderer* R () { return m_renderer; }
--- a/src/gui_actions.cpp Sat Jul 06 02:52:54 2013 +0300 +++ b/src/gui_actions.cpp Sat Jul 06 03:06:00 2013 +0300 @@ -460,6 +460,10 @@ g_win->R ()->setDepthValue (depth); } +#ifndef RELEASE +// This is a test to draw a dummy axle. Meant to be used as a primitive gallery, +// but I can't figure how to generate these pictures properly. Multi-threading +// these is an immense pain. MAKE_ACTION (testpic, "Test picture", "", "", (0)) { LDOpenFile* file = getFile ("axle.dat"); setlocale (LC_ALL, "C"); @@ -498,6 +502,7 @@ delete[] imgdata; rend->deleteLater (); } +#endif MAKE_ACTION (reloadPrimitives, "Scan Primitives", "", "", (0)) { PrimitiveLister::start ();
--- a/src/gui_editactions.cpp Sat Jul 06 02:52:54 2013 +0300 +++ b/src/gui_editactions.cpp Sat Jul 06 03:06:00 2013 +0300 @@ -41,30 +41,39 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -static void copyToClipboard () { +static int copyToClipboard () { vector<LDObject*> objs = g_win->sel (); + int num = 0; // Clear the clipboard first. g_Clipboard.clear (); // Now, copy the contents into the clipboard. for (LDObject* obj : objs) + { g_Clipboard << obj->raw (); + ++num; + } + + return num; } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= MAKE_ACTION (cut, "Cut", "cut", "Cut the current selection to clipboard.", CTRL (X)) { - copyToClipboard (); + int num = copyToClipboard (); g_win->deleteSelection (); + + log( ForgeWindow::tr( "%1 objects cut" ), num ); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= MAKE_ACTION (copy, "Copy", "copy", "Copy the current selection to clipboard.", CTRL (C)) { - copyToClipboard (); + int num = copyToClipboard (); + log( ForgeWindow::tr( "%1 objects copied" ), num ); } // ============================================================================= @@ -73,14 +82,17 @@ MAKE_ACTION (paste, "Paste", "paste", "Paste clipboard contents.", CTRL (V)) { ulong idx = g_win->getInsertionPoint (); g_win->sel ().clear (); + int num = 0; for (str line : g_Clipboard) { LDObject* pasted = parseLine (line); g_curfile->insertObj (idx++, pasted); g_win->sel () << pasted; g_win->R ()->compileObject (pasted); + ++num; } + log( ForgeWindow::tr( "%1 objects pasted" ), num ); g_win->refresh (); g_win->scrollToSelection (); } @@ -89,7 +101,8 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= MAKE_ACTION (del, "Delete", "delete", "Delete the selection", KEY (Delete)) { - g_win->deleteSelection (); + int num = g_win->deleteSelection (); + log( ForgeWindow::tr( "%1 objects deleted" ), num ); } // ============================================================================= @@ -142,6 +155,7 @@ // =============================================================================================== MAKE_ACTION (splitQuads, "Split Quads", "quad-split", "Split quads into triangles.", (0)) { vector<LDObject*> objs = g_win->sel (); + int num = 0; for (LDObject* obj : objs) { if (obj->getType() != LDObject::Quad) @@ -162,8 +176,12 @@ // Delete this quad now, it has been split. delete obj; + + num++; } + log( "%1 quadrilaterals split", num ); + g_win->fullRefresh (); } @@ -476,7 +494,6 @@ doRotate (0, 0, -1); } -// ========================================================================================================================================= MAKE_ACTION (rotpoint, "Set Rotation Point", "rotpoint", "Configure the rotation point.", (0)) { configRotationPoint (); } @@ -493,7 +510,7 @@ vertex v = obj->getVertex (i); for (const Axis ax : g_Axes) { - // HACK: :p + // HACK: .. should find a better way to do this char valstr[64]; sprintf (valstr, "%.3f", v[ax]); v[ax] = atof (valstr); @@ -511,13 +528,21 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= MAKE_ACTION (uncolorize, "Uncolorize", "uncolorize", "Reduce colors of everything selected to main and edge colors", (0)) { + int num = 0; + for (LDObject* obj : g_win->sel ()) { if (obj->isColored () == false) continue; - obj->setColor ((obj->getType () == LDObject::Line || obj->getType () == LDObject::CondLine) ? edgecolor : maincolor); + int col = maincolor; + if( obj->getType() == LDObject::Line || obj->getType() == LDObject::CondLine ) + col = edgecolor; + + obj->setColor( col ); + num++; } + log( ForgeWindow::tr( "%1 objects uncolored" ), num ); g_win->fullRefresh (); }