diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index ae3baca56..adbf460f4 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -707,6 +707,7 @@ MacroCommand::MacroCommand(const char* name, bool system) { sGroup = QT_TR_NOOP("Macros"); eType = 0; + sScriptName = 0; } MacroCommand::~MacroCommand() diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 29140ccf8..70c38b25b 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -924,7 +924,7 @@ void StdCmdToggleObjects::activated(int iMsg) (App::DocumentObject::getClassTypeId()); for (std::vector::const_iterator it=obj.begin();it!=obj.end();++it) { - if (doc && doc->isShow((*it)->getNameInDocument())) + if (doc->isShow((*it)->getNameInDocument())) doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=False" , app->getName(), (*it)->getNameInDocument()); else diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index a7fe5d9f2..5a2f4ba67 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -1425,25 +1425,25 @@ PyObject* Document::getPyObject(void) void Document::handleChildren3D(ViewProvider* viewProvider) { // check for children - if (viewProvider->getChildRoot()) { + if (viewProvider && viewProvider->getChildRoot()) { std::vector children = viewProvider->claimChildren3D(); SoGroup* childGroup = viewProvider->getChildRoot(); // size not the same -> build up the list new - if(childGroup->getNumChildren() != static_cast(children.size())){ + if (childGroup->getNumChildren() != static_cast(children.size())) { childGroup->removeAllChildren(); - for(std::vector::iterator it=children.begin();it!=children.end();++it){ + for (std::vector::iterator it=children.begin();it!=children.end();++it) { ViewProvider* ChildViewProvider = getViewProvider(*it); - if(ChildViewProvider) { + if (ChildViewProvider) { SoSeparator* childRootNode = ChildViewProvider->getRoot(); childGroup->addChild(childRootNode); // cycling to all views of the document to remove the viewprovider from the viewer itself for (std::list::iterator vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) { View3DInventor *activeView = dynamic_cast(*vIt); - if (activeView && viewProvider && activeView->getViewer()->hasViewProvider(ChildViewProvider)) { + if (activeView && activeView->getViewer()->hasViewProvider(ChildViewProvider)) { // Note about hasViewProvider() //remove the viewprovider serves the purpose of detaching the inventor nodes from the //top level root in the viewer. However, if some of the children were grouped beneath the object diff --git a/src/Gui/MouseSelection.cpp b/src/Gui/MouseSelection.cpp index 7e817b1ab..65cf2142c 100644 --- a/src/Gui/MouseSelection.cpp +++ b/src/Gui/MouseSelection.cpp @@ -505,32 +505,31 @@ int FreehandSelection::mouseButtonEvent(const SoMouseButtonEvent* const e, const const SbBool press = e->getState() == SoButtonEvent::DOWN ? true : false; if (press) { - switch(button) - { + switch(button) { case SoMouseButtonEvent::BUTTON1: - { - if (!polyline.isWorking()) { - polyline.setWorking(true); - polyline.clear(); - }; - polyline.addNode(pos); - polyline.setCoords(pos.x(), pos.y()); - m_iXnew = pos.x(); m_iYnew = pos.y(); - m_iXold = pos.x(); m_iYold = pos.y(); - } - break; + { + if (!polyline.isWorking()) { + polyline.setWorking(true); + polyline.clear(); + } + + polyline.addNode(pos); + polyline.setCoords(pos.x(), pos.y()); + m_iXnew = pos.x(); m_iYnew = pos.y(); + m_iXold = pos.x(); m_iYold = pos.y(); + } + break; case SoMouseButtonEvent::BUTTON2: - { - polyline.addNode(pos); - m_iXnew = pos.x(); m_iYnew = pos.y(); - m_iXold = pos.x(); m_iYold = pos.y(); - } - break; + { + polyline.addNode(pos); + m_iXnew = pos.x(); m_iYnew = pos.y(); + m_iXold = pos.x(); m_iYold = pos.y(); + } + break; default: - { - } break; + break; } } // release @@ -542,31 +541,31 @@ int FreehandSelection::mouseButtonEvent(const SoMouseButtonEvent* const e, const releaseMouseModel(); return Finish; } + break; case SoMouseButtonEvent::BUTTON2: - { - QCursor cur = _pcView3D->getWidget()->cursor(); - _pcView3D->getWidget()->setCursor(m_cPrevCursor); + { + QCursor cur = _pcView3D->getWidget()->cursor(); + _pcView3D->getWidget()->setCursor(m_cPrevCursor); - // The pop-up menu should be shown when releasing mouse button because - // otherwise the navigation style doesn't get the UP event and gets into - // an inconsistent state. - int id = popupMenu(); + // The pop-up menu should be shown when releasing mouse button because + // otherwise the navigation style doesn't get the UP event and gets into + // an inconsistent state. + int id = popupMenu(); - if (id == Finish || id == Cancel) { - releaseMouseModel(); + if (id == Finish || id == Cancel) { + releaseMouseModel(); + } + else if (id == Restart) { + _pcView3D->getWidget()->setCursor(cur); + } + + polyline.setWorking(false); + return id; } - else if (id == Restart) { - _pcView3D->getWidget()->setCursor(cur); - } - - polyline.setWorking(false); - return id; - } - break; + break; default: - { - } break; + break; } } diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index 35f7f1506..f2ff9b70a 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -135,10 +135,10 @@ void PropertyView::slotAppendDynamicProperty(const App::Property& prop) if (parent->isHidden(&prop)) return; - if (parent && parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) { propertyEditorData->appendProperty(prop); } - else if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) { + else if (parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) { propertyEditorView->appendProperty(prop); } } diff --git a/src/Gui/SplitView3DInventor.cpp b/src/Gui/SplitView3DInventor.cpp index fcb6aeec8..ec5350f07 100644 --- a/src/Gui/SplitView3DInventor.cpp +++ b/src/Gui/SplitView3DInventor.cpp @@ -634,8 +634,6 @@ Py::Object AbstractSplitViewPy::getViewer(const Py::Tuple& args) catch(...) { throw Py::Exception("Unknown C++ exception"); } - - return Py::None(); } Py::Object AbstractSplitViewPy::sequence_item(ssize_t viewIndex)