diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 6c19a5c4d..05cf9d72c 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -270,9 +270,9 @@ void Application::renameDocument(const char *OldName, const char *NewName) DocMap[NewName] = temp; signalRenameDocument(*temp); } - else - Base::Exception("Application::renameDocument(): no document with this name to rename!"); - + else { + throw Base::Exception("Application::renameDocument(): no document with this name to rename!"); + } } Document* Application::newDocument(const char * Name, const char * UserName) @@ -1464,8 +1464,6 @@ pair customSyntax(const string& s) return make_pair(string("fg"), string("null")); else if (s.find("-button") == 0) return make_pair(string("button"), string("null")); - else if (s.find("-button") == 0) - return make_pair(string("button"), string("null")); else if (s.find("-btn") == 0) return make_pair(string("btn"), string("null")); else if (s.find("-name") == 0) diff --git a/src/Base/FileInfo.cpp b/src/Base/FileInfo.cpp index 83f9937aa..6efb485f0 100644 --- a/src/Base/FileInfo.cpp +++ b/src/Base/FileInfo.cpp @@ -516,7 +516,7 @@ bool FileInfo::deleteDirectoryRecursive(void) const It->deleteFile(); } else { - Base::Exception("FileInfo::deleteDirectoryRecursive(): Unknown object Type in directory!"); + throw Base::FileException("FileInfo::deleteDirectoryRecursive(): Unknown object Type in directory!"); } } return deleteDirectory(); diff --git a/src/Base/MemDebug.cpp b/src/Base/MemDebug.cpp index 7d140a836..59ccb6247 100644 --- a/src/Base/MemDebug.cpp +++ b/src/Base/MemDebug.cpp @@ -219,7 +219,7 @@ int __cdecl MemDebug::sAllocHook( if ( pvData != NULL ) fprintf( logFile, " at %p\n", pvData ); else - fprintf( logFile, "\n", pvData ); + fprintf( logFile, "\n" ); return( 7 ); // Allow the memory operation to proceed (True = 7, False = 0) } diff --git a/src/Base/Rotation.cpp b/src/Base/Rotation.cpp index 77dd1d683..bbefa4b6e 100644 --- a/src/Base/Rotation.cpp +++ b/src/Base/Rotation.cpp @@ -257,7 +257,6 @@ Rotation & Rotation::invert(void) this->quat[0] = -this->quat[0]; this->quat[1] = -this->quat[1]; this->quat[2] = -this->quat[2]; - this->quat[3] = this->quat[3]; return *this; } diff --git a/src/Gui/BlenderNavigationStyle.cpp b/src/Gui/BlenderNavigationStyle.cpp index 0855fddfa..28bb6cfe0 100644 --- a/src/Gui/BlenderNavigationStyle.cpp +++ b/src/Gui/BlenderNavigationStyle.cpp @@ -188,18 +188,6 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev) this->centerTime = ev->getTime(); processed = TRUE; } - else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) { - SbTime tmp = (ev->getTime() - this->centerTime); - float dci = (float)QApplication::doubleClickInterval()/1000.0f; - if (tmp.getValue() < dci) { - newmode = NavigationStyle::ZOOMING; - } - processed = TRUE; - } - else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) { - this->setViewing(false); - processed = TRUE; - } else if (viewer->isEditing() && (this->currentmode == NavigationStyle::SPINNING)) { processed = TRUE; } @@ -229,14 +217,6 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev) this->centerTime = ev->getTime(); processed = TRUE; } - else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) { - SbTime tmp = (ev->getTime() - this->centerTime); - float dci = (float)QApplication::doubleClickInterval()/1000.0f; - if (tmp.getValue() < dci) { - newmode = NavigationStyle::ZOOMING; - } - processed = TRUE; - } this->button2down = press; break; case SoMouseButtonEvent::BUTTON3: @@ -340,6 +320,9 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev) else newmode = NavigationStyle::SELECTION; break; + //case BUTTON1DOWN|BUTTON3DOWN: + // newmode = NavigationStyle::PANNING; + // break; case SHIFTDOWN|BUTTON3DOWN: newmode = NavigationStyle::PANNING; break; @@ -349,6 +332,9 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev) } newmode = NavigationStyle::DRAGGING; break; + //case BUTTON1DOWN|BUTTON2DOWN|BUTTON3DOWN: + // newmode = NavigationStyle::ZOOMING; + // break; case CTRLDOWN|SHIFTDOWN|BUTTON2DOWN: newmode = NavigationStyle::ZOOMING; break; diff --git a/src/Gui/CADNavigationStyle.cpp b/src/Gui/CADNavigationStyle.cpp index 1f7482be0..7140e4245 100644 --- a/src/Gui/CADNavigationStyle.cpp +++ b/src/Gui/CADNavigationStyle.cpp @@ -224,10 +224,6 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev) } processed = TRUE; } - else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) { - this->setViewing(false); - processed = TRUE; - } else if (viewer->isEditing() && (this->currentmode == NavigationStyle::SPINNING)) { processed = TRUE; } diff --git a/src/Gui/TaskPanelView.cpp b/src/Gui/TaskPanelView.cpp index 890530f91..f637f623f 100644 --- a/src/Gui/TaskPanelView.cpp +++ b/src/Gui/TaskPanelView.cpp @@ -153,6 +153,7 @@ TaskPanelView::~TaskPanelView() void TaskPanelView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller, Gui::SelectionSingleton::MessageType Reason) { + /* std::string temp; if (Reason.Type == SelectionChanges::AddSelection) { @@ -161,8 +162,7 @@ void TaskPanelView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller, } else if (Reason.Type == SelectionChanges::RmvSelection) { } - else if (Reason.Type == SelectionChanges::RmvSelection) { - } + */ } void TaskPanelView::onUpdate(void) diff --git a/src/Gui/TouchpadNavigationStyle.cpp b/src/Gui/TouchpadNavigationStyle.cpp index 6e1db76f3..8f3060a40 100644 --- a/src/Gui/TouchpadNavigationStyle.cpp +++ b/src/Gui/TouchpadNavigationStyle.cpp @@ -192,18 +192,6 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev) this->centerTime = ev->getTime(); processed = TRUE; } - else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) { - SbTime tmp = (ev->getTime() - this->centerTime); - float dci = (float)QApplication::doubleClickInterval()/1000.0f; - if (tmp.getValue() < dci) { - newmode = NavigationStyle::ZOOMING; - } - processed = TRUE; - } - else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) { - this->setViewing(false); - processed = TRUE; - } else if (viewer->isEditing() && (this->currentmode == NavigationStyle::SPINNING)) { processed = TRUE; } @@ -233,14 +221,6 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev) this->centerTime = ev->getTime(); processed = TRUE; } - else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) { - SbTime tmp = (ev->getTime() - this->centerTime); - float dci = (float)QApplication::doubleClickInterval()/1000.0f; - if (tmp.getValue() < dci) { - newmode = NavigationStyle::ZOOMING; - } - processed = TRUE; - } this->button2down = press; break; case SoMouseButtonEvent::BUTTON4: diff --git a/src/Gui/View3DInventorExamples.cpp b/src/Gui/View3DInventorExamples.cpp index 5c4b0bc09..a6931262a 100644 --- a/src/Gui/View3DInventorExamples.cpp +++ b/src/Gui/View3DInventorExamples.cpp @@ -290,8 +290,8 @@ void LightManip(SoSeparator * root) SoInput in; in.setBuffer((void *)scenegraph, std::strlen(scenegraph)); SoSeparator * _root = SoDB::readAll( &in ); + if ( _root == NULL ) return; // Shouldn't happen. root->addChild(_root); - if ( root == NULL ) return; // Shouldn't happen. root->ref(); const char * pointlightnames[3] = { "RedLight", "GreenLight", "BlueLight" }; diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 90caf93a2..1b5f2d4ef 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -1007,12 +1007,14 @@ void PropertyVectorDistanceItem::setValue(const QVariant& variant) return; const Base::Vector3d& value = variant.value(); - Base::Quantity q = Base::Quantity(value.x, Base::Unit::Length); - QString unit = QString::fromLatin1("('%1 %2'").arg(q.getValue()).arg(q.getUnit().getString()); - q = Base::Quantity(value.y, Base::Unit::Length); - unit + QString::fromLatin1("'%1 %2'").arg(q.getValue()).arg(q.getUnit().getString()); - - setPropertyValue(unit); + Base::Quantity x = Base::Quantity(value.x, Base::Unit::Length); + Base::Quantity y = Base::Quantity(value.y, Base::Unit::Length); + Base::Quantity z = Base::Quantity(value.z, Base::Unit::Length); + QString data = QString::fromAscii("(%1, %2, %3)") + .arg(x.getUserString()) + .arg(y.getUserString()) + .arg(z.getUserString()); + setPropertyValue(data); } void PropertyVectorDistanceItem::setEditorData(QWidget *editor, const QVariant& data) const diff --git a/src/Mod/Drawing/App/CMakeLists.txt b/src/Mod/Drawing/App/CMakeLists.txt index 0f5c202f1..e120de0b8 100644 --- a/src/Mod/Drawing/App/CMakeLists.txt +++ b/src/Mod/Drawing/App/CMakeLists.txt @@ -78,9 +78,9 @@ SET(Drawing_Templates ) if(MSVC) - add_definitions(-D_PreComp_) - GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" Drawing_CPP_SRCS ${Drawing_SRCS} ${Features_SRCS} ${DrawingAlgos_SRCS}) - ADD_MSVC_PRECOMPILED_HEADER(Drawing PreCompiled.h PreCompiled.cpp Drawing_CPP_SRCS) + #add_definitions(-D_PreComp_) + #GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" Drawing_CPP_SRCS ${Drawing_SRCS} ${Features_SRCS} ${DrawingAlgos_SRCS}) + #ADD_MSVC_PRECOMPILED_HEADER(Drawing PreCompiled.h PreCompiled.cpp Drawing_CPP_SRCS) endif(MSVC) add_library(Drawing SHARED ${Drawing_SRCS} ${Features_SRCS} ${DrawingAlgos_SRCS}) diff --git a/src/Mod/Drawing/Gui/CMakeLists.txt b/src/Mod/Drawing/Gui/CMakeLists.txt index 2e0b07793..3224aead2 100644 --- a/src/Mod/Drawing/Gui/CMakeLists.txt +++ b/src/Mod/Drawing/Gui/CMakeLists.txt @@ -81,9 +81,9 @@ SET(DrawingGuiTaskDlgs_SRCS SOURCE_GROUP("TaskDialogs" FILES ${DrawingGuiTaskDlgs_SRCS}) if(MSVC) - add_definitions(-D_PreComp_) - GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${DrawingGui_SRCS} ${DrawingGuiView_SRCS} ${DrawingGuiViewProvider_SRCS}) - ADD_MSVC_PRECOMPILED_HEADER(DrawingGui PreCompiled.h PreCompiled.cpp PCH_SRCS) + #add_definitions(-D_PreComp_) + #GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${DrawingGui_SRCS} ${DrawingGuiView_SRCS} ${DrawingGuiViewProvider_SRCS}) + #ADD_MSVC_PRECOMPILED_HEADER(DrawingGui PreCompiled.h PreCompiled.cpp PCH_SRCS) endif(MSVC) add_library(DrawingGui SHARED ${DrawingGui_SRCS} ${DrawingGuiView_SRCS} ${DrawingGuiViewProvider_SRCS}) diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp index 4f0c21f92..66b84349b 100755 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp @@ -689,9 +689,10 @@ void ViewProviderFEMMeshBuilder::buildNodes(const App::Property* prop, std::vect inline void insEdgeVec(std::map > &map, int n1, int n2) { - if(n1(scaleX, scaleY); - if (cam && cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) { + if (cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) { float height = static_cast(cam)->height.getValue() * scale; static_cast(cam)->height = height; } - else if (cam && cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) { + else if (cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) { float height = static_cast(cam)->heightAngle.getValue() / 2.0f; height = 2.0f * atan(tan(height) * scale); static_cast(cam)->heightAngle = height; diff --git a/src/Mod/Part/App/modelRefine.cpp b/src/Mod/Part/App/modelRefine.cpp index 9dd148a9e..0e2468aef 100644 --- a/src/Mod/Part/App/modelRefine.cpp +++ b/src/Mod/Part/App/modelRefine.cpp @@ -777,7 +777,7 @@ bool FaceTypedBSpline::isEqual(const TopoDS_Face &faceOne, const TopoDS_Face &fa return false; if (surfaceOne->IsURational() != surfaceTwo->IsURational()) return false; - if (surfaceTwo->IsVRational() != surfaceTwo->IsVRational()) return false; + if (surfaceOne->IsVRational() != surfaceTwo->IsVRational()) return false; if (surfaceOne->IsUPeriodic() != surfaceTwo->IsUPeriodic()) return false; if (surfaceOne->IsVPeriodic() != surfaceTwo->IsVPeriodic()) return false; if (surfaceOne->IsUClosed() != surfaceTwo->IsUClosed()) return false; diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index e3ad95116..99b5c7395 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -183,10 +183,10 @@ ResultEntry::ResultEntry() ResultEntry::~ResultEntry() { - if (boxSep) + if (boxSep && viewProviderRoot) viewProviderRoot->removeChild(boxSep); if (viewProviderRoot) - viewProviderRoot->unref(); + viewProviderRoot->unref(); qDeleteAll(children); } diff --git a/src/Mod/Robot/App/WaypointPyImp.cpp b/src/Mod/Robot/App/WaypointPyImp.cpp index 3965b5183..3304f150c 100644 --- a/src/Mod/Robot/App/WaypointPyImp.cpp +++ b/src/Mod/Robot/App/WaypointPyImp.cpp @@ -225,10 +225,11 @@ Py::Int WaypointPy::getTool(void) const void WaypointPy::setTool(Py::Int arg) { - if((int)arg.operator long() > 0) - getWaypointPtr()->Tool = (int)arg.operator long(); + long value = static_cast(arg); + if (value >= 0) + getWaypointPtr()->Tool = value; else - Base::Exception("negativ tool not allowed!"); + throw Py::ValueError("negative tool not allowed!"); } Py::Int WaypointPy::getBase(void) const @@ -238,10 +239,11 @@ Py::Int WaypointPy::getBase(void) const void WaypointPy::setBase(Py::Int arg) { - if((int)arg.operator long() > 0) - getWaypointPtr()->Base = (int)arg.operator long(); + long value = static_cast(arg); + if (value >= 0) + getWaypointPtr()->Base = value; else - Base::Exception("negativ base not allowed!"); + throw Py::ValueError("negative base not allowed!"); } PyObject *WaypointPy::getCustomAttributes(const char* /*attr*/) const diff --git a/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp b/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp index 0ff9bf6d7..2e8d81544 100644 --- a/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp +++ b/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp @@ -206,9 +206,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop) path = searchAction.getPath(); if(path){ SoNode* node = path->getTail(); - std::string typeName = (const char*)node->getTypeId().getName(); if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId()) throw; // should not happen + std::string typeName = (const char*)node->getTypeId().getName(); Axis1Node = static_cast(node); } // Axis 2 @@ -219,9 +219,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop) path = searchAction.getPath(); if(path){ SoNode* node = path->getTail(); - std::string typeName = (const char*)node->getTypeId().getName(); if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId()) throw; // should not happen + std::string typeName = (const char*)node->getTypeId().getName(); Axis2Node = static_cast(node); } // Axis 3 @@ -232,9 +232,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop) path = searchAction.getPath(); if(path){ SoNode* node = path->getTail(); - std::string typeName = (const char*)node->getTypeId().getName(); if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId()) throw; // should not happen + std::string typeName = (const char*)node->getTypeId().getName(); Axis3Node = static_cast(node); } // Axis 4 @@ -245,9 +245,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop) path = searchAction.getPath(); if(path){ SoNode* node = path->getTail(); - std::string typeName = (const char*)node->getTypeId().getName(); if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId()) throw; // should not happen + std::string typeName = (const char*)node->getTypeId().getName(); Axis4Node = static_cast(node); } // Axis 5 @@ -258,9 +258,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop) path = searchAction.getPath(); if(path){ SoNode* node = path->getTail(); - std::string typeName = (const char*)node->getTypeId().getName(); if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId()) throw; // should not happen + std::string typeName = (const char*)node->getTypeId().getName(); Axis5Node = static_cast(node); } // Axis 6 @@ -271,9 +271,9 @@ void ViewProviderRobotObject::updateData(const App::Property* prop) path = searchAction.getPath(); if(path){ SoNode* node = path->getTail(); - std::string typeName = (const char*)node->getTypeId().getName(); if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId()) throw; // should not happen + std::string typeName = (const char*)node->getTypeId().getName(); Axis6Node = static_cast(node); } if(Axis1Node) diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 4fb5541c5..9dff30f71 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -182,8 +182,7 @@ int Sketch::addGeometry(const Part::Geometry *geo, bool fixed) // create the definition struct for that geom return addArcOfEllipse(*aoe, fixed); } else { - Base::Exception("Sketch::addGeometry(): Unknown or unsupported type added to a sketch"); - return 0; + throw Base::TypeError("Sketch::addGeometry(): Unknown or unsupported type added to a sketch"); } } diff --git a/src/Mod/Sketcher/App/planegcs/Geo.h b/src/Mod/Sketcher/App/planegcs/Geo.h index bc95708cf..9e03771ba 100644 --- a/src/Mod/Sketcher/App/planegcs/Geo.h +++ b/src/Mod/Sketcher/App/planegcs/Geo.h @@ -89,7 +89,7 @@ namespace GCS class Curve //a base class for all curve-based objects (line, circle/arc, ellipse/arc) { public: - + virtual ~Curve(){} //returns normal vector. The vector should point to the left when one // walks along the curve from start to end. Ellipses and circles are // assumed to be walked counterclockwise, so the vector should point @@ -111,6 +111,7 @@ namespace GCS { public: Line(){} + virtual ~Line(){} Point p1; Point p2; DeriVector2 CalculateNormal(Point &p, double* derivparam = 0); @@ -123,6 +124,7 @@ namespace GCS { public: Circle(){rad = 0;} + virtual ~Circle(){} Point center; double *rad; DeriVector2 CalculateNormal(Point &p, double* derivparam = 0); @@ -135,6 +137,7 @@ namespace GCS { public: Arc(){startAngle=0;endAngle=0;rad=0;} + virtual ~Arc(){} double *startAngle; double *endAngle; //double *rad; //inherited @@ -150,6 +153,7 @@ namespace GCS { public: Ellipse(){ radmin = 0;} + virtual ~Ellipse(){} Point center; Point focus1; double *radmin; @@ -166,6 +170,7 @@ namespace GCS { public: ArcOfEllipse(){startAngle=0;endAngle=0;radmin = 0;} + virtual ~ArcOfEllipse(){} double *startAngle; double *endAngle; //double *radmin; //inherited diff --git a/src/Mod/Spreadsheet/App/PropertySheet.cpp b/src/Mod/Spreadsheet/App/PropertySheet.cpp index 3e0425c56..1a3021903 100644 --- a/src/Mod/Spreadsheet/App/PropertySheet.cpp +++ b/src/Mod/Spreadsheet/App/PropertySheet.cpp @@ -992,7 +992,7 @@ void PropertySheet::recomputeDependants(const Property *prop) assert(name != 0); - if (owner && name) { + if (name) { const char * docName = owner->getDocument()->Label.getValue(); const char * nameInDoc = owner->getNameInDocument();