diff --git a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake index eccec0dcb2..744fdd8ce9 100644 --- a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake +++ b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake @@ -27,7 +27,7 @@ macro(PrintFinalReport) message(STATUS "pybind11: not enabled") endif(DEFINED pybind11_FOUND) - message(STATUS "Boost: ${Boost_VERSION}") + message(STATUS "Boost: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} (${Boost_VERSION})") message(STATUS "XercesC: [${XercesC_LIBRARIES}] [${XercesC_INCLUDE_DIRS}]") diff --git a/src/Gui/CommandFeat.cpp b/src/Gui/CommandFeat.cpp index 008534ec76..90b3365c03 100644 --- a/src/Gui/CommandFeat.cpp +++ b/src/Gui/CommandFeat.cpp @@ -75,6 +75,7 @@ StdCmdRandomColor::StdCmdRandomColor() sToolTipText = QT_TR_NOOP("Random color"); sWhatsThis = "Std_RandomColor"; sStatusTip = QT_TR_NOOP("Random color"); + sPixmap = "Std_RandomColor"; } void StdCmdRandomColor::activated(int iMsg) diff --git a/src/Gui/CommandStd.cpp b/src/Gui/CommandStd.cpp index 0a6698f08e..8166e27059 100644 --- a/src/Gui/CommandStd.cpp +++ b/src/Gui/CommandStd.cpp @@ -514,6 +514,33 @@ void StdCmdOnlineHelpWebsite::activated(int iMsg) OpenURLInBrowser(url.c_str()); } +//=========================================================================== +// Std_FreeCADDonation +//=========================================================================== + +DEF_STD_CMD(StdCmdFreeCADDonation) + +StdCmdFreeCADDonation::StdCmdFreeCADDonation() + :Command("Std_FreeCADDonation") +{ + sGroup = QT_TR_NOOP("Help"); + sMenuText = QT_TR_NOOP("Donate"); + sToolTipText = QT_TR_NOOP("Donate to FreeCAD development"); + sWhatsThis = "Std_FreeCADDonation"; + sStatusTip = sToolTipText; + sPixmap = "internet-web-browser"; + eType = 0; +} + +void StdCmdFreeCADDonation::activated(int iMsg) +{ + Q_UNUSED(iMsg); + ParameterGrp::handle hURLGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Websites"); + std::string url = hURLGrp->GetASCII("DonatePage", "https://wiki.freecadweb.org/Donate"); + hURLGrp->SetASCII("DonatePage", url.c_str()); + OpenURLInBrowser(url.c_str()); +} + //=========================================================================== // Std_FreeCADWebsite //=========================================================================== @@ -814,6 +841,7 @@ void CreateStdCommands(void) rcCmdMgr.addCommand(new StdCmdOnlineHelp()); rcCmdMgr.addCommand(new StdCmdOnlineHelpWebsite()); rcCmdMgr.addCommand(new StdCmdFreeCADWebsite()); + rcCmdMgr.addCommand(new StdCmdFreeCADDonation()); rcCmdMgr.addCommand(new StdCmdFreeCADUserHub()); rcCmdMgr.addCommand(new StdCmdFreeCADPowerUserHub()); rcCmdMgr.addCommand(new StdCmdFreeCADForum()); diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 0a4383be5a..b225764910 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -563,6 +563,7 @@ StdCmdToggleClipPlane::StdCmdToggleClipPlane() sToolTipText = QT_TR_NOOP("Toggles clipping plane for active view"); sWhatsThis = "Std_ToggleClipPlane"; sStatusTip = QT_TR_NOOP("Toggles clipping plane for active view"); + sPixmap = "Std_ToggleClipPlane"; eType = Alter3DView; } @@ -862,6 +863,7 @@ StdCmdToggleVisibility::StdCmdToggleVisibility() sToolTipText = QT_TR_NOOP("Toggles visibility"); sStatusTip = QT_TR_NOOP("Toggles visibility"); sWhatsThis = "Std_ToggleVisibility"; + sPixmap = "Std_ToggleVisibility"; sAccel = "Space"; eType = Alter3DView; } @@ -938,6 +940,7 @@ StdCmdShowSelection::StdCmdShowSelection() sToolTipText = QT_TR_NOOP("Show all selected objects"); sStatusTip = QT_TR_NOOP("Show all selected objects"); sWhatsThis = "Std_ShowSelection"; + sPixmap = "Std_ShowSelection"; eType = Alter3DView; } @@ -965,6 +968,7 @@ StdCmdHideSelection::StdCmdHideSelection() sToolTipText = QT_TR_NOOP("Hide all selected objects"); sStatusTip = QT_TR_NOOP("Hide all selected objects"); sWhatsThis = "Std_HideSelection"; + sPixmap = "Std_HideSelection"; eType = Alter3DView; } @@ -992,6 +996,7 @@ StdCmdSelectVisibleObjects::StdCmdSelectVisibleObjects() sToolTipText = QT_TR_NOOP("Select visible objects in the active document"); sStatusTip = QT_TR_NOOP("Select visible objects in the active document"); sWhatsThis = "Std_SelectVisibleObjects"; + sPixmap = "Std_SelectVisibleObjects"; eType = Alter3DView; } @@ -1033,6 +1038,7 @@ StdCmdToggleObjects::StdCmdToggleObjects() sToolTipText = QT_TR_NOOP("Toggles visibility of all objects in the active document"); sStatusTip = QT_TR_NOOP("Toggles visibility of all objects in the active document"); sWhatsThis = "Std_ToggleObjects"; + sPixmap = "Std_ToggleObjects"; eType = Alter3DView; } @@ -1073,6 +1079,7 @@ StdCmdShowObjects::StdCmdShowObjects() sToolTipText = QT_TR_NOOP("Show all objects in the document"); sStatusTip = QT_TR_NOOP("Show all objects in the document"); sWhatsThis = "Std_ShowObjects"; + sPixmap = "Std_ShowObjects"; eType = Alter3DView; } @@ -1109,6 +1116,7 @@ StdCmdHideObjects::StdCmdHideObjects() sToolTipText = QT_TR_NOOP("Hide all objects in the document"); sStatusTip = QT_TR_NOOP("Hide all objects in the document"); sWhatsThis = "Std_HideObjects"; + sPixmap = "Std_HideObjects"; eType = Alter3DView; } @@ -1188,7 +1196,7 @@ StdCmdViewHome::StdCmdViewHome() sToolTipText = QT_TR_NOOP("Set to default home view"); sWhatsThis = "Std_ViewHome"; sStatusTip = QT_TR_NOOP("Set to default home view"); - //sPixmap = "view-home"; + sPixmap = "Std_ViewHome"; sAccel = "Home"; eType = Alter3DView; } @@ -1384,6 +1392,7 @@ StdCmdViewDimetric::StdCmdViewDimetric() sToolTipText= QT_TR_NOOP("Set to dimetric view"); sWhatsThis = "Std_ViewDimetric"; sStatusTip = QT_TR_NOOP("Set to dimetric view"); + sPixmap = "Std_ViewDimetric"; eType = Alter3DView; } @@ -1406,6 +1415,7 @@ StdCmdViewTrimetric::StdCmdViewTrimetric() sToolTipText= QT_TR_NOOP("Set to trimetric view"); sWhatsThis = "Std_ViewTrimetric"; sStatusTip = QT_TR_NOOP("Set to trimetric view"); + sPixmap = "Std_ViewTrimetric"; eType = Alter3DView; } @@ -2025,6 +2035,7 @@ StdCmdToggleNavigation::StdCmdToggleNavigation() sWhatsThis = "Std_ToggleNavigation"; //iAccel = Qt::SHIFT+Qt::Key_Space; sAccel = "Esc"; + sPixmap = "Std_ToggleNavigation"; eType = Alter3DView; } @@ -2072,6 +2083,7 @@ public: sToolTipText = QT_TR_NOOP("Toggle axis cross"); sStatusTip = QT_TR_NOOP("Toggle axis cross"); sWhatsThis = "Std_AxisCross"; + sPixmap = "Std_AxisCross"; } ~StdCmdAxisCross() { @@ -2431,7 +2443,7 @@ StdCmdViewIvIssueCamPos::StdCmdViewIvIssueCamPos() sToolTipText = QT_TR_NOOP("Issue the camera position to the console and to a macro, to easily recall this position"); sWhatsThis = "Std_ViewIvIssueCamPos"; sStatusTip = QT_TR_NOOP("Issue the camera position to the console and to a macro, to easily recall this position"); - sPixmap = "Std_Tool8"; + sPixmap = "Std_ViewIvIssueCamPos"; eType = Alter3DView; } @@ -3099,6 +3111,7 @@ StdCmdTextureMapping::StdCmdTextureMapping() sToolTipText = QT_TR_NOOP("Texture mapping"); sWhatsThis = "Std_TextureMapping"; sStatusTip = QT_TR_NOOP("Texture mapping"); + sPixmap = "Std_TextureMapping"; eType = Alter3DView; } diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 4b28736248..0b938181ff 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -477,8 +477,10 @@ void Document::_resetEdit(void) // the editing object gets deleted inside the above call to // 'finishEditing()', which will trigger our slotDeletedObject(), which // nullifies _editViewProvider. - if (d->_editViewProvider && d->_editViewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) - signalResetEdit(*(static_cast(d->_editViewProvider))); + if (d->_editViewProvider && d->_editViewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + auto vpd = static_cast(d->_editViewProvider); + vpd->getDocument()->signalResetEdit(*vpd); + } d->_editViewProvider = 0; // The logic below is not necessary anymore, because this method is diff --git a/src/Gui/Icons/Std_AxisCross.svg b/src/Gui/Icons/Std_AxisCross.svg new file mode 100644 index 0000000000..135ac9736e --- /dev/null +++ b/src/Gui/Icons/Std_AxisCross.svg @@ -0,0 +1,231 @@ + + + Std_AxisCross + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_AxisCross + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + 2020/12/20 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_HideObjects.svg b/src/Gui/Icons/Std_HideObjects.svg new file mode 100644 index 0000000000..2453750545 --- /dev/null +++ b/src/Gui/Icons/Std_HideObjects.svg @@ -0,0 +1,518 @@ + + + Std_HideObjects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_HideObjects + 2020/12/25 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + + + eye + box + page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_HideSelection.svg b/src/Gui/Icons/Std_HideSelection.svg new file mode 100644 index 0000000000..08eb31a483 --- /dev/null +++ b/src/Gui/Icons/Std_HideSelection.svg @@ -0,0 +1,209 @@ + + + Std_HideSelection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_HideSelection + 2020/12/25 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + + + eye + arrow + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_RandomColor.svg b/src/Gui/Icons/Std_RandomColor.svg new file mode 100644 index 0000000000..fa6ce634db --- /dev/null +++ b/src/Gui/Icons/Std_RandomColor.svg @@ -0,0 +1,299 @@ + + + Std_RandomColor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_RandomColor + + + bitacovir + + + + + + + + + + + + 2020/12/15 + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_SelectVisibleObjects.svg b/src/Gui/Icons/Std_SelectVisibleObjects.svg new file mode 100644 index 0000000000..5a576ed73f --- /dev/null +++ b/src/Gui/Icons/Std_SelectVisibleObjects.svg @@ -0,0 +1,304 @@ + + + Std_SelectVisibleObjects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_SelectVisibleObjects + 2020/12/25 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + + + eye + arrow + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_ShowObjects.svg b/src/Gui/Icons/Std_ShowObjects.svg new file mode 100644 index 0000000000..d00f63b68e --- /dev/null +++ b/src/Gui/Icons/Std_ShowObjects.svg @@ -0,0 +1,554 @@ + + + Std_ShowObjects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ShowObjects + 2020/12/25 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + + + eye + cube + page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_ShowSelection.svg b/src/Gui/Icons/Std_ShowSelection.svg new file mode 100644 index 0000000000..8282ffd0bd --- /dev/null +++ b/src/Gui/Icons/Std_ShowSelection.svg @@ -0,0 +1,223 @@ + + + Std_ShowSelection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ShowSelection + 2020/12/25 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + + + eye + arrow + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_TextureMapping.svg b/src/Gui/Icons/Std_TextureMapping.svg new file mode 100644 index 0000000000..80fc8956b5 --- /dev/null +++ b/src/Gui/Icons/Std_TextureMapping.svg @@ -0,0 +1,153 @@ + + + Std_TextureMapping + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_TextureMapping + 2020/12/17 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_ToggleClipPlane.svg b/src/Gui/Icons/Std_ToggleClipPlane.svg new file mode 100644 index 0000000000..abc7e62f90 --- /dev/null +++ b/src/Gui/Icons/Std_ToggleClipPlane.svg @@ -0,0 +1,146 @@ + + + Std_ToggleClipPlane + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ToggleClipPlane + + + [bitacovir] + + + Arch_SectionPlane + 2020-12-17 + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + FreeCAD + + + + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html + + + Based on Agryson's work + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_ToggleNavigation.svg b/src/Gui/Icons/Std_ToggleNavigation.svg new file mode 100644 index 0000000000..f00fb55718 --- /dev/null +++ b/src/Gui/Icons/Std_ToggleNavigation.svg @@ -0,0 +1,150 @@ + + + Std_ToggleNavigation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ToggleNavigation + + 2020/12/17 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + based on Alexander Gryson, wmayer's work + + + + + + esc + + + arrow-ccw + https://www.gnu.org/copyleft/lesser.html + + + + diff --git a/src/Gui/Icons/Std_ToggleObjects.svg b/src/Gui/Icons/Std_ToggleObjects.svg new file mode 100644 index 0000000000..79a9e81d25 --- /dev/null +++ b/src/Gui/Icons/Std_ToggleObjects.svg @@ -0,0 +1,477 @@ + + + Std_ToggleObjects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ToggleObjects + 2020/12/25 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + + + eye + page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_ToggleVisibility.svg b/src/Gui/Icons/Std_ToggleVisibility.svg new file mode 100644 index 0000000000..bd0d717f70 --- /dev/null +++ b/src/Gui/Icons/Std_ToggleVisibility.svg @@ -0,0 +1,172 @@ + + + Std_ToggleVisibility + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ToggleVisibility + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_ViewDimetric.svg b/src/Gui/Icons/Std_ViewDimetric.svg new file mode 100644 index 0000000000..89dd74dc80 --- /dev/null +++ b/src/Gui/Icons/Std_ViewDimetric.svg @@ -0,0 +1,142 @@ + + + Std_ViewDimetric + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ViewDimetric + 2020/12/10 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_ViewHome.svg b/src/Gui/Icons/Std_ViewHome.svg new file mode 100644 index 0000000000..246fcbe7b7 --- /dev/null +++ b/src/Gui/Icons/Std_ViewHome.svg @@ -0,0 +1,133 @@ + + + Std_ViewHome + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ViewHome + 2020/12/15 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_ViewIvIssueCamPos.svg b/src/Gui/Icons/Std_ViewIvIssueCamPos.svg new file mode 100644 index 0000000000..654c096c46 --- /dev/null +++ b/src/Gui/Icons/Std_ViewIvIssueCamPos.svg @@ -0,0 +1,172 @@ + + + Std_ViewIvIssueCamPos + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ViewIvIssueCamPos + 2020/12/10 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/Std_ViewTrimetric.svg b/src/Gui/Icons/Std_ViewTrimetric.svg new file mode 100644 index 0000000000..a679323ee4 --- /dev/null +++ b/src/Gui/Icons/Std_ViewTrimetric.svg @@ -0,0 +1,142 @@ + + + Std_ViewTrimetric + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Std_ViewTrimetric + 2020/12/10 + + + [bitacovir] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/resource.qrc b/src/Gui/Icons/resource.qrc index 23baacf303..597b985081 100644 --- a/src/Gui/Icons/resource.qrc +++ b/src/Gui/Icons/resource.qrc @@ -141,6 +141,7 @@ DrawStyleHiddenLine.svg DrawStyleNoShading.svg user.svg + Std_AxisCross.svg Std_CoordinateSystem.svg Std_CoordinateSystem_alt.svg Std_Placement.svg @@ -155,14 +156,25 @@ Std_CloseActiveWindow.svg Std_CloseAllWindows.svg Std_Export.svg + Std_HideObjects.svg + Std_HideSelection.svg Std_Import.svg Std_MergeProjects.svg Std_PrintPdf.svg + Std_RandomColor.svg Std_RecentFiles.svg Std_Revert.svg Std_SaveAll.svg Std_SaveCopy.svg + Std_SelectVisibleObjects.svg Std_SetAppearance.svg + Std_ShowObjects.svg + Std_ShowSelection.svg + Std_TextureMapping.svg + Std_ToggleClipPlane.svg + Std_ToggleNavigation.svg + Std_ToggleObjects.svg + Std_ToggleVisibility.svg Std_Tool1.svg Std_Tool2.svg Std_Tool3.svg @@ -175,11 +187,15 @@ Std_Tool10.svg Std_Tool11.svg Std_Tool12.svg + Std_ViewDimetric.svg + Std_ViewHome.svg + Std_ViewIvIssueCamPos.svg Std_ViewIvStereoInterleavedColumns.svg Std_ViewIvStereoInterleavedRows.svg Std_ViewIvStereoOff.svg Std_ViewIvStereoQuadBuff.svg Std_ViewIvStereoRedGreen.svg + Std_ViewTrimetric.svg Std_WindowCascade.svg Std_WindowNext.svg Std_WindowPrev.svg diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 00f3b0d83e..396da77057 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -513,12 +513,11 @@ void View3DInventor::printPreview() { QPrinter printer(QPrinter::ScreenResolution); printer.setFullPage(true); -#if (QT_VERSION > QT_VERSION_CHECK(5, 9, 0)) - printer.setPageSize(QPrinter::A4); -#endif #if QT_VERSION >= 0x050300 + printer.setPageSize(QPageSize(QPageSize::A4)); printer.setPageOrientation(QPageLayout::Landscape); #else + printer.setPageSize(QPrinter::A4); printer.setOrientation(QPrinter::Landscape); #endif diff --git a/src/Gui/Workbench.cpp b/src/Gui/Workbench.cpp index cc3d1bec6a..c499a6ed78 100644 --- a/src/Gui/Workbench.cpp +++ b/src/Gui/Workbench.cpp @@ -695,7 +695,7 @@ MenuItem* StdWorkbench::setupMenuBar() const // Help MenuItem* help = new MenuItem( menuBar ); help->setCommand("&Help"); - *help << "Std_OnlineHelp" << "Std_FreeCADWebsite" + *help << "Std_OnlineHelp" << "Std_FreeCADWebsite" << "Std_FreeCADDonation" << "Std_FreeCADUserHub" << "Std_FreeCADPowerUserHub" << "Std_PythonHelp" << "Std_FreeCADForum" << "Std_FreeCADFAQ" << "Std_About" << "Std_WhatsThis"; diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index afa607c1dc..9aa8818b2e 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -320,7 +320,7 @@ def getSVG(source, lineColor=(0.0, 0.0, 0.0), fontsize=1, showFill=False, - fillColor=(0.8, 0.8, 0.8), + fillColor=(1.0, 1.0, 1.0), techdraw=False, fillSpaces=False, cutlinewidth=0, @@ -400,10 +400,10 @@ def getSVG(source, svgSymbolLineWidth = str(linewidth * yt) hiddenPattern = archUserParameters.GetString("archHiddenPattern","30,10") svgHiddenPattern = hiddenPattern.replace(" ","") - fillpattern = ' 0 0 - 453 - 424 + 416 + 542 @@ -22,6 +22,18 @@ + + + 0 + 0 + + + + + 60 + 0 + + The name of your style. Existing style names can be edited. @@ -46,11 +58,17 @@ false - + 0 0 + + + 60 + 0 + + 110 @@ -71,11 +89,17 @@ false - + 0 0 + + + 60 + 0 + + 110 @@ -90,6 +114,26 @@ + + + + Import styles from json file + + + + + + + + + + Export styles to json file + + + + + + @@ -108,8 +152,8 @@ 0 - -290 - 420 + 0 + 383 589 @@ -152,6 +196,18 @@ + + + 0 + 0 + + + + + 60 + 0 + + The font to use for texts and dimensions @@ -400,6 +456,18 @@ + + + 0 + 0 + + + + + 60 + 0 + + The type of arrows or markers to use at the end of dimension lines diff --git a/src/Mod/Draft/draftfunctions/draftify.py b/src/Mod/Draft/draftfunctions/draftify.py index 8ba71c117f..cb8355b55d 100644 --- a/src/Mod/Draft/draftfunctions/draftify.py +++ b/src/Mod/Draft/draftfunctions/draftify.py @@ -27,12 +27,21 @@ ## \addtogroup draftfuctions # @{ + +import lazy_loader.lazy_loader as lz + import FreeCAD as App import draftutils.gui_utils as gui_utils import draftmake.make_block as make_block import draftmake.make_wire as make_wire import draftmake.make_circle as make_circle +import draftmake.make_bspline as make_bspline +import draftmake.make_bezcurve as make_bezcurve +import draftmake.make_arc_3points as make_arc_3points +# Delay import of module until first use because it is heavy +Part = lz.LazyLoader("Part", globals(), "Part") +DraftGeomUtils = lz.LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils") def draftify(objectslist, makeblock=False, delete=True): """draftify(objectslist,[makeblock],[delete]) @@ -52,24 +61,18 @@ def draftify(objectslist, makeblock=False, delete=True): delete : bool If delete = False, old objects are not deleted """ - import Part - import DraftGeomUtils if not isinstance(objectslist,list): objectslist = [objectslist] newobjlist = [] for obj in objectslist: if hasattr(obj,'Shape'): - for cluster in Part.getSortedClusters(obj.Shape.Edges): + for cluster in Part.sortEdges(obj.Shape.Edges): w = Part.Wire(cluster) - if DraftGeomUtils.hasCurves(w): - if (len(w.Edges) == 1) and (DraftGeomUtils.geomType(w.Edges[0]) == "Circle"): - nobj = make_circle.make_circle(w.Edges[0]) - else: - nobj = App.ActiveDocument.addObject("Part::Feature", obj.Name) - nobj.Shape = w - else: - nobj = make_wire.make_wire(w) + nobj = draftify_shape(w) + if nobj == None: + nobj = App.ActiveDocument.addObject("Part::Feature", obj.Name) + nobj.Shape = w newobjlist.append(nobj) gui_utils.format_object(nobj, obj) # sketches are always in wireframe mode. In Draft we don't like that! @@ -85,4 +88,34 @@ def draftify(objectslist, makeblock=False, delete=True): return newobjlist[0] return newobjlist +def draftify_shape(shape): + + nobj = None + if DraftGeomUtils.hasCurves(shape): + if (len(shape.Edges) == 1): + edge = shape.Edges[0] + edge_type = DraftGeomUtils.geomType(edge) + if edge_type == "Circle": + if edge.isClosed(): + nobj = make_circle.make_circle(edge) + else: + first_parameter = edge.FirstParameter + last_parameter = edge.LastParameter + points = [edge.Curve.value(first_parameter), + edge.Curve.value((first_parameter + last_parameter)/2), + edge.Curve.value(last_parameter)] + nobj = make_arc_3points.make_arc_3points(points) + # TODO: take into consideration trimmed curves and capture the specific + # type of BSpline and Bezier that can be converted to a draft object. + # elif edge_type == "BSplineCurve": + # knots = [edge.Curve.value(p) for p in edge.Curve.getKnots()] + # nobj = make_bspline.make_bspline(knots, closed=edge.isClosed()) + # elif edge_type == "BezierCurve": + # nobj = make_bezcurve.make_bezcurve(edge.Curve.getPoles(), + # closed=edge.isClosed()) + else: + nobj = make_wire.make_wire(shape) + + return nobj + ## @} diff --git a/src/Mod/Draft/draftfunctions/upgrade.py b/src/Mod/Draft/draftfunctions/upgrade.py index c449015bde..e328fe7511 100644 --- a/src/Mod/Draft/draftfunctions/upgrade.py +++ b/src/Mod/Draft/draftfunctions/upgrade.py @@ -504,18 +504,10 @@ def upgrade(objects, delete=False, force=None): if result: _msg(_tr("Found closed wires: creating faces")) # wires or edges: we try to join them - elif len(wires) > 1 or len(loneedges) > 1: + elif len(objects) > 1 and len(edges) > 1: result = makeWires(objects) if result: _msg(_tr("Found several wires or edges: wiring them")) - # TODO: improve draftify function - # only one object: if not parametric, we "draftify" it - # elif (len(objects) == 1 - # and not objects[0].isDerivedFrom("Part::Part2DObjectPython")): - # result = ext_draftify.draftify(objects[0]) - # if result: - # _msg(_tr("Found 1 non-parametric objects: " - # "draftifying it")) # special case, we have only one open wire. We close it, # unless it has only 1 edge! elif len(objects) == 1 and len(openwires) == 1: @@ -524,14 +516,23 @@ def upgrade(objects, delete=False, force=None): if result: _msg(_tr("Found 1 open wire: closing it")) # we have only one object that contains one edge - # TODO: this case should be considered in draftify - elif len(objects) == 1 and len(edges) == 1: - # turn to Draft Line + # TODO: improve draftify function + # only one object: if not parametric, we "draftify" it + # elif (len(objects) == 1 + # and not objects[0].isDerivedFrom("Part::Part2DObjectPython")): + # result = ext_draftify.draftify(objects[0]) + # if result: + # _msg(_tr("Found 1 non-parametric objects: " + # "draftifying it")) + elif (len(objects) == 1 and len(edges) == 1 + and not objects[0].isDerivedFrom("Part::Part2DObjectPython")): e = objects[0].Shape.Edges[0] - if isinstance(e.Curve, (Part.LineSegment, Part.Line)): - result = turnToLine(objects[0]) + edge_type = DraftGeomUtils.geomType(e) + # currently only support Line and Circle + if edge_type in ("Line", "Circle"): + result = ext_draftify.draftify(objects[0]) if result: - _msg(_tr("Found 1 linear object: converting to line")) + _msg(_tr("Found 1 object: draftifying it")) # only points, no edges elif not edges and len(objects) > 1: result = makeCompound(objects) diff --git a/src/Mod/Draft/draftguitools/gui_annotationstyleeditor.py b/src/Mod/Draft/draftguitools/gui_annotationstyleeditor.py index ffeaca51b4..82be6d8539 100644 --- a/src/Mod/Draft/draftguitools/gui_annotationstyleeditor.py +++ b/src/Mod/Draft/draftguitools/gui_annotationstyleeditor.py @@ -111,6 +111,8 @@ class AnnotationStyleEditor(gui_base.GuiCommandSimplest): self.form.pushButtonRename.setIcon(QtGui.QIcon(":/icons/accessories-text-editor.svg")) self.form.pushButtonDelete.resize(self.form.pushButtonDelete.sizeHint()) self.form.pushButtonRename.resize(self.form.pushButtonRename.sizeHint()) + self.form.pushButtonImport.setIcon(QtGui.QIcon(":/icons/Std_Import.svg")) + self.form.pushButtonExport.setIcon(QtGui.QIcon(":/icons/Std_Export.svg")) # fill the styles combo self.styles = self.read_meta() @@ -121,6 +123,8 @@ class AnnotationStyleEditor(gui_base.GuiCommandSimplest): self.form.comboBoxStyles.currentIndexChanged.connect(self.on_style_changed) self.form.pushButtonDelete.clicked.connect(self.on_delete) self.form.pushButtonRename.clicked.connect(self.on_rename) + self.form.pushButtonImport.clicked.connect(self.on_import) + self.form.pushButtonExport.clicked.connect(self.on_export) for attr in DEFAULT.keys(): control = getattr(self.form, attr) for signal in ("clicked", "textChanged", @@ -280,6 +284,42 @@ class AnnotationStyleEditor(gui_base.GuiCommandSimplest): self.styles[newname] = value self.renamed[style] = newname + + def on_import(self): + """imports styles from a json file""" + filename = QtGui.QFileDialog.getOpenFileName( + QtGui.QApplication.activeWindow(), + _tr("Open styles file"), + None, + _tr("JSON file (*.json)")) + if filename and filename[0]: + with open(filename[0]) as f: + nstyles = json.load(f) + if nstyles: + self.styles.update(nstyles) + l1 = self.form.comboBoxStyles.itemText(0) + l2 = self.form.comboBoxStyles.itemText(1) + self.form.comboBoxStyles.clear() + self.form.comboBoxStyles.addItem(l1) + self.form.comboBoxStyles.addItem(l2) + for style in self.styles.keys(): + self.form.comboBoxStyles.addItem(style) + print("Styles updated from "+filename[0]) + + + def on_export(self): + """exports styles to a json file""" + filename = QtGui.QFileDialog.getSaveFileName( + QtGui.QApplication.activeWindow(), + _tr("Save styles file"), + None, + _tr("JSON file (*.json)")) + if filename and filename[0]: + with open(filename[0],"w") as f: + json.dump(self.styles,f,indent=4) + print("Styles saved to "+filename[0]) + + def fill_editor(self, style): """Fill the editor fields with the contents of a style.""" if style is None: diff --git a/src/Mod/Draft/draftguitools/gui_array_simple.py b/src/Mod/Draft/draftguitools/gui_array_simple.py index 37a3bf9070..3d2ddd26b2 100644 --- a/src/Mod/Draft/draftguitools/gui_array_simple.py +++ b/src/Mod/Draft/draftguitools/gui_array_simple.py @@ -79,16 +79,14 @@ class Array(gui_base_original.Modifier): if self.ui: self.ui.selectUi() _msg(translate("draft", "Select an object to array")) - self.call = \ - self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) + self.call = self.view.addEventCallback( + "SoEvent", + gui_tool_utils.selectObject) else: self.proceed() def proceed(self): """Proceed with the command if one object was selected.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) if Gui.Selection.getSelection(): obj = Gui.Selection.getSelection()[0] Gui.addModule("Draft") diff --git a/src/Mod/Draft/draftguitools/gui_clone.py b/src/Mod/Draft/draftguitools/gui_clone.py index bbe1be68f8..1901c5c4e5 100644 --- a/src/Mod/Draft/draftguitools/gui_clone.py +++ b/src/Mod/Draft/draftguitools/gui_clone.py @@ -80,17 +80,14 @@ class Clone(gui_base_original.Modifier): if self.ui: self.ui.selectUi() _msg(translate("draft", "Select an object to clone")) - self.call = \ - self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) + self.call = self.view.addEventCallback( + "SoEvent", + gui_tool_utils.selectObject) else: self.proceed() def proceed(self): """Proceed with the command if one object was selected.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) - if Gui.Selection.getSelection(): sels = len(Gui.Selection.getSelection()) Gui.addModule("Draft") diff --git a/src/Mod/Draft/draftguitools/gui_downgrade.py b/src/Mod/Draft/draftguitools/gui_downgrade.py index 4bc95bf053..dbc056165f 100644 --- a/src/Mod/Draft/draftguitools/gui_downgrade.py +++ b/src/Mod/Draft/draftguitools/gui_downgrade.py @@ -71,17 +71,14 @@ class Downgrade(gui_base_original.Modifier): if not Gui.Selection.getSelection(): self.ui.selectUi() _msg(translate("draft", "Select an object to upgrade")) - self.call = \ - self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) + self.call = self.view.addEventCallback( + "SoEvent", + gui_tool_utils.selectObject) else: self.proceed() def proceed(self): """Proceed with execution of the command after selection.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) - if Gui.Selection.getSelection(): Gui.addModule("Draft") _cmd = 'Draft.downgrade' diff --git a/src/Mod/Draft/draftguitools/gui_draft2sketch.py b/src/Mod/Draft/draftguitools/gui_draft2sketch.py index 6deac33000..d5311d7dbb 100644 --- a/src/Mod/Draft/draftguitools/gui_draft2sketch.py +++ b/src/Mod/Draft/draftguitools/gui_draft2sketch.py @@ -71,17 +71,14 @@ class Draft2Sketch(gui_base_original.Modifier): if self.ui: self.ui.selectUi() _msg(translate("draft", "Select an object to convert.")) - self.call = \ - self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) + self.call = self.view.addEventCallback( + "SoEvent", + gui_tool_utils.selectObject) else: self.proceed() def proceed(self): """Proceed with the command if one object was selected.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) - sel = Gui.Selection.getSelection() allSketches = True allDraft = True diff --git a/src/Mod/Draft/draftguitools/gui_facebinders.py b/src/Mod/Draft/draftguitools/gui_facebinders.py index 0f78eb739f..7f1879c61b 100644 --- a/src/Mod/Draft/draftguitools/gui_facebinders.py +++ b/src/Mod/Draft/draftguitools/gui_facebinders.py @@ -70,16 +70,14 @@ class Facebinder(gui_base_original.Creator): if self.ui: self.ui.selectUi() _msg(translate("draft", "Select faces from existing objects")) - self.call = \ - self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) + self.call = self.view.addEventCallback( + "SoEvent", + gui_tool_utils.selectObject) else: self.proceed() def proceed(self): """Proceed when a valid selection has been made.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) if Gui.Selection.getSelection(): App.ActiveDocument.openTransaction("Create Facebinder") Gui.addModule("Draft") diff --git a/src/Mod/Draft/draftguitools/gui_join.py b/src/Mod/Draft/draftguitools/gui_join.py index 12034a9635..62cfcb5919 100644 --- a/src/Mod/Draft/draftguitools/gui_join.py +++ b/src/Mod/Draft/draftguitools/gui_join.py @@ -78,8 +78,9 @@ class Join(gui_base_original.Modifier): if not Gui.Selection.getSelection(): self.ui.selectUi() _msg(translate("draft", "Select an object to join")) - self.call = self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) + self.call = self.view.addEventCallback( + "SoEvent", + gui_tool_utils.selectObject) else: self.proceed() @@ -90,8 +91,6 @@ class Join(gui_base_original.Modifier): visually share a point. This is due to the underlying `joinWires` method not handling the points correctly. """ - if self.call: - self.view.removeEventCallback("SoEvent", self.call) if Gui.Selection.getSelection(): self.print_selection() Gui.addModule("Draft") diff --git a/src/Mod/Draft/draftguitools/gui_offset.py b/src/Mod/Draft/draftguitools/gui_offset.py index 58960b9a9f..86e21b044d 100644 --- a/src/Mod/Draft/draftguitools/gui_offset.py +++ b/src/Mod/Draft/draftguitools/gui_offset.py @@ -78,9 +78,9 @@ class Offset(gui_base_original.Modifier): if not Gui.Selection.getSelection(): self.ui.selectUi() _msg(translate("draft", "Select an object to offset")) - self.call = \ - self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) + self.call = self.view.addEventCallback( + "SoEvent", + gui_tool_utils.selectObject) elif len(Gui.Selection.getSelection()) > 1: _wrn(translate("draft", "Offset only works " "on one object at a time.")) diff --git a/src/Mod/Draft/draftguitools/gui_patharray.py b/src/Mod/Draft/draftguitools/gui_patharray.py index c025668901..15a3d32448 100644 --- a/src/Mod/Draft/draftguitools/gui_patharray.py +++ b/src/Mod/Draft/draftguitools/gui_patharray.py @@ -103,9 +103,6 @@ class PathArray(gui_base_original.Modifier): def proceed(self): """Proceed with the command if one object was selected.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) - sel = Gui.Selection.getSelectionEx() if len(sel) != 2: _err(_tr("Please select exactly two objects, " diff --git a/src/Mod/Draft/draftguitools/gui_pathtwistedarray.py b/src/Mod/Draft/draftguitools/gui_pathtwistedarray.py index 0275258648..daf0e81660 100644 --- a/src/Mod/Draft/draftguitools/gui_pathtwistedarray.py +++ b/src/Mod/Draft/draftguitools/gui_pathtwistedarray.py @@ -80,9 +80,6 @@ class PathTwistedArray(gui_base_original.Modifier): def proceed(self): """Proceed with the command if one object was selected.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) - sel = Gui.Selection.getSelectionEx() if len(sel) != 2: _err(_tr("Please select exactly two objects, " diff --git a/src/Mod/Draft/draftguitools/gui_pointarray.py b/src/Mod/Draft/draftguitools/gui_pointarray.py index 49efd09ade..7057afeb6c 100644 --- a/src/Mod/Draft/draftguitools/gui_pointarray.py +++ b/src/Mod/Draft/draftguitools/gui_pointarray.py @@ -113,9 +113,6 @@ class PointArray(gui_base_original.Modifier): def proceed(self): """Proceed with the command if one object was selected.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) - sel = Gui.Selection.getSelectionEx() if len(sel) != 2: _err(_tr("Please select exactly two objects, " diff --git a/src/Mod/Draft/draftguitools/gui_shape2dview.py b/src/Mod/Draft/draftguitools/gui_shape2dview.py index c1fcc97b15..fca56f6af7 100644 --- a/src/Mod/Draft/draftguitools/gui_shape2dview.py +++ b/src/Mod/Draft/draftguitools/gui_shape2dview.py @@ -75,17 +75,14 @@ class Shape2DView(gui_base_original.Modifier): if self.ui: self.ui.selectUi() _msg(translate("draft", "Select an object to project")) - self.call = \ - self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) + self.call = self.view.addEventCallback( + "SoEvent", + gui_tool_utils.selectObject) else: self.proceed() def proceed(self): """Proceed with the command if one object was selected.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) - faces = [] objs = [] vec = Gui.ActiveDocument.ActiveView.getViewDirection().negative() diff --git a/src/Mod/Draft/draftguitools/gui_split.py b/src/Mod/Draft/draftguitools/gui_split.py index 880804611e..70f009335f 100644 --- a/src/Mod/Draft/draftguitools/gui_split.py +++ b/src/Mod/Draft/draftguitools/gui_split.py @@ -112,8 +112,6 @@ class Split(gui_base_original.Modifier): self.commit(translate("draft", "Split line"), _cmd_list) - if self.call: - self.view.removeEventCallback("SoEvent", self.call) self.finish() diff --git a/src/Mod/Draft/draftguitools/gui_upgrade.py b/src/Mod/Draft/draftguitools/gui_upgrade.py index 18acc0cf51..088f02721c 100644 --- a/src/Mod/Draft/draftguitools/gui_upgrade.py +++ b/src/Mod/Draft/draftguitools/gui_upgrade.py @@ -73,17 +73,14 @@ class Upgrade(gui_base_original.Modifier): if not Gui.Selection.getSelection(): self.ui.selectUi() _msg(translate("draft", "Select an object to upgrade")) - self.call = \ - self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) + self.call = self.view.addEventCallback( + "SoEvent", + gui_tool_utils.selectObject) else: self.proceed() def proceed(self): """Proceed with execution of the command after selection.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) - if Gui.Selection.getSelection(): Gui.addModule("Draft") _cmd = 'Draft.upgrade' diff --git a/src/Mod/Draft/draftmake/make_copy.py b/src/Mod/Draft/draftmake/make_copy.py index 9960ed62bd..b1d0662a8b 100644 --- a/src/Mod/Draft/draftmake/make_copy.py +++ b/src/Mod/Draft/draftmake/make_copy.py @@ -59,12 +59,18 @@ def make_copy(obj, force=None, reparent=False, simple_copy=False): newobj = None if simple_copy and hasattr(obj, 'Shape'): + # this was the old implementation that is actyally not used by default _name = utils.get_real_name(obj.Name) newobj = App.ActiveDocument.addObject("Part::Feature", _name) newobj.Shape = obj.Shape gui_utils.format_object(newobj, obj) elif not simple_copy: - newobj = App.ActiveDocument.copyObject(obj) + # this is the new implementation using doc.copyObject API + if obj.hasExtension("App::OriginGroupExtension"): + # always copy with dependencies when copying App::Part and PartDesign::Body + newobj = App.ActiveDocument.copyObject(obj, True) + else: + newobj = App.ActiveDocument.copyObject(obj) if not newobj: return None diff --git a/src/Mod/Drawing/Gui/DrawingView.cpp b/src/Mod/Drawing/Gui/DrawingView.cpp index 0a97f26a1e..799b24cce7 100644 --- a/src/Mod/Drawing/Gui/DrawingView.cpp +++ b/src/Mod/Drawing/Gui/DrawingView.cpp @@ -260,10 +260,11 @@ DrawingView::DrawingView(Gui::Document* doc, QWidget* parent) //setWindowTitle(tr("SVG Viewer")); #if QT_VERSION >= 0x050300 m_orientation = QPageLayout::Landscape; + m_pageSize = QPageSize::A4; #else m_orientation = QPrinter::Landscape; -#endif m_pageSize = QPrinter::A4; +#endif ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/View"); @@ -319,6 +320,29 @@ void DrawingView::findPrinterSettings(const QString& fileName) #endif } +#if QT_VERSION >= 0x050300 + QMap pageSizes; + pageSizes[QPageSize::A0] = QString::fromLatin1("A0"); + pageSizes[QPageSize::A1] = QString::fromLatin1("A1"); + pageSizes[QPageSize::A2] = QString::fromLatin1("A2"); + pageSizes[QPageSize::A3] = QString::fromLatin1("A3"); + pageSizes[QPageSize::A4] = QString::fromLatin1("A4"); + pageSizes[QPageSize::A5] = QString::fromLatin1("A5"); + pageSizes[QPageSize::A6] = QString::fromLatin1("A6"); + pageSizes[QPageSize::A7] = QString::fromLatin1("A7"); + pageSizes[QPageSize::A8] = QString::fromLatin1("A8"); + pageSizes[QPageSize::A9] = QString::fromLatin1("A9"); + pageSizes[QPageSize::B0] = QString::fromLatin1("B0"); + pageSizes[QPageSize::B1] = QString::fromLatin1("B1"); + pageSizes[QPageSize::B2] = QString::fromLatin1("B2"); + pageSizes[QPageSize::B3] = QString::fromLatin1("B3"); + pageSizes[QPageSize::B4] = QString::fromLatin1("B4"); + pageSizes[QPageSize::B5] = QString::fromLatin1("B5"); + pageSizes[QPageSize::B6] = QString::fromLatin1("B6"); + pageSizes[QPageSize::B7] = QString::fromLatin1("B7"); + pageSizes[QPageSize::B8] = QString::fromLatin1("B8"); + pageSizes[QPageSize::B9] = QString::fromLatin1("B9"); +#else QMap pageSizes; pageSizes[QPrinter::A0] = QString::fromLatin1("A0"); pageSizes[QPrinter::A1] = QString::fromLatin1("A1"); @@ -340,7 +364,12 @@ void DrawingView::findPrinterSettings(const QString& fileName) pageSizes[QPrinter::B7] = QString::fromLatin1("B7"); pageSizes[QPrinter::B8] = QString::fromLatin1("B8"); pageSizes[QPrinter::B9] = QString::fromLatin1("B9"); +#endif +#if QT_VERSION >= 0x050300 + for (QMap::iterator it = pageSizes.begin(); it != pageSizes.end(); ++it) { +#else for (QMap::iterator it = pageSizes.begin(); it != pageSizes.end(); ++it) { +#endif if (fileName.startsWith(it.value(), Qt::CaseInsensitive)) { m_pageSize = it.key(); break; @@ -499,6 +528,20 @@ void DrawingView::printPdf() formLayout->addWidget(groupBox, 0, 0, 1, 1); groupBox->setTitle(tr("Page sizes")); +#if QT_VERSION >= 0x050300 + item = new QListWidgetItem(tr("A0"), listWidget); + item->setData(Qt::UserRole, QVariant(QPageSize::A0)); + item = new QListWidgetItem(tr("A1"), listWidget); + item->setData(Qt::UserRole, QVariant(QPageSize::A1)); + item = new QListWidgetItem(tr("A2"), listWidget); + item->setData(Qt::UserRole, QVariant(QPageSize::A2)); + item = new QListWidgetItem(tr("A3"), listWidget); + item->setData(Qt::UserRole, QVariant(QPageSize::A3)); + item = new QListWidgetItem(tr("A4"), listWidget); + item->setData(Qt::UserRole, QVariant(QPageSize::A4)); + item = new QListWidgetItem(tr("A5"), listWidget); + item->setData(Qt::UserRole, QVariant(QPageSize::A5)); +#else item = new QListWidgetItem(tr("A0"), listWidget); item->setData(Qt::UserRole, QVariant(QPrinter::A0)); item = new QListWidgetItem(tr("A1"), listWidget); @@ -511,6 +554,7 @@ void DrawingView::printPdf() item->setData(Qt::UserRole, QVariant(QPrinter::A4)); item = new QListWidgetItem(tr("A5"), listWidget); item->setData(Qt::UserRole, QVariant(QPrinter::A5)); +#endif int index = 4; // by default A4 for (int i=0; icount(); i++) { if (listWidget->item(i)->data(Qt::UserRole).toInt() == m_pageSize) { @@ -536,7 +580,11 @@ void DrawingView::printPdf() QList items = listWidget->selectedItems(); if (items.size() == 1) { int AX = items.front()->data(Qt::UserRole).toInt(); +#if QT_VERSION >= 0x050300 + printer.setPageSize(QPageSize(QPageSize::PageSizeId(AX))); +#else printer.setPaperSize(QPrinter::PageSize(AX)); +#endif } print(&printer); @@ -547,10 +595,12 @@ void DrawingView::print() { QPrinter printer(QPrinter::HighResolution); printer.setFullPage(true); - printer.setPageSize(m_pageSize); + #if QT_VERSION >= 0x050300 + printer.setPageSize(QPageSize(m_pageSize)); printer.setPageOrientation(m_orientation); #else + printer.setPageSize(m_pageSize); printer.setOrientation(m_orientation); #endif @@ -564,10 +614,12 @@ void DrawingView::printPreview() { QPrinter printer(QPrinter::HighResolution); printer.setFullPage(true); - printer.setPageSize(m_pageSize); + #if QT_VERSION >= 0x050300 + printer.setPageSize(QPageSize(m_pageSize)); printer.setPageOrientation(m_orientation); #else + printer.setPageSize(m_pageSize); printer.setOrientation(m_orientation); #endif @@ -594,8 +646,13 @@ void DrawingView::print(QPrinter* printer) if (printer->outputFormat() == QPrinter::NativeFormat) { int w = printer->widthMM(); int h = printer->heightMM(); +#if QT_VERSION >= 0x050300 + QPageSize::PageSizeId realPaperSize = getPageSize(w, h); + QPageSize::PageSizeId curPaperSize = printer->pageLayout().pageSize().id(); +#else QPrinter::PaperSize realPaperSize = getPageSize(w, h); QPrinter::PaperSize curPaperSize = printer->paperSize(); +#endif // for the preview a 'Picture' paint engine is used which we don't // care if it uses wrong printer settings @@ -658,7 +715,11 @@ void DrawingView::print(QPrinter* printer) p.end(); } +#if QT_VERSION >= 0x050300 +QPageSize::PageSizeId DrawingView::getPageSize(int w, int h) const +#else QPrinter::PageSize DrawingView::getPageSize(int w, int h) const +#endif { static const float paperSizes[][2] = { {210, 297}, // A4 @@ -693,17 +754,29 @@ QPrinter::PageSize DrawingView::getPageSize(int w, int h) const {279.4f, 431.8f} // Tabloid }; +#if QT_VERSION >= 0x050300 + QPageSize::PageSizeId ps = QPageSize::Custom; +#else QPrinter::PageSize ps = QPrinter::Custom; +#endif for (int i=0; i<30; i++) { if (std::abs(paperSizes[i][0]-w) <= 1 && std::abs(paperSizes[i][1]-h) <= 1) { +#if QT_VERSION >= 0x050300 + ps = static_cast(i); +#else ps = static_cast(i); +#endif break; } else if (std::abs(paperSizes[i][0]-h) <= 1 && std::abs(paperSizes[i][1]-w) <= 1) { +#if QT_VERSION >= 0x050300 + ps = static_cast(i); +#else ps = static_cast(i); +#endif break; } } diff --git a/src/Mod/Drawing/Gui/DrawingView.h b/src/Mod/Drawing/Gui/DrawingView.h index 4f746ef1c6..8683a862d8 100644 --- a/src/Mod/Drawing/Gui/DrawingView.h +++ b/src/Mod/Drawing/Gui/DrawingView.h @@ -107,7 +107,11 @@ protected: void contextMenuEvent(QContextMenuEvent *event); void closeEvent(QCloseEvent*); void findPrinterSettings(const QString&); +#if QT_VERSION >= 0x050300 + QPageSize::PageSizeId getPageSize(int w, int h) const; +#else QPrinter::PageSize getPageSize(int w, int h) const; +#endif private: QAction *m_nativeAction; @@ -123,10 +127,11 @@ private: QString m_currentPath; #if QT_VERSION >= 0x050300 QPageLayout::Orientation m_orientation; + QPageSize::PageSizeId m_pageSize; #else QPrinter::Orientation m_orientation; -#endif QPrinter::PageSize m_pageSize; +#endif }; } // namespace DrawingViewGui diff --git a/src/Mod/Fem/femtest/data/calculix/box_frequency.inp b/src/Mod/Fem/femtest/data/calculix/box_frequency.inp index 4711ed82a4..8c2a6b3d31 100644 --- a/src/Mod/Fem/femtest/data/calculix/box_frequency.inp +++ b/src/Mod/Fem/femtest/data/calculix/box_frequency.inp @@ -482,7 +482,7 @@ S, E ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -494,8 +494,8 @@ S, E ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/box_static.inp b/src/Mod/Fem/femtest/data/calculix/box_static.inp index e2481279f8..97f24b42be 100644 --- a/src/Mod/Fem/femtest/data/calculix/box_static.inp +++ b/src/Mod/Fem/femtest/data/calculix/box_static.inp @@ -613,7 +613,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -625,8 +625,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/ccxcantilever_faceload.inp b/src/Mod/Fem/femtest/data/calculix/ccxcantilever_faceload.inp index e2d8578077..06258a9e06 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccxcantilever_faceload.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccxcantilever_faceload.inp @@ -432,7 +432,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -444,8 +444,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/ccxcantilever_hexa20.inp b/src/Mod/Fem/femtest/data/calculix/ccxcantilever_hexa20.inp index 44d293867d..a6a43d5197 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccxcantilever_hexa20.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccxcantilever_hexa20.inp @@ -466,7 +466,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -478,8 +478,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/ccxcantilever_nodeload.inp b/src/Mod/Fem/femtest/data/calculix/ccxcantilever_nodeload.inp index 45d48cf969..f3f3d1b9c6 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccxcantilever_nodeload.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccxcantilever_nodeload.inp @@ -429,7 +429,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -441,8 +441,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/ccxcantilever_prescribeddisplacement.inp b/src/Mod/Fem/femtest/data/calculix/ccxcantilever_prescribeddisplacement.inp index ec93d23ea8..226960c613 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccxcantilever_prescribeddisplacement.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccxcantilever_prescribeddisplacement.inp @@ -437,7 +437,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -449,8 +449,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp b/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp index 893a792976..4accd664b5 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp @@ -38439,7 +38439,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -38451,8 +38451,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_contact_solid_solid.inp b/src/Mod/Fem/femtest/data/calculix/constraint_contact_solid_solid.inp index efdeddaca9..7787d6cbb5 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_contact_solid_solid.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_contact_solid_solid.inp @@ -5371,7 +5371,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -5383,8 +5383,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp b/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp index 96b521775a..074f7bade4 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp @@ -3485,7 +3485,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -3497,8 +3497,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_selfweight_cantilever.inp b/src/Mod/Fem/femtest/data/calculix/constraint_selfweight_cantilever.inp index 6a16dbbd29..7c1ce57e7c 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_selfweight_cantilever.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_selfweight_cantilever.inp @@ -2213,7 +2213,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -2225,8 +2225,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp b/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp index 8ad31106ee..f9b53e0077 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp @@ -18677,7 +18677,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -18689,8 +18689,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fiveboxes.inp b/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fiveboxes.inp index 1f1ad967c3..ad75fb0b7c 100644 --- a/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fiveboxes.inp +++ b/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fiveboxes.inp @@ -29213,7 +29213,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -29225,8 +29225,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fivefaces.inp b/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fivefaces.inp index 09296d047b..250de8894d 100644 --- a/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fivefaces.inp +++ b/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fivefaces.inp @@ -2724,7 +2724,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -2736,8 +2736,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/material_multiple_tensionrod_twoboxes.inp b/src/Mod/Fem/femtest/data/calculix/material_multiple_tensionrod_twoboxes.inp index c0c2805461..aaa569e805 100644 --- a/src/Mod/Fem/femtest/data/calculix/material_multiple_tensionrod_twoboxes.inp +++ b/src/Mod/Fem/femtest/data/calculix/material_multiple_tensionrod_twoboxes.inp @@ -1305,7 +1305,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -1317,8 +1317,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/material_nonlinear.inp b/src/Mod/Fem/femtest/data/calculix/material_nonlinear.inp index 34fa09e23a..6aa3d5d639 100644 --- a/src/Mod/Fem/femtest/data/calculix/material_nonlinear.inp +++ b/src/Mod/Fem/femtest/data/calculix/material_nonlinear.inp @@ -20142,7 +20142,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -20154,8 +20154,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_edgeforces.inp b/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_edgeforces.inp index f77b2999f6..3f8ba1e1c9 100644 --- a/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_edgeforces.inp +++ b/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_edgeforces.inp @@ -2687,7 +2687,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -2699,8 +2699,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_nodeforces.inp b/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_nodeforces.inp index 2b53bb6a90..20c6d9404a 100644 --- a/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_nodeforces.inp +++ b/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_nodeforces.inp @@ -2799,7 +2799,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -2811,8 +2811,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/thermomech_bimetall.inp b/src/Mod/Fem/femtest/data/calculix/thermomech_bimetall.inp index 482fe55638..46c0d42a1c 100644 --- a/src/Mod/Fem/femtest/data/calculix/thermomech_bimetall.inp +++ b/src/Mod/Fem/femtest/data/calculix/thermomech_bimetall.inp @@ -8274,7 +8274,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -8286,8 +8286,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/thermomech_flow1D.inp b/src/Mod/Fem/femtest/data/calculix/thermomech_flow1D.inp index f8a4517ed8..e6ceb8cee9 100644 --- a/src/Mod/Fem/femtest/data/calculix/thermomech_flow1D.inp +++ b/src/Mod/Fem/femtest/data/calculix/thermomech_flow1D.inp @@ -183,7 +183,7 @@ MF, PS ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -195,8 +195,8 @@ MF, PS ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Fem/femtest/data/calculix/thermomech_spine.inp b/src/Mod/Fem/femtest/data/calculix/thermomech_spine.inp index c8e9a1160b..9e03315ebe 100644 --- a/src/Mod/Fem/femtest/data/calculix/thermomech_spine.inp +++ b/src/Mod/Fem/femtest/data/calculix/thermomech_spine.inp @@ -222,7 +222,7 @@ RF ** Golden rule: The user must make sure that the numbers he provides have consistent units. ** The user is the FreeCAD calculix writer module ;-) ** -** The unit system which is used at Guido Dhodts company: mm, N, s, K +** The unit system which is used at Guido Dhondt's company: mm, N, s, K ** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N ** The following units are used to write to inp file: ** @@ -234,8 +234,8 @@ RF ** This leads to: ** Force: N ** Pressure: N/mm^2 -** Density: t/mm^2 +** Density: t/mm^3 ** Gravity: mm/s^2 -** Thermal conductivity: t*mm/K*s^3 -** Specific Heat: kJ/t/K = mm^2/s^2/K +** Thermal conductivity: t*mm/K/s^3 (same as W/m/K) +** Specific Heat: mm^2/s^2/K (same as J/kg/K) ** diff --git a/src/Mod/Path/App/CMakeLists.txt b/src/Mod/Path/App/CMakeLists.txt index 5177dcf8f8..2ec0a12615 100644 --- a/src/Mod/Path/App/CMakeLists.txt +++ b/src/Mod/Path/App/CMakeLists.txt @@ -141,6 +141,12 @@ SOURCE_GROUP("Module" FILES ${Mod_SRCS}) add_library(Path SHARED ${Path_SRCS}) target_link_libraries(Path ${Path_LIBS}) +# Boost >= 1.75.0 +if(NOT ${Boost_VERSION} LESS 107500) + set_target_properties(Path PROPERTIES CXX_STANDARD_REQUIRED ON) + set_target_properties(Path PROPERTIES CXX_STANDARD 14) +endif() + if(FREECAD_USE_PCH) add_definitions(-D_PreComp_) GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" Path_CPP_SRCS ${Path_SRCS}) diff --git a/src/Mod/Path/PathScripts/PathAdaptive.py b/src/Mod/Path/PathScripts/PathAdaptive.py index ff44082ca9..162406cfb3 100644 --- a/src/Mod/Path/PathScripts/PathAdaptive.py +++ b/src/Mod/Path/PathScripts/PathAdaptive.py @@ -174,6 +174,7 @@ def GenerateGCode(op,obj,adaptiveResults, helixDiameter): if obj.UseHelixArcs == False: # rapid move to start point + op.commandlist.append(Path.Command("G0", {"Z": obj.ClearanceHeight.Value})) op.commandlist.append(Path.Command("G0", {"X": helixStart[0], "Y": helixStart[1], "Z": obj.ClearanceHeight.Value})) # rapid move to safe height @@ -205,6 +206,7 @@ def GenerateGCode(op,obj,adaptiveResults, helixDiameter): helixStart = [region["HelixCenterPoint"][0] + r, region["HelixCenterPoint"][1]] # rapid move to start point + op.commandlist.append(Path.Command("G0", {"Z": obj.ClearanceHeight.Value})) op.commandlist.append(Path.Command("G0", {"X": helixStart[0], "Y": helixStart[1], "Z": obj.ClearanceHeight.Value})) # rapid move to safe height @@ -238,6 +240,7 @@ def GenerateGCode(op,obj,adaptiveResults, helixDiameter): else: # no helix entry # rapid move to clearance height + op.commandlist.append(Path.Command("G0", {"Z": obj.ClearanceHeight.Value})) op.commandlist.append(Path.Command("G0", {"X": region["StartPoint"][0], "Y": region["StartPoint"][1], "Z": obj.ClearanceHeight.Value})) # straight plunge to target depth op.commandlist.append(Path.Command("G1", {"X":region["StartPoint"][0], "Y": region["StartPoint"][1], "Z": passEndDepth,"F": op.vertFeed})) diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index d68b24cdcb..a6c027b722 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -58,6 +58,7 @@ class JobTemplate: PostProcessorOutputFile = 'Output' SetupSheet = 'SetupSheet' Stock = 'Stock' + # TCs are grouped under Tools in a job, the template refers to them directly though ToolController = 'ToolController' Version = 'Version' @@ -120,7 +121,7 @@ class ObjectJob: obj.addProperty("App::PropertyLink", "Stock", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Solid object to be used as stock.")) obj.addProperty("App::PropertyLink", "Operations", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Compound path of all operations in the order they are processed.")) - obj.addProperty("App::PropertyLinkList", "ToolController", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Collection of tool controllers available for this job.")) + #obj.addProperty("App::PropertyLinkList", "ToolController", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Collection of tool controllers available for this job.")) obj.addProperty("App::PropertyBool", "SplitOutput", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "Split output into multiple gcode files")) obj.addProperty("App::PropertyEnumeration", "OrderOutputBy", "WCS", QtCore.QT_TRANSLATE_NOOP("PathJob", "If multiple WCS, order the output this way")) @@ -150,6 +151,7 @@ class ObjectJob: self.setupSetupSheet(obj) self.setupBaseModel(obj, models) + self.setupToolTable(obj) self.tooltip = None self.tooltipArgs = None @@ -191,6 +193,18 @@ class ObjectJob: obj.Base = None obj.removeProperty('Base') + def setupToolTable(self, obj): + if not hasattr(obj, 'Tools'): + obj.addProperty("App::PropertyLink", "Tools", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Collection of all tool controllers for the job")) + toolTable = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup", "Tools") + toolTable.Label = 'Tools' + if toolTable.ViewObject: + toolTable.ViewObject.Visibility = False + if hasattr(obj, 'ToolController'): + toolTable.addObjects(obj.ToolController) + obj.removeProperty('ToolController') + obj.Tools = toolTable + def removeBase(self, obj, base, removeFromModel): if isResourceClone(obj, base, None): PathUtil.clearExpressionEngine(base) @@ -234,14 +248,16 @@ class ObjectJob: # Tool controllers might refer to either legacy tool or toolbit PathLog.debug('taking down tool controller') - for tc in obj.ToolController: + for tc in obj.Tools.Group: if hasattr(tc.Tool, "Proxy"): PathUtil.clearExpressionEngine(tc.Tool) doc.removeObject(tc.Tool.Name) PathUtil.clearExpressionEngine(tc) tc.Proxy.onDelete(tc) doc.removeObject(tc.Name) - obj.ToolController = [] + obj.Tools.Group = [] + doc.removeObject(obj.Tools.Name) + obj.Tools = None # SetupSheet PathUtil.clearExpressionEngine(obj.SetupSheet) @@ -268,6 +284,7 @@ class ObjectJob: self.setupBaseModel(obj) self.fixupOperations(obj) self.setupSetupSheet(obj) + self.setupToolTable(obj) obj.setEditorMode('Operations', 2) # hide obj.setEditorMode('Placement', 2) @@ -334,7 +351,7 @@ class ObjectJob: obj.Stock = PathStock.CreateFromTemplate(obj, attrs.get(JobTemplate.Stock)) PathLog.debug("setting tool controllers (%d)" % len(tcs)) - obj.ToolController = tcs + obj.Tools.Group = tcs else: PathLog.error(translate('PathJob', "Unsupported PathJob template version %s") % attrs.get(JobTemplate.Version)) if not tcs: @@ -414,13 +431,12 @@ class ObjectJob: op.Path.Center = self.obj.Operations.Path.Center def addToolController(self, tc): - group = self.obj.ToolController + group = self.obj.Tools.Group PathLog.debug("addToolController(%s): %s" % (tc.Label, [t.Label for t in group])) if tc.Name not in [str(t.Name) for t in group]: tc.setExpression('VertRapid', "%s.%s" % (self.setupSheet.expressionReference(), PathSetupSheet.Template.VertRapid)) tc.setExpression('HorizRapid', "%s.%s" % (self.setupSheet.expressionReference(), PathSetupSheet.Template.HorizRapid)) - group.append(tc) - self.obj.ToolController = group + self.obj.Tools.addObject(tc) Notification.updateTC.emit(self.obj, tc) def allOperations(self): diff --git a/src/Mod/Path/PathScripts/PathJobCmd.py b/src/Mod/Path/PathScripts/PathJobCmd.py index 9b600dc32b..a3b26ac128 100644 --- a/src/Mod/Path/PathScripts/PathJobCmd.py +++ b/src/Mod/Path/PathScripts/PathJobCmd.py @@ -146,7 +146,7 @@ class CommandJobTemplateExport: attrs.pop(PathJob.JobTemplate.PostProcessorOutputFile, None) # tool controller settings - toolControllers = dialog.includeToolControllers() if dialog else job.ToolController + toolControllers = dialog.includeToolControllers() if dialog else job.Tools.Group if toolControllers: tcAttrs = [tc.Proxy.templateAttrs(tc) for tc in toolControllers] attrs[PathJob.JobTemplate.ToolController] = tcAttrs diff --git a/src/Mod/Path/PathScripts/PathJobDlg.py b/src/Mod/Path/PathScripts/PathJobDlg.py index a28466eb3c..c7e98edda5 100644 --- a/src/Mod/Path/PathScripts/PathJobDlg.py +++ b/src/Mod/Path/PathScripts/PathJobDlg.py @@ -338,7 +338,7 @@ class JobTemplateExport: self.dialog.settingsOpsList.addItem(item) self.dialog.toolsList.clear() - for tc in sorted(job.ToolController, key=lambda o: o.Label): + for tc in sorted(job.Tools.Group, key=lambda o: o.Label): item = QtGui.QListWidgetItem(tc.Label) item.setData(self.DataObject, tc) item.setCheckState(QtCore.Qt.CheckState.Checked) diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index a85c437fdf..f5d2fa9db2 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -210,7 +210,7 @@ class ViewProvider: return ":/icons/Path_Job.svg" def claimChildren(self): - children = self.obj.ToolController + children = [] children.append(self.obj.Operations) if hasattr(self.obj, 'Model'): # unfortunately this function is called before the object has been fully loaded @@ -222,6 +222,8 @@ class ViewProvider: if hasattr(self.obj, 'SetupSheet'): # when loading a job that didn't have a setup sheet they might not've been created yet children.append(self.obj.SetupSheet) + if hasattr(self.obj, 'Tools'): + children.append(self.obj.Tools) return children def onDelete(self, vobj, arg2=None): @@ -707,7 +709,7 @@ class TaskPanel: vUnit = FreeCAD.Units.Quantity(1, FreeCAD.Units.Velocity).getUserPreferred()[2] - for row, tc in enumerate(sorted(self.obj.ToolController, key=lambda tc: tc.Label)): + for row, tc in enumerate(sorted(self.obj.Tools.Group, key=lambda tc: tc.Label)): self.form.activeToolController.addItem(tc.Label, tc) if tc == select: index = row @@ -847,7 +849,7 @@ class TaskPanel: # can only delete what is selected delete = edit # ... but we want to make sure there's at least one TC left - if len(self.obj.ToolController) == len(self.form.toolControllerList.selectedItems()): + if len(self.obj.Tools.Group) == len(self.form.toolControllerList.selectedItems()): delete = False # ... also don't want to delete any TCs that are already used if delete: diff --git a/src/Mod/Path/PathScripts/PathSanity.py b/src/Mod/Path/PathScripts/PathSanity.py index 09664be146..0d1517e4f7 100644 --- a/src/Mod/Path/PathScripts/PathSanity.py +++ b/src/Mod/Path/PathScripts/PathSanity.py @@ -517,7 +517,7 @@ class CommandPathSanity: data = {} try: - for TC in obj.ToolController: + for TC in obj.Tools.Group: if not hasattr(TC.Tool, 'BitBody'): self.squawk("PathSanity", "Tool number {} is a legacy tool. Legacy tools not \ diff --git a/src/Mod/Path/PathScripts/PathToolControllerGui.py b/src/Mod/Path/PathScripts/PathToolControllerGui.py index 62709086e0..33e735a08d 100644 --- a/src/Mod/Path/PathScripts/PathToolControllerGui.py +++ b/src/Mod/Path/PathScripts/PathToolControllerGui.py @@ -165,12 +165,12 @@ class CommandPathToolController(object): tool = PathToolBitGui.ToolBitSelector().getTool() if tool: toolNr = None - for tc in job.ToolController: + for tc in job.Tools.Group: if tc.Tool == tool: toolNr = tc.ToolNumber break if not toolNr: - toolNr = max([tc.ToolNumber for tc in job.ToolController]) + 1 + toolNr = max([tc.ToolNumber for tc in job.Tools.Group]) + 1 tc = Create("TC: {}".format(tool.Label), tool, toolNr) job.Proxy.addToolController(tc) FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py index 6c7afdf4fd..d2e18e7184 100644 --- a/src/Mod/Path/PathScripts/PathUtils.py +++ b/src/Mod/Path/PathScripts/PathUtils.py @@ -403,7 +403,7 @@ def getToolControllers(obj, proxy=None): PathLog.debug("op={} ({})".format(obj.Label, type(obj))) if job: - return [c for c in job.ToolController if proxy.isToolSupported(obj, c.Tool)] + return [tc for tc in job.Tools.Group if proxy.isToolSupported(obj, tc.Tool)] return [] diff --git a/src/Mod/Path/PathTests/TestPathHelix.py b/src/Mod/Path/PathTests/TestPathHelix.py index 0fb76c9f1a..a3dc545156 100644 --- a/src/Mod/Path/PathTests/TestPathHelix.py +++ b/src/Mod/Path/PathTests/TestPathHelix.py @@ -62,7 +62,7 @@ class TestPathHelix(PathTestUtils.PathTestBase): def test02(self): '''Verify Helix generates proper holes for rotated model''' - self.job.ToolController[0].Tool.Diameter = 0.5 + self.job.Tools.Group[0].Tool.Diameter = 0.5 op = PathHelix.Create('Helix') proxy = op.Proxy @@ -87,7 +87,7 @@ class TestPathHelix(PathTestUtils.PathTestBase): self.doc.Body.Placement.Rotation = FreeCAD.Rotation(deg, 0, 0) self.job = PathJob.Create('Job', [self.doc.Body]) - self.job.ToolController[0].Tool.Diameter = 0.5 + self.job.Tools.Group[0].Tool.Diameter = 0.5 op = PathHelix.Create('Helix') proxy = op.Proxy @@ -109,7 +109,7 @@ class TestPathHelix(PathTestUtils.PathTestBase): self.clone.Placement.Rotation = FreeCAD.Rotation(deg, 0, 0) self.job = PathJob.Create('Job', [self.clone]) - self.job.ToolController[0].Tool.Diameter = 0.5 + self.job.Tools.Group[0].Tool.Diameter = 0.5 op = PathHelix.Create('Helix') proxy = op.Proxy diff --git a/src/Mod/Start/StartPage/StartPage.html b/src/Mod/Start/StartPage/StartPage.html index 346eedff7e..36a3bf2aa0 100644 --- a/src/Mod/Start/StartPage/StartPage.html +++ b/src/Mod/Start/StartPage/StartPage.html @@ -11,7 +11,7 @@
VERSIONSTRING - +
diff --git a/src/Mod/Start/StartPage/TranslationTexts.py b/src/Mod/Start/StartPage/TranslationTexts.py index 512ce19e9f..dbe76a34d5 100644 --- a/src/Mod/Start/StartPage/TranslationTexts.py +++ b/src/Mod/Start/StartPage/TranslationTexts.py @@ -79,3 +79,4 @@ T_EXTERNALLINKS = translate("StartPage", "To open any of the links above in your T_CREATIONDATE = translate("StartPage", "Creation date") T_LASTMODIFIED = translate("StartPage", "Last modification") T_NOTES = translate("StartPage", "Notes") +T_VTOOLTIP = translate("StartPage", "Open start page preferences") diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.cpp b/src/Mod/TechDraw/Gui/MDIViewPage.cpp index 71636640c8..771814912d 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.cpp +++ b/src/Mod/TechDraw/Gui/MDIViewPage.cpp @@ -119,10 +119,11 @@ MDIViewPage::MDIViewPage(ViewProviderPage *pageVp, Gui::Document* doc, QWidget* : Gui::MDIView(doc, parent), #if QT_VERSION >= 0x050300 m_orientation(QPageLayout::Landscape), + m_paperSize(QPageSize::A4), #else m_orientation(QPrinter::Landscape), -#endif m_paperSize(QPrinter::A4), +#endif m_vpPage(pageVp) { @@ -675,10 +676,12 @@ void MDIViewPage::printPdf(std::string file) QPrinter printer(QPrinter::HighResolution); printer.setFullPage(true); printer.setOutputFileName(filename); - if (m_paperSize == QPrinter::Ledger) { + #if QT_VERSION >= 0x050300 + if (m_paperSize == QPageSize::Ledger) { printer.setPageOrientation((QPageLayout::Orientation) (1 - m_orientation)); //reverse 0/1 #else + if (m_paperSize == QPrinter::Ledger) { printer.setOrientation((QPrinter::Orientation) (1 - m_orientation)); //reverse 0/1 #endif } else { @@ -688,7 +691,11 @@ void MDIViewPage::printPdf(std::string file) printer.setOrientation(m_orientation); #endif } +#if QT_VERSION >= 0x050300 + printer.setPageSize(QPageSize(m_paperSize)); +#else printer.setPaperSize(m_paperSize); +#endif print(&printer); } @@ -696,10 +703,11 @@ void MDIViewPage::print() { QPrinter printer(QPrinter::HighResolution); printer.setFullPage(true); - printer.setPaperSize(m_paperSize); #if QT_VERSION >= 0x050300 + printer.setPageSize(QPageSize(m_paperSize)); printer.setPageOrientation(m_orientation); #else + printer.setPaperSize(m_paperSize); printer.setOrientation(m_orientation); #endif QPrintDialog dlg(&printer, this); @@ -712,10 +720,11 @@ void MDIViewPage::printPreview() { QPrinter printer(QPrinter::HighResolution); printer.setFullPage(true); - printer.setPaperSize(m_paperSize); #if QT_VERSION >= 0x050300 + printer.setPageSize(QPageSize(m_paperSize)); printer.setPageOrientation(m_orientation); #else + printer.setPaperSize(m_paperSize); printer.setOrientation(m_orientation); #endif @@ -743,8 +752,13 @@ void MDIViewPage::print(QPrinter* printer) if (printer->outputFormat() == QPrinter::NativeFormat) { int w = printer->widthMM(); int h = printer->heightMM(); +#if QT_VERSION >= 0x050300 + QPageSize::PageSizeId psPrtCalcd = getPaperSize(w, h); + QPageSize::PageSizeId psPrtSetting = printer->pageLayout().pageSize().id(); +#else QPrinter::PaperSize psPrtCalcd = getPaperSize(w, h); QPrinter::PaperSize psPrtSetting = printer->paperSize(); +#endif // for the preview a 'Picture' paint engine is used which we don't // care if it uses wrong printer settings @@ -836,8 +850,11 @@ void MDIViewPage::print(QPrinter* printer) static_cast (blockConnection(false)); } - +#if QT_VERSION >= 0x050300 +QPageSize::PageSizeId MDIViewPage::getPaperSize(int w, int h) const +#else QPrinter::PaperSize MDIViewPage::getPaperSize(int w, int h) const +#endif { static const float paperSizes[][2] = { {210, 297}, // A4 @@ -872,25 +889,46 @@ QPrinter::PaperSize MDIViewPage::getPaperSize(int w, int h) const {279.4f, 431.8f} // Tabloid (29) causes trouble with orientation on PDF export }; +#if QT_VERSION >= 0x050300 + QPageSize::PageSizeId ps = QPageSize::Custom; +#else QPrinter::PaperSize ps = QPrinter::Custom; +#endif for (int i=0; i<30; i++) { if (std::abs(paperSizes[i][0]-w) <= 1 && std::abs(paperSizes[i][1]-h) <= 1) { +#if QT_VERSION >= 0x050300 + ps = static_cast(i); +#else ps = static_cast(i); +#endif break; } else //handle landscape & portrait w/h if (std::abs(paperSizes[i][0]-h) <= 1 && std::abs(paperSizes[i][1]-w) <= 1) { +#if QT_VERSION >= 0x050300 + ps = static_cast(i); +#else ps = static_cast(i); +#endif break; } } +#if QT_VERSION >= 0x050300 + if (ps == QPageSize::Ledger) { //check if really Tabloid + if (w < 431) { + ps = QPageSize::Tabloid; + } + } +#else if (ps == QPrinter::Ledger) { //check if really Tabloid if (w < 431) { ps = QPrinter::Tabloid; } } +#endif + return ps; } diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.h b/src/Mod/TechDraw/Gui/MDIViewPage.h index c5061f1b1a..9cf6864b05 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.h +++ b/src/Mod/TechDraw/Gui/MDIViewPage.h @@ -128,7 +128,12 @@ protected: void contextMenuEvent(QContextMenuEvent *event); void closeEvent(QCloseEvent*); +#if QT_VERSION >= 0x050300 + QPageSize::PageSizeId getPaperSize(int w, int h) const; +#else QPrinter::PaperSize getPaperSize(int w, int h) const; +#endif + void setDimensionGroups(void); void setBalloonGroups(void); void setLeaderGroups(void); @@ -161,10 +166,11 @@ private: QString m_currentPath; #if QT_VERSION >= 0x050300 QPageLayout::Orientation m_orientation; + QPageSize::PageSizeId m_paperSize; #else QPrinter::Orientation m_orientation; -#endif QPrinter::PaperSize m_paperSize; +#endif ViewProviderPage *m_vpPage; QList m_qgSceneSelected; //items in selection order