From 4c7ff0a6beaabe03d5cf7bb66213b02ff33e1aad Mon Sep 17 00:00:00 2001 From: Paddle Date: Wed, 22 Nov 2023 16:47:51 +0100 Subject: [PATCH] Sketcher: remove unused cursor_createcoincident[] and DrawSketchHandlerCoincident. They are not used anymore. --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 146 -------------------- 1 file changed, 146 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index f9d11b6e14..2b64c58af0 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -3492,152 +3492,6 @@ void CmdSketcherConstrainBlock::applyConstraint(std::vector& selSeq, // ====================================================================================== -/* XPM */ -static const char* cursor_createcoincident[] = {"32 32 3 1", - "+ c white", - "# c red", - ". c None", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "................................", - "+++++...+++++...................", - "................................", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "................................", - "................................", - "................................", - ".................####...........", - "................######..........", - "...............########.........", - "...............########.........", - "...............########.........", - "...............########.........", - "................######..........", - ".................####...........", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................"}; - -class DrawSketchHandlerCoincident: public DrawSketchHandler -{ -public: - DrawSketchHandlerCoincident() - { - GeoId1 = GeoId2 = GeoEnum::GeoUndef; - PosId1 = PosId2 = Sketcher::PointPos::none; - } - ~DrawSketchHandlerCoincident() override - { - Gui::Selection().rmvSelectionGate(); - } - - void mouseMove(Base::Vector2d onSketchPos) override - { - Q_UNUSED(onSketchPos); - } - - bool pressButton(Base::Vector2d onSketchPos) override - { - Q_UNUSED(onSketchPos); - return true; - } - - bool releaseButton(Base::Vector2d onSketchPos) override - { - int VtId = getPreselectPoint(); - int CrsId = getPreselectCross(); - std::stringstream ss; - int GeoId_temp; - Sketcher::PointPos PosId_temp; - - if (VtId != -1) { - sketchgui->getSketchObject()->getGeoVertexIndex(VtId, GeoId_temp, PosId_temp); - ss << "Vertex" << VtId + 1; - } - else if (CrsId == 0) { - GeoId_temp = Sketcher::GeoEnum::RtPnt; - PosId_temp = Sketcher::PointPos::start; - ss << "RootPoint"; - } - else { - GeoId1 = GeoId2 = GeoEnum::GeoUndef; - PosId1 = PosId2 = Sketcher::PointPos::none; - Gui::Selection().clearSelection(); - - return true; - } - - if (GeoId1 == GeoEnum::GeoUndef) { - GeoId1 = GeoId_temp; - PosId1 = PosId_temp; - Gui::Selection().addSelection(sketchgui->getSketchObject()->getDocument()->getName(), - sketchgui->getSketchObject()->getNameInDocument(), - ss.str().c_str(), - onSketchPos.x, - onSketchPos.y, - 0.f); - } - else { - GeoId2 = GeoId_temp; - PosId2 = PosId_temp; - - // Apply the constraint - Sketcher::SketchObject* Obj = - static_cast(sketchgui->getObject()); - - // undo command open - Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add coincident constraint")); - - // check if this coincidence is already enforced (even indirectly) - bool constraintExists = Obj->arePointsCoincident(GeoId1, PosId1, GeoId2, PosId2); - if (!constraintExists && (GeoId1 != GeoId2)) { - Gui::cmdAppObjectArgs( - sketchgui->getObject(), - "addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d))", - GeoId1, - static_cast(PosId1), - GeoId2, - static_cast(PosId2)); - Gui::Command::commitCommand(); - } - else { - Gui::Command::abortCommand(); - } - } - - return true; - } - -private: - void activated() override - { - Gui::Selection().rmvSelectionGate(); - GenericConstraintSelection* selFilterGate = - new GenericConstraintSelection(sketchgui->getObject()); - selFilterGate->setAllowedSelTypes(SelVertex | SelRoot); - Gui::Selection().addSelectionGate(selFilterGate); - int hotX = 8; - int hotY = 8; - setCursor(QPixmap(cursor_createcoincident), hotX, hotY); - } - -protected: - int GeoId1, GeoId2; - Sketcher::PointPos PosId1, PosId2; -}; - class CmdSketcherConstrainCoincident: public CmdSketcherConstraint { public: