From a25247162579053995c1e0a2b35544c35b96404b Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 30 Jul 2014 10:04:03 +0200 Subject: [PATCH] + fix author notes, fix memory leak, fix build failure under Windows --- src/Gui/InventorAll.h | 1 + src/Gui/PropertyView.cpp | 4 +-- src/Gui/View3DInventor.h | 4 +-- src/Gui/View3DInventorViewer.cpp | 9 +++---- src/Gui/View3DInventorViewer.h | 8 ++---- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 27 ++++++++++----------- src/Mod/Sketcher/Gui/ViewProviderSketch.h | 2 +- 7 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/Gui/InventorAll.h b/src/Gui/InventorAll.h index 8e13ef92d..4570d9fcb 100644 --- a/src/Gui/InventorAll.h +++ b/src/Gui/InventorAll.h @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index 41c1c9918..e57e7d28f 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2002 J�rgen Riegel * + * Copyright (c) 2002 Juergen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * @@ -53,7 +53,7 @@ using namespace Gui::PropertyEditor; /* TRANSLATOR Gui::PropertyView */ /*! Property Editor Widget - * + * * Provides two Gui::PropertyEditor::PropertyEditor widgets, for "View" and "Data", * in two tabs. */ diff --git a/src/Gui/View3DInventor.h b/src/Gui/View3DInventor.h index 45356c2e7..a8cb9bfa5 100644 --- a/src/Gui/View3DInventor.h +++ b/src/Gui/View3DInventor.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2004 J�rgen Riegel * + * Copyright (c) 2004 Juergen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * @@ -58,7 +58,7 @@ protected: /** The 3D view window * It consists out of the 3D view - * \author J�rgen Riegel + * \author Juergen Riegel */ class GuiExport View3DInventor : public MDIView, public ParameterGrp::ObserverType { diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 5acbb6de5..e7563f3c4 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -742,15 +742,14 @@ const std::vector& View3DInventorViewer::getPolygon(SbBool* clip_inner) SbVec2f View3DInventorViewer::screenCoordsOfPath(SoPath *path) const { // Generate a matrix (well, a SoGetMatrixAction) that - // moves us us to the picked object's coordinate space. - SoGetMatrixAction *gma; - gma = new SoGetMatrixAction(getViewportRegion()); - gma->apply(path); + // moves us to the picked object's coordinate space. + SoGetMatrixAction gma(getViewportRegion()); + gma.apply(path); // Use that matrix to translate the origin in the picked // object's coordinate space into object space SbVec3f imageCoords(0, 0, 0); - SbMatrix m = gma->getMatrix().transpose(); + SbMatrix m = gma.getMatrix().transpose(); m.multMatrixVec(imageCoords, imageCoords); // Now, project the object space coordinates of the object diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index 19bc7d2f1..1fe23218c 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2004 J�rgen Riegel * + * Copyright (c) 2004 Juergen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * @@ -61,7 +61,7 @@ class SoFCUnifiedSelection; class GLGraphicsItem; class SoShapeScale; -/** GUI view into a 3-D Scene provided by View3DInventor +/** GUI view into a 3D scene provided by View3DInventor * */ class GuiExport View3DInventorViewer : public SoQtViewer, public Gui::SelectionSingleton::ObserverType @@ -127,10 +127,6 @@ public: SbBool isBacklight(void) const; void setSceneGraph (SoNode *root); - // TODO: I think it might be cleaner to move this functionality into a - // different class, with this class supporting something like a - // rotate() slot that gets triggered by the new Animator class? - // IR 20140630 void setAnimationEnabled(const SbBool enable); SbBool isAnimationEnabled(void) const; diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 46f385f22..54a553561 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2009 J�rgen Riegel * + * Copyright (c) 2009 Juergen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * @@ -2038,7 +2038,6 @@ void ViewProviderSketch::clearCoinImage(SoImage *soImagePtr) soImagePtr->setToDefaults(); } - QColor ViewProviderSketch::constrColor(int constraintId) { static QColor constrIcoColor((int)(ConstrIcoColor [0] * 255.0f), @@ -2058,7 +2057,7 @@ QColor ViewProviderSketch::constrColor(int constraintId) else return constrIcoColor; } - + int ViewProviderSketch::constrColorPriority(int constraintId) { if (edit->PreselectConstraintSet.count(constraintId)) @@ -2116,7 +2115,7 @@ void ViewProviderSketch::drawConstraintIcons() // Find the Constraint Icon SoImage Node SoSeparator *sep = static_cast(edit->constrGroup->getChild(constrId)); - + SbVec3f absPos; // Somewhat hacky - we use SoZoomTranslations for most types of icon, // but symmetry icons use SoTranslations... @@ -2125,7 +2124,7 @@ void ViewProviderSketch::drawConstraintIcons() absPos = static_cast(translationPtr)->abPos.getValue(); else absPos = translationPtr->translation.getValue(); - + SoImage *coinIconPtr = dynamic_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_FIRST_ICON)); SoInfo *infoPtr = static_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_FIRST_CONSTRAINTID)); @@ -2165,7 +2164,7 @@ void ViewProviderSketch::drawConstraintIcons() iconQueue.push_back(thisIcon); } - + combineConstraintIcons(iconQueue); } @@ -2297,7 +2296,7 @@ void ViewProviderSketch::drawMergedConstraintIcons(IconQueue iconQueue) i = iconQueue.erase(i); } - + // To be inserted into edit->combinedConstBoxes std::vector boundingBoxesVec; int oldHeight = 0; @@ -2390,7 +2389,7 @@ QImage ViewProviderSketch::renderConstrIcon(const QString &type, QString joinStr = QString::fromAscii(", "); QImage icon = Gui::BitmapFactory().pixmap(type.toAscii()).toImage(); - + QFont font = QApplication::font(); font.setPixelSize(11); font.setBold(true); @@ -2432,7 +2431,7 @@ QImage ViewProviderSketch::renderConstrIcon(const QString &type, ++labelItr, ++colorItr) { qp.setPen(*colorItr); - + if(labelItr + 1 == labels.end()) // if this is the last label labelStr = *labelItr; else @@ -2450,7 +2449,7 @@ QImage ViewProviderSketch::renderConstrIcon(const QString &type, icon.height() - qfm.height() + pxBelowBase); boundingBoxes->push_back(labelBB); } - + cursorOffset += qfm.width(labelStr); } } @@ -3336,15 +3335,15 @@ void ViewProviderSketch::rebuildConstraintsVisual(void) // #define CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL 0 sep->addChild(mat); // #define CONSTRAINT_SEPARATOR_INDEX_FIRST_TRANSLATION 1 - sep->addChild(new SoZoomTranslation()); + sep->addChild(new SoZoomTranslation()); // #define CONSTRAINT_SEPARATOR_INDEX_FIRST_ICON 2 - sep->addChild(new SoImage()); + sep->addChild(new SoImage()); // #define CONSTRAINT_SEPARATOR_INDEX_FIRST_CONSTRAINTID 3 sep->addChild(new SoInfo()); // #define CONSTRAINT_SEPARATOR_INDEX_SECOND_TRANSLATION 4 - sep->addChild(new SoZoomTranslation()); + sep->addChild(new SoZoomTranslation()); // #define CONSTRAINT_SEPARATOR_INDEX_SECOND_ICON 5 - sep->addChild(new SoImage()); + sep->addChild(new SoImage()); // #define CONSTRAINT_SEPARATOR_INDEX_SECOND_CONSTRAINTID 6 sep->addChild(new SoInfo()); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h index ab5e774f1..b9b8cdbc3 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2009 J�rgen Riegel * + * Copyright (c) 2009 Juergen Riegel * * * * This file is part of the FreeCAD CAx development system. * * *