From 65e66c9e626ae6be70019fc94dab49c5c7fde2e0 Mon Sep 17 00:00:00 2001 From: Vanuan Date: Sat, 18 Jul 2020 12:36:11 +0300 Subject: [PATCH] High DPI support: Convert sketcher cursors to SVG Remove xpm --- src/Gui/BitmapFactory.cpp | 22 +- src/Gui/BitmapFactory.h | 10 +- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 392 +------- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 857 +----------------- src/Mod/Sketcher/Gui/DrawSketchHandler.cpp | 226 +++-- src/Mod/Sketcher/Gui/DrawSketchHandler.h | 21 +- src/Mod/Sketcher/Gui/Resources/Sketcher.qrc | 21 + .../icons/Sketcher_ConstrainBlock.svg | 534 +---------- .../Resources/icons/Sketcher_Crosshair.svg | 161 ++++ .../icons/Sketcher_Pointer_CarbonCopy.svg | 68 ++ .../Sketcher_Pointer_Create_3PointArc.svg | 12 + .../Sketcher_Pointer_Create_3PointCircle.svg | 12 + .../icons/Sketcher_Pointer_Create_Arc.svg | 11 + .../Sketcher_Pointer_Create_ArcOfEllipse.svg | 11 + ...Sketcher_Pointer_Create_ArcOfHyperbola.svg | 11 + .../Sketcher_Pointer_Create_ArcOfParabola.svg | 11 + .../icons/Sketcher_Pointer_Create_BSpline.svg | 14 + .../icons/Sketcher_Pointer_Create_Box.svg | 11 + .../icons/Sketcher_Pointer_Create_Circle.svg | 11 + .../icons/Sketcher_Pointer_Create_Ellipse.svg | 10 + .../icons/Sketcher_Pointer_Create_Fillet.svg | 10 + .../icons/Sketcher_Pointer_Create_Line.svg | 11 + .../icons/Sketcher_Pointer_Create_Lineset.svg | 13 + .../icons/Sketcher_Pointer_Create_Point.svg | 9 + .../icons/Sketcher_Pointer_Extension.svg | 11 + .../icons/Sketcher_Pointer_External.svg | 58 ++ .../Sketcher_Pointer_Regular_Polygon.svg | 54 ++ .../Resources/icons/Sketcher_Pointer_Slot.svg | 10 + .../icons/Sketcher_Pointer_Trimming.svg | 11 + 29 files changed, 845 insertions(+), 1768 deletions(-) create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Crosshair.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_CarbonCopy.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_3PointArc.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_3PointCircle.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Arc.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfEllipse.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfHyperbola.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfParabola.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_BSpline.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Box.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Circle.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Ellipse.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Fillet.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Line.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Lineset.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Point.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Extension.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_External.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Regular_Polygon.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Slot.svg create mode 100644 src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Trimming.svg diff --git a/src/Gui/BitmapFactory.cpp b/src/Gui/BitmapFactory.cpp index 5f7f711555..ed3023e33c 100644 --- a/src/Gui/BitmapFactory.cpp +++ b/src/Gui/BitmapFactory.cpp @@ -23,6 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ +# include # include # include # include @@ -36,7 +37,6 @@ # include # include #endif - #if defined (FC_OS_WIN32) && QT_VERSION < 0x050000 #define QTWEBKIT #endif @@ -296,7 +296,8 @@ QPixmap BitmapFactoryInst::pixmap(const char* name) const return QPixmap(not_found); } -QPixmap BitmapFactoryInst::pixmapFromSvg(const char* name, const QSize& size) const +QPixmap BitmapFactoryInst::pixmapFromSvg(const char* name, const QSizeF& size, + const std::map& colorMapping) const { // If an absolute path is given QPixmap icon; @@ -325,15 +326,26 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const char* name, const QSize& size) co QFile file(iconPath); if (file.open(QFile::ReadOnly | QFile::Text)) { QByteArray content = file.readAll(); - icon = pixmapFromSvg(content, size); + icon = pixmapFromSvg(content, size, colorMapping); } } return icon; } -QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& contents, const QSize& size) const +QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& originalContents, const QSizeF& size, + const std::map& colorMapping) const { + QString stringContents = QString::fromUtf8(originalContents); + for ( const auto &colorToColor : colorMapping ) { + ulong fromColor = colorToColor.first; + ulong toColor = colorToColor.second; + QString fromColorString = QString::fromLatin1(":#%1;").arg(fromColor, 6, 16, QChar::fromLatin1('0')); + QString toColorString = QString::fromLatin1(":#%1;").arg(toColor, 6, 16, QChar::fromLatin1('0')); + stringContents = stringContents.replace(fromColorString, toColorString); + } + QByteArray contents = stringContents.toUtf8(); + #ifdef QTWEBKIT // There is a crash when using the Webkit engine in debug mode // for a couple of SVG files. Thus, use the qsvg plugin. @@ -419,7 +431,7 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& contents, const QSize return QPixmap::fromImage(image); #endif // QT_VERSION #else //QTWEBKIT - QImage image(size, QImage::Format_ARGB32_Premultiplied); + QImage image(size.toSize(), QImage::Format_ARGB32_Premultiplied); image.fill(0x00000000); QPainter p(&image); diff --git a/src/Gui/BitmapFactory.h b/src/Gui/BitmapFactory.h index 2b9ac7a074..aa089fd9c4 100644 --- a/src/Gui/BitmapFactory.h +++ b/src/Gui/BitmapFactory.h @@ -77,13 +77,19 @@ public: QPixmap pixmap(const char* name) const; /** Retrieves a pixmap by name and size created by an * scalable vector graphics (SVG). + * + * @param colorMapping - a dictionary of substitute colors. + * Can be used to customize icon color scheme, e.g. crosshair color */ - QPixmap pixmapFromSvg(const char* name, const QSize& size) const; + QPixmap pixmapFromSvg(const char* name, const QSizeF& size, + const std::map& colorMapping = std::map()) const; /** This method is provided for convenience and does the same * as the method above except that it creates the pixmap from * a byte array. + * @param colorMapping - see above. */ - QPixmap pixmapFromSvg(const QByteArray& contents, const QSize& size) const; + QPixmap pixmapFromSvg(const QByteArray& contents, const QSizeF& size, + const std::map& colorMapping = std::map()) const; /** Returns the names of all registered pixmaps. * To get the appropriate pixmaps call pixmap() for each name. */ diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 257e0e6b09..867b75d389 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -803,8 +803,6 @@ protected: */ std::vector > allowedSelSequences; - const char** constraintCursor = 0; - virtual void applyConstraint(std::vector &, int) {} virtual void activated(int /*iMsg*/); virtual bool isActive(void) @@ -813,49 +811,11 @@ protected: extern char cursor_crosshair_color[]; -/* XPM */ -static const char *cursor_genericconstraint[]={ -"32 32 2 1", -" c None", -cursor_crosshair_color, -" + ", -" + ", -" + ", -" + ", -" + ", -" ", -"+++++ +++++ ", -" ", -" + ", -" + ", -" + ", -" + ", -" + ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ",}; - class DrawSketchHandlerGenConstraint: public DrawSketchHandler { public: - DrawSketchHandlerGenConstraint(const char* cursor[], CmdSketcherConstraint *_cmd) - : constraintCursor(cursor), cmd(_cmd), seqIndex(0) {} + DrawSketchHandlerGenConstraint(CmdSketcherConstraint *_cmd) + : cmd(_cmd), seqIndex(0) {} virtual ~DrawSketchHandlerGenConstraint() { Gui::Selection().rmvSelectionGate(); @@ -872,17 +832,25 @@ public: Gui::Selection().rmvSelectionGate(); Gui::Selection().addSelectionGate(selFilterGate); - setCrosshairColor(); - // Constrain icon size in px - int iconSize = 16; - QPixmap cursorPixmap(cursor_genericconstraint), - icon = Gui::BitmapFactory().pixmap(cmd->sPixmap).scaledToWidth(iconSize); + qreal pixelRatio = devicePixelRatio(); + const unsigned long defaultCrosshairColor = 0xFFFFFF; + unsigned long color = getCrosshairColor(); + auto colorMapping = std::map(); + colorMapping[defaultCrosshairColor] = color; + + qreal fullIconWidth = 32 * pixelRatio; + qreal iconWidth = 16 * pixelRatio; + QPixmap cursorPixmap = Gui::BitmapFactory().pixmapFromSvg("Sketcher_Crosshair", QSizeF(fullIconWidth, fullIconWidth), colorMapping), + icon = Gui::BitmapFactory().pixmapFromSvg(cmd->sPixmap, QSizeF(iconWidth, iconWidth)); QPainter cursorPainter; cursorPainter.begin(&cursorPixmap); - cursorPainter.drawPixmap(16, 16, icon); + cursorPainter.drawPixmap(16 * pixelRatio, 16 * pixelRatio, icon); cursorPainter.end(); - setCursor(cursorPixmap, 7, 7); +#if QT_VERSION >= 0x050000 + cursorPixmap.setDevicePixelRatio(pixelRatio); +#endif + setCursor(cursorPixmap, 7 * pixelRatio, 7 * pixelRatio, false); } virtual void mouseMove(Base::Vector2d /*onSketchPos*/) {} @@ -983,7 +951,6 @@ public: } protected: - const char** constraintCursor; CmdSketcherConstraint* cmd; GenericConstraintSelection* selFilterGate = nullptr; @@ -1018,51 +985,12 @@ protected: void CmdSketcherConstraint::activated(int /*iMsg*/) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } // ============================================================================ -/* XPM */ -static const char *cursor_createhoriconstraint[]={ -"32 32 3 1", -"+ c white", -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+......#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............############.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class CmdSketcherConstrainHorizontal : public CmdSketcherConstraint { public: @@ -1090,7 +1018,6 @@ CmdSketcherConstrainHorizontal::CmdSketcherConstrainHorizontal() eType = ForEdit; allowedSelSequences = {{SelEdge}}; - constraintCursor = cursor_createhoriconstraint; } void CmdSketcherConstrainHorizontal::activated(int iMsg) @@ -1107,7 +1034,7 @@ void CmdSketcherConstrainHorizontal::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -1272,44 +1199,6 @@ void CmdSketcherConstrainHorizontal::applyConstraint(std::vector &sel // ================================================================================ -static const char *cursor_createvertconstraint[]={ -"32 32 3 1", -"+ c white", -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+......#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -".............#..........#.......", -"..............#........#........", -"...............#......#.........", -"................#....#..........", -".................#..#...........", -"..................##............", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class CmdSketcherConstrainVertical : public CmdSketcherConstraint { public: @@ -1337,7 +1226,6 @@ CmdSketcherConstrainVertical::CmdSketcherConstrainVertical() eType = ForEdit; allowedSelSequences = {{SelEdge}}; - constraintCursor = cursor_createvertconstraint; } void CmdSketcherConstrainVertical::activated(int iMsg) @@ -1354,7 +1242,7 @@ void CmdSketcherConstrainVertical::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -1516,45 +1404,6 @@ void CmdSketcherConstrainVertical::applyConstraint(std::vector &selSe // ====================================================================================== -/* XPM */ -static const char *cursor_createlock[]={ -"32 32 3 1", -"+ c white", -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+..........###............", -"................######..........", -"...............##....##.........", -"..............##......##........", -"..............##......##........", -".............############.......", -".............############.......", -".............############.......", -".............############.......", -".............############.......", -".............############.......", -".............############.......", -".............############.......", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class CmdSketcherConstrainLock : public CmdSketcherConstraint { public: @@ -1581,7 +1430,6 @@ CmdSketcherConstrainLock::CmdSketcherConstrainLock() eType = ForEdit; allowedSelSequences = {{SelVertex}}; - constraintCursor = cursor_createlock; } void CmdSketcherConstrainLock::activated(int iMsg) @@ -1598,7 +1446,7 @@ void CmdSketcherConstrainLock::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -1777,45 +1625,6 @@ void CmdSketcherConstrainLock::updateAction(int mode) // ====================================================================================== -/* XPM */ -static const char *cursor_createblock[]={ - "32 32 3 1", - "+ c white", - "# c red", - ". c None", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "................................", - "+++++...+++++...................", - "................................", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "......+..........###............", - "....................##..........", - ".....................##.........", - "......................##........", - "......................##........", - ".............############.......", - ".............###########........", - ".............##########.........", - ".............########...........", - ".............#######............", - ".............########...........", - ".............##########.........", - ".............###########........", - ".............############.......", - "......................##........", - "......................##........", - ".....................##.........", - "....................##..........", - ".................###............", - "................................"}; - class CmdSketcherConstrainBlock : public CmdSketcherConstraint { public: @@ -1841,7 +1650,6 @@ CmdSketcherConstrainBlock::CmdSketcherConstrainBlock() eType = ForEdit; allowedSelSequences = {{SelEdge}}; - constraintCursor = cursor_createblock; } void CmdSketcherConstrainBlock::activated(int iMsg) @@ -1858,7 +1666,7 @@ void CmdSketcherConstrainBlock::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -2147,7 +1955,6 @@ CmdSketcherConstrainCoincident::CmdSketcherConstrainCoincident() eType = ForEdit; allowedSelSequences = {{SelVertex, SelVertexOrRoot}, {SelRoot, SelVertex}}; - constraintCursor = cursor_createcoincident; } void CmdSketcherConstrainCoincident::activated(int iMsg) @@ -2164,7 +1971,7 @@ void CmdSketcherConstrainCoincident::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here @@ -2339,7 +2146,6 @@ CmdSketcherConstrainDistance::CmdSketcherConstrainDistance() {SelEdge}, {SelExternalEdge}, {SelVertex, SelEdgeOrAxis}, {SelRoot, SelEdge}, {SelVertex, SelExternalEdge}, {SelRoot, SelExternalEdge}}; - constraintCursor = cursor_genericconstraint; } void CmdSketcherConstrainDistance::activated(int iMsg) @@ -2355,7 +2161,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } @@ -2650,45 +2456,6 @@ void CmdSketcherConstrainDistance::updateAction(int mode) // ====================================================================================== -/* XPM */ -static const char * cursor_createpointonobj[] = { -"32 32 3 1", -" c None", -". c #FFFFFF", -"+ c #FF0000", -" . ", -" . ++++", -" . ++++++", -" . +++++++ ", -" . ++++++ ", -" ++++++ ", -"..... ..... +++++ ", -" +++++ ", -" . +++ ++++ ", -" . +++++++++ ", -" . ++++++++ ", -" . +++++++++ ", -" . +++++++++ ", -" +++++++++ ", -" +++++++ ", -" ++++++++ ", -" +++++++ ", -" +++ ", -" +++ ", -" +++ ", -" +++ ", -" +++ ", -" +++ ", -" +++ ", -" +++ ", -" ++ ", -" +++ ", -" ++ ", -" +++ ", -" +++ ", -" ++ ", -" ++ "}; - class CmdSketcherConstrainPointOnObject : public CmdSketcherConstraint { public: @@ -2720,7 +2487,6 @@ CmdSketcherConstrainPointOnObject::CmdSketcherConstrainPointOnObject() {SelVertex, SelExternalEdge}, {SelEdge, SelVertexOrRoot}, {SelEdgeOrAxis, SelVertex}, {SelExternalEdge, SelVertex}}; - constraintCursor = cursor_createpointonobj; } @@ -2737,7 +2503,7 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here @@ -2903,7 +2669,6 @@ CmdSketcherConstrainDistanceX::CmdSketcherConstrainDistanceX() allowedSelSequences = {{SelVertex, SelVertexOrRoot}, {SelRoot, SelVertex}, {SelEdge}, {SelExternalEdge}}; // Can't do single vertex because its a prefix for 2 vertices - constraintCursor = cursor_genericconstraint; } void CmdSketcherConstrainDistanceX::activated(int iMsg) @@ -2919,7 +2684,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { @@ -3150,7 +2915,6 @@ CmdSketcherConstrainDistanceY::CmdSketcherConstrainDistanceY() allowedSelSequences = {{SelVertex, SelVertexOrRoot}, {SelRoot, SelVertex}, {SelEdge}, {SelExternalEdge}}; // Can't do single vertex because its a prefix for 2 vertices - constraintCursor = cursor_genericconstraint; } void CmdSketcherConstrainDistanceY::activated(int iMsg) @@ -3166,7 +2930,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here @@ -3365,45 +3129,6 @@ void CmdSketcherConstrainDistanceY::updateAction(int mode) //================================================================================= -/* XPM */ -static const char *cursor_createparallel[]={ -"32 32 3 1", -" c None", -". c #FFFFFF", -"+ c #FF0000", -" . ", -" . ", -" . ", -" . ", -" . ", -" ", -"..... ..... ", -" ", -" . ", -" . ", -" . + + ", -" . ++ ++ ", -" . + + ", -" ++ ++ ", -" + + ", -" ++ ++ ", -" + + ", -" ++ ++ ", -" + + ", -" ++ ++ ", -" + + ", -" ++ ++ ", -" + + ", -" ++ ++ ", -" + + ", -" ++ ++ ", -" + + ", -" ++ ++ ", -" + + ", -" ", -" ", -" "}; - class CmdSketcherConstrainParallel : public CmdSketcherConstraint { public: @@ -3432,7 +3157,6 @@ CmdSketcherConstrainParallel::CmdSketcherConstrainParallel() // TODO: Also needed: ExternalEdges allowedSelSequences = {{SelEdge, SelEdgeOrAxis}, {SelEdgeOrAxis, SelEdge}, {SelEdge, SelExternalEdge}, {SelExternalEdge, SelEdge}}; - constraintCursor = cursor_createparallel; } void CmdSketcherConstrainParallel::activated(int iMsg) @@ -3448,7 +3172,7 @@ void CmdSketcherConstrainParallel::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here @@ -3555,45 +3279,6 @@ void CmdSketcherConstrainParallel::applyConstraint(std::vector &selSe // ====================================================================================== -/* XPM */ -static const char *cursor_createperpconstraint[] = { -"32 32 3 1", -" c None", -". c #FFFFFF", -"+ c #FF0000", -" . ", -" . ", -" . ", -" . ", -" . ", -" ", -"..... ..... ", -" ", -" . ", -" . ", -" . ", -" . ++ ", -" . ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++ ", -" ++++++++++++++++++++ ", -" ++++++++++++++++++++ ", -" ", -" "}; - class CmdSketcherConstrainPerpendicular : public CmdSketcherConstraint { public: @@ -3631,7 +3316,6 @@ CmdSketcherConstrainPerpendicular::CmdSketcherConstrainPerpendicular() {SelEdge, SelVertexOrRoot, SelExternalEdge}, {SelExternalEdge, SelVertexOrRoot, SelEdge}}; ; - constraintCursor = cursor_createperpconstraint; } void CmdSketcherConstrainPerpendicular::activated(int iMsg) @@ -3654,7 +3338,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here @@ -4237,7 +3921,6 @@ CmdSketcherConstrainTangent::CmdSketcherConstrainTangent() {SelEdge, SelVertexOrRoot, SelExternalEdge}, {SelExternalEdge, SelVertexOrRoot, SelEdge}, /* Two Curves and a Point */ {SelVertexOrRoot, SelVertex} /*Two Endpoints*/ /*No Place for One Endpoint and One Curve*/}; - constraintCursor = cursor_genericconstraint; } void CmdSketcherConstrainTangent::activated(int iMsg) @@ -4260,7 +3943,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { strError = QObject::tr("Select some geometry from the sketch.", "tangent constraint"); @@ -4871,7 +4554,6 @@ CmdSketcherConstrainRadius::CmdSketcherConstrainRadius() eType = ForEdit; allowedSelSequences = {{SelEdge}, {SelExternalEdge}}; - constraintCursor = cursor_genericconstraint; } void CmdSketcherConstrainRadius::activated(int iMsg) @@ -4887,7 +4569,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here @@ -5330,7 +5012,6 @@ CmdSketcherConstrainDiameter::CmdSketcherConstrainDiameter() eType = ForEdit; allowedSelSequences = {{SelEdge}, {SelExternalEdge}}; - constraintCursor = cursor_genericconstraint; } void CmdSketcherConstrainDiameter::activated(int iMsg) @@ -5346,7 +5027,7 @@ void CmdSketcherConstrainDiameter::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here @@ -5904,7 +5585,6 @@ CmdSketcherConstrainAngle::CmdSketcherConstrainAngle() {SelVertexOrRoot, SelEdge, SelExternalEdge}, {SelVertexOrRoot, SelExternalEdge, SelEdge}, {SelVertexOrRoot, SelExternalEdge, SelExternalEdge}}; - constraintCursor = cursor_genericconstraint; } void CmdSketcherConstrainAngle::activated(int iMsg) @@ -5921,7 +5601,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here @@ -6394,7 +6074,6 @@ CmdSketcherConstrainEqual::CmdSketcherConstrainEqual() allowedSelSequences = {{SelEdge, SelEdge}, {SelEdge, SelExternalEdge}, {SelExternalEdge, SelEdge}}; // Only option for equal constraint - constraintCursor = cursor_genericconstraint; } void CmdSketcherConstrainEqual::activated(int iMsg) @@ -6410,7 +6089,7 @@ void CmdSketcherConstrainEqual::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -6592,7 +6271,6 @@ CmdSketcherConstrainSymmetric::CmdSketcherConstrainSymmetric() {SelVertex, SelVertexOrRoot, SelVertex}, {SelVertex, SelVertex, SelVertexOrRoot}, {SelVertexOrRoot, SelVertex, SelVertex}}; - constraintCursor = cursor_genericconstraint; } void CmdSketcherConstrainSymmetric::activated(int iMsg) @@ -6608,7 +6286,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) if (constraintMode) { ActivateHandler(getActiveGuiDocument(), - new DrawSketchHandlerGenConstraint(constraintCursor, this)); + new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 02ed035a27..46247bb2c3 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -234,6 +234,12 @@ static const char cursor_crosshair_color_fmt[] = "+ c #%06lX"; char cursor_crosshair_color[12]; void DrawSketchHandler::setCrosshairColor() +{ + unsigned long color = getCrosshairColor(); + sprintf(cursor_crosshair_color, cursor_crosshair_color_fmt, color); +} + +unsigned long DrawSketchHandler::getCrosshairColor() { unsigned long color = 0xFFFFFFFF; // white ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath @@ -241,48 +247,9 @@ void DrawSketchHandler::setCrosshairColor() color = hGrp->GetUnsigned("CursorCrosshairColor", color); // from rgba to rgb color = (color >> 8) & 0xFFFFFF; - sprintf(cursor_crosshair_color, cursor_crosshair_color_fmt, color); + return color; } -/* XPM */ -static const char *cursor_createline[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+...............###.......", -"......+...............#.#.......", -"......+...............###.......", -"......+..............#..........", -"......+.............#...........", -"....................#...........", -"...................#............", -"..................#.............", -"..................#.............", -".................#..............", -"................#...............", -"................#...............", -"...............#................", -"..............#.................", -"..............#.................", -".............#..................", -"..........###...................", -"..........#.#...................", -"..........###...................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerLine: public DrawSketchHandler { public: @@ -297,8 +264,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createline),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_Line"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -451,45 +417,6 @@ bool CmdSketcherCreateLine::isActive(void) /* Create Box =======================================================*/ -/* XPM */ -static const char *cursor_createbox[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"................................", -"..........................###...", -"...........################.#...", -"...........#..............###...", -"...........#...............#....", -"...........#...............#....", -"...........#...............#....", -"...........#...............#....", -"...........#...............#....", -"...........#...............#....", -"..........###..............#....", -"..........#.################....", -"..........###...................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerBox: public DrawSketchHandler { public: @@ -504,8 +431,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createbox),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_Box"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -690,45 +616,6 @@ bool CmdSketcherCreateRectangle::isActive(void) // ====================================================================================== -/* XPM */ -static const char *cursor_createlineset[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+...............###.......", -"......+...............#.#.......", -"......+...............###.......", -"......+..............#..#.......", -"......+.............#....#......", -"....................#....#......", -"...................#......#.....", -"..................#.......#.....", -"..................#........#....", -".................#.........#....", -"................#..........###..", -"................#..........#.#..", -"......#........#...........###..", -".......#......#.................", -"........#.....#.................", -".........#...#..................", -"..........###...................", -"..........#.#...................", -"..........###...................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerLineSet: public DrawSketchHandler { public: @@ -858,8 +745,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createlineset),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_Lineset"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -1417,45 +1303,6 @@ bool CmdSketcherCreatePolyline::isActive(void) // ====================================================================================== -/* XPM */ -static const char *cursor_createarc[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+...........###...........", -"......+...........#.#...........", -"......+...........###...........", -"......+..............##.........", -"......+...............##........", -".......................#........", -"+++++...+++++...........#.......", -"........................##......", -"......+..................#......", -"......+..................#......", -"......+...................#.....", -"......+...................#.....", -"......+...................#.....", -"..........................#.....", -"..........................#.....", -"..........................#.....", -"..........................#.....", -".........................#......", -".........................#......", -"........................#.......", -"........................#.......", -"...###.................#........", -"...#.#................#.........", -"...###...............#..........", -"......##...........##...........", -".......###.......##.............", -"..........#######...............", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerArc : public DrawSketchHandler { public: @@ -1479,8 +1326,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createarc),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_Arc"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -1686,45 +1532,6 @@ bool CmdSketcherCreateArc::isActive(void) // ====================================================================================== -/* XPM */ -static const char *cursor_create3pointarc[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+...........###...........", -"......+...........#.#...........", -"......+...........###...........", -"......+..............##.........", -"......+...............##........", -".......................#........", -"+++++...+++++...........#.......", -"........................##......", -"......+..................#......", -"......+..................#......", -"......+...................#.....", -"......+...................#.....", -"......+...................#.....", -"..........................#.....", -"..........................#.....", -"..........................#.....", -"..........................#.....", -".........................#......", -".......................###......", -".......................#.#......", -".......................###......", -"...###.................#........", -"...#.#................#.........", -"...###...............#..........", -"......##...........##...........", -".......###.......##.............", -"..........#######...............", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandler3PointArc : public DrawSketchHandler { public: @@ -1747,8 +1554,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_create3pointarc),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_3PointArc"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -2095,45 +1901,6 @@ bool CmdSketcherCompCreateArc::isActive(void) // ====================================================================================== -/* XPM */ -static const char *cursor_createcircle[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+........#######..........", -"......+......##.......##........", -"......+.....#...........#.......", -"......+....#.............#......", -"......+...#...............#.....", -".........#.................#....", -"........#...................#...", -"........#...................#...", -".......#.....................#..", -".......#.....................#..", -".......#.........###.........#..", -".......#.........#.#.........#..", -".......#.........###.........#..", -".......#.....................#..", -".......#.....................#..", -"........#...................#...", -"........#...................#...", -".........#.................#....", -"..........#...............#.....", -"...........#.............#......", -"............#...........#.......", -".............##.......##........", -"...............#######..........", -"................................"}; - class DrawSketchHandlerCircle : public DrawSketchHandler { public: @@ -2148,8 +1915,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createcircle),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_Circle"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -2294,46 +2060,6 @@ bool CmdSketcherCreateCircle::isActive(void) } // ====================================================================================== -/** - * @brief Creates a 32x32 pixel XPM image for the mouse cursor when making an ellipse - */ -static const char *cursor_createellipse[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+..............#####......", -"..................###.....#.....", -"...............###.......##.....", -".............##..........##.....", -"...........##............##.....", -"..........##.....###....##......", -".........##.....#.#.....#.......", -"........##.....###....##........", -"........##...........##.........", -".......##..........###..........", -"......##........####............", -"......#.....####................", -"......######....................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................"}; /** * @brief This class handles user interaction to draw and save the ellipse @@ -2407,8 +2133,7 @@ public: */ virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createellipse),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_Ellipse"); if (constrMethod == 0) { method = CENTER_PERIAPSIS_B; mode = STATUS_SEEK_CENTROID; @@ -3159,45 +2884,6 @@ bool CmdSketcherCreateEllipseBy3Points::isActive(void) return isCreateGeoActive(getActiveGuiDocument()); } -/* XPM */ -static const char *cursor_createarcofellipse[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+................##.......", -"......+..............##.........", -"......+............##...........", -"......+...........##............", -"................##..............", -"...............##...............", -"..............##................", -".............###................", -"............##.........###......", -"...........##.........#.#.......", -"...........##.........###.......", -"..........##....................", -".........##.....................", -"........##......................", -"........##......................", -"........##......................", -"........#.....####..............", -"........######..................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerArcOfEllipse : public DrawSketchHandler { public: @@ -3219,8 +2905,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createarcofellipse),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_ArcOfEllipse"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -3526,45 +3211,6 @@ bool CmdSketcherCreateArcOfEllipse::isActive(void) return isCreateGeoActive(getActiveGuiDocument()); } -/* XPM */ -static const char *cursor_createarcofhyperbola[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+................##.......", -"......+..............##.........", -"......+............##...........", -"......+...........##............", -"................##..............", -"...............##...............", -"..............##................", -".............###................", -"..###.......##..................", -".#.#.......##...................", -"..###......##...................", -"..........##....................", -".........##.....................", -"........##......................", -"........##......................", -"........##......................", -"........#.....####..............", -"........######..................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerArcOfHyperbola : public DrawSketchHandler { public: @@ -3587,8 +3233,7 @@ public: virtual void activated(ViewProviderSketch * /*sketchgui*/) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createarcofhyperbola),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_ArcOfHyperbola"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -3908,45 +3553,6 @@ bool CmdSketcherCreateArcOfHyperbola::isActive(void) return isCreateGeoActive(getActiveGuiDocument()); } -/* XPM */ -static const char *cursor_createarcofparabola[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+................##.......", -"......+..............##.........", -"......+............##...........", -"......+...........##............", -"................##..............", -"...............##...............", -"..............##................", -".............###................", -"............##......###.........", -"...........##......#.#..........", -"...........##.....###...........", -"..........##....................", -".........##.....................", -"........##......................", -"........##......................", -"........##......................", -"........#.....####..............", -"........######..................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerArcOfParabola : public DrawSketchHandler { public: @@ -3971,8 +3577,7 @@ public: virtual void activated(ViewProviderSketch * /*sketchgui*/) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createarcofparabola),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_ArcOfParabola"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -4394,45 +3999,6 @@ bool CmdSketcherCompCreateConic::isActive(void) // ====================================================================================== -/* XPM */ -static const char *cursor_createbspline[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+...............###.......", -"......+...............#.#.......", -"......+...............###.......", -"......+..............#..#.......", -"......+.............#....#......", -"....................#.+..#......", -"..................+#+..+..#...+.", -"................++#.....+.#..+..", -"......+........+..#......++#+...", -".......+......+..#.........#....", -"........++..++..#..........###..", -"..........++....#..........#.#..", -"......#........#...........###..", -".......#......#.................", -"........#.....#.................", -".........#...#..................", -"..........###...................", -"..........#.#...................", -"..........###...................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerBSpline: public DrawSketchHandler { public: @@ -4458,8 +4024,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createbspline),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_BSpline"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -5000,45 +4565,6 @@ bool CmdSketcherCompCreateBSpline::isActive(void) // ====================================================================================== -/* XPM */ -static const char *cursor_create3pointcircle[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+........#######..........", -"......+......##.......##........", -"......+.....#...........#.......", -"......+....#.............#......", -"......+...#...............#.....", -".........#.................#....", -".......###.................###..", -".......#.#.................#.#..", -".......###.................###..", -".......#.....................#..", -".......#.........###.........#..", -".......#.........#.#.........#..", -".......#.........###.........#..", -".......#.....................#..", -".......#.....................#..", -"........#...................#...", -"........#...................#...", -".........#.................#....", -"..........#...............#.....", -"...........#.............#......", -"............#...........#.......", -".............##..###..##........", -"...............###.###..........", -".................###............"}; - class DrawSketchHandler3PointCircle : public DrawSketchHandler { public: @@ -5055,8 +4581,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_create3pointcircle),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_3PointCircle"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -5351,45 +4876,6 @@ bool CmdSketcherCompCreateCircle::isActive(void) // ====================================================================================== -/* XPM */ -static const char *cursor_createpoint[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"................................", -"................................", -".................++++...........", -"................++++++..........", -"...............++++++++.........", -"...............++++++++.........", -"...............++++++++.........", -"...............++++++++.........", -"................++++++..........", -".................++++...........", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerPoint: public DrawSketchHandler { public: @@ -5398,8 +4884,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createpoint),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_Point"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -5596,46 +5081,6 @@ namespace SketcherGui { }; } - -/* XPM */ -static const char *cursor_createfillet[]={ -"32 32 3 1", -cursor_crosshair_color, -"* c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+..*......................", -".........*......................", -".........*......................", -".........*......................", -".........*......................", -".........*......................", -".........*.........***..........", -".........*.........*.*..........", -".........*.........***..........", -".........*......................", -".........*......................", -"..........*.....................", -"..........*.....................", -"...........*....................", -"............*...................", -".............*..................", -"..............*.................", -"...............**...............", -".................**************.", -"................................"}; - class DrawSketchHandlerFillet: public DrawSketchHandler { public: @@ -5653,8 +5098,7 @@ public: { Gui::Selection().rmvSelectionGate(); Gui::Selection().addSelectionGate(new FilletSelection(sketchgui->getObject())); - setCrosshairColor(); - setCursor(QPixmap(cursor_createfillet),7,7); + setCrosshairCursor("Sketcher_Pointer_Create_Fillet"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -5900,46 +5344,6 @@ namespace SketcherGui { }; } - -/* XPM */ -static const char *cursor_trimming[]={ -"32 32 3 1", -cursor_crosshair_color, -"* c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+......................*..", -"......+....................**...", -"......+...................**....", -".*..............................", -"..*.....................*.......", -"...*..................**........", -".....*...............**.........", -"......*.........................", -".......*..........*.............", -".........*......**..............", -"..........*....**...............", -"...........****.................", -"............*.*.................", -"............***.................", -"..........*....*................", -".........*.......*..............", -".......*..........*.............", -"......*............*............", -"....*................*..........", -"...*..................*.........", -".*.....................*........", -".........................*......"}; - class DrawSketchHandlerTrimming: public DrawSketchHandler { public: @@ -5954,8 +5358,7 @@ public: Gui::Selection().clearSelection(); Gui::Selection().rmvSelectionGate(); Gui::Selection().addSelectionGate(new TrimmingSelection(sketchgui->getObject())); - setCrosshairColor(); - setCursor(QPixmap(cursor_trimming),7,7); + setCrosshairCursor("Sketcher_Pointer_Trimming"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -6068,45 +5471,6 @@ namespace SketcherGui { }; } -/* XPM */ -static const char *cursor_extension[]={ -"32 32 3 1", -cursor_crosshair_color, -"* c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+..........****...........", -"..................***...........", -".................*.**...........", -"................*...*...........", -"................................", -"..............*.................", -".............*..................", -"................................", -"...........*....................", -"..........*.....................", -"................................", -"........*.......................", -".......*........................", -"......*.........................", -"...***..........................", -"...***..........................", -"....**..........................", -"................................", -"................................", -"................................"}; - class DrawSketchHandlerExtend: public DrawSketchHandler { public: @@ -6135,8 +5499,7 @@ public: Gui::Selection().rmvSelectionGate(); filterGate = new ExtendSelection(sketchgui->getObject()); Gui::Selection().addSelectionGate(filterGate); - setCrosshairColor(); - setCursor(QPixmap(cursor_extension),7,7); + setCrosshairCursor("Sketcher_Pointer_Extension"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -6441,46 +5804,6 @@ namespace SketcherGui { }; } - -/* XPM */ -static const char *cursor_external[]={ -"32 32 3 1", -cursor_crosshair_color, -"* c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+....***************......", -".........**...............***...", -"........**................***...", -".......**................**.*...", -"......*.................*...*...", -"....**................**....*...", -"...**................**.....*...", -"..**................**......*...", -"..******************........*...", -"..*................*........*...", -"..*................*........*...", -"..*................*........*...", -"..*................*............", -"..*................*............", -"..*................*............", -"..*................*............", -"..*................*............", -"..*................*............", -"................................", -"................................"}; - class DrawSketchHandlerExternal: public DrawSketchHandler { public: @@ -6503,8 +5826,7 @@ public: Gui::Selection().clearSelection(); Gui::Selection().rmvSelectionGate(); Gui::Selection().addSelectionGate(new ExternalSelection(sketchgui->getObject())); - setCrosshairColor(); - setCursor(QPixmap(cursor_external),7,7); + setCrosshairCursor("Sketcher_Pointer_External"); } virtual void deactivated(ViewProviderSketch *sketchgui) @@ -6666,45 +5988,6 @@ namespace SketcherGui { } -/* XPM */ -static const char *cursor_carboncopy[]={ - "32 32 3 1", - cursor_crosshair_color, - "* c red", - ". c None", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "................................", - "+++++...+++++...................", - "................................", - "......+.........................", - "......+.........................", - "......+.........................", - "......+.........................", - "......+....+++++++++++++++......", - ".........++*..............+++...", - "........++.*..............++*...", - ".......++..*.............++.*...", - "......+....*............+...*...", - "....++.....*..........++....*...", - "...++......*.........++.....*...", - "..++.......*........++......*...", - "..++++++++++++++++++........*...", - "..*........*.......*........*...", - "..*........*.......*........*...", - "..*.......+++++++++*++++++++*...", - "..*.....++.........*.......++...", - "..*....++..........*......++....", - "..*...+............*.....+......", - "..*.++.............*...++.......", - "..*++..............*..++........", - "..*+...............*.++.........", - "..++++++++++++++++++............", - "................................"}; - class DrawSketchHandlerCarbonCopy: public DrawSketchHandler { public: @@ -6727,8 +6010,7 @@ static const char *cursor_carboncopy[]={ Gui::Selection().clearSelection(); Gui::Selection().rmvSelectionGate(); Gui::Selection().addSelectionGate(new CarbonCopySelection(sketchgui->getObject())); - setCrosshairColor(); - setCursor(QPixmap(cursor_carboncopy),7,7); + setCrosshairCursor("Sketcher_Pointer_CarbonCopy"); } virtual void deactivated(ViewProviderSketch *sketchgui) @@ -6836,47 +6118,9 @@ static const char *cursor_carboncopy[]={ } -/* Create Slot =======================================================*/ - -/* XPM */ -static const char *cursor_creatslot[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"................................", -"..........................###...", -"........###################.##..", -".......#..................###.#.", -"......#........................#", -".....#.........................#", -"....#.....###..................#", -"....#.....#.#..................#", -".....#....###.................#.", -"......#.......................#.", -".......#.....................#..", -"........#####################...", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - +/** + * Create Slot + */ class DrawSketchHandlerSlot: public DrawSketchHandler { public: @@ -6896,8 +6140,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_creatslot),7,7); + setCrosshairCursor("Sketcher_Pointer_Slot"); } virtual void mouseMove(Base::Vector2d onSketchPos) @@ -7118,45 +6361,6 @@ bool CmdSketcherCreateSlot::isActive(void) /* Create Regular Polygon ==============================================*/ -/* XPM */ -static const char *cursor_createregularpolygon[]={ -"32 32 3 1", -cursor_crosshair_color, -"# c red", -". c None", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+.........................", -"................................", -"+++++...+++++...................", -"................................", -"......+.........................", -"......+.........................", -"......+.........................", -"......+................###......", -"......+.......##########.##.....", -".............#.........###......", -"............#.............#.....", -"...........#...............#....", -"...........#...............#....", -"..........#.................#...", -".........#...................#..", -".........#...................#..", -"........#.........###.........#.", -".......#..........#.#..........#", -"........#.........###.........#.", -".........#...................#..", -".........#...................#..", -"..........#.................#...", -"...........#...............#....", -"...........#...............#....", -"............#.............#.....", -".............#...........#......", -"..............###########.......", -"................................"}; - class DrawSketchHandlerRegularPolygon: public DrawSketchHandler { public: @@ -7179,8 +6383,7 @@ public: virtual void activated(ViewProviderSketch *) { - setCrosshairColor(); - setCursor(QPixmap(cursor_createregularpolygon),7,7); + setCrosshairCursor("Sketcher_Pointer_Regular_Polygon"); } virtual void mouseMove(Base::Vector2d onSketchPos) diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index 1dbc17f8f8..bb538de686 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -91,20 +91,130 @@ int DrawSketchHandler::getHighestCurveIndex(void) return sketchgui->getSketchObject()->getHighestCurveIndex(); } -void DrawSketchHandler::setCursor(const QPixmap &p,int x,int y) +void DrawSketchHandler::setCrosshairCursor(const char* svgName) { + QString cursorName = QString::fromLatin1(svgName); + const unsigned long defaultCrosshairColor = 0xFFFFFF; + unsigned long color = getCrosshairColor(); + auto colorMapping = std::map(); + colorMapping[defaultCrosshairColor] = color; + setSvgCursor(cursorName, 7, 7, colorMapping); +} + +void DrawSketchHandler::setSvgCursor(const QString & cursorName, int x, int y, const std::map& colorMapping) +{ + qreal pRatio = devicePixelRatio(); + qreal defaultCursorSize = 32; + qreal hotX = x * pRatio; + qreal hotY = y * pRatio; + qreal cursorSize = defaultCursorSize * pRatio; + + QPixmap pointer = Gui::BitmapFactory().pixmapFromSvg(cursorName.toStdString().c_str(), QSizeF(cursorSize, cursorSize), colorMapping); +#if QT_VERSION >= 0x050000 + pointer.setDevicePixelRatio(pRatio); +#endif + + setCursor(pointer, hotX, hotY, false); +} + +void DrawSketchHandler::setCursor(const QPixmap &p,int x,int y, bool autoScale) { Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); oldCursor = viewer->getWidget()->cursor(); - QCursor cursor(p, x, y); + + QCursor cursor; + QPixmap p1(p); + // TODO remove autoScale after all cursors are SVG-based + if (autoScale) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + qreal pRatio = viewer->devicePixelRatio(); +#else + qreal pRatio = 1; +#endif + int newWidth = p.width()*pRatio; + int newHeight = p.height()*pRatio; + p1 = p1.scaled(newWidth, newHeight,Qt::KeepAspectRatio,Qt::SmoothTransformation); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + p1.setDevicePixelRatio(pRatio); +#endif + cursor = QCursor(p1, x * pRatio, y * pRatio); + } else { + // already scaled + cursor = QCursor(p1, x, y); + } + actCursor = cursor; + actCursorPixmap = p1; viewer->getWidget()->setCursor(cursor); } } +void DrawSketchHandler::addCursorTail( std::vector &pixmaps ) { + // Create a pixmap that will contain icon and each autoconstraint icon + Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); + if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + QPixmap baseIcon = QPixmap(actCursorPixmap); +#if QT_VERSION >= 0x050000 + baseIcon.setDevicePixelRatio(actCursorPixmap.devicePixelRatio()); + qreal pixelRatio = baseIcon.devicePixelRatio(); +#else + qreal pixelRatio = 1; +#endif + // cursor size in device independent pixels + qreal baseCursorWidth = baseIcon.width(); + qreal baseCursorHeight = baseIcon.height(); + + int tailWidth = 0; + for (auto const& p: pixmaps) { + tailWidth += p.width(); + } + + int newIconWidth = baseCursorWidth + tailWidth; + int newIconHeight = baseCursorHeight; + + QPixmap newIcon(newIconWidth, newIconHeight); + newIcon.fill(Qt::transparent); + + QPainter qp; + qp.begin(&newIcon); + + qp.drawPixmap(QPointF(0,0), baseIcon.scaled( + baseCursorWidth * pixelRatio, + baseCursorHeight * pixelRatio, + Qt::KeepAspectRatio, + Qt::SmoothTransformation + )); + + // Iterate through pixmaps and them to the cursor pixmap + std::vector::iterator pit=pixmaps.begin(); + int i = 0; + qreal currentIconX = baseCursorWidth; + qreal currentIconY; + + for (; pit != pixmaps.end(); ++pit, i++) { + QPixmap icon = *pit; + currentIconY = baseCursorHeight - icon.height(); + qp.drawPixmap(QPointF(currentIconX, currentIconY), icon); + currentIconX += icon.width(); + } + + qp.end(); // Finish painting + + // Create the new cursor with the icon. + QPoint p=actCursor.hotSpot(); + +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + newIcon.setDevicePixelRatio(pixelRatio); +#endif + + QCursor newCursor(newIcon, p.x(), p.y()); + applyCursor(newCursor); + } +} + void DrawSketchHandler::applyCursor(void) { applyCursor(actCursor); @@ -128,6 +238,64 @@ void DrawSketchHandler::unsetCursor(void) } } +qreal DrawSketchHandler::devicePixelRatio() { + qreal pixelRatio = 1; +# if QT_VERSION >= 0x050000 + Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); + if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); + pixelRatio = viewer->devicePixelRatio(); + } +# endif + return pixelRatio; +} + +std::vector DrawSketchHandler::suggestedConstraintsPixmaps( + std::vector &suggestedConstraints) { + std::vector pixmaps; + // Iterate through AutoConstraints types and get their pixmaps + std::vector::iterator it=suggestedConstraints.begin(); + int i = 0; + for (; it != suggestedConstraints.end(); ++it, i++) { + QString iconType; + switch (it->Type) + { + case Horizontal: + iconType = QString::fromLatin1("Constraint_Horizontal"); + break; + case Vertical: + iconType = QString::fromLatin1("Constraint_Vertical"); + break; + case Coincident: + iconType = QString::fromLatin1("Constraint_PointOnPoint"); + break; + case PointOnObject: + iconType = QString::fromLatin1("Constraint_PointOnObject"); + break; + case Tangent: + iconType = QString::fromLatin1("Constraint_Tangent"); + break; + default: + break; + } + if (!iconType.isEmpty()) { + qreal pixelRatio = 1; +# if QT_VERSION >= 0x050000 + Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); + if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); + pixelRatio = viewer->devicePixelRatio(); + } +# endif + int iconWidth = 16 * pixelRatio; + QPixmap icon = Gui::BitmapFactory() + .pixmapFromSvg(iconType.toStdString().c_str(), QSize(iconWidth, iconWidth)); + pixmaps.push_back(icon); + } + } + return pixmaps; +} + int DrawSketchHandler::seekAutoConstraint(std::vector &suggestedConstraints, const Base::Vector2d& Pos, const Base::Vector2d& Dir, AutoConstraint::TargetType type) @@ -502,58 +670,8 @@ void DrawSketchHandler::createAutoConstraints(const std::vector void DrawSketchHandler::renderSuggestConstraintsCursor(std::vector &suggestedConstraints) { - // Auto Constraint icon size in px - int iconSize = 16; - - // Create a pixmap that will contain icon and each autoconstraint icon - QPixmap baseIcon = actCursor.pixmap(); - QPixmap newIcon(baseIcon.width() + suggestedConstraints.size() * iconSize, - baseIcon.height()); - newIcon.fill(Qt::transparent); - - QPainter qp; - qp.begin(&newIcon); - - qp.drawPixmap(0,0, baseIcon); - - // Iterate through AutoConstraints type and add icons to the cursor pixmap - std::vector::iterator it=suggestedConstraints.begin(); - int i = 0; - for (; it != suggestedConstraints.end(); ++it, i++) { - QString iconType; - switch (it->Type) - { - case Horizontal: - iconType = QString::fromLatin1("Constraint_Horizontal"); - break; - case Vertical: - iconType = QString::fromLatin1("Constraint_Vertical"); - break; - case Coincident: - iconType = QString::fromLatin1("Constraint_PointOnPoint"); - break; - case PointOnObject: - iconType = QString::fromLatin1("Constraint_PointOnObject"); - break; - case Tangent: - iconType = QString::fromLatin1("Constraint_Tangent"); - break; - default: - break; - } - - if (!iconType.isEmpty()) { - QPixmap icon = Gui::BitmapFactory().pixmap(iconType.toLatin1()).scaledToWidth(iconSize); - qp.drawPixmap(QPoint(baseIcon.width() + i * iconSize, baseIcon.height() - iconSize), icon); - } - } - - qp.end(); // Finish painting - - // Create the new cursor with the icon. - QPoint p=actCursor.hotSpot(); - QCursor newCursor(newIcon, p.x(), p.y()); - applyCursor(newCursor); + std::vector pixmaps = suggestedConstraintsPixmaps(suggestedConstraints); + addCursorTail(pixmaps); } void DrawSketchHandler::setPositionText(const Base::Vector2d &Pos, const SbString &text) diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.h b/src/Mod/Sketcher/Gui/DrawSketchHandler.h index ac831c7d99..e009bf163b 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.h @@ -94,15 +94,34 @@ public: protected: // helpers - void setCursor( const QPixmap &p,int x,int y ); + /** + * Sets a cursor for 3D inventor view. + * pixmap as a cursor image in device independent pixels. + * + * \param autoScale - set this to false if pixmap already scaled for HiDPI + **/ + void setCursor(const QPixmap &pixmap, int x,int y, bool autoScale=true); + void setSvgCursor(const QString &svgName, int x, int y, + const std::map& colorMapping = std::map()); + void addCursorTail(std::vector &pixmaps); void unsetCursor(void); void applyCursor(void); void applyCursor(QCursor &newCursor); void setCrosshairColor(); + unsigned long getCrosshairColor(); + qreal devicePixelRatio(); + void setCrosshairCursor(const char* svgName); + + /** + * Returns contraints icons scaled to width. + **/ + std::vector suggestedConstraintsPixmaps( + std::vector &suggestedConstraints); ViewProviderSketch *sketchgui; QCursor oldCursor; QCursor actCursor; + QPixmap actCursorPixmap; }; diff --git a/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc b/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc index 6d3d65165f..d95d5a6138 100644 --- a/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc +++ b/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc @@ -60,6 +60,7 @@ icons/Sketcher_Conics_Ellipse_3points.svg icons/Sketcher_Conics_Ellipse_Center.svg icons/Sketcher_ConnectLines.svg + icons/Sketcher_Crosshair.svg icons/Sketcher_ConstrainBlock.svg icons/Sketcher_ConstrainCoincident.svg icons/Sketcher_ConstrainDistance.svg @@ -159,6 +160,26 @@ icons/Sketcher_Move.svg icons/Sketcher_NewSketch.svg icons/Sketcher_NewSketch.svg + icons/Sketcher_Pointer_Slot.svg + icons/Sketcher_Pointer_Create_Box.svg + icons/Sketcher_Pointer_Create_Line.svg + icons/Sketcher_Pointer_Create_Lineset.svg + icons/Sketcher_Pointer_Create_Arc.svg + icons/Sketcher_Pointer_Create_3PointArc.svg + icons/Sketcher_Pointer_Create_Circle.svg + icons/Sketcher_Pointer_Create_Ellipse.svg + icons/Sketcher_Pointer_Create_ArcOfEllipse.svg + icons/Sketcher_Pointer_Create_ArcOfHyperbola.svg + icons/Sketcher_Pointer_Create_ArcOfParabola.svg + icons/Sketcher_Pointer_Create_BSpline.svg + icons/Sketcher_Pointer_Create_3PointCircle.svg + icons/Sketcher_Pointer_Create_Point.svg + icons/Sketcher_Pointer_Create_Fillet.svg + icons/Sketcher_Pointer_Trimming.svg + icons/Sketcher_Pointer_Extension.svg + icons/Sketcher_Pointer_Regular_Polygon.svg + icons/Sketcher_Pointer_External.svg + icons/Sketcher_Pointer_CarbonCopy.svg icons/Sketcher_Parabolic_Arc.svg icons/Sketcher_Parabolic_Arc_Constr.svg icons/Sketcher_ProfilesHexagon1.svg diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_ConstrainBlock.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_ConstrainBlock.svg index 6a7776461c..89da17357d 100644 --- a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_ConstrainBlock.svg +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_ConstrainBlock.svg @@ -1,525 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - [wmayer] - - - Sketcher_ConstrainLock - 2011-10-10 - http://www.freecadweb.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_ConstrainLock.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Crosshair.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Crosshair.svg new file mode 100644 index 0000000000..b5e002693d --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Crosshair.svg @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + [bitacovir] + + + Sketcher_Crosshair + + + + + FreeCAD + + + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_CarbonCopy.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_CarbonCopy.svg new file mode 100644 index 0000000000..585f721853 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_CarbonCopy.svg @@ -0,0 +1,68 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_3PointArc.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_3PointArc.svg new file mode 100644 index 0000000000..56ac9a387c --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_3PointArc.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_3PointCircle.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_3PointCircle.svg new file mode 100644 index 0000000000..7d35dbcaab --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_3PointCircle.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Arc.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Arc.svg new file mode 100644 index 0000000000..6137a825e9 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Arc.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfEllipse.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfEllipse.svg new file mode 100644 index 0000000000..0654e485e4 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfEllipse.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfHyperbola.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfHyperbola.svg new file mode 100644 index 0000000000..0f9357af88 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfHyperbola.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfParabola.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfParabola.svg new file mode 100644 index 0000000000..0654e485e4 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_ArcOfParabola.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_BSpline.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_BSpline.svg new file mode 100644 index 0000000000..f4ba4d816a --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_BSpline.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Box.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Box.svg new file mode 100644 index 0000000000..bf4c41f373 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Box.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Circle.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Circle.svg new file mode 100644 index 0000000000..1808b49ad7 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Circle.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Ellipse.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Ellipse.svg new file mode 100644 index 0000000000..089b0b543c --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Ellipse.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Fillet.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Fillet.svg new file mode 100644 index 0000000000..02780696f1 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Fillet.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Line.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Line.svg new file mode 100644 index 0000000000..fc66e711df --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Line.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Lineset.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Lineset.svg new file mode 100644 index 0000000000..aaed995f25 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Lineset.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Point.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Point.svg new file mode 100644 index 0000000000..4bc67e2f23 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Create_Point.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Extension.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Extension.svg new file mode 100644 index 0000000000..4402c6a8bc --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Extension.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_External.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_External.svg new file mode 100644 index 0000000000..9072450b79 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_External.svg @@ -0,0 +1,58 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Regular_Polygon.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Regular_Polygon.svg new file mode 100644 index 0000000000..bec9066af8 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Regular_Polygon.svg @@ -0,0 +1,54 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Slot.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Slot.svg new file mode 100644 index 0000000000..d6b4d2aa80 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Slot.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Trimming.svg b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Trimming.svg new file mode 100644 index 0000000000..b59d723233 --- /dev/null +++ b/src/Mod/Sketcher/Gui/Resources/icons/Sketcher_Pointer_Trimming.svg @@ -0,0 +1,11 @@ + + + + + + + + + + +