From f25826bba3124f46e267d9a4cf078dda7e6c031d Mon Sep 17 00:00:00 2001 From: wandererfan Date: Wed, 5 Jun 2019 16:03:22 -0400 Subject: [PATCH] Change Face centerline command name and icon --- src/Mod/TechDraw/Gui/CommandAnnotate.cpp | 16 +- src/Mod/TechDraw/Gui/Resources/TechDraw.qrc | 4 +- ...erline.svg => techdraw-facecenterline.svg} | 186 ++++++++++++++---- src/Mod/TechDraw/Gui/TaskCenterLine.cpp | 21 +- src/Mod/TechDraw/Gui/TaskCenterLine.ui | 2 +- src/Mod/TechDraw/Gui/Workbench.cpp | 4 +- 6 files changed, 171 insertions(+), 62 deletions(-) rename src/Mod/TechDraw/Gui/Resources/icons/actions/{techdraw-centerline.svg => techdraw-facecenterline.svg} (60%) diff --git a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp index a3d7012cd7..910f9700be 100644 --- a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp +++ b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp @@ -587,21 +587,21 @@ bool CmdTechDrawAnnotation::isActive(void) // TechDraw_Centerline //=========================================================================== -DEF_STD_CMD_A(CmdTechDrawCenterLine); +DEF_STD_CMD_A(CmdTechDrawFaceCenterLine); -CmdTechDrawCenterLine::CmdTechDrawCenterLine() - : Command("TechDraw_CenterLine") +CmdTechDrawFaceCenterLine::CmdTechDrawFaceCenterLine() + : Command("TechDraw_FaceCenterLine") { sAppModule = "TechDraw"; sGroup = QT_TR_NOOP("TechDraw"); sMenuText = QT_TR_NOOP("Add a centerline to a Face(s)"); sToolTipText = QT_TR_NOOP("Add a centerline to a Face(s)"); - sWhatsThis = "TechDraw_CenterLine"; + sWhatsThis = "TechDraw_FaceCenterLine"; sStatusTip = sToolTipText; - sPixmap = "actions/techdraw-centerline"; + sPixmap = "actions/techdraw-facecenterline"; } -void CmdTechDrawCenterLine::activated(int iMsg) +void CmdTechDrawFaceCenterLine::activated(int iMsg) { Q_UNUSED(iMsg); @@ -652,7 +652,7 @@ void CmdTechDrawCenterLine::activated(int iMsg) SubNames)); } -bool CmdTechDrawCenterLine::isActive(void) +bool CmdTechDrawFaceCenterLine::isActive(void) { bool havePage = DrawGuiUtil::needPage(this); bool haveView = DrawGuiUtil::needView(this, false); @@ -762,7 +762,7 @@ void CreateTechDrawCommandsAnnotate(void) rcCmdMgr.addCommand(new CmdTechDrawMidpoints()); rcCmdMgr.addCommand(new CmdTechDrawQuadrant()); rcCmdMgr.addCommand(new CmdTechDrawAnnotation()); - rcCmdMgr.addCommand(new CmdTechDrawCenterLine()); + rcCmdMgr.addCommand(new CmdTechDrawFaceCenterLine()); rcCmdMgr.addCommand(new CmdTechDrawCosmeticEraser()); } diff --git a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc index fac7020ae3..4297c3ab87 100644 --- a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc +++ b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc @@ -66,7 +66,7 @@ icons/actions/techdraw-point.svg icons/actions/techdraw-midpoint.svg icons/actions/techdraw-quadrant.svg - icons/actions/techdraw-centerline.svg + icons/actions/techdraw-facecenterline.svg icons/actions/techdraw-eraser.svg icons/actions/section-up.svg icons/actions/section-down.svg @@ -145,4 +145,4 @@ translations/TechDraw_ar.qm translations/TechDraw_vi.qm - + diff --git a/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-centerline.svg b/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-facecenterline.svg similarity index 60% rename from src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-centerline.svg rename to src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-facecenterline.svg index acad530d56..c81914884c 100644 --- a/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-centerline.svg +++ b/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-facecenterline.svg @@ -14,7 +14,7 @@ width="64" height="64" id="svg3085" - sodipodi:docname="techdraw-centerline.svg" + sodipodi:docname="techdraw-facecenterline.svg" inkscape:version="0.92.4 (unknown)"> + id="grid985" + empspacing="2" + color="#ff423f" + opacity="0.1254902" /> + + + + + id="linearGradient5062-3"> + gradientTransform="rotate(-18.319839,64.341466,-116.09907)" /> + gradientTransform="rotate(-18.319839,75.134275,-113.93787)" /> + + @@ -307,43 +341,117 @@ id="rect2535" width="52" height="15" - x="6" - y="24.5" /> + x="60" + y="74" /> + id="g1246" + transform="translate(0.3521777,68.322473)"> - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Gui/TaskCenterLine.cpp b/src/Mod/TechDraw/Gui/TaskCenterLine.cpp index d010b43ca8..dd7acd7887 100644 --- a/src/Mod/TechDraw/Gui/TaskCenterLine.cpp +++ b/src/Mod/TechDraw/Gui/TaskCenterLine.cpp @@ -295,6 +295,8 @@ TechDraw::CosmeticEdge* TaskCenterLine::calcEndPoints(std::vector f Bnd_Box faceBox; faceBox.SetGap(0.0); + double scale = m_partFeat->getScale(); + for (auto& fn: faceNames) { if (TechDraw::DrawUtil::getGeomTypeFromName(fn) != "Face") { continue; @@ -309,16 +311,15 @@ TechDraw::CosmeticEdge* TaskCenterLine::calcEndPoints(std::vector f } } - double scale = m_partFeat->getScale(); double Xmin,Ymin,Zmin,Xmax,Ymax,Zmax; faceBox.Get(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax); double Xspan = fabs(Xmax - Xmin); - Xspan = (Xspan / 2.0) + (ext * scale); + Xspan = (Xspan / 2.0) + (ext); double Xmid = Xmin + fabs(Xmax - Xmin) / 2.0; double Yspan = fabs(Ymax - Ymin); - Yspan = (Yspan / 2.0) + (ext * scale); + Yspan = (Yspan / 2.0) + (ext); double Ymid = Ymin + fabs(Ymax - Ymin) / 2.0; Base::Vector3d bbxCenter(Xmid, Ymid, 0.0); @@ -327,16 +328,16 @@ TechDraw::CosmeticEdge* TaskCenterLine::calcEndPoints(std::vector f if (vert) { Base::Vector3d top(Xmid, Ymid - Yspan, 0.0); Base::Vector3d bottom(Xmid, Ymid + Yspan, 0.0); - p1 = top; - p2 = bottom; + p1 = top / scale; + p2 = bottom / scale; } else { Base::Vector3d left(Xmid - Xspan, Ymid, 0.0); Base::Vector3d right(Xmid + Xspan, Ymid, 0.0); - p1 = left; - p2 = right; + p1 = left / scale; + p2 = right / scale; } - result = new TechDraw::CosmeticEdge(p1,p2); + result = new TechDraw::CosmeticEdge(p1, p2, scale); App::Color ac; ac.setValue(ui->cpLineColor->color()); result->color = ac; @@ -437,7 +438,7 @@ TaskDlgCenterLine::TaskDlgCenterLine(TechDraw::DrawViewPart* partFeat, : TaskDialog() { widget = new TaskCenterLine(partFeat,page,subNames); - taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-centerline"), + taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-facecenterline"), widget->windowTitle(), true, 0); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); @@ -447,7 +448,7 @@ TaskDlgCenterLine::TaskDlgCenterLine(TechDraw::DrawViewPart* partFeat, // : TaskDialog() //{ // widget = new TaskCenterLine(partVP); -// taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-centerline"), +// taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-facecenterline"), // widget->windowTitle(), true, 0); // taskbox->groupLayout()->addWidget(widget); // Content.push_back(taskbox); diff --git a/src/Mod/TechDraw/Gui/TaskCenterLine.ui b/src/Mod/TechDraw/Gui/TaskCenterLine.ui index bb0d719d80..c5aa98ba39 100644 --- a/src/Mod/TechDraw/Gui/TaskCenterLine.ui +++ b/src/Mod/TechDraw/Gui/TaskCenterLine.ui @@ -27,7 +27,7 @@ - :/icons/actions/techdraw-centerline.svg:/icons/actions/techdraw-centerline.svg + :/icons/actions/techdraw-facecenterline.svg:/icons/actions/techdraw-facecenterline.svg diff --git a/src/Mod/TechDraw/Gui/Workbench.cpp b/src/Mod/TechDraw/Gui/Workbench.cpp index 647846c7ab..1f9d9f82bf 100644 --- a/src/Mod/TechDraw/Gui/Workbench.cpp +++ b/src/Mod/TechDraw/Gui/Workbench.cpp @@ -156,7 +156,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const *anno << "TechDraw_LeaderLine"; *anno << "TechDraw_RichAnno"; *anno << "TechDraw_CosmeticVertexGrp"; - *anno << "TechDraw_CenterLine"; + *anno << "TechDraw_FaceCenterLine"; *anno << "TechDraw_CosmeticEraser"; return root; @@ -218,7 +218,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const *anno << "TechDraw_LeaderLine"; *anno << "TechDraw_RichAnno"; *anno << "TechDraw_CosmeticVertexGrp"; - *anno << "TechDraw_CenterLine"; + *anno << "TechDraw_FaceCenterLine"; *anno << "TechDraw_CosmeticEraser"; return root;