From 044fe795490a162d250070648dbadce98b3ecdeb Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sat, 8 Jun 2019 11:16:51 -0400 Subject: [PATCH] SVG Refactor - minor cleanups --- src/Mod/TechDraw/App/AppTechDraw.cpp | 1 + src/Mod/TechDraw/App/DrawPage.cpp | 12 +++ src/Mod/TechDraw/App/DrawPage.h | 3 + src/Mod/TechDraw/App/QDomNodeModel.cpp | 1 + src/Mod/TechDraw/App/QDomNodeModel.h | 26 ++++++ src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp | 3 +- src/Mod/TechDraw/Templates/A4_LandscapeTD.svg | 13 +-- src/Mod/TechDraw/Templates/ANSIB.svg | 92 ++++++++----------- src/Mod/TechDraw/Templates/ANSIB_Portrait.svg | 50 +++------- 9 files changed, 100 insertions(+), 101 deletions(-) diff --git a/src/Mod/TechDraw/App/AppTechDraw.cpp b/src/Mod/TechDraw/App/AppTechDraw.cpp index 761731a5a9..bf5f491193 100644 --- a/src/Mod/TechDraw/App/AppTechDraw.cpp +++ b/src/Mod/TechDraw/App/AppTechDraw.cpp @@ -97,6 +97,7 @@ PyMOD_INIT_FUNC(TechDraw) TechDraw::DrawViewImage ::init(); // Python Types + TechDraw::DrawPagePython ::init(); TechDraw::DrawViewPython ::init(); TechDraw::DrawViewPartPython ::init(); TechDraw::DrawViewMultiPython ::init(); diff --git a/src/Mod/TechDraw/App/DrawPage.cpp b/src/Mod/TechDraw/App/DrawPage.cpp index 61ad4e9d86..8bcc87485a 100644 --- a/src/Mod/TechDraw/App/DrawPage.cpp +++ b/src/Mod/TechDraw/App/DrawPage.cpp @@ -481,4 +481,16 @@ void DrawPage::Restore(Base::XMLReader &reader) reader.readEndElement("Properties"); } +// Python Drawing feature --------------------------------------------------------- +namespace App { +/// @cond DOXERR +PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawPagePython, TechDraw::DrawPage) +template<> const char* TechDraw::DrawPagePython::getViewProviderName(void) const { + return "TechDrawGui::ViewProviderPage"; +} +/// @endcond + +// explicit template instantiation +template class TechDrawExport FeaturePythonT; +} diff --git a/src/Mod/TechDraw/App/DrawPage.h b/src/Mod/TechDraw/App/DrawPage.h index 51e59bfd06..70362a95a8 100644 --- a/src/Mod/TechDraw/App/DrawPage.h +++ b/src/Mod/TechDraw/App/DrawPage.h @@ -111,7 +111,10 @@ private: }; +typedef App::FeaturePythonT DrawPagePython; + } //namespace TechDraw #endif + diff --git a/src/Mod/TechDraw/App/QDomNodeModel.cpp b/src/Mod/TechDraw/App/QDomNodeModel.cpp index b496285f1c..7e3f890522 100644 --- a/src/Mod/TechDraw/App/QDomNodeModel.cpp +++ b/src/Mod/TechDraw/App/QDomNodeModel.cpp @@ -22,6 +22,7 @@ // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// * Used under BSD license 2.0 * #include "PreCompiled.h" diff --git a/src/Mod/TechDraw/App/QDomNodeModel.h b/src/Mod/TechDraw/App/QDomNodeModel.h index 8ac71cb29a..b6d7f22d9c 100644 --- a/src/Mod/TechDraw/App/QDomNodeModel.h +++ b/src/Mod/TechDraw/App/QDomNodeModel.h @@ -1,3 +1,29 @@ +// Copyright (c) 2011 Stanislaw Adaszewski, portions (c) 2019 Tomas Pavlicek +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of Stanislaw Adaszewski nor the +// names of other contributors may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL STANISLAW ADASZEWSKI BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// * Used under BSD license 2.0 * + #ifndef _QDOMNODEMODEL_H_ #define _QDOMNODEMODEL_H_ diff --git a/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp b/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp index d7c95f9479..0ec05e485f 100644 --- a/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp @@ -126,13 +126,14 @@ void QGIViewAnnotation::drawAnnotation() } const std::vector& annoText = viewAnno->Text.getValues(); + int fontSize = calculateFontPixelSize(viewAnno->TextSize.getValue()); //build HTML/CSS formatting around Text lines std::stringstream ss; ss << "\n\n