Fri, 17 May 2013 03:11:47 +0300
Fixed: rotation point dialog didn't accept negative custom coords; objects were rotated by the grid angle's half
src/dialogs.cpp | file | annotate | diff | comparison | revisions | |
src/gldraw.cpp | file | annotate | diff | comparison | revisions | |
src/gui.cpp | file | annotate | diff | comparison | revisions | |
src/gui_actions.cpp | file | annotate | diff | comparison | revisions | |
src/gui_editactions.cpp | file | annotate | diff | comparison | revisions | |
src/string.cpp | file | annotate | diff | comparison | revisions |
--- a/src/dialogs.cpp Thu May 16 22:59:10 2013 +0300 +++ b/src/dialogs.cpp Fri May 17 03:11:47 2013 +0300 @@ -431,6 +431,9 @@ dsb_customY = new QDoubleSpinBox; dsb_customZ = new QDoubleSpinBox; + for (auto x : initlist<QDoubleSpinBox*> ({dsb_customX, dsb_customY, dsb_customZ})) + x->setRange (-10000.0f, 10000.0f); + QGridLayout* customLayout = new QGridLayout (gb_customPos); customLayout->setColumnStretch (1, 1); customLayout->addWidget (new QLabel ("X"), 0, 0);
--- a/src/gldraw.cpp Thu May 16 22:59:10 2013 +0300 +++ b/src/gldraw.cpp Fri May 17 03:11:47 2013 +0300 @@ -993,6 +993,9 @@ void GLRenderer::pick (uint mouseX, uint mouseY) { GLint viewport[4]; + // Use particularly thick lines while picking ease up selecting lines. + glLineWidth (max<double> (gl_linethickness, 6.5f)); + // Clear the selection if we do not wish to add to it. if (!m_addpick) { std::vector<LDObject*> oldsel = g_win->sel (); @@ -1109,6 +1112,9 @@ if (removedObj) compileObject (removedObj); + // Restore line thickness + glLineWidth (gl_linethickness); + m_picking = false; m_rangepick = false; glEnable (GL_DITHER);
--- a/src/gui.cpp Thu May 16 22:59:10 2013 +0300 +++ b/src/gui.cpp Fri May 17 03:11:47 2013 +0300 @@ -362,7 +362,6 @@ addToolBarAction ("rotateYNeg"); addToolBarAction ("rotateZPos"); addToolBarAction ("rotateZNeg"); - addToolBarAction ("rotpoint"); // ========================================== initSingleToolBar ("Grids");
--- a/src/gui_actions.cpp Thu May 16 22:59:10 2013 +0300 +++ b/src/gui_actions.cpp Fri May 17 03:11:47 2013 +0300 @@ -374,16 +374,16 @@ // GL and Qt formats have R and B swapped. Also, GL flips Y - correct it as well. QImage img = QImage (imagedata, w, h, QImage::Format_ARGB32).rgbSwapped ().mirrored (); - str root = basename (g_curfile->m_filename.chars ()); - if (root.substr (~root - 4, -1) == ".dat") + str root = basename (g_curfile->m_filename); + if (~root >= 4 && root.substr (~root - 4, -1) == ".dat") root -= 4; - str defaultname = (~root > 0) ? fmt ("%s.png", root.chars ()) : ""; + str defaultname = (~root > 0) ? fmt ("%s.png", root.c ()) : ""; str fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname, "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)"); if (~fname > 0 && !img.save (fname)) - critical (fmt ("Couldn't open %s for writing to save screencap: %s", fname.chars(), strerror (errno))); + critical (fmt ("Couldn't open %s for writing to save screencap: %s", fname.c (), strerror (errno))); delete[] imagedata; }
--- a/src/gui_editactions.cpp Thu May 16 22:59:10 2013 +0300 +++ b/src/gui_editactions.cpp Fri May 17 03:11:47 2013 +0300 @@ -542,7 +542,7 @@ std::vector<LDObject*> sel = g_win->sel (); vertex origin; std::vector<vertex*> queue; - const double angle = (pi * currentGrid ().confs[Grid::Angle]->value) / 360; + const double angle = (pi * currentGrid ().confs[Grid::Angle]->value) / 180; // ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2 const double cosangle = cos (angle),
--- a/src/string.cpp Thu May 16 22:59:10 2013 +0300 +++ b/src/string.cpp Fri May 17 03:11:47 2013 +0300 @@ -16,6 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <stdexcept> #include "common.h" #include "string.h" @@ -159,5 +160,15 @@ if (b == -1) b = len (); - return m_string.substr (a, b - a); + str sub; + + try { + sub = m_string.substr (a, b - a); + } catch (const std::out_of_range& e) { + printf ("%s: %s: caught std::out_of_range, coords were: (%ld, %ld), string: `%s', length: %lu\n", + __func__, e.what (), a, b, chars (), (ulong) len ()); + abort (); + } + + return sub; } \ No newline at end of file