diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user
new file mode 100644
index 0000000000..6df35fe60d
--- /dev/null
+++ b/CMakeLists.txt.user
@@ -0,0 +1,827 @@
+
+
+
+
+
+ EnvironmentId
+ {2bb8d980-59c2-4103-9ad9-f84df3b67da6}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 1
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ Desktop
+ {6576b0bd-ff13-47bd-97c2-c8159848c669}
+ 0
+ 0
+ 0
+
+
+ /home/huxster/Target/freecad-qtcdb-build
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Default
+ Default
+ CMakeProjectManager.CMakeBuildConfiguration
+
+
+
+ CMAKE_BUILD_TYPE:STRING=Debug
+
+ /home/huxster/Source/build-FreeCAD-src-Desktop-Debug
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Debug
+ CMakeProjectManager.CMakeBuildConfiguration
+
+
+
+ CMAKE_BUILD_TYPE:STRING=Release
+
+ /home/huxster/Source/build-FreeCAD-src-Desktop-Release
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Release
+ CMakeProjectManager.CMakeBuildConfiguration
+
+
+
+ CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
+
+ /home/huxster/Source/build-FreeCAD-src-Desktop-Release with Debug Information
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release with Debug Information
+ Release with Debug Information
+ CMakeProjectManager.CMakeBuildConfiguration
+
+
+
+ CMAKE_BUILD_TYPE:STRING=MinSizeRel
+
+ /home/huxster/Source/build-FreeCAD-src-Desktop-Minimum Size Release
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Minimum Size Release
+ Minimum Size Release
+ CMakeProjectManager.CMakeBuildConfiguration
+
+ 5
+
+
+ 0
+ Deploy
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy locally
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ FreeCADMainCmd
+
+
+ /home/huxster/Target/freecad-qtcdb-build/bin
+ 2
+
+ FreeCADMainCmd
+
+ CMakeProjectManager.CMakeRunConfiguration.FreeCADMainCmd
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ FreeCADMain
+
+
+ /home/huxster/Target/freecad-qtcdb-build/bin
+ -1
+
+ FreeCADMain
+
+ CMakeProjectManager.CMakeRunConfiguration.FreeCADMain
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+ 2
+
+
+
+ ProjectExplorer.Project.Target.1
+
+ FCPy3
+ FCPy3
+ {e6789b53-bada-4b34-95c2-99709681bbbb}
+ 1
+ 0
+ 1
+
+
+ /home/huxster/Target/freecad-qtc-build
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Default
+ Default
+ CMakeProjectManager.CMakeBuildConfiguration
+
+
+
+ BUILD_ADDONMGR:INTERNAL=ON
+ BUILD_ARCH:INTERNAL=ON
+ BUILD_ASSEMBLY:INTERNAL=OFF
+ BUILD_COMPLETE:INTERNAL=OFF
+ BUILD_DRAFT:INTERNAL=ON
+ BUILD_DRAWING:INTERNAL=ON
+ BUILD_FEM:INTERNAL=OFF
+ BUILD_FLAT_MESH:INTERNAL=OFF
+ BUILD_IDF:INTERNAL=OFF
+ BUILD_IMAGE:INTERNAL=OFF
+ BUILD_IMPORT:INTERNAL=ON
+ BUILD_INSPECTION:INTERNAL=OFF
+ BUILD_JTREADER:INTERNAL=OFF
+ BUILD_MATERIAL:INTERNAL=ON
+ BUILD_MESH:INTERNAL=ON
+ BUILD_MESH_PART:INTERNAL=ON
+ BUILD_OPENSCAD:INTERNAL=OFF
+ BUILD_PART:INTERNAL=ON
+ BUILD_PART_DESIGN:INTERNAL=ON
+ BUILD_PATH:INTERNAL=OFF
+ BUILD_PLOT:INTERNAL=OFF
+ BUILD_POINTS:INTERNAL=OFF
+ BUILD_QT5:INTERNAL=ON
+ BUILD_RAYTRACING:INTERNAL=OFF
+ BUILD_REVERSEENGINEERING:INTERNAL=OFF
+ BUILD_ROBOT:INTERNAL=OFF
+ BUILD_SANDBOX:INTERNAL=OFF
+ BUILD_SHIP:INTERNAL=OFF
+ BUILD_SHOW:INTERNAL=ON
+ BUILD_SKETCHER:INTERNAL=ON
+ BUILD_SPREADSHEET:INTERNAL=ON
+ BUILD_START:INTERNAL=OFF
+ BUILD_SURFACE:INTERNAL=OFF
+ BUILD_TECHDRAW:INTERNAL=ON
+ BUILD_TEMPLATE:INTERNAL=OFF
+ BUILD_TEST:INTERNAL=ON
+ BUILD_TUX:INTERNAL=ON
+ BUILD_VR:INTERNAL=OFF
+ BUILD_WEB:INTERNAL=OFF
+ CMAKE_BUILD_TYPE:STRING=Debug
+ FREECAD_USE_OCC_VARIANT:INTERNAL="Official Version"
+ OpenCASCADE_DIR:PATH=/usr/local/lib/cmake/opencascade72obs
+ PYTHON_EXECUTABLE:INTERNAL=/usr/bin/python3
+
+ /home/huxster/Target/freecad-qtcdb-build
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Debug
+ CMakeProjectManager.CMakeBuildConfiguration
+
+
+
+ CMAKE_BUILD_TYPE:STRING=Release
+
+ /home/huxster/Source/build-FreeCAD-src-FCPy3-Release
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Release
+ CMakeProjectManager.CMakeBuildConfiguration
+
+
+
+ CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
+
+ /home/huxster/Source/build-FreeCAD-src-FCPy3-Release with Debug Information
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release with Debug Information
+ Release with Debug Information
+ CMakeProjectManager.CMakeBuildConfiguration
+
+
+
+ CMAKE_BUILD_TYPE:STRING=MinSizeRel
+
+ /home/huxster/Source/build-FreeCAD-src-FCPy3-Minimum Size Release
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ all
+
+ true
+ CMake Build
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Minimum Size Release
+ Minimum Size Release
+ CMakeProjectManager.CMakeBuildConfiguration
+
+ 5
+
+
+ 0
+ Deploy
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy locally
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ FreeCADMainCmd
+
+
+ /home/huxster/Target/freecad-qtcdb-build/bin
+ 2
+
+ FreeCADMainCmd
+
+ CMakeProjectManager.CMakeRunConfiguration.FreeCADMainCmd
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ FreeCADMain
+ -l
+
+ /home/huxster/Target/freecad-qtcdb-build/bin
+ 2
+
+ FreeCADMain
+
+ CMakeProjectManager.CMakeRunConfiguration.FreeCADMain
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+ 2
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 2
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 18
+
+
+ Version
+ 18
+
+
diff --git a/src/Mod/TechDraw/App/DrawTile.cpp b/src/Mod/TechDraw/App/DrawTile.cpp
index 65bb6e45b8..9965b97f7f 100644
--- a/src/Mod/TechDraw/App/DrawTile.cpp
+++ b/src/Mod/TechDraw/App/DrawTile.cpp
@@ -47,12 +47,12 @@ DrawTile::DrawTile(void)
{
static const char *group = "Tile";
- Base::Vector3d defOrg(0.0, 0.0, 0.0);
+// Base::Vector3d defOrg(0.0, 0.0, 0.0);
ADD_PROPERTY_TYPE(TileParent,(0),group,(App::PropertyType)(App::Prop_None),
"Object to which this tile is attached");
ADD_PROPERTY_TYPE(TileRow, (0), group, App::Prop_None, "Row in parent");
ADD_PROPERTY_TYPE(TileColumn, (0), group, App::Prop_None, "Column in parent");
- ADD_PROPERTY_TYPE(TileOrigin, (defOrg), group, App::Prop_None, "Width limit before auto wrap");
+// ADD_PROPERTY_TYPE(TileOrigin, (defOrg), group, App::Prop_None, "Width limit before auto wrap");
}
DrawTile::~DrawTile()
@@ -81,7 +81,7 @@ App::DocumentObjectExecReturn *DrawTile::execute(void)
DrawView* DrawTile::getParent(void) const
{
- Base::Console().Message("DT::getParent() - %s\n", getNameInDocument());
+// Base::Console().Message("DT::getParent() - %s\n", getNameInDocument());
DrawView* result = nullptr;
App::DocumentObject* baseObj = TileParent.getValue();
if (baseObj != nullptr) {
diff --git a/src/Mod/TechDraw/App/DrawTile.h b/src/Mod/TechDraw/App/DrawTile.h
index 6b80bd6e75..1f3de65d43 100644
--- a/src/Mod/TechDraw/App/DrawTile.h
+++ b/src/Mod/TechDraw/App/DrawTile.h
@@ -42,7 +42,7 @@ public:
App::PropertyLink TileParent; //eg DrawWeldSymbol
App::PropertyInteger TileRow;
App::PropertyInteger TileColumn;
- App::PropertyVector TileOrigin; //sb call to TileParent - WeldingSymbol
+/* App::PropertyVector TileOrigin; //sb call to TileParent - WeldingSymbol*/
virtual short mustExecute() const;
virtual App::DocumentObjectExecReturn *execute(void);
diff --git a/src/Mod/TechDraw/App/DrawTileWeld.cpp b/src/Mod/TechDraw/App/DrawTileWeld.cpp
index 851d356743..0664e1ace7 100644
--- a/src/Mod/TechDraw/App/DrawTileWeld.cpp
+++ b/src/Mod/TechDraw/App/DrawTileWeld.cpp
@@ -74,7 +74,7 @@ short DrawTileWeld::mustExecute() const
App::DocumentObjectExecReturn *DrawTileWeld::execute(void)
{
-// Base::Console().Message("DT::execute()\n");
+// Base::Console().Message("DTW::execute()\n");
return DrawTile::execute();
}
diff --git a/src/Mod/TechDraw/App/DrawWeldSymbol.cpp b/src/Mod/TechDraw/App/DrawWeldSymbol.cpp
index 7dd0fbfaa8..c3ecb1e29b 100644
--- a/src/Mod/TechDraw/App/DrawWeldSymbol.cpp
+++ b/src/Mod/TechDraw/App/DrawWeldSymbol.cpp
@@ -36,6 +36,7 @@
#include // generated from DrawWeldSymbolPy.xml
+#include "DrawLeaderLine.h"
#include "DrawTile.h"
#include "DrawTileWeld.h"
#include "DrawWeldSymbol.h"
@@ -55,6 +56,7 @@ DrawWeldSymbol::DrawWeldSymbol(void)
ADD_PROPERTY_TYPE(Leader,(0),group,(App::PropertyType)(App::Prop_None), "Parent Leader");
ADD_PROPERTY_TYPE(AllAround, (false), group, App::Prop_None, "All Around Symbol on/off");
ADD_PROPERTY_TYPE(FieldWeld, (false), group, App::Prop_None, "Field Weld Symbol on/off");
+ ADD_PROPERTY_TYPE(AlternatingWeld, (false), group, App::Prop_None, "Alternating Weld true/false");
ADD_PROPERTY_TYPE(TailText, (""), group, App::Prop_None, "Text at tail of symbol");
Caption.setStatus(App::Property::Hidden,true);
@@ -87,7 +89,6 @@ App::DocumentObjectExecReturn *DrawWeldSymbol::execute(void)
return App::DocumentObject::StdReturn;
}
-
return DrawView::execute();
}
@@ -107,10 +108,25 @@ std::vector DrawWeldSymbol::getTiles(void) const
}
}
}
-// Base::Console().Message("DWS::getTiles - returns: %d tiles\n",result.size());
return result;
}
+bool DrawWeldSymbol::isTailRightSide()
+{
+ bool result = true;
+ App::DocumentObject* obj = Leader.getValue();
+ TechDraw::DrawLeaderLine* realLeader = dynamic_cast(obj);
+ if (realLeader != nullptr) {
+ Base::Vector3d tail = realLeader->getTailPoint();
+ Base::Vector3d kink = realLeader->getKinkPoint();
+ if (tail.x < kink.x) { //tail is to left
+ result = false;
+ }
+ }
+ return result;
+}
+
+
PyObject *DrawWeldSymbol::getPyObject(void)
{
if (PythonObject.is(Py::_None())) {
diff --git a/src/Mod/TechDraw/App/DrawWeldSymbol.h b/src/Mod/TechDraw/App/DrawWeldSymbol.h
index 0ab74871ea..59d89e7496 100644
--- a/src/Mod/TechDraw/App/DrawWeldSymbol.h
+++ b/src/Mod/TechDraw/App/DrawWeldSymbol.h
@@ -43,9 +43,9 @@ public:
virtual ~DrawWeldSymbol();
App::PropertyLink Leader;
-// App::PropertyLinkList Tiles;
App::PropertyBool AllAround;
App::PropertyBool FieldWeld;
+ App::PropertyBool AlternatingWeld;
App::PropertyString TailText;
virtual short mustExecute() const;
@@ -57,8 +57,8 @@ public:
virtual PyObject *getPyObject(void);
virtual QRectF getRect() const { return QRectF(0,0,1,1);}
+ bool isTailRightSide();
std::vector getTiles(void) const;
-// void addTile(App::DocumentObject* d);
protected:
virtual void onChanged(const App::Property* prop);
diff --git a/src/Mod/TechDraw/Gui/CMakeLists.txt b/src/Mod/TechDraw/Gui/CMakeLists.txt
index e31c45a3ec..bc6f126ef1 100644
--- a/src/Mod/TechDraw/Gui/CMakeLists.txt
+++ b/src/Mod/TechDraw/Gui/CMakeLists.txt
@@ -65,6 +65,7 @@ set(TechDrawGui_MOC_HDRS
mtextedit.h
TaskBalloon.h
QGIWeldSymbol.h
+ SymbolChooser.h
)
fc_wrap_cpp(TechDrawGui_MOC_SRCS ${TechDrawGui_MOC_HDRS})
@@ -94,6 +95,7 @@ set(TechDrawGui_UIC_SRCS
TaskLineDecor.ui
TaskRestoreLines.ui
TaskWeldingSymbol.ui
+ SymbolChooser.ui
)
if(BUILD_QT5)
@@ -178,6 +180,9 @@ SET(TechDrawGui_SRCS
DrawGuiUtil.h
Rez.cpp
Rez.h
+ SymbolChooser.ui
+ SymbolChooser.cpp
+ SymbolChooser.h
)
SET(TechDrawGuiView_SRCS
@@ -338,6 +343,7 @@ SET(TechDrawGuiTaskDlgs_SRCS
TaskRestoreLines.ui
TaskCL2Lines.ui
TaskWeldingSymbol.ui
+ SymbolChooser.ui
)
SOURCE_GROUP("TaskDialogs" FILES ${TechDrawGuiTaskDlgs_SRCS})
diff --git a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp
index f6c4d09909..cc13ebdd9b 100644
--- a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp
+++ b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp
@@ -1318,15 +1318,23 @@ void CmdTechDrawWeldSymbol::activated(int iMsg)
std::vector leaders = getSelection().
getObjectsOfType(TechDraw::DrawLeaderLine::getClassTypeId());
- if (leaders.size() != 1) {
+ std::vector welds = getSelection().
+ getObjectsOfType(TechDraw::DrawWeldSymbol::getClassTypeId());
+ TechDraw::DrawLeaderLine* leadFeat = nullptr;
+ TechDraw::DrawWeldSymbol* weldFeat = nullptr;
+ if ( (leaders.size() != 1) &&
+ (welds.size() != 1) ) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
- QObject::tr("Select exactly one Leader line."));
+ QObject::tr("Select exactly one Leader line or one Weld symbol."));
return;
}
- TechDraw::DrawLeaderLine* baseFeat = nullptr;
- baseFeat = static_cast (leaders.front());
-
- Gui::Control().showDialog(new TaskDlgWeldingSymbol(baseFeat));
+ if (!leaders.empty()) {
+ leadFeat = static_cast (leaders.front());
+ Gui::Control().showDialog(new TaskDlgWeldingSymbol(leadFeat));
+ } else if (!welds.empty()) {
+ weldFeat = static_cast (welds.front());
+ Gui::Control().showDialog(new TaskDlgWeldingSymbol(weldFeat));
+ }
}
bool CmdTechDrawWeldSymbol::isActive(void)
diff --git a/src/Mod/TechDraw/Gui/QGIArrow.cpp b/src/Mod/TechDraw/Gui/QGIArrow.cpp
index 3f8908a15b..fa0e4bcbc9 100644
--- a/src/Mod/TechDraw/Gui/QGIArrow.cpp
+++ b/src/Mod/TechDraw/Gui/QGIArrow.cpp
@@ -48,9 +48,11 @@ QGIArrow::QGIArrow() :
m_dirMode(false),
m_dir(Base::Vector3d(1.0,0.0,0.0))
{
- isFlipped = false;
+ setFlipped(false);
setFill(Qt::SolidPattern);
m_brush.setStyle(m_fill);
+ m_colDefFill = getNormalColor();
+ m_colNormalFill = m_colDefFill;
setCacheMode(QGraphicsItem::NoCache);
setAcceptHoverEvents(false);
@@ -58,11 +60,6 @@ QGIArrow::QGIArrow() :
setFlag(QGraphicsItem::ItemIsMovable, false);
}
-
-void QGIArrow::flip(bool state) {
- isFlipped = state;
-}
-
void QGIArrow::draw() {
QPainterPath path;
if (m_style == 0) {
@@ -122,7 +119,7 @@ QPainterPath QGIArrow::makeFilledTriangle(double length, double width, bool flip
path.lineTo(QPointF(Rez::guiX(length),Rez::guiX(-width)));
path.lineTo(QPointF(Rez::guiX(length),Rez::guiX(width)));
path.closeSubpath();
- m_fill = Qt::SolidPattern;
+ setFill(Qt::SolidPattern);
return path;
}
@@ -141,7 +138,7 @@ QPainterPath QGIArrow::makeFilledTriangle(Base::Vector3d dir, double length, dou
path.lineTo(QPointF(Rez::guiX(barb1.x),Rez::guiX(barb1.y)));
path.lineTo(QPointF(Rez::guiX(barb2.x),Rez::guiX(barb2.y)));
path.closeSubpath();
- m_fill = Qt::SolidPattern;
+ setFill(Qt::SolidPattern);
return path;
}
diff --git a/src/Mod/TechDraw/Gui/QGITile.cpp b/src/Mod/TechDraw/Gui/QGITile.cpp
index 629f8dcdd6..0e00d33729 100644
--- a/src/Mod/TechDraw/Gui/QGITile.cpp
+++ b/src/Mod/TechDraw/Gui/QGITile.cpp
@@ -23,9 +23,9 @@
#include "PreCompiled.h"
#ifndef _PreComp_
#include
-#include
#include
#include
+#include
#endif
#include
@@ -36,6 +36,7 @@
#include
#include
#include
+#include
#include
#include "Rez.h"
@@ -45,14 +46,11 @@
using namespace TechDrawGui;
-QGITile::QGITile(TechDraw::DrawTile* feat) :
+QGITile::QGITile(TechDraw::DrawTileWeld* feat) :
m_tileFeat(feat),
m_textL(QString()),
m_textR(QString()),
m_textC(QString()),
- m_textSize(0.0),
- m_row(0),
- m_col(0),
m_scale(1.0)
{
m_qgSvg = new QGCustomSvg();
@@ -67,15 +65,17 @@ QGITile::QGITile(TechDraw::DrawTile* feat) :
m_wide = getSymbolWidth();
m_high = getFontSize();
- m_textSize = getFontSize();
m_textL = QString();
m_textR = QString();
m_textC = QString();
m_fontName = getTextFont();
m_font = QFont(m_fontName);
-// setHandlesChildEvents(true); //qt4
+#if PY_MAJOR_VERSION < 3
+ setHandlesChildEvents(true); //qt4 deprecated in qt5
+#else
setFiltersChildEvents(true); //qt5
+#endif
setAcceptHoverEvents(true);
setFlag(QGraphicsItem::ItemIsSelectable, false);
setFlag(QGraphicsItem::ItemIsMovable, false);
@@ -106,31 +106,67 @@ void QGITile::draw(void)
double textWidthL = m_qgTextL->boundingRect().width();
double textWidthR = m_qgTextR->boundingRect().width();
double totalWidth = m_wide + textWidthL + textWidthR;
-
- double x = m_origin.x() + m_col * totalWidth; //bit of a hack. sb 0.5 of prev tile + 0.5 of this tile
- double y = m_origin.y() - (m_row * m_high) - (m_high * 0.5); //inverted y!!
- setPos(x,y);
+ int row = m_tileFeat->TileRow.getValue();
+ int col = m_tileFeat->TileColumn.getValue();
+ if (row == 0) { //arrowSide
+ double x = m_origin.x();
+ double y = m_origin.y() - (m_high * 0.5); //inverted y!!
+ setPos(x,y);
+ } else if (row == -1) { //otherSide
+ if (getAltWeld()) {
+ if (isTailRight()) {
+ double x = m_origin.x() + (0.5 * totalWidth); //move to right 1/2 tile width
+ double y = m_origin.y() + (m_high * 0.5); //inverted y!!
+ setPos(x,y);
+ } else {
+ double x = m_origin.x() - (0.5 * totalWidth); //move to left 1/2 tile width
+ double y = m_origin.y() + (m_high * 0.5); //inverted y!!
+ setPos(x,y);
+ }
+ } else {
+ double x = m_origin.x();
+ double y = m_origin.y() + (m_high * 0.5); //inverted y!!
+ setPos(x,y);
+ }
+ } else {
+ double x = m_origin.x() + col * totalWidth;
+ double y = m_origin.y() - (row * m_high) - (m_high * 0.5); //inverted y!!
+ setPos(x,y);
+ }
}
void QGITile::makeSymbol(void)
{
// Base::Console().Message("QGIT::makeSymbol()\n");
m_effect->setColor(m_colCurrent);
-
+
+ if (m_svgPath.isEmpty()) {
+ Base::Console().Warning("QGIT::makeSymbol - no symbol file set\n");
+ return;
+ }
+
m_qgSvg->setGraphicsEffect(m_effect);
- QFile svgFile(m_svgPath);
- if(svgFile.open(QIODevice::ReadOnly)) {
- QByteArray qba = svgFile.readAll();
- if (!m_qgSvg->load(&qba)) {
- Base::Console().Error("Error - Could not load SVG renderer with %s\n", qPrintable(m_svgPath));
- }
- svgFile.close();
- } else {
- Base::Console().Error("Error - Could not open file %s\n", qPrintable(m_svgPath));
- }
- m_qgSvg->setScale(scaleToFont());
- m_qgSvg->centerAt(0.0, 0.0); //(0,0) is based on symbol size
+ QFileInfo fi(m_svgPath);
+ if (fi.isReadable()) {
+ QFile svgFile(m_svgPath);
+ if(svgFile.open(QIODevice::ReadOnly)) {
+ QByteArray qba = svgFile.readAll();
+ if (!m_qgSvg->load(&qba)) {
+ Base::Console().Error("Error - Could not load SVG renderer with **%s**\n", qPrintable(m_svgPath));
+ return;
+ }
+ svgFile.close();
+ m_qgSvg->setScale(scaleToFont());
+ m_qgSvg->centerAt(0.0, 0.0); //(0,0) is based on symbol size
+ } else {
+ Base::Console().Error("Error - Could not open file **%s**\n", qPrintable(m_svgPath));
+ }
+ } else {
+ Base::Console().Error("QGIT::makeSymbol - file: **%s** is not readable\n",qPrintable(m_svgPath));
+ return;
+ }
+
}
void QGITile::makeText(void)
@@ -138,8 +174,11 @@ void QGITile::makeText(void)
// Base::Console().Message("QGIT::makeText()\n");
prepareGeometryChange();
m_font.setPixelSize(getFontSize());
- double verticalFudge = 0.10; //% of textHeight
+ double verticalFudge = 0.10;
+ int row = m_tileFeat->TileRow.getValue();
+
+ //(0, 0) is 1/2 up (above line symbol)!
m_qgTextL->setFont(m_font);
m_qgTextL->setPlainText(m_textL);
m_qgTextL->setColor(m_colCurrent);
@@ -148,52 +187,45 @@ void QGITile::makeText(void)
double hMargin = (m_wide / 2.0) + (charWidth / 2.0);
double textHeightL = m_qgTextL->boundingRect().height();
- double offsetAdjustL = 0.0;
- if (m_row < 0) {
- offsetAdjustL = -textHeightL * verticalFudge;
+ double vOffset = 0.0;
+ if (row < 0) { // below line
+ vOffset = textHeightL * verticalFudge;
} else {
- offsetAdjustL = textHeightL * verticalFudge;
+ vOffset = 0.0;
}
- double offset = (textHeightL * verticalFudge * m_row) + offsetAdjustL;
- m_qgTextL->justifyRightAt(-hMargin, -offset, true);
+ m_qgTextL->justifyRightAt(-hMargin, vOffset, true);
m_qgTextR->setFont(m_font);
m_qgTextR->setPlainText(m_textR);
m_qgTextR->setColor(m_colCurrent);
textWidth = m_qgTextR->boundingRect().width();
charWidth = textWidth / m_textR.size();
+ hMargin = (m_wide / 2.0) + (charWidth / 2.0);
double textHeightR = m_qgTextR->boundingRect().height();
- double offsetAdjustR = 0.0;
- if (m_row < 0) {
- offsetAdjustR = -textHeightR * verticalFudge;
+ if (row < 0) { // below line
+ vOffset = textHeightR * verticalFudge;
} else {
- offsetAdjustR = textHeightR * verticalFudge;
+ vOffset = 0.0;
}
- offset = (textHeightR * verticalFudge * m_row) + offsetAdjustR;
- m_qgTextR->justifyLeftAt(hMargin, -offset, true);
+ m_qgTextR->justifyLeftAt(hMargin, vOffset, true);
m_qgTextC->setFont(m_font);
m_qgTextC->setPlainText(m_textC);
m_qgTextC->setColor(m_colCurrent);
double textHeightC = m_qgTextC->boundingRect().height();
textHeightC = textHeightC;
- int rowAdjustC = m_row;
- if (m_row >= 0) {
- rowAdjustC++;
+ if (row < 0) { // below line
+ vOffset = m_high * (1 + verticalFudge);
+ } else {
+ vOffset = -0.5 * (m_high + textHeightC);
}
- double offsetAdjustC = textHeightC * verticalFudge;
- if (m_row < 0) {
- offsetAdjustC = - offsetAdjustC;
- }
- offset = (textHeightC * rowAdjustC) - offsetAdjustC;
- m_qgTextC->centerAt(0.0, -offset);
+ m_qgTextC->centerAt(0.0, vOffset);
}
-void QGITile::setTilePosition(QPointF org, int r, int c)
+void QGITile::setTilePosition(QPointF org)
+
{
m_origin = org;
- m_row = r;
- m_col = c;
}
void QGITile::setTileScale(double s)
@@ -264,6 +296,29 @@ void QGITile::setPrettySel() {
draw();
}
+bool QGITile::isTailRight(void)
+{
+ bool right = false;
+ App::DocumentObject* obj = m_tileFeat->TileParent.getValue();
+ TechDraw::DrawWeldSymbol* realParent = dynamic_cast(obj);
+ if (realParent != nullptr) {
+ right = realParent->isTailRightSide();
+ }
+ return right;
+}
+
+bool QGITile::getAltWeld(void)
+{
+ bool alt = false;
+ App::DocumentObject* obj = m_tileFeat->TileParent.getValue();
+ TechDraw::DrawWeldSymbol* realParent = dynamic_cast(obj);
+ if (realParent != nullptr) {
+ alt = realParent->AlternatingWeld.getValue();
+ } else {
+ Base::Console().Message("QGIT::getAltWeld - real parent not found!\n");
+ }
+ return alt;
+}
//TODO: this is Pen, not Brush. sb Brush to colour background
QColor QGITile::getTileColor(void) const
diff --git a/src/Mod/TechDraw/Gui/QGITile.h b/src/Mod/TechDraw/Gui/QGITile.h
index b04d859d31..0a67d9247c 100644
--- a/src/Mod/TechDraw/Gui/QGITile.h
+++ b/src/Mod/TechDraw/Gui/QGITile.h
@@ -51,7 +51,7 @@ namespace TechDrawGui
class TechDrawGuiExport QGITile : public QGIDecoration
{
public:
- explicit QGITile(TechDraw::DrawTile* tileFeat);
+ explicit QGITile(TechDraw::DrawTileWeld* tileFeat);
~QGITile(void) {}
enum {Type = QGraphicsItem::UserType + 325};
@@ -65,10 +65,11 @@ public:
void setTileTextCenter(std::string s);
void setFont(QFont f, double fsize);
void setSymbolFile(std::string s);
- void setTilePosition(QPointF org, int row, int col);
+ void setTilePosition(QPointF org);
void setTileScale(double s);
-// double getSymbolScale(void) const;
virtual void draw(void);
+ bool isTailRight(void);
+
protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
@@ -87,8 +88,10 @@ protected:
void makeSymbol(void);
void makeText(void);
+ bool getAltWeld(void);
+
private:
- TechDraw::DrawTile* m_tileFeat;
+ TechDraw::DrawTileWeld* m_tileFeat;
QGCustomText* m_qgTextL;
QGCustomText* m_qgTextR;
QGCustomText* m_qgTextC;
@@ -100,9 +103,6 @@ private:
QString m_textC;
QString m_fontName;
QFont m_font;
- double m_textSize;
- int m_row;
- int m_col;
QPointF m_origin;
double m_wide;
double m_high;
diff --git a/src/Mod/TechDraw/Gui/QGIView.cpp b/src/Mod/TechDraw/Gui/QGIView.cpp
index 415b291155..57b87887df 100644
--- a/src/Mod/TechDraw/Gui/QGIView.cpp
+++ b/src/Mod/TechDraw/Gui/QGIView.cpp
@@ -525,6 +525,7 @@ void QGIView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
QStyleOptionGraphicsItem myOption(*option);
myOption.state &= ~QStyle::State_Selected;
+// painter->setPen(Qt::red);
// painter->drawRect(boundingRect()); //good for debugging
QGraphicsItemGroup::paint(painter, &myOption, widget);
@@ -541,8 +542,12 @@ QRectF QGIView::customChildrenBoundingRect() const
int textLeaderItemType = QGraphicsItem::UserType + 233; // TODO: Magic number warning
int editablePathItemType = QGraphicsItem::UserType + 301; // TODO: Magic number warning
int movableTextItemType = QGraphicsItem::UserType + 300;
+ int weldingSymbolItemType = QGraphicsItem::UserType + 340;
QRectF result;
for (QList::iterator it = children.begin(); it != children.end(); ++it) {
+ if (!(*it)->isVisible()) {
+ continue;
+ }
if ( ((*it)->type() != dimItemType) &&
((*it)->type() != leaderItemType) &&
((*it)->type() != textLeaderItemType) &&
@@ -550,6 +555,7 @@ QRectF QGIView::customChildrenBoundingRect() const
((*it)->type() != movableTextItemType) &&
((*it)->type() != borderItemType) &&
((*it)->type() != labelItemType) &&
+ ((*it)->type() != weldingSymbolItemType) &&
((*it)->type() != captionItemType) ) {
QRectF childRect = mapFromItem(*it,(*it)->boundingRect()).boundingRect();
result = result.united(childRect);
diff --git a/src/Mod/TechDraw/Gui/QGIWeldSymbol.cpp b/src/Mod/TechDraw/Gui/QGIWeldSymbol.cpp
index eac2392006..ea436f3151 100644
--- a/src/Mod/TechDraw/Gui/QGIWeldSymbol.cpp
+++ b/src/Mod/TechDraw/Gui/QGIWeldSymbol.cpp
@@ -97,6 +97,14 @@ QGIWeldSymbol::QGIWeldSymbol(QGILeaderLine* myParent,
m_tailText = new QGCustomText();
addToGroup(m_tailText);
+ m_tailText->hide();
+ m_tailText->setPos(0.0, 0.0); //avoid bRect issues
+
+ m_allAround = new QGIVertex(-1);
+ m_allAround->setParentItem(this);
+ m_fieldFlag = new QGIPrimPath();
+ m_fieldFlag->setParentItem(this);
+
m_colCurrent = getNormalColor(); //preference
m_colSetting = m_colCurrent;
}
@@ -137,15 +145,40 @@ void QGIWeldSymbol::draw()
removeDecorations();
std::vector tiles = m_weldFeat->getTiles();
- for (auto& t: tiles) {
- if (t != nullptr) {
- QGITile* qt = new QGITile(t);
- qt->setParentItem(this);
- m_tiles.push_back(qt);
- drawTile(t, qt);
+
+ TechDraw::DrawTileWeld* arrowTile = nullptr;
+ TechDraw::DrawTileWeld* otherTile = nullptr;
+ if (!tiles.empty()) {
+ TechDraw::DrawTileWeld* tempTile = tiles.at(0);
+ if (tempTile->TileRow.getValue() == 0) {
+ arrowTile = tempTile;
+ } else {
+ otherTile = tempTile;
}
}
-
+ if (tiles.size() > 1) {
+ TechDraw::DrawTileWeld* tempTile = tiles.at(1);
+ if (tempTile->TileRow.getValue() == 0) {
+ arrowTile = tempTile;
+ } else {
+ otherTile = tempTile;
+ }
+ }
+
+ if (arrowTile != nullptr) {
+ QGITile* qt = new QGITile(arrowTile);
+ m_arrowTile = qt;
+ qt->setParentItem(this);
+ drawTile(arrowTile, m_arrowTile);
+ }
+
+ if (otherTile != nullptr) {
+ QGITile* qt = new QGITile(otherTile);
+ m_otherTile = qt;
+ qt->setParentItem(this);
+ drawTile(otherTile, m_otherTile);
+ }
+
if (m_weldFeat->AllAround.getValue()) {
drawAllAround();
}
@@ -154,9 +187,7 @@ void QGIWeldSymbol::draw()
drawFieldFlag();
}
- if (strlen(m_weldFeat->TailText.getValue()) != 0) {
- drawTailText();
- }
+ drawTailText();
}
void QGIWeldSymbol::drawTile(TechDraw::DrawTileWeld* dtw,
@@ -169,12 +200,10 @@ void QGIWeldSymbol::drawTile(TechDraw::DrawTileWeld* dtw,
std::string tileTextR = dtw->RightText.getValue();
std::string tileTextC = dtw->CenterText.getValue();
tile->setSymbolFile(dtw->SymbolFile.getValue());
- int tileRow = dtw->TileRow.getValue();
- int tileCol = dtw->TileColumn.getValue();
tile->setTileScale(featScale);
-
+
QPointF org = getTileOrigin();
- tile->setTilePosition(org, tileRow, tileCol);
+ tile->setTilePosition(org);
tile->setColor(getCurrentColor());
tile->setTileTextLeft(tileTextL);
tile->setTileTextRight(tileTextR);
@@ -211,26 +240,30 @@ void QGIWeldSymbol::drawAllAround(void)
void QGIWeldSymbol::drawTailText(void)
{
// Base::Console().Message("QGIWS::drawTailText()\n");
- m_tailText = new QGCustomText();
- m_tailText->setParentItem(this);
+ QPointF textPos = getTailPoint();
+ m_tailText->setPos(textPos); //avoid messing up brect with empty item at 0,0
+ std::string tText = m_weldFeat->TailText.getValue();
+ if (tText.empty()) {
+ m_tailText->hide();
+ return;
+ } else {
+ m_tailText->show();
+ }
m_font.setFamily(getPrefFont());
m_font.setPixelSize(calculateFontPixelSize(getDimFontSize()));
m_tailText->setFont(m_font);
- std::string tText = m_weldFeat->TailText.getValue();
m_tailText->setPlainText(
QString::fromUtf8(tText.c_str()));
m_tailText->setColor(getCurrentColor());
m_tailText->setZValue(ZVALUE::DIMENSION);
- QPointF textPos = getTailPoint();
-
double textWidth = m_tailText->boundingRect().width();
double charWidth = textWidth / tText.size();
double hMargin = charWidth + getPrefArrowSize();
- if (isTextRightSide()) {
+ if (getFeature()->isTailRightSide()) {
m_tailText->justifyLeftAt(textPos.x() + hMargin, textPos.y(), true);
} else {
m_tailText->justifyRightAt(textPos.x() - hMargin, textPos.y(), true);
@@ -287,22 +320,18 @@ void QGIWeldSymbol::removeDecorations()
QGITile* tile = dynamic_cast(c);
QGIPrimPath* prim = dynamic_cast(c); //allAround, fieldFlag
if (tile) {
- tile->setParentItem(nullptr);
scene()->removeItem(tile);
delete tile;
} else if (prim) {
- prim->setParentItem(nullptr);
scene()->removeItem(prim);
- delete prim;
+ delete tile;
}
}
- if (m_tailText != nullptr) {
- m_tailText->setParentItem(nullptr);
- scene()->removeItem(m_tailText);
- delete m_tailText;
- }
- std::vector noTiles;
- m_tiles = noTiles;
+ m_arrowTile = nullptr;
+ m_otherTile = nullptr;
+
+// std::vector noTiles;
+// m_tiles = noTiles;
}
void QGIWeldSymbol::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
@@ -339,10 +368,19 @@ void QGIWeldSymbol::drawBorder()
void QGIWeldSymbol::setPrettyNormal()
{
- for (auto t: m_tiles) {
- t->setColor(m_colNormal);
- t->draw();
+// for (auto t: m_tiles) {
+// t->setColor(m_colNormal);
+// t->draw();
+// }
+ if (m_arrowTile != nullptr) {
+ m_arrowTile->setColor(m_colNormal);
+ m_arrowTile->draw();
}
+ if (m_otherTile != nullptr) {
+ m_otherTile->setColor(m_colNormal);
+ m_otherTile->draw();
+ }
+
m_colCurrent = m_colNormal;
m_fieldFlag->setNormalColor(m_colCurrent);
m_fieldFlag->setFillColor(m_colCurrent);
@@ -356,24 +394,50 @@ void QGIWeldSymbol::setPrettyNormal()
void QGIWeldSymbol::setPrettyPre()
{
// Base::Console().Message("QGIWS::setPrettyPre()\n");
- for (auto t: m_tiles) {
- t->setColor(getPreColor());
- t->draw();
+// for (auto t: m_tiles) {
+// t->setColor(getPreColor());
+// t->draw();
+// }
+ if (m_arrowTile != nullptr) {
+ m_arrowTile->setColor(getPreColor());
+ m_arrowTile->draw();
}
+ if (m_otherTile != nullptr) {
+ m_otherTile->setColor(getPreColor());
+ m_otherTile->draw();
+ }
+ m_colCurrent = getPreColor();
+ m_fieldFlag->setNormalColor(getPreColor());
+ m_fieldFlag->setFillColor(getPreColor());
m_fieldFlag->setPrettyPre();
+ m_allAround->setNormalColor(getPreColor());
m_allAround->setPrettyPre();
+ m_tailText->setColor(getPreColor());
m_tailText->setPrettyPre();
}
void QGIWeldSymbol::setPrettySel()
{
// Base::Console().Message("QGIWS::setPrettySel()\n");
- for (auto t: m_tiles) {
- t->setColor(getSelectColor());
- t->draw();
+// for (auto t: m_tiles) {
+// t->setColor(getSelectColor());
+// t->draw();
+// }
+ if (m_arrowTile != nullptr) {
+ m_arrowTile->setColor(getSelectColor());
+ m_arrowTile->draw();
}
+ if (m_otherTile != nullptr) {
+ m_otherTile->setColor(getSelectColor());
+ m_otherTile->draw();
+ }
+ m_colCurrent = getSelectColor();
+ m_fieldFlag->setNormalColor(getSelectColor());
+ m_fieldFlag->setFillColor(getSelectColor());
m_fieldFlag->setPrettySel();
+ m_allAround->setNormalColor(getSelectColor());
m_allAround->setPrettySel();
+ m_tailText->setColor(getSelectColor());
m_tailText->setPrettySel();
}
@@ -398,16 +462,16 @@ QPointF QGIWeldSymbol::getTailPoint(void)
return result;
}
-bool QGIWeldSymbol::isTextRightSide()
-{
- bool result = true;
- Base::Vector3d tail = m_leadFeat->getTailPoint();
- Base::Vector3d kink = m_leadFeat->getKinkPoint();
- if (tail.x < kink.x) { //tail is to left
- result = false;
- }
- return result;
-}
+//bool QGIWeldSymbol::isTailRightSide()
+//{
+// bool result = true;
+// Base::Vector3d tail = m_leadFeat->getTailPoint();
+// Base::Vector3d kink = m_leadFeat->getKinkPoint();
+// if (tail.x < kink.x) { //tail is to left
+// result = false;
+// }
+// return result;
+//}
TechDraw::DrawWeldSymbol* QGIWeldSymbol::getFeature(void)
{
diff --git a/src/Mod/TechDraw/Gui/QGIWeldSymbol.h b/src/Mod/TechDraw/Gui/QGIWeldSymbol.h
index cea74598d6..7b30becd6f 100644
--- a/src/Mod/TechDraw/Gui/QGIWeldSymbol.h
+++ b/src/Mod/TechDraw/Gui/QGIWeldSymbol.h
@@ -77,7 +77,6 @@ public:
QPointF getTileOrigin(void);
QPointF getKinkPoint(void);
QPointF getTailPoint(void);
- bool isTextRightSide(void);
virtual void setPrettyNormal();
virtual void setPrettySel();
@@ -105,7 +104,8 @@ protected:
TechDraw::DrawLeaderLine* m_leadFeat;
QGILeaderLine* m_qgLead;
- std::vector m_tiles;
+ QGITile* m_arrowTile;
+ QGITile* m_otherTile;
QGCustomText* m_tailText;
QGIPrimPath* m_fieldFlag;
QGIVertex* m_allAround;
diff --git a/src/Mod/TechDraw/Gui/SymbolChooser.cpp b/src/Mod/TechDraw/Gui/SymbolChooser.cpp
new file mode 100644
index 0000000000..3ed8a9e809
--- /dev/null
+++ b/src/Mod/TechDraw/Gui/SymbolChooser.cpp
@@ -0,0 +1,156 @@
+/***************************************************************************
+ * Copyright (c) 2019 Wandererfan
+#include
+
+#include "DrawGuiStd.h"
+#include "Rez.h"
+
+#include
+
+#include "SymbolChooser.h"
+
+using namespace Gui;
+using namespace TechDraw;
+using namespace TechDrawGui;
+
+
+SymbolChooser::SymbolChooser(QWidget *parent,
+ QString startDir,
+ QString source) :
+ QDialog(parent),
+ ui(new Ui_SymbolChooser),
+ m_symbolDir(startDir),
+ m_source(source)
+{
+ ui->setupUi(this);
+ connect(ui->pbOK, SIGNAL(clicked(bool)),
+ this, SLOT(onOKClicked(bool)));
+ connect(ui->pbCancel, SIGNAL(clicked(bool)),
+ this, SLOT(onCancelClicked(bool)));
+ connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
+ this, SLOT(onDirectorySelected(const QString&)));
+ connect(ui->lwSymbols, SIGNAL(itemClicked(QListWidgetItem*)), //double click?
+ this, SLOT(onItemClicked(QListWidgetItem*)));
+
+ setUiPrimary();
+}
+
+void SymbolChooser::setUiPrimary()
+{
+// Base::Console().Message("SC::setUiPrimary()\n");
+ setWindowTitle(QObject::tr("Select a symbol"));
+ if (!m_symbolDir.isEmpty()) {
+ ui->fcSymbolDir->setFileName(m_symbolDir);
+ loadSymbolNames(m_symbolDir);
+ } else {
+ std::string resourceDir = App::Application::getResourceDir();
+ QString defDir = QString::fromUtf8(resourceDir.c_str());
+ ui->fcSymbolDir->setFileName(defDir);
+ loadSymbolNames(defDir);
+ m_symbolDir = defDir;
+ }
+
+ ui->lwSymbols->setViewMode(QListView::IconMode);
+ ui->lwSymbols->setFlow(QListView::LeftToRight);
+ ui->lwSymbols->setWrapping(true);
+ ui->lwSymbols->setDragEnabled(true);
+ ui->lwSymbols->setSelectionMode(QAbstractItemView::SingleSelection);
+ ui->lwSymbols->setAcceptDrops(false);
+}
+
+void SymbolChooser::onOKClicked(bool b)
+{
+ Q_UNUSED(b);
+// Base::Console().Message("SC::OnOKClicked()\n");
+ QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
+ QString targetText = sourceItem->text();
+ m_symbolPath = m_symbolDir +
+ targetText +
+ QString::fromUtf8(".svg");
+
+ Q_EMIT symbolSelected(m_symbolPath, m_source);
+// Base::Console().Message("SC::onOKClicked - symbol; %s\n", qPrintable(m_symbolPath));
+ accept();
+}
+
+void SymbolChooser::onCancelClicked(bool b)
+{
+ Q_UNUSED(b);
+// Base::Console().Message("SC::OnCancelCicked()\n");
+ reject();
+}
+
+void SymbolChooser::onItemClicked(QListWidgetItem* item)
+{
+ Q_UNUSED(item);
+// Base::Console().Message("SCS::onItemClicked(%s)\n", qPrintable(item->text()));
+ //are item and currentItem() the same? should use item?
+ QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
+ QString targetText = sourceItem->text();
+ m_symbolPath = m_symbolDir +
+ targetText +
+ QString::fromUtf8(".svg");
+ Q_EMIT symbolSelected(m_symbolPath, m_source);
+
+// Base::Console().Message("SC::onOKClicked - symbol: %s\n", qPrintable(m_symbolPath));
+ accept();
+}
+
+void SymbolChooser::onDirectorySelected(const QString& newDir)
+{
+// Base::Console().Message("SC::onDirectorySelected(%s)\n", qPrintable(newDir));
+ m_symbolDir = newDir + QString::fromUtf8("/");
+ loadSymbolNames(m_symbolDir);
+}
+
+void SymbolChooser::loadSymbolNames(QString pathToSymbols)
+{
+ //fill selection list with names and icons
+ QDir symbolDir(pathToSymbols);
+ symbolDir.setFilter(QDir::Files);
+ QStringList fileNames = symbolDir.entryList();
+
+ for (auto& fn: fileNames) {
+ QListWidgetItem* item = new QListWidgetItem(fn, ui->lwSymbols);
+ QFileInfo fi(fn);
+ item->setText(fi.baseName());
+ QIcon symbolIcon(pathToSymbols + fn);
+ item->setIcon(symbolIcon);
+ ui->lwSymbols->addItem(item);
+ }
+ ui->lwSymbols->setCurrentRow(0);
+ ui->lwSymbols->setAcceptDrops(false); //have to do this every time you update the items
+}
+
+//QString SymbolChooser::getSymbolPath(void)
+//{
+// Base::Console().Message("SC::getSymbolPath returns: %s\n", qPrintable(m_symbolPath));
+// return m_symbolPath;
+//}
+
+#include
diff --git a/src/Mod/TechDraw/Gui/SymbolChooser.h b/src/Mod/TechDraw/Gui/SymbolChooser.h
new file mode 100644
index 0000000000..d45fc58eee
--- /dev/null
+++ b/src/Mod/TechDraw/Gui/SymbolChooser.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (c) 2019 Wandererfan
+#include
+#include
+
+#include
+
+namespace TechDrawGui {
+
+class TechDrawGuiExport SymbolChooser : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SymbolChooser(QWidget *parent = 0,
+ QString startDir = QString(),
+ QString source = QString());
+
+public Q_SLOTS:
+ void onOKClicked(bool b);
+ void onCancelClicked(bool b);
+ void onItemClicked(QListWidgetItem* item);
+ void onDirectorySelected(const QString& newDir);
+
+Q_SIGNALS:
+ void symbolSelected(QString symbolPath,
+ QString source);
+
+protected:
+ void setUiPrimary(void);
+ void loadSymbolNames(QString pathToSymbols);
+
+private:
+ Ui_SymbolChooser* ui;
+ QString m_symbolDir;
+ QString m_symbolPath;
+ QString m_source;
+};
+
+}
+#endif // #ifndef TECHDRAWGUI_SYMBOLCHOOSER_H
+
diff --git a/src/Mod/TechDraw/Gui/SymbolChooser.ui b/src/Mod/TechDraw/Gui/SymbolChooser.ui
new file mode 100644
index 0000000000..634b025821
--- /dev/null
+++ b/src/Mod/TechDraw/Gui/SymbolChooser.ui
@@ -0,0 +1,124 @@
+
+
+ SymbolChooser
+
+
+ Qt::WindowModal
+
+
+
+ 0
+ 0
+ 400
+ 394
+
+
+
+ SymbolChooser
+
+
+ true
+
+
+
+
+ 19
+ 19
+ 361
+ 341
+
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+ 2
+
+
+
+
+ 9
+ 19
+ 341
+ 191
+
+
+
+ -
+
+
+
+
+
+
+
+ 10
+ 220
+ 341
+ 41
+
+
+
+ -
+
+
+ Cancel
+
+
+
+ -
+
+
+ OK
+
+
+
+
+
+
+
+
+ 10
+ 280
+ 341
+ 35
+
+
+
+ -
+
+
+ Symbol Dir
+
+
+
+ -
+
+
+ Gui::FileChooser::Directory
+
+
+
+
+
+
+
+
+
+ Gui::FileChooser
+ QWidget
+
+
+
+
+
+
diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp
index c5318dff29..369098f957 100644
--- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp
+++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp
@@ -68,6 +68,7 @@
#include "MDIViewPage.h"
#include "ViewProviderPage.h"
#include "ViewProviderViewPart.h"
+#include "SymbolChooser.h"
#include "Rez.h"
#include "TaskWeldingSymbol.h"
@@ -80,8 +81,12 @@ using namespace TechDrawGui;
TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawLeaderLine* leader) :
ui(new Ui_TaskWeldingSymbol),
m_leadFeat(leader),
- m_arrowCount(0),
- m_otherCount(0)
+ m_weldFeat(nullptr),
+ m_arrowIn(nullptr),
+ m_otherIn(nullptr),
+ m_createMode(true),
+ m_arrowDirty(false),
+ m_otherDirty(false)
{
// Base::Console().Message("TWS::TWS() - create mode\n");
if (m_leadFeat == nullptr) {
@@ -89,22 +94,94 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawLeaderLine* leader) :
Base::Console().Error("TaskWeldingSymbol - bad parameters. Can not proceed.\n");
return;
}
-
ui->setupUi(this);
- connect(ui->pbArrow0, SIGNAL(clicked(bool)),
- this, SLOT(onArrow0Clicked(bool)));
- connect(ui->pbArrow1, SIGNAL(clicked(bool)),
- this, SLOT(onArrow1Clicked(bool)));
- connect(ui->pbOther0, SIGNAL(clicked(bool)),
- this, SLOT(onOther0Clicked(bool)));
- connect(ui->pbOther1, SIGNAL(clicked(bool)),
- this, SLOT(onOther1Clicked(bool)));
+
+ connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
+ this, SLOT(onArrowSymbolClicked(bool)));
+ connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)),
+ this, SLOT(onOtherSymbolClicked(bool)));
+ connect(ui->pbOtherErase, SIGNAL(clicked(bool)),
+ this, SLOT(onOtherEraseClicked(bool)));
+
connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
this, SLOT(onDirectorySelected(const QString&)));
+ connect(ui->leArrowTextL, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onArrowTextChanged(const QString&)));
+ connect(ui->leArrowTextR, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onArrowTextChanged(const QString&)));
+ connect(ui->leArrowTextC, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onArrowTextChanged(const QString&)));
+
+ connect(ui->leOtherTextL, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onOtherTextChanged(const QString&)));
+ connect(ui->leOtherTextR, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onOtherTextChanged(const QString&)));
+ connect(ui->leOtherTextC, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onOtherTextChanged(const QString&)));
+
+
setUiPrimary();
}
+//ctor for edit
+TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) :
+ ui(new Ui_TaskWeldingSymbol),
+ m_leadFeat(nullptr),
+ m_weldFeat(weld),
+ m_arrowIn(nullptr),
+ m_otherIn(nullptr),
+ m_createMode(false),
+ m_arrowDirty(false),
+ m_otherDirty(false)
+{
+// Base::Console().Message("TWS::TWS() - edit mode\n");
+ if (m_weldFeat == nullptr) {
+ //should be caught in CMD caller
+ Base::Console().Error("TaskWeldingSymbol - bad parameters. Can not proceed.\n");
+ return;
+ }
+
+ App::DocumentObject* obj = m_weldFeat->Leader.getValue();
+ if ( (obj != nullptr) &&
+ (obj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) ) {
+ m_leadFeat = static_cast(obj);
+ } else {
+ Base::Console().Error("TaskWeldingSymbol - no leader for welding symbol. Can not proceed.\n");
+ return;
+ }
+
+ ui->setupUi(this);
+
+ connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
+ this, SLOT(onArrowSymbolClicked(bool)));
+
+ connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)),
+ this, SLOT(onOtherSymbolClicked(bool)));
+ connect(ui->pbOtherErase, SIGNAL(clicked(bool)),
+ this, SLOT(onOtherEraseClicked(bool)));
+
+ connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
+ this, SLOT(onDirectorySelected(const QString&)));
+
+ connect(ui->leArrowTextL, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onArrowTextChanged(const QString&)));
+ connect(ui->leArrowTextR, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onArrowTextChanged(const QString&)));
+ connect(ui->leArrowTextC, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onArrowTextChanged(const QString&)));
+
+ connect(ui->leOtherTextL, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onOtherTextChanged(const QString&)));
+ connect(ui->leOtherTextR, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onOtherTextChanged(const QString&)));
+ connect(ui->leOtherTextC, SIGNAL(textEdited(const QString&)),
+ this, SLOT(onOtherTextChanged(const QString&)));
+
+ saveState();
+ setUiEdit();
+}
+
TaskWeldingSymbol::~TaskWeldingSymbol()
{
delete ui;
@@ -130,220 +207,214 @@ void TaskWeldingSymbol::setUiPrimary()
setWindowTitle(QObject::tr("Create Welding Symbol"));
m_currDir = QString::fromUtf8(prefSymbolDir().c_str());
ui->fcSymbolDir->setFileName(m_currDir);
- loadSymbolNames(m_currDir);
- ui->lwSymbols->setViewMode(QListView::IconMode);
- ui->lwSymbols->setFlow(QListView::LeftToRight);
- ui->lwSymbols->setWrapping(true);
- ui->lwSymbols->setDragEnabled(true);
- ui->lwSymbols->setSelectionMode(QAbstractItemView::SingleSelection);
- ui->lwSymbols->setAcceptDrops(false);
+ ui->pbArrowSymbol->setFocus();
+ m_arrowOut.init();
+ m_arrowPath = QString();
+ m_otherOut.init();
+ m_otherPath = QString();
}
void TaskWeldingSymbol::setUiEdit()
{
// Base::Console().Message("TWS::setUiEdit()\n");
setWindowTitle(QObject::tr("Edit Welding Symbol"));
-}
-void TaskWeldingSymbol::onArrow0Clicked(bool b)
-{
-// Base::Console().Message("TWS::OnArrow0Clicked()\n");
- Q_UNUSED(b);
- Qt::KeyboardModifiers km = QApplication::keyboardModifiers();
- if (km & Qt::ControlModifier) {
- ui->pbArrow0->setText(QString::fromUtf8("Add"));
- ui->pbArrow0->setIcon(QIcon());
- removePendingTile(0,0);
- return;
- }
-
- QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
- QString targetText = sourceItem->text();
- TechDrawGui::Tile2Add newTile;
+ m_currDir = QString::fromUtf8(prefSymbolDir().c_str()); //sb path part of 1st symbol file??
+ ui->fcSymbolDir->setFileName(m_currDir);
- QString iconPath = m_currDir +
- targetText +
- QString::fromUtf8(".svg") ;
+ ui->cbAllAround->setChecked(m_weldFeat->AllAround.getValue());
+ ui->cbFieldWeld->setChecked(m_weldFeat->FieldWeld.getValue());
+ ui->cbAltWeld->setChecked(m_weldFeat->AlternatingWeld.getValue());
+ ui->leTailText->setText(QString::fromUtf8(m_weldFeat->TailText.getValue()));
- QIcon targetIcon(iconPath);
- QSize iconSize(32,32);
- ui->pbArrow0->setIcon(targetIcon);
- ui->pbArrow0->setIconSize(iconSize);
- ui->pbArrow0->setText(QString());
-
- newTile.arrowSide = true;
- newTile.symbolPath = Base::Tools::toStdString(iconPath);
- newTile.leftText = Base::Tools::toStdString(ui->leLeftText->text());
- newTile.centerText = Base::Tools::toStdString(ui->leCenterText->text());
- newTile.rightText = Base::Tools::toStdString(ui->leRightText->text());
- newTile.row = 0;
- newTile.col = 0;
- m_tiles2Add.push_back(newTile);
- m_arrowCount++;
-}
+ //save existing tiles done in saveState
+ if (m_arrowIn != nullptr) {
+ QString qTemp = QString::fromUtf8(m_arrowIn->LeftText.getValue());
+ ui->leArrowTextL->setText(qTemp);
+ qTemp = QString::fromUtf8(m_arrowIn->RightText.getValue());
+ ui->leArrowTextR->setText(qTemp);
+ qTemp = QString::fromUtf8(m_arrowIn->CenterText.getValue());
+ ui->leArrowTextC->setText(qTemp);
-void TaskWeldingSymbol::onArrow1Clicked(bool b)
-{
-// Base::Console().Message("TWS::OnArrow1Clicked()\n");
- Q_UNUSED(b);
- Qt::KeyboardModifiers km = QApplication::keyboardModifiers();
- if (km & Qt::ControlModifier) {
- ui->pbArrow1->setText(QString::fromUtf8("Add"));
- ui->pbArrow1->setIcon(QIcon());
- removePendingTile(0,1);
- return;
+ std::string inFile = m_arrowIn->SymbolFile.getValue();
+ auto fi = Base::FileInfo(inFile);
+ if (fi.isReadable()) {
+ qTemp = QString::fromUtf8(m_arrowIn->SymbolFile.getValue());
+ QIcon targetIcon(qTemp);
+ QSize iconSize(32,32);
+ ui->pbArrowSymbol->setIcon(targetIcon);
+ ui->pbArrowSymbol->setIconSize(iconSize);
+ ui->pbArrowSymbol->setText(QString());
+ }
}
- QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
- QString targetText = sourceItem->text();
- TechDrawGui::Tile2Add newTile;
+ if (m_otherIn != nullptr) {
+ QString qTemp = QString::fromUtf8(m_otherIn->LeftText.getValue());
+ ui->leOtherTextL->setText(qTemp);
+ qTemp = QString::fromUtf8(m_otherIn->RightText.getValue());
+ ui->leOtherTextR->setText(qTemp);
+ qTemp = QString::fromUtf8(m_otherIn->CenterText.getValue());
+ ui->leOtherTextC->setText(qTemp);
- QString iconPath = m_currDir +
- targetText +
- QString::fromUtf8(".svg") ;
-
- QIcon targetIcon(iconPath);
- QSize iconSize(32,32);
- ui->pbArrow1->setIcon(targetIcon);
- ui->pbArrow1->setIconSize(iconSize);
- ui->pbArrow1->setText(QString());
-
- newTile.arrowSide = true;
- newTile.symbolPath = Base::Tools::toStdString(iconPath);
- newTile.leftText = Base::Tools::toStdString(ui->leLeftText->text());
- newTile.centerText = Base::Tools::toStdString(ui->leCenterText->text());
- newTile.rightText = Base::Tools::toStdString(ui->leRightText->text());
- newTile.row = 0;
- newTile.col = 1;
- m_tiles2Add.push_back(newTile);
- m_arrowCount++;
-}
-
-void TaskWeldingSymbol::onOther0Clicked(bool b)
-{
-// Base::Console().Message("TWS::onOther0Clicked()\n");
- Q_UNUSED(b);
- Qt::KeyboardModifiers km = QApplication::keyboardModifiers();
- if (km & Qt::ControlModifier) {
- ui->pbOther0->setText(QString::fromUtf8("Add"));
- ui->pbOther0->setIcon(QIcon());
- removePendingTile(-1,0);
- return;
+ std::string inFile = m_otherIn->SymbolFile.getValue();
+ auto fi = Base::FileInfo(inFile);
+ if (fi.isReadable()) {
+ qTemp = QString::fromUtf8(m_otherIn->SymbolFile.getValue());
+ QIcon targetIcon(qTemp);
+ QSize iconSize(32,32);
+ ui->pbOtherSymbol->setIcon(targetIcon);
+ ui->pbOtherSymbol->setIconSize(iconSize);
+ ui->pbOtherSymbol->setText(QString());
+ }
}
- QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
- QString targetText = sourceItem->text();
- TechDrawGui::Tile2Add newTile;
-
- QString iconPath = m_currDir +
- targetText +
- QString::fromUtf8(".svg") ;
-
- QIcon targetIcon(iconPath);
- QSize iconSize(32,32);
- ui->pbOther0->setIcon(targetIcon);
- ui->pbOther0->setIconSize(iconSize);
- ui->pbOther0->setText(QString());
-
- newTile.arrowSide = false;
- newTile.symbolPath = Base::Tools::toStdString(iconPath);
- newTile.leftText = Base::Tools::toStdString(ui->leLeftText->text());
- newTile.centerText = Base::Tools::toStdString(ui->leCenterText->text());
- newTile.rightText = Base::Tools::toStdString(ui->leRightText->text());
- newTile.row = -1;
- newTile.col = 0;
- m_tiles2Add.push_back(newTile);
- m_otherCount++;
+ ui->pbArrowSymbol->setFocus();
}
-void TaskWeldingSymbol::onOther1Clicked(bool b)
+void TaskWeldingSymbol::onArrowSymbolClicked(bool b)
{
-// Base::Console().Message("TWS::onOther1Clicked()\n");
+// Base::Console().Message("TWS::OnArrowSymbolClicked()\n");
Q_UNUSED(b);
- Qt::KeyboardModifiers km = QApplication::keyboardModifiers();
- if (km & Qt::ControlModifier) {
- ui->pbOther1->setText(QString::fromUtf8("Add"));
- ui->pbOther1->setIcon(QIcon());
- removePendingTile(-1,1);
- return;
- }
-
- QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
- QString targetText = sourceItem->text();
- TechDrawGui::Tile2Add newTile;
- QString iconPath = m_currDir +
- targetText +
- QString::fromUtf8(".svg") ;
+ QString source = QString::fromUtf8("arrow");
+ SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
+ connect(dlg, SIGNAL(symbolSelected(QString, QString)),
+ this, SLOT(onSymbolSelected(QString, QString)));
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
- QIcon targetIcon(iconPath);
- QSize iconSize(32,32);
- ui->pbOther1->setIcon(targetIcon);
- ui->pbOther1->setIconSize(iconSize);
- ui->pbOther1->setText(QString());
-
- newTile.arrowSide = false;
- newTile.symbolPath = Base::Tools::toStdString(iconPath);
- newTile.leftText = Base::Tools::toStdString(ui->leLeftText->text());
- newTile.centerText = Base::Tools::toStdString(ui->leCenterText->text());
- newTile.rightText = Base::Tools::toStdString(ui->leRightText->text());
- newTile.row = -1;
- newTile.col = 1;
- m_tiles2Add.push_back(newTile);
- m_otherCount++;
+ //int rc =
+ dlg->exec();
}
+void TaskWeldingSymbol::onOtherSymbolClicked(bool b)
+{
+// Base::Console().Message("TWS::OnOtherSymbolClicked()\n");
+ Q_UNUSED(b);
+
+ QString source = QString::fromUtf8("other");
+ SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
+ connect(dlg, SIGNAL(symbolSelected(QString, QString)),
+ this, SLOT(onSymbolSelected(QString, QString)));
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
+
+// int rc =
+ dlg->exec();
+}
+
+void TaskWeldingSymbol::onOtherEraseClicked(bool b)
+{
+// Base::Console().Message("TWS::onOtherEraseClicked()\n");
+ Q_UNUSED(b);
+ m_otherOut.init();
+
+ ui->leOtherTextL->setText(QString());
+ ui->leOtherTextC->setText(QString());
+ ui->leOtherTextR->setText(QString());
+ ui->pbOtherSymbol->setIcon(QIcon());
+ ui->pbOtherSymbol->setText(QString::fromUtf8("Symbol"));
+
+ if ( (!m_createMode) &&
+ (m_otherIn != nullptr) ) {
+ m_toRemove.push_back(m_otherIn->getNameInDocument());
+ }
+ m_otherIn = nullptr;
+}
+
+void TaskWeldingSymbol::onArrowTextChanged(const QString& qs)
+{
+// Base::Console().Message("TWS::onArrowTextChanged(%s)\n", qPrintable(qs));
+ Q_UNUSED(qs);
+ m_arrowDirty = true;
+}
+
+void TaskWeldingSymbol::onOtherTextChanged(const QString& qs)
+{
+// Base::Console().Message("TWS::onOtherTextChanged(%s)\n", qPrintable(qs));
+ Q_UNUSED(qs);
+ m_otherDirty = true;
+}
+
+
void TaskWeldingSymbol::onDirectorySelected(const QString& newDir)
{
// Base::Console().Message("TWS::onDirectorySelected(%s)\n", qPrintable(newDir));
m_currDir = newDir + QString::fromUtf8("/");
- loadSymbolNames(m_currDir);
}
-void TaskWeldingSymbol::removePendingTile(int row, int col)
+void TaskWeldingSymbol::onSymbolSelected(QString symbolPath,
+ QString source)
{
-// Base::Console().Message("TWS::removePendingIcon(%d, %d) - tiles in: %d\n",
-// row, col, m_tiles2Add.size());
- std::vector newList;
- for (auto& t: m_tiles2Add) {
- if ((t.row == row) &&
- (t.col == col) ) {
- continue;
- } else {
- newList.push_back(t);
- }
+// Base::Console().Message("TWS::onSymbolSelected(%s) - source: %s\n",
+// qPrintable(symbolPath), qPrintable(source));
+ QIcon targetIcon(symbolPath);
+ QSize iconSize(32,32);
+ QString arrow = QString::fromUtf8("arrow");
+ QString other = QString::fromUtf8("other");
+ if (source == arrow) {
+ m_arrowDirty = true;
+ ui->pbArrowSymbol->setIcon(targetIcon);
+ ui->pbArrowSymbol->setIconSize(iconSize);
+ ui->pbArrowSymbol->setText(QString());
+ m_arrowPath = symbolPath;
+ } else if (source == other) {
+ m_otherDirty = true;
+ ui->pbOtherSymbol->setIcon(targetIcon);
+ ui->pbOtherSymbol->setIconSize(iconSize);
+ ui->pbOtherSymbol->setText(QString());
+ m_otherPath = symbolPath;
}
- m_tiles2Add = newList;
}
-
void TaskWeldingSymbol::blockButtons(bool b)
{
Q_UNUSED(b);
}
-void TaskWeldingSymbol::loadSymbolNames(QString pathToSymbols)
+void TaskWeldingSymbol::saveState(void)
{
- //fill selection list with names and icons
- QDir symbolDir(pathToSymbols);
- symbolDir.setFilter(QDir::Files);
- QStringList fileNames = symbolDir.entryList();
-
- for (auto& fn: fileNames) {
- QListWidgetItem* item = new QListWidgetItem(fn, ui->lwSymbols);
- QFileInfo fi(fn);
- item->setText(fi.baseName());
- QIcon symbolIcon(pathToSymbols + fn);
- item->setIcon(symbolIcon);
- ui->lwSymbols->addItem(item);
+ std::vector tiles = m_weldFeat->getTiles();
+ for (auto t: tiles) {
+ if (t->TileRow.getValue() == 0) {
+ m_arrowIn = t;
+ } else if (t->TileRow.getValue() == -1) {
+ m_otherIn = t;
+ } else {
+ Base::Console().Message("TWS::saveState - bad row: %d\n", t->TileRow.getValue());
+ }
}
- ui->lwSymbols->setCurrentRow(0);
- ui->lwSymbols->setAcceptDrops(false); //have to do this every time you update the items
+}
+
+void TaskWeldingSymbol::collectArrowData(void)
+{
+// Base::Console().Message("TWS::collectArrowData()\n");
+ m_arrowOut.toBeSaved = true;
+ m_arrowOut.arrowSide = false;
+ m_arrowOut.row = 0;
+ m_arrowOut.col = 0;
+ m_arrowOut.leftText = Base::Tools::toStdString(ui->leArrowTextL->text());
+ m_arrowOut.centerText = Base::Tools::toStdString(ui->leArrowTextC->text());
+ m_arrowOut.rightText = Base::Tools::toStdString(ui->leArrowTextR->text());
+ m_arrowOut.symbolPath= Base::Tools::toStdString(m_arrowPath);
+ m_arrowOut.tileName = "";
+}
+
+void TaskWeldingSymbol::collectOtherData(void)
+{
+// Base::Console().Message("TWS::collectOtherData()\n");
+ m_otherOut.toBeSaved = true;
+ m_otherOut.arrowSide = false;
+ m_otherOut.row = -1;
+ m_otherOut.col = 0;
+ m_otherOut.leftText = Base::Tools::toStdString(ui->leOtherTextL->text());
+ m_otherOut.centerText = Base::Tools::toStdString(ui->leOtherTextC->text());
+ m_otherOut.rightText = Base::Tools::toStdString(ui->leOtherTextR->text());
+ m_otherOut.symbolPath= Base::Tools::toStdString(m_otherPath);
+ m_otherOut.tileName = "";
}
//******************************************************************************
-App::DocumentObject* TaskWeldingSymbol::createWeldingSymbol(void)
+TechDraw::DrawWeldSymbol* TaskWeldingSymbol::createWeldingSymbol(void)
{
// Base::Console().Message("TWS::createWeldingSymbol()\n");
Gui::Command::openCommand("Create WeldSymbol");
@@ -361,53 +432,85 @@ App::DocumentObject* TaskWeldingSymbol::createWeldingSymbol(void)
Command::doCommand(Command::Doc,"App.activeDocument().%s.Leader = App.activeDocument().%s",
symbolName.c_str(),m_leadFeat->getNameInDocument());
- bool allAround = ui->rbAllAround->isChecked();
+ bool allAround = ui->cbAllAround->isChecked();
std::string allAroundText = allAround ? "True" : "False";
Command::doCommand(Command::Doc,"App.activeDocument().%s.AllAround = %s",
symbolName.c_str(), allAroundText.c_str());
- bool fieldWeld = ui->rbFieldWeld->isChecked();
+ bool fieldWeld = ui->cbFieldWeld->isChecked();
std::string fieldWeldText = fieldWeld ? "True" : "False";
Command::doCommand(Command::Doc,"App.activeDocument().%s.FieldWeld = %s",
symbolName.c_str(), fieldWeldText.c_str());
+ bool altWeld = ui->cbAltWeld->isChecked();
+ std::string altWeldText = altWeld ? "True" : "False";
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.AlternatingWeld = %s",
+ symbolName.c_str(), altWeldText.c_str());
+
std::string tailText = Base::Tools::toStdString(ui->leTailText->text());
Command::doCommand(Command::Doc,"App.activeDocument().%s.TailText = '%s'",
symbolName.c_str(), tailText.c_str());
App::DocumentObject* newObj = m_leadFeat->getDocument()->getObject(symbolName.c_str());
- if (newObj == nullptr) {
+ TechDraw::DrawWeldSymbol* newSym = dynamic_cast(newObj);
+ if ( (newObj == nullptr) ||
+ (newSym == nullptr) ) {
throw Base::RuntimeError("TaskWeldingSymbol - new symbol object not found");
}
- newObj->recomputeFeature();
+
Gui::Command::updateActive();
Gui::Command::commitCommand();
- return newObj;
+ return newSym;
+}
+
+void TaskWeldingSymbol::updateWeldingSymbol(void)
+{
+// Base::Console().Message("TWS::updateWeldingSymbol()\n");
+ std::string symbolName = m_weldFeat->getNameInDocument();
+
+ bool allAround = ui->cbAllAround->isChecked();
+ std::string allAroundText = allAround ? "True" : "False";
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.AllAround = %s",
+ symbolName.c_str(), allAroundText.c_str());
+
+ bool fieldWeld = ui->cbFieldWeld->isChecked();
+ std::string fieldWeldText = fieldWeld ? "True" : "False";
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.FieldWeld = %s",
+ symbolName.c_str(), fieldWeldText.c_str());
+
+ bool altWeld = ui->cbAltWeld->isChecked();
+ std::string altWeldText = altWeld ? "True" : "False";
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.AlternatingWeld = %s",
+ symbolName.c_str(), altWeldText.c_str());
+
+ std::string tailText = Base::Tools::toStdString(ui->leTailText->text());
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.TailText = '%s'",
+ symbolName.c_str(), tailText.c_str());
}
std::vector TaskWeldingSymbol::createTiles(void)
{
// Base::Console().Message("TWS::createTiles()\n");
- Gui::Command::openCommand("Create Welding Tiles");
std::vector tileFeats;
std::string tileType("TechDraw::DrawTileWeld");
- for (auto& t: m_tiles2Add) {
+
+ collectArrowData();
+ if (m_arrowOut.toBeSaved) {
std::string tileName = m_leadFeat->getDocument()->getUniqueObjectName("DrawTileWeld");
Command::doCommand(Command::Doc,"App.activeDocument().addObject('%s','%s')",
tileType.c_str(),tileName.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.TileRow = %d",
- tileName.c_str(), t.row);
+ tileName.c_str(), m_arrowOut.row);
Command::doCommand(Command::Doc,"App.activeDocument().%s.TileColumn = %d",
- tileName.c_str(), t.col);
+ tileName.c_str(), m_arrowOut.col);
Command::doCommand(Command::Doc,"App.activeDocument().%s.SymbolFile = '%s'",
- tileName.c_str(), t.symbolPath.c_str());
+ tileName.c_str(), m_arrowOut.symbolPath.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.LeftText = '%s'",
- tileName.c_str(), t.leftText.c_str());
+ tileName.c_str(), m_arrowOut.leftText.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.RightText = '%s'",
- tileName.c_str(), t.rightText.c_str());
+ tileName.c_str(), m_arrowOut.rightText.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.CenterText = '%s'",
- tileName.c_str(), t.centerText.c_str());
-
+ tileName.c_str(), m_arrowOut.centerText.c_str());
App::DocumentObject* newTile = m_leadFeat->getDocument()->getObject(tileName.c_str());
if (newTile == nullptr) {
throw Base::RuntimeError("TaskWeldingSymbol - new tile object not found");
@@ -415,19 +518,132 @@ std::vector TaskWeldingSymbol::createTiles(void)
tileFeats.push_back(newTile);
}
- Gui::Command::updateActive();
- Gui::Command::commitCommand();
+ if (m_otherDirty) {
+ collectOtherData();
+ if (m_otherOut.toBeSaved) {
+ std::string tileName = m_leadFeat->getDocument()->getUniqueObjectName("DrawTileWeld");
+ Command::doCommand(Command::Doc,"App.activeDocument().addObject('%s','%s')",
+ tileType.c_str(),tileName.c_str());
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.TileRow = %d",
+ tileName.c_str(), m_otherOut.row);
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.TileColumn = %d",
+ tileName.c_str(), m_otherOut.col);
+
+ if (m_otherOut.symbolPath.empty()) {
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.SymbolFile = ''",
+ tileName.c_str());
+ } else {
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.SymbolFile = '%s'",
+ tileName.c_str(), m_otherOut.symbolPath.c_str());
+ }
+
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.LeftText = '%s'",
+ tileName.c_str(), m_otherOut.leftText.c_str());
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.RightText = '%s'",
+ tileName.c_str(), m_otherOut.rightText.c_str());
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.CenterText = '%s'",
+ tileName.c_str(), m_otherOut.centerText.c_str());
+ App::DocumentObject* newTile = m_leadFeat->getDocument()->getObject(tileName.c_str());
+ if (newTile == nullptr) {
+ throw Base::RuntimeError("TaskWeldingSymbol - new tile object not found");
+ }
+ tileFeats.push_back(newTile);
+ }
+ }
+
return tileFeats;
}
-void TaskWeldingSymbol::updateWeldingSymbol(void)
+std::vector TaskWeldingSymbol::updateTiles(void)
{
-// Base::Console().Message("TWS::updateWeldingSymbol()\n");
- Gui::Command::openCommand("Edit WeldingSymbol");
- m_weldFeat->requestPaint();
+// Base::Console().Message("TWS::updateTiles()\n");
+ std::vector tileFeats;
+ std::string tileType("TechDraw::DrawTileWeld");
+ std::string tileName;
- Gui::Command::updateActive();
- Gui::Command::commitCommand();
+ collectArrowData();
+
+ if (m_arrowIn != nullptr) {
+ tileName = m_arrowIn->getNameInDocument();
+ }
+ if (m_arrowIn == nullptr) {
+ tileName = m_leadFeat->getDocument()->getUniqueObjectName("DrawTileWeld");
+ Command::doCommand(Command::Doc,"App.activeDocument().addObject('%s','%s')",
+ tileType.c_str(),tileName.c_str());
+ App::DocumentObject* newTile = m_leadFeat->getDocument()->getObject(tileName.c_str());
+ if (newTile == nullptr) {
+ throw Base::RuntimeError("TaskWeldingSymbol - new tile object not found");
+ }
+ tileFeats.push_back(newTile);
+ }
+
+ if (m_arrowOut.toBeSaved) {
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.TileRow = %d",
+ tileName.c_str(), m_arrowOut.row);
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.TileColumn = %d",
+ tileName.c_str(), m_arrowOut.col);
+
+ if (m_otherOut.symbolPath.empty()) {
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.SymbolFile = ''",
+ tileName.c_str());
+ } else {
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.SymbolFile = '%s'",
+ tileName.c_str(), m_arrowOut.symbolPath.c_str());
+ }
+
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.LeftText = '%s'",
+ tileName.c_str(), m_arrowOut.leftText.c_str());
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.RightText = '%s'",
+ tileName.c_str(), m_arrowOut.rightText.c_str());
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.CenterText = '%s'",
+ tileName.c_str(), m_arrowOut.centerText.c_str());
+ }
+
+ if (m_otherDirty) {
+ collectOtherData();
+
+ if (m_otherIn != nullptr) {
+ tileName = m_otherIn->getNameInDocument();
+ }
+
+ if ( (m_otherIn == nullptr) &&
+ (m_otherOut.toBeSaved) ) {
+ tileName = m_leadFeat->getDocument()->getUniqueObjectName("DrawTileWeld");
+ Command::doCommand(Command::Doc,"App.activeDocument().addObject('%s','%s')",
+ tileType.c_str(),tileName.c_str());
+ App::DocumentObject* newTile = m_leadFeat->getDocument()->getObject(tileName.c_str());
+ if (newTile == nullptr) {
+ throw Base::RuntimeError("TaskWeldingSymbol - new tile object not found");
+ }
+ tileFeats.push_back(newTile);
+ }
+
+ if (m_otherOut.toBeSaved) {
+ Command::doCommand(Command::Doc,"App.activeDocument().addObject('%s','%s')",
+ tileType.c_str(),tileName.c_str());
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.TileRow = %d",
+ tileName.c_str(), m_otherOut.row);
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.TileColumn = %d",
+ tileName.c_str(), m_otherOut.col);
+
+ if (m_otherOut.symbolPath.empty()) {
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.SymbolFile = ''",
+ tileName.c_str());
+ } else {
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.SymbolFile = '%s'",
+ tileName.c_str(), m_otherOut.symbolPath.c_str());
+ }
+
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.LeftText = '%s'",
+ tileName.c_str(), m_otherOut.leftText.c_str());
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.RightText = '%s'",
+ tileName.c_str(), m_otherOut.rightText.c_str());
+ Command::doCommand(Command::Doc,"App.activeDocument().%s.CenterText = '%s'",
+ tileName.c_str(), m_otherOut.centerText.c_str());
+ }
+ }
+
+ return tileFeats;
}
void TaskWeldingSymbol::saveButtons(QPushButton* btnOK,
@@ -458,15 +674,36 @@ std::string TaskWeldingSymbol::prefSymbolDir()
bool TaskWeldingSymbol::accept()
{
// Base::Console().Message("TWS::accept()\n");
- std::vector tileFeats = createTiles();
- App::DocumentObject* weldFeat = createWeldingSymbol();
- for (auto& obj: tileFeats) {
- TechDraw::DrawTileWeld* tile = dynamic_cast(obj);
- tile->TileParent.setValue(weldFeat);
+ if (m_createMode) {
+ m_weldFeat = createWeldingSymbol();
+ std::vector tileFeats = createTiles();
+ for (auto& obj: tileFeats) {
+ TechDraw::DrawTileWeld* tile = dynamic_cast(obj);
+ tile->TileParent.setValue(m_weldFeat);
+ }
+ m_weldFeat->recomputeFeature();
+ // m_weldFeat->requestPaint(); //not a dv!
+ } else {
+ try {
+ updateWeldingSymbol();
+ std::vector tileFeats = updateTiles();
+ for (auto& obj: tileFeats) { //new tiles only
+ TechDraw::DrawTileWeld* tile = dynamic_cast(obj);
+ tile->TileParent.setValue(m_weldFeat);
+ }
+ for (auto name: m_toRemove) {
+ Command::doCommand(Command::Doc,
+ "App.activeDocument().removeObject('%s')", name.c_str());
+ }
+ }
+
+ catch (...) {
+ Base::Console().Error("TWS::accept - failed to update symbol\n");
+ }
+
+ m_weldFeat->recomputeFeature();
+ // m_weldFeat->requestPaint(); //not a dv!
}
- weldFeat->recomputeFeature();
-// weldFeat->requestPaint(); //not a dv!
-
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
return true;
@@ -493,6 +730,16 @@ TaskDlgWeldingSymbol::TaskDlgWeldingSymbol(TechDraw::DrawLeaderLine* leader)
Content.push_back(taskbox);
}
+TaskDlgWeldingSymbol::TaskDlgWeldingSymbol(TechDraw::DrawWeldSymbol* weld)
+ : TaskDialog()
+{
+ widget = new TaskWeldingSymbol(weld);
+ taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-weldsymbol"),
+ widget->windowTitle(), true, 0);
+ taskbox->groupLayout()->addWidget(widget);
+ Content.push_back(taskbox);
+}
+
TaskDlgWeldingSymbol::~TaskDlgWeldingSymbol()
{
}
diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h
index a935545f62..231cb3bdf9 100644
--- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h
+++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h
@@ -32,7 +32,6 @@
#include
-
class Ui_TaskWeldingSymbol;
class Ui_TaskCL2Lines;
@@ -46,6 +45,8 @@ class DrawPage;
class DrawView;
class DrawLeaderLine;
class DrawWeldSymbol;
+class DrawTileWeld;
+class DrawTile;
}
namespace TechDraw
@@ -62,35 +63,55 @@ class QGIWeldSymbol;
class MDIViewPage;
//class ViewProviderWeld;
-class Tile2Add
+class TileImage
{
public:
- Tile2Add() {};
- ~Tile2Add() = default;
- bool arrowSide; // or is row enough?
+ TileImage() {};
+ ~TileImage() = default;
+ bool toBeSaved;
+ bool arrowSide;
int row;
int col;
std::string leftText;
std::string centerText;
std::string rightText;
std::string symbolPath;
+ std::string tileName;
+ void init(void) {
+ toBeSaved = false;
+ arrowSide = true;
+ row = 0;
+ col = 0;
+ leftText = "";
+ centerText = "";
+ rightText = "";
+ symbolPath= "";
+ tileName = "";
+ }
+
};
-class TaskWeldingSymbol : public QWidget
+class TechDrawGuiExport TaskWeldingSymbol : public QWidget
{
Q_OBJECT
public:
TaskWeldingSymbol(TechDraw::DrawLeaderLine* baseFeat);
+ TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weldFeat);
~TaskWeldingSymbol();
public Q_SLOTS:
- void onArrow0Clicked(bool b);
- void onArrow1Clicked(bool b);
- void onOther0Clicked(bool b);
- void onOther1Clicked(bool b);
+ void onArrowSymbolClicked(bool b);
+
+ void onOtherSymbolClicked(bool b);
+ void onOtherEraseClicked(bool b);
+
+ void onArrowTextChanged(const QString& qs);
+ void onOtherTextChanged(const QString& qs);
+
void onDirectorySelected(const QString& newDir);
-
+ void onSymbolSelected(QString symbolPath, QString source);
+
public:
virtual bool accept();
virtual bool reject();
@@ -98,7 +119,6 @@ public:
void saveButtons(QPushButton* btnOK,
QPushButton* btnCancel);
void enableTaskButtons(bool b);
- void setFlipped(bool b);
protected Q_SLOTS:
@@ -109,34 +129,43 @@ protected:
void setUiPrimary(void);
void setUiEdit();
- void turnOnArrow();
- void turnOnOther();
- void removePendingTile(int row, int col);
-
-
- App::DocumentObject* createWeldingSymbol(void);
+ TechDraw::DrawWeldSymbol* createWeldingSymbol(void);
void updateWeldingSymbol(void);
- std::vector createTiles(void);
- void loadSymbolNames(QString pathToSymbols);
+ std::vector createTiles(void);
+ std::vector updateTiles(void);
+
+ void collectArrowData(void);
+ void collectOtherData(void);
std::string prefSymbolDir();
+ void saveState(void);
+
QString m_currDir;
-
private:
- Ui_TaskWeldingSymbol * ui;
+ Ui_TaskWeldingSymbol* ui;
TechDraw::DrawLeaderLine* m_leadFeat;
TechDraw::DrawWeldSymbol* m_weldFeat;
+ TechDraw::DrawTileWeld* m_arrowIn;
+ TechDraw::DrawTileWeld* m_otherIn;
- std::vector m_tiles2Add;
+ TileImage m_arrowOut;
+ TileImage m_otherOut;
+
+ QString m_arrowPath;
+ QString m_otherPath;
+
+ std::vector m_toRemove;
QPushButton* m_btnOK;
QPushButton* m_btnCancel;
- int m_arrowCount;
- int m_otherCount;
+ bool m_createMode;
+
+ bool m_arrowDirty;
+ bool m_otherDirty;
};
@@ -146,6 +175,7 @@ class TaskDlgWeldingSymbol : public Gui::TaskView::TaskDialog
public:
TaskDlgWeldingSymbol(TechDraw::DrawLeaderLine* leader);
+ TaskDlgWeldingSymbol(TechDraw::DrawWeldSymbol* weld);
~TaskDlgWeldingSymbol();
public:
diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui
index a72b219b08..22e2949735 100644
--- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui
+++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui
@@ -6,8 +6,8 @@
0
0
- 409
- 578
+ 423
+ 374
@@ -50,63 +50,63 @@
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 32
-
-
-
-
- 0
- 32
-
-
-
- Add an Arrow Side Symbol
-
-
-
-
-
- Add
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 32
-
-
-
-
- 0
- 32
-
-
-
- Add an Arrow Side Symbol
-
-
- Add
-
-
+
+
-
+
+
+ Text before arrow side symbol
+
+
+
+ -
+
+
+ Text after arrow side symbol
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 32
+
+
+
+
+ 0
+ 32
+
+
+
+ Pick arrow side symbol
+
+
+
+
+
+ Symbol
+
+
+ false
+
+
+
+ -
+
+
+ Text above arrow side symbol
+
+
+
+
@@ -126,176 +126,69 @@
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 32
-
-
-
-
- 0
- 32
-
-
-
- Add an Other Side Symbol
-
-
- Add
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 32
-
-
-
-
- 0
- 32
-
-
-
- Add an Other Side Symbol
-
-
- Add
-
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 128
-
-
-
-
- 16777215
- 256
-
-
-
-
- 0
- 64
-
-
-
-
- 0
- 128
-
-
-
- Select a symbol
-
-
- QListView::Static
-
-
- QListView::LeftToRight
-
-
- true
-
-
- QListView::Adjust
-
-
-
- 64
- 64
-
-
-
- QListView::IconMode
-
-
- false
-
-
- false
-
-
- -1
-
-
-
- -
-
-
- QFormLayout::AllNonFixedFieldsGrow
-
-
-
-
-
- Left Text
+
+
-
+
+
+ Text after other side symbol
-
-
+
- Text before symbol
+ Pick other side symbol
+
+
+ Symbol
- -
-
-
- Center Text
+
-
+
+
+ Text before other side symbol
-
-
+
- Text above/below symbol
+ Text below other side symbol
- -
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 60
+ 30
+
+
+
+
+ 60
+ 30
+
+
+
+
+ 60
+ 30
+
+
+
+ Remove other side symbol
+
- Right Text
-
-
-
- -
-
-
- Text after symbol
+ Delete
@@ -313,72 +206,88 @@
-
-
-
- QFormLayout::AllNonFixedFieldsGrow
-
-
-
-
-
- Symbol Directory
-
-
+
+
-
+
+
-
+
+
+ Field Weld
+
+
+
+ -
+
+
+ All Around
+
+
+
+ -
+
+
+ Alternating
+
+
+
+
- -
-
-
- Pick a directory of welding symbols
+
-
+
+
+ QFormLayout::AllNonFixedFieldsGrow
-
- Gui::FileChooser::Directory
-
-
- *.svg
-
-
-
- -
-
-
- Process Text
-
-
-
- -
-
-
- Text at end of symbol
-
-
-
- -
-
-
- Show on site flag
-
-
- Field Weld
-
-
- false
-
-
-
- -
-
-
- show perimeter circle
-
-
- All Around
-
-
- false
-
-
+
-
+
+
+ Tail Text
+
+
+
+ -
+
+
+ Text at end of symbol
+
+
+
+ -
+
+
+ Symbol Directory
+
+
+
+ -
+
+
+ Pick a directory of welding symbols
+
+
+ Gui::FileChooser::Directory
+
+
+ *.svg
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
diff --git a/src/Mod/TechDraw/Gui/ViewProviderWeld.cpp b/src/Mod/TechDraw/Gui/ViewProviderWeld.cpp
index f74656befc..a7bb5226d2 100644
--- a/src/Mod/TechDraw/Gui/ViewProviderWeld.cpp
+++ b/src/Mod/TechDraw/Gui/ViewProviderWeld.cpp
@@ -34,9 +34,17 @@
#include
#include
#include
-#include
+
+#include
+#include
+#include
+#include
+#include
+#include
#include
+#include "TaskWeldingSymbol.h"
+
#include "ViewProviderWeld.h"
using namespace TechDrawGui;
@@ -99,6 +107,42 @@ std::vector ViewProviderWeld::claimChildren(void) const
}
}
+bool ViewProviderWeld::setEdit(int ModNum)
+{
+// Base::Console().Message("VPW::setEdit(%d)\n",ModNum);
+ if (ModNum == ViewProvider::Default ) {
+ if (Gui::Control().activeDialog()) { //TaskPanel already open!
+ return false;
+ }
+ // clear the selection (convenience)
+ Gui::Selection().clearSelection();
+ Gui::Control().showDialog(new TaskDlgWeldingSymbol(getFeature()));
+ return true;
+ } else {
+ return ViewProviderDrawingView::setEdit(ModNum);
+ }
+ return true;
+}
+
+void ViewProviderWeld::unsetEdit(int ModNum)
+{
+ Q_UNUSED(ModNum);
+ if (ModNum == ViewProvider::Default) {
+ Gui::Control().closeDialog();
+ }
+ else {
+ ViewProviderDrawingView::unsetEdit(ModNum);
+ }
+}
+
+bool ViewProviderWeld::doubleClicked(void)
+{
+// Base::Console().Message("VPW::doubleClicked()\n");
+ setEdit(ViewProvider::Default);
+ return true;
+}
+
+
TechDraw::DrawWeldSymbol* ViewProviderWeld::getViewObject() const
{
return dynamic_cast(pcObject);
diff --git a/src/Mod/TechDraw/Gui/ViewProviderWeld.h b/src/Mod/TechDraw/Gui/ViewProviderWeld.h
index 49adea59f7..5ee63c520f 100644
--- a/src/Mod/TechDraw/Gui/ViewProviderWeld.h
+++ b/src/Mod/TechDraw/Gui/ViewProviderWeld.h
@@ -52,6 +52,9 @@ public:
virtual std::vector getDisplayModes(void) const;
virtual void updateData(const App::Property*);
virtual std::vector claimChildren(void) const;
+ virtual bool setEdit(int ModNum);
+ virtual void unsetEdit(int ModNum);
+ virtual bool doubleClicked(void);
virtual TechDraw::DrawWeldSymbol* getViewObject() const;
virtual TechDraw::DrawWeldSymbol* getFeature() const;