From 989fe4028e66290a36cd1c147313c19e73c85365 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 19 Jun 2017 17:18:16 +0200 Subject: [PATCH] various fixes: + fix typos + fix const correctness + whitespace improvements --- src/App/Document.cpp | 14 +++++++------- src/App/Document.h | 2 +- src/App/DocumentObject.cpp | 4 ++-- src/App/GeoFeature.cpp | 2 +- src/App/GeoFeature.h | 6 +++--- src/App/GeoFeatureGroupExtension.cpp | 8 ++++---- src/App/GeoFeatureGroupExtension.h | 12 ++++++------ src/App/GroupExtension.cpp | 5 ++--- src/App/GroupExtension.h | 2 +- src/Gui/ViewProviderGeoFeatureGroupExtension.cpp | 2 +- src/Gui/ViewProviderGroupExtension.cpp | 1 - src/Gui/ViewProviderOrigin.h | 4 +++- src/Mod/PartDesign/Gui/CommandBody.cpp | 2 +- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 3 +-- 14 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index b8ec2d9dc9..eff7d899a7 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -325,8 +325,8 @@ void Document::exportGraphviz(std::ostream& out) const } /** - * @brief addExpressionSubgraphIfNeeded Add a subgraph to the main graph if it is needed, i.e there are defined at least one expression in hte - * document object, or other objects are referencing properties in it. + * @brief addExpressionSubgraphIfNeeded Add a subgraph to the main graph if it is needed, i.e. there are defined at least one + * expression in the document object, or other objects are referencing properties in it. * @param obj DocumentObject to assess. * @param CSSubgraphs Boolean if the GeoFeatureGroups are created as subgraphs */ @@ -370,8 +370,9 @@ void Document::exportGraphviz(std::ostream& out) const auto graph2 = group ? GraphList[group] : &DepList; GraphList[o] = &graph2->create_subgraph(); } - else + else { GraphList[o] = &graph->create_subgraph(); + } setGraphAttributes(o); } @@ -394,7 +395,7 @@ void Document::exportGraphviz(std::ostream& out) const if(std::find(objects.begin(), objects.end(), docObj) != objects.end()) return; - //find the correct graph to add the vertex too. Check first expressions graphs, afterwards + //find the correct graph to add the vertex to. Check first expression graphs, afterwards //the parent CS and origin graphs Graph * sgraph = GraphList[docObj]; if(CSSubgraphs) { @@ -868,12 +869,11 @@ bool Document::redo(void) return false; } -bool Document::performsTransactionOperation() { - +bool Document::isPerformingTransaction() const +{ return d->undoing || d->rollback; } - std::vector Document::getAvailableUndoNames() const { std::vector vList; diff --git a/src/App/Document.h b/src/App/Document.h index 64b20fa8f4..351d6388da 100644 --- a/src/App/Document.h +++ b/src/App/Document.h @@ -307,7 +307,7 @@ public: /// Will REDO one step, returns False if no redo was done (Redos == 0). bool redo() ; /// returns true if the document is in an Transaction phase, e.g. currently performing a redo/undo or rollback - bool performsTransactionOperation(); + bool isPerformingTransaction() const; //@} /** @name dependency stuff */ diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index 6a6156e0f2..0099787415 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -422,9 +422,9 @@ void DocumentObject::onChanged(const Property* prop) if (prop == &Label && _pDoc && oldLabel != Label.getStrValue()) _pDoc->signalRelabelObject(*this); - // set object touched if it is a input ptoperty + // set object touched if it is an input property if (!(prop->getType() & Prop_Output)) - StatusBits.set(0); + StatusBits.set(ObjectStatus::Touch); //call the parent for appropriate handling TransactionalObject::onChanged(prop); diff --git a/src/App/GeoFeature.cpp b/src/App/GeoFeature.cpp index 8ce3c94718..bff633ca7c 100644 --- a/src/App/GeoFeature.cpp +++ b/src/App/GeoFeature.cpp @@ -56,7 +56,7 @@ void GeoFeature::transformPlacement(const Base::Placement &transform) this->Placement.setValue(plm); } -Base::Placement GeoFeature::globalPlacement() +Base::Placement GeoFeature::globalPlacement() const { auto* group = GeoFeatureGroupExtension::getGroupOfObject(this); if(group) { diff --git a/src/App/GeoFeature.h b/src/App/GeoFeature.h index b030c606c0..673b1516c3 100644 --- a/src/App/GeoFeature.h +++ b/src/App/GeoFeature.h @@ -72,14 +72,14 @@ public: * * In FreeCAD the GeoFeature placement describes the local placement of the object in its parent * coordinate system. This is however not always the same as the global reference system. If the - * object is in a GeoFeatureGroup, hence in annother local coordinate system, the Placement + * object is in a GeoFeatureGroup, hence in another local coordinate system, the Placement * property does only give the local transformation. This function can be used to calculate the * placement of the object in the global reference coordinate system taking all stacked local - * system into account. + * systems into account. * * @return Base::Placement The transformation from the global reference coordinate system */ - Base::Placement globalPlacement(); + Base::Placement globalPlacement() const; }; } //namespace App diff --git a/src/App/GeoFeatureGroupExtension.cpp b/src/App/GeoFeatureGroupExtension.cpp index 233dd58aea..fd53d47f40 100644 --- a/src/App/GeoFeatureGroupExtension.cpp +++ b/src/App/GeoFeatureGroupExtension.cpp @@ -89,9 +89,9 @@ DocumentObject* GeoFeatureGroupExtension::getGroupOfObject(const DocumentObject* if(obj->isDerivedFrom(App::OriginFeature::getClassTypeId())) return OriginGroupExtension::getGroupOfObject(obj); - //compared to GroupExtension we do return here all geofeaturegroups including all extensions erived from it - //like origingroup. That is needed as we use this function to get all local coordinate systems. Also there - //is no reason to distuinguish between geofeatuergroups, there is only between group/geofeaturegroup + //compared to GroupExtension we do return here all GeoFeatureGroups including all extensions derived from it + //like OriginGroup. That is needed as we use this function to get all local coordinate systems. Also there + //is no reason to distinguish between GeoFeatuerGroups, there is only between group/geofeaturegroup auto list = obj->getInList(); for (auto obj : list) { if(obj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId())) @@ -213,7 +213,7 @@ void GeoFeatureGroupExtension::getCSOutList(App::DocumentObject* obj, std::vecto if(!obj) return; - //if the object is a geofeaturegroup than all dependencies belong to that CS, we don't want them + //if the object is a GeoFeatureGroup then all dependencies belong to that CS, we don't want them if(obj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId())) return; diff --git a/src/App/GeoFeatureGroupExtension.h b/src/App/GeoFeatureGroupExtension.h index 1718c7149a..a5b2b591ce 100644 --- a/src/App/GeoFeatureGroupExtension.h +++ b/src/App/GeoFeatureGroupExtension.h @@ -38,7 +38,7 @@ namespace App * * This class is the FreeCAD way of representing local coordinate systems. It groups its childs beneath * it and transforms them all with the GeoFeatureGroup placement. A few important properties: - * - Every child that belongs to the CS must be in the Group proeprty. Even if a sketch is part of a pad, + * - Every child that belongs to the CS must be in the Group property. Even if a sketch is part of a pad, * it must be in the Group property of the same GeoFeatureGroup as pad. This also holds for normal * GroupExtensions. They can be added to a GeoFeatureGroup, but all objects that the group holds must * also be added to the GeoFeatureGroup @@ -97,13 +97,13 @@ public: virtual std::vector< DocumentObject* > addObjects(std::vector< DocumentObject* > obj) override; virtual std::vector< DocumentObject* > removeObjects(std::vector< DocumentObject* > obj) override; - /// Collects GeoFeatureGroup relevant objects that are linked from the given one. That meas all linked objects - /// including their linkes (recursively) except GeoFeatureGroups, where the recursion stops. Expressions - /// links are ignored. A exception is thrown when there are dependency loops. + /// Collects GeoFeatureGroup relevant objects that are linked from the given one. That means all linked objects + /// including their links (recursively) except GeoFeatureGroups, where the recursion stops. Expressions + /// links are ignored. An exception is thrown when there are dependency loops. static void getCSOutList(App::DocumentObject* obj, std::vector& vec); - /// Collects GeoFeatureGroup relevant objects that link to the given one. That meas all objects + /// Collects GeoFeatureGroup relevant objects that link to the given one. That means all objects /// including their parents (recursively) except GeoFeatureGroups, where the recursion stops. Expression - /// links are ignored. A exception is thrown when there are dependency loops. + /// links are ignored. An exception is thrown when there are dependency loops. static void getCSInList(App::DocumentObject* obj, std::vector& vec); /// Collects all links that are relevant for the coordinate system, meaning all recursive links to /// obj and from obj excluding expressions and stopping the recursion at other geofeaturegroups. diff --git a/src/App/GroupExtension.cpp b/src/App/GroupExtension.cpp index 09b21ec838..de219972a7 100644 --- a/src/App/GroupExtension.cpp +++ b/src/App/GroupExtension.cpp @@ -88,7 +88,7 @@ std::vector< DocumentObject* > GroupExtension::addObjects(std::vector< DocumentO auto geogrp = GeoFeatureGroupExtension::getGroupOfObject(getExtendedObject()); auto objgrp = GeoFeatureGroupExtension::getGroupOfObject(obj); if( geogrp != objgrp ) { - //what to doo depends on if we are in geofeature group or not + //what to do depends on if we are in geofeature group or not if(geogrp) geogrp->getExtensionByType()->addObject(obj); else @@ -133,7 +133,6 @@ std::vector< DocumentObject* > GroupExtension::removeObjects(std::vector< Docume return removed; } - void GroupExtension::removeObjectsFromDocument() { const std::vector & grp = Group.getValues(); @@ -233,7 +232,7 @@ int GroupExtension::countObjectsOfType(const Base::Type& typeId) const DocumentObject* GroupExtension::getGroupOfObject(const DocumentObject* obj) { //note that we return here only Groups, but nothing derived from it, e.g. no GeoFeatureGroups. - //That is important as there are clear differences between groups/geofeature groups (e.g. a object + //That is important as there are clear differences between groups/geofeature groups (e.g. an object //can be in only one group, and only one geofeaturegroup, however, it can be in both at the same time) auto list = obj->getInList(); for (auto obj : list) { diff --git a/src/App/GroupExtension.h b/src/App/GroupExtension.h index 9332512d8d..53230e6f12 100644 --- a/src/App/GroupExtension.h +++ b/src/App/GroupExtension.h @@ -96,7 +96,7 @@ public: /** Returns the object group of the document which the given object \a obj is part of. * In case this object is not part of a group 0 is returned. * @note This only returns objects that are normal groups, not any special derived type - * like geofeaturegroups or origingroups. To retrieve those please youse their appropriate functions + * like GeoFeatureGroups or OriginGroups. To retrieve those please use their appropriate functions */ static DocumentObject* getGroupOfObject(const DocumentObject* obj); //@} diff --git a/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp b/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp index 323ac54264..2bd94aa84b 100644 --- a/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp +++ b/src/Gui/ViewProviderGeoFeatureGroupExtension.cpp @@ -72,7 +72,7 @@ std::vector ViewProviderGeoFeatureGroupExtension::extensio //like pad/sketch auto* ext = getExtendedViewProvider()->getObject()->getExtensionByType(); if(ext) { - //filter out all objects with more than one inlink, as they are most likely hold by annother + //filter out all objects with more than one inlink, as they are most likely hold by another //object in the tree std::vector claim; auto objs = ext->Group.getValues(); diff --git a/src/Gui/ViewProviderGroupExtension.cpp b/src/Gui/ViewProviderGroupExtension.cpp index 63ff4387dc..055720c4ca 100644 --- a/src/Gui/ViewProviderGroupExtension.cpp +++ b/src/Gui/ViewProviderGroupExtension.cpp @@ -96,7 +96,6 @@ void ViewProviderGroupExtension::extensionDropObject(App::DocumentObject* obj) { App::DocumentObject* grp = static_cast(getExtendedViewProvider()->getObject()); App::Document* doc = grp->getDocument(); - Gui::Document* gui = Gui::Application::Instance->getDocument(doc); // build Python command for execution QString cmd; diff --git a/src/Gui/ViewProviderOrigin.h b/src/Gui/ViewProviderOrigin.h index bd0c4f90a5..1e474e5c1f 100644 --- a/src/Gui/ViewProviderOrigin.h +++ b/src/Gui/ViewProviderOrigin.h @@ -70,7 +70,9 @@ public: void resetTemporaryVisibility (); ///@} - virtual bool canDragObjects() const {return false;}; + virtual bool canDragObjects() const { + return false; + } /// Returns default size. Use this if it is not possible to determine appropriate size by other means static double defaultSize() {return 10.;} diff --git a/src/Mod/PartDesign/Gui/CommandBody.cpp b/src/Mod/PartDesign/Gui/CommandBody.cpp index cc890c44c1..d2bdc9f117 100644 --- a/src/Mod/PartDesign/Gui/CommandBody.cpp +++ b/src/Mod/PartDesign/Gui/CommandBody.cpp @@ -614,7 +614,7 @@ CmdPartDesignMoveFeature::CmdPartDesignMoveFeature() } void CmdPartDesignMoveFeature::activated(int iMsg) -{ +{ Q_UNUSED(iMsg); std::vector features = getSelection().getObjectsOfType(Part::Feature::getClassTypeId()); if (features.empty()) return; diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 9e0af75231..9c7aebd803 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -5823,5 +5823,4 @@ void ViewProviderSketch::showRestoreInformationLayer() { visibleInformationChanged = true ; draw(false,false); - -} \ No newline at end of file +}