diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index a2923f4e6..850f2f284 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -885,7 +885,9 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe case STATUS_SKETCH_DragPoint: case STATUS_SKETCH_DragCurve: case STATUS_SKETCH_DragConstraint: - break; + case STATUS_SKETCH_StartRubberBand: + case STATUS_SKETCH_UseRubberBand: + break; } } } @@ -946,6 +948,8 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor (cursorPos - prvCursorPos).getValue(dx, dy); if(std::abs(dx) < dragIgnoredDistance && std::abs(dy) < dragIgnoredDistance) return false; + default: + break; } // Calculate 3d point to the mouse position @@ -971,9 +975,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor Mode != STATUS_SKETCH_UseRubberBand) { SoPickedPoint *pp = this->getPointOnRay(cursorPos, viewer); - preselectChanged = detectPreselection(pp, viewer, cursorPos); - delete pp; } @@ -1291,11 +1293,13 @@ Base::Vector3d ViewProviderSketch::seekConstraintPosition(const Base::Vector3d & // checking if a constraint is the same as the one selected if (tailFather1 == constraint || tailFather2 == constraint) isConstraintAtPosition = false; - } else + } + else { isConstraintAtPosition = false; + } multiplier *= -1; // search in both sides - if (multiplier >= 0) + if (multiplier >= 0) multiplier++; // Increment the multiplier } if (multiplier == 10) @@ -1338,43 +1342,43 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg) // is it this object?? if (strcmp(msg.pDocName,getSketchObject()->getDocument()->getName())==0 && strcmp(msg.pObjectName,getSketchObject()->getNameInDocument())== 0) { - if (msg.pSubName) { - std::string shapetype(msg.pSubName); - if (shapetype.size() > 4 && shapetype.substr(0,4) == "Edge") { - int GeoId = std::atoi(&shapetype[4]) - 1; - edit->SelCurvSet.insert(GeoId); - this->updateColor(); - } - else if (shapetype.size() > 12 && shapetype.substr(0,12) == "ExternalEdge") { - int GeoId = std::atoi(&shapetype[12]) - 1; - GeoId = -GeoId - 3; - edit->SelCurvSet.insert(GeoId); - this->updateColor(); - } - else if (shapetype.size() > 6 && shapetype.substr(0,6) == "Vertex") { - int VtId = std::atoi(&shapetype[6]) - 1; - addSelectPoint(VtId); - this->updateColor(); - } - else if (shapetype == "RootPoint") { - addSelectPoint(-1); - this->updateColor(); - } - else if (shapetype == "H_Axis") { - edit->SelCurvSet.insert(-1); - this->updateColor(); - } - else if (shapetype == "V_Axis") { - edit->SelCurvSet.insert(-2); - this->updateColor(); - } - else if (shapetype.size() > 10 && shapetype.substr(0,10) == "Constraint") { - int ConstrId = std::atoi(&shapetype[10]) - 1; - edit->SelConstraintSet.insert(ConstrId); - this->drawConstraintIcons(); - this->updateColor(); - } + if (msg.pSubName) { + std::string shapetype(msg.pSubName); + if (shapetype.size() > 4 && shapetype.substr(0,4) == "Edge") { + int GeoId = std::atoi(&shapetype[4]) - 1; + edit->SelCurvSet.insert(GeoId); + this->updateColor(); } + else if (shapetype.size() > 12 && shapetype.substr(0,12) == "ExternalEdge") { + int GeoId = std::atoi(&shapetype[12]) - 1; + GeoId = -GeoId - 3; + edit->SelCurvSet.insert(GeoId); + this->updateColor(); + } + else if (shapetype.size() > 6 && shapetype.substr(0,6) == "Vertex") { + int VtId = std::atoi(&shapetype[6]) - 1; + addSelectPoint(VtId); + this->updateColor(); + } + else if (shapetype == "RootPoint") { + addSelectPoint(-1); + this->updateColor(); + } + else if (shapetype == "H_Axis") { + edit->SelCurvSet.insert(-1); + this->updateColor(); + } + else if (shapetype == "V_Axis") { + edit->SelCurvSet.insert(-2); + this->updateColor(); + } + else if (shapetype.size() > 10 && shapetype.substr(0,10) == "Constraint") { + int ConstrId = std::atoi(&shapetype[10]) - 1; + edit->SelConstraintSet.insert(ConstrId); + this->drawConstraintIcons(); + this->updateColor(); + } + } } } else if (msg.Type == Gui::SelectionChanges::RmvSelection) { @@ -1440,45 +1444,44 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg) //} } else if (msg.Type == Gui::SelectionChanges::SetPreselect) { - if (strcmp(msg.pDocName,getSketchObject()->getDocument()->getName())==0 + if (strcmp(msg.pDocName,getSketchObject()->getDocument()->getName())==0 && strcmp(msg.pObjectName,getSketchObject()->getNameInDocument())== 0) { - if (msg.pSubName) { - std::string shapetype(msg.pSubName); - if (shapetype.size() > 4 && shapetype.substr(0,4) == "Edge") { - int GeoId = std::atoi(&shapetype[4]) - 1; - resetPreselectPoint(); - edit->PreselectCurve = GeoId; - edit->PreselectCross = -1; - edit->PreselectConstraintSet.clear(); - if (edit->sketchHandler) - edit->sketchHandler->applyCursor(); - this->updateColor(); - - } - else if (shapetype.size() > 6 && shapetype.substr(0,6) == "Vertex"){ - int PtIndex = std::atoi(&shapetype[6]) - 1; - setPreselectPoint(PtIndex); - edit->PreselectCurve = -1; - edit->PreselectCross = -1; - edit->PreselectConstraintSet.clear(); - if (edit->sketchHandler) - edit->sketchHandler->applyCursor(); - this->updateColor(); - } - } - } - } - else if (msg.Type == Gui::SelectionChanges::RmvPreselect) { - resetPreselectPoint(); - edit->PreselectCurve = -1; - edit->PreselectCross = -1; - edit->PreselectConstraintSet.clear(); - if (edit->sketchHandler) - edit->sketchHandler->applyCursor(); - this->updateColor(); + if (msg.pSubName) { + std::string shapetype(msg.pSubName); + if (shapetype.size() > 4 && shapetype.substr(0,4) == "Edge") { + int GeoId = std::atoi(&shapetype[4]) - 1; + resetPreselectPoint(); + edit->PreselectCurve = GeoId; + edit->PreselectCross = -1; + edit->PreselectConstraintSet.clear(); - } + if (edit->sketchHandler) + edit->sketchHandler->applyCursor(); + this->updateColor(); + } + else if (shapetype.size() > 6 && shapetype.substr(0,6) == "Vertex") { + int PtIndex = std::atoi(&shapetype[6]) - 1; + setPreselectPoint(PtIndex); + edit->PreselectCurve = -1; + edit->PreselectCross = -1; + edit->PreselectConstraintSet.clear(); + if (edit->sketchHandler) + edit->sketchHandler->applyCursor(); + this->updateColor(); + } + } + } + } + else if (msg.Type == Gui::SelectionChanges::RmvPreselect) { + resetPreselectPoint(); + edit->PreselectCurve = -1; + edit->PreselectCross = -1; + edit->PreselectConstraintSet.clear(); + if (edit->sketchHandler) + edit->sketchHandler->applyCursor(); + this->updateColor(); + } } } @@ -3706,6 +3709,7 @@ Restart: break; case Coincident: // nothing to do for coincident case None: + case InternalAlignment: break; } } @@ -4485,14 +4489,6 @@ int ViewProviderSketch::getPreselectCross(void) const return -1; } -/*This never gets used? - int ViewProviderSketch::getPreselectConstraint(void) const -{ - if (edit) - return edit->PreselectConstraint; - return -1; -}*/ - Sketcher::SketchObject *ViewProviderSketch::getSketchObject(void) const { return dynamic_cast(pcObject);