diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 27cb09f61f..a9ac7fed92 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -32,6 +32,7 @@ # else # include # endif +# include # include # include # include @@ -170,8 +171,8 @@ public: double m_BorderWidth = 1.1; bool m_RotateToNearest = true; int m_NaviStepByTurn = 8; - float m_FontZoom = 0.3; - float m_Chamfer = 0.12; + float m_FontZoom = 0.3F; + float m_Chamfer = 0.12F; std::string m_TextFont; int m_FontWeight = 0; int m_FontStretch = 0; @@ -463,9 +464,9 @@ void NaviCubeImplementation::addButtonFace(PickId pickId, const SbVec3f& directi { if (m_Faces[pickId].vertexArray.size()) m_Faces[pickId].vertexArray.clear(); - float scale = 0.005; - float offx = 0.5; - float offy = 0.5; + float scale = 0.005F; + float offx = 0.5F; + float offy = 0.5F; vector pointData; switch (pickId) { @@ -474,19 +475,19 @@ void NaviCubeImplementation::addButtonFace(PickId pickId, const SbVec3f& directi case PickId::ArrowRight: case PickId::ArrowLeft: { pointData = { - 66.6, -66.6,//outer curve - 58.3, -74.0, - 49.2 ,-80.3, - 39.4 ,-85.5, - 29. , -89.5, - 25.3, -78.1,//inner curve - 34.3, -74.3, - 42.8, -69.9, - 50.8, -64.4, - 58.1, -58.1, - 53.8, -53.8,//arrowhead - 74.7, -46.8, - 70.7, -70.4 + 66.6F, -66.6F,//outer curve + 58.3F, -74.0F, + 49.2F ,-80.3F, + 39.4F ,-85.5F, + 29.0F, -89.5F, + 25.3F, -78.1F,//inner curve + 34.3F, -74.3F, + 42.8F, -69.9F, + 50.8F, -64.4F, + 58.1F, -58.1F, + 53.8F, -53.8F,//arrowhead + 74.7F, -46.8F, + 70.7F, -70.4F }; break; } @@ -502,8 +503,8 @@ void NaviCubeImplementation::addButtonFace(PickId pickId, const SbVec3f& directi break; } case PickId::ViewMenu: { - offx = 0.84; - offy = 0.84; + offx = 0.84F; + offy = 0.84F; pointData = { 0., 0.,//top rhombus 15., -6., @@ -627,7 +628,11 @@ void NaviCubeImplementation::setSize(int size) m_Prepared = false; } -void NaviCubeImplementation::prepare() { +void NaviCubeImplementation::prepare() +{ + static const float pi = boost::math::constants::pi(); + static const float pi1_2 = boost::math::constants::half_pi(); + createCubeFaceTextures(); Vector3f x(1, 0, 0); @@ -643,28 +648,28 @@ void NaviCubeImplementation::prepare() { addCubeFace( x,-z, ShapeId::Main, PickId::Bottom); // create corner faces - addCubeFace(-x-y, x-y+z, ShapeId::Corner, PickId::FrontTopRight, M_PI); - addCubeFace(-x+y,-x-y+z, ShapeId::Corner, PickId::FrontTopLeft, M_PI); + addCubeFace(-x-y, x-y+z, ShapeId::Corner, PickId::FrontTopRight, pi); + addCubeFace(-x+y,-x-y+z, ShapeId::Corner, PickId::FrontTopLeft, pi); addCubeFace(x+y, x-y-z, ShapeId::Corner, PickId::FrontBottomRight); addCubeFace(x-y,-x-y-z, ShapeId::Corner, PickId::FrontBottomLeft); - addCubeFace(x-y, x+y+z, ShapeId::Corner, PickId::RearTopRight, M_PI); - addCubeFace(x+y,-x+y+z, ShapeId::Corner, PickId::RearTopLeft, M_PI); + addCubeFace(x-y, x+y+z, ShapeId::Corner, PickId::RearTopRight, pi); + addCubeFace(x+y,-x+y+z, ShapeId::Corner, PickId::RearTopLeft, pi); addCubeFace(-x+y, x+y-z, ShapeId::Corner, PickId::RearBottomRight); addCubeFace(-x-y,-x+y-z, ShapeId::Corner, PickId::RearBottomLeft); // create edge faces addCubeFace(x, z-y, ShapeId::Edge, PickId::FrontTop); addCubeFace(x,-z-y, ShapeId::Edge, PickId::FrontBottom); - addCubeFace(x, y-z, ShapeId::Edge, PickId::RearBottom, M_PI); - addCubeFace(x, y+z, ShapeId::Edge, PickId::RearTop, M_PI); - addCubeFace(z, x+y, ShapeId::Edge, PickId::RearRight, M_PI_2); - addCubeFace(z, x-y, ShapeId::Edge, PickId::FrontRight, M_PI_2); - addCubeFace(z,-x-y, ShapeId::Edge, PickId::FrontLeft, M_PI_2); - addCubeFace(z, y-x, ShapeId::Edge, PickId::RearLeft, M_PI_2); - addCubeFace(y, z-x, ShapeId::Edge, PickId::TopLeft, M_PI); + addCubeFace(x, y-z, ShapeId::Edge, PickId::RearBottom, pi); + addCubeFace(x, y+z, ShapeId::Edge, PickId::RearTop, pi); + addCubeFace(z, x+y, ShapeId::Edge, PickId::RearRight, pi1_2); + addCubeFace(z, x-y, ShapeId::Edge, PickId::FrontRight, pi1_2); + addCubeFace(z,-x-y, ShapeId::Edge, PickId::FrontLeft, pi1_2); + addCubeFace(z, y-x, ShapeId::Edge, PickId::RearLeft, pi1_2); + addCubeFace(y, z-x, ShapeId::Edge, PickId::TopLeft, pi); addCubeFace(y, x+z, ShapeId::Edge, PickId::TopRight); addCubeFace(y, x-z, ShapeId::Edge, PickId::BottomRight); - addCubeFace(y,-z-x, ShapeId::Edge, PickId::BottomLeft, M_PI); + addCubeFace(y,-z-x, ShapeId::Edge, PickId::BottomLeft, pi); // create the flat buttons addButtonFace(PickId::ArrowNorth, SbVec3f(-1, 0, 0)); @@ -785,7 +790,7 @@ void NaviCubeImplementation::drawNaviCube(bool pickMode) SbMatrix mx; mx = cam->orientation.getValue(); mx = mx.inverse(); - mx[3][2] = -5.1; + mx[3][2] = -5.1F; glLoadMatrixf((float*)mx); glEnableClientState(GL_VERTEX_ARRAY); @@ -974,7 +979,10 @@ SbRotation NaviCubeImplementation::getNearestOrientation(PickId pickId) { return intermediateOrientation * rotation; } -bool NaviCubeImplementation::mouseReleased(short x, short y) { +bool NaviCubeImplementation::mouseReleased(short x, short y) +{ + static const float pi = boost::math::constants::pi(); + setHilite(PickId::None); m_MouseDown = false; @@ -1007,7 +1015,7 @@ bool NaviCubeImplementation::mouseReleased(short x, short y) { // Handle the flat buttons SbRotation rotation = m_Faces[pickId].rotation; if (pickId == PickId::DotBackside) { - rotation.scaleAngle(M_PI); + rotation.scaleAngle(pi); } else { rotation.scaleAngle(rotStepAngle); diff --git a/src/Gui/PreCompiled.h b/src/Gui/PreCompiled.h index 2c06bba847..b50b25f462 100644 --- a/src/Gui/PreCompiled.h +++ b/src/Gui/PreCompiled.h @@ -89,6 +89,7 @@ #include #include #include +#include #include #include diff --git a/src/Gui/SelectionFilterPy.cpp b/src/Gui/SelectionFilterPy.cpp index d5d8d630b5..d07ff8ccfc 100644 --- a/src/Gui/SelectionFilterPy.cpp +++ b/src/Gui/SelectionFilterPy.cpp @@ -20,6 +20,7 @@ * * ***************************************************************************/ +#include "PreCompiled.h" #include #include "SelectionFilterPy.h" diff --git a/src/Gui/SoFCBackgroundGradient.cpp b/src/Gui/SoFCBackgroundGradient.cpp index 653b8bbc24..37eb809127 100644 --- a/src/Gui/SoFCBackgroundGradient.cpp +++ b/src/Gui/SoFCBackgroundGradient.cpp @@ -24,6 +24,7 @@ #ifndef _PreComp_ #include +#include #ifdef FC_OS_WIN32 #define _USE_MATH_DEFINES #endif @@ -38,14 +39,18 @@ #include "SoFCBackgroundGradient.h" static const std::array big_circle = []{ + static const float pi2 = boost::math::constants::two_pi(); std::array result; int c = 0; - for (GLfloat i = 0; i < 2*M_PI; i += 2*M_PI / 32, c++){ - result[c][0] = M_SQRT2*cosf(i); result[c][1] = M_SQRT2*sinf(i); } + for (GLfloat i = 0; i < pi2; i += pi2 / 32, c++) { + result[c][0] = M_SQRT2*cosf(i); result[c][1] = M_SQRT2*sinf(i); + } return result; }(); static const std::array small_oval = []{ + static const float pi2 = boost::math::constants::two_pi(); std::array result; int c = 0; - for (GLfloat i = 0; i < 2*M_PI; i += 2*M_PI / 32, c++){ - result[c][0] = 0.3*M_SQRT2*cosf(i); result[c][1] = M_SQRT1_2*sinf(i); } + for (GLfloat i = 0; i < pi2; i += pi2 / 32, c++) { + result[c][0] = 0.3*M_SQRT2*cosf(i); result[c][1] = M_SQRT1_2*sinf(i); + } return result; }(); using namespace Gui; diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 6bb50af393..8667a628bd 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -1564,7 +1564,7 @@ void ExpLineEdit::setExpression(std::shared_ptr expr) try { ExpressionBinding::setExpression(expr); } - catch (const Base::Exception & e) { + catch (const Base::Exception&) { setReadOnly(true); QPalette p(palette()); p.setColor(QPalette::Active, QPalette::Text, Qt::red); @@ -1631,7 +1631,7 @@ void ExpLineEdit::resizeEvent(QResizeEvent * event) iconLabel->setExpressionText(QString()); } } - catch (const Base::Exception & e) { + catch (const Base::Exception&) { setReadOnly(true); QPalette p(palette()); p.setColor(QPalette::Active, QPalette::Text, Qt::red); diff --git a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.ui b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.ui index a17b7559ab..3ed6882fee 100644 --- a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.ui @@ -154,7 +154,7 @@ 0 - + Offset @@ -185,7 +185,7 @@ - + Occurrences diff --git a/src/Mod/Sketcher/App/PreCompiled.h b/src/Mod/Sketcher/App/PreCompiled.h index 9d8d9a9fc6..36d58d073b 100644 --- a/src/Mod/Sketcher/App/PreCompiled.h +++ b/src/Mod/Sketcher/App/PreCompiled.h @@ -25,6 +25,10 @@ #include +#ifdef _MSC_VER +#pragma warning(disable : 4251) +#endif + #ifdef _PreComp_ // standard diff --git a/src/Mod/Sketcher/App/planegcs/GCS.cpp b/src/Mod/Sketcher/App/planegcs/GCS.cpp index 474d3e5ac8..fdbf350a70 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/planegcs/GCS.cpp @@ -21,6 +21,7 @@ ***************************************************************************/ #ifdef _MSC_VER +#pragma warning(disable : 4251) #pragma warning(disable : 4244) #pragma warning(disable : 4996) #endif diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 980a588624..fc36153d85 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -614,7 +614,7 @@ bool addConstraintSafely(SketchObject* obj, std::function constraintaddi tryAutoRecompute(obj); return false; } - catch (const Base::Exception& e) { + catch (const Base::Exception&) { Gui::TranslatedUserError( obj, QObject::tr("Error"), diff --git a/tests/src/Base/BoundBox.cpp b/tests/src/Base/BoundBox.cpp index f29f2faced..21e8be6f63 100644 --- a/tests/src/Base/BoundBox.cpp +++ b/tests/src/Base/BoundBox.cpp @@ -1,4 +1,11 @@ #include "gtest/gtest.h" +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#ifndef NOMINMAX +#define NOMINMAX +#endif +#include +#endif #include #include diff --git a/tests/src/Base/Reader.cpp b/tests/src/Base/Reader.cpp index 8689fb9818..737b7fb2d6 100644 --- a/tests/src/Base/Reader.cpp +++ b/tests/src/Base/Reader.cpp @@ -2,6 +2,10 @@ #include "gtest/gtest.h" +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#endif + #include "Base/Exception.h" #include "Base/Reader.h" #include