From a1b7e3e33bd88a2da1c7dd8858cd5a31302521bb Mon Sep 17 00:00:00 2001 From: edi271 Date: Tue, 19 Jul 2022 08:44:39 +0200 Subject: [PATCH] [TD] Add SurfaceFinishSymbol command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Bræstrup Sayoc --- src/Mod/TechDraw/Gui/CMakeLists.txt | 5 + src/Mod/TechDraw/Gui/CommandAnnotate.cpp | 46 +++ src/Mod/TechDraw/Gui/Resources/TechDraw.qrc | 1 + .../actions/TechDraw_SurfaceFinishSymbols.svg | 347 ++++++++++++++++ .../TechDraw/Gui/TaskSurfaceFinishSymbols.cpp | 382 ++++++++++++++++++ .../TechDraw/Gui/TaskSurfaceFinishSymbols.h | 148 +++++++ .../TechDraw/Gui/TaskSurfaceFinishSymbols.ui | 188 +++++++++ src/Mod/TechDraw/Gui/Workbench.cpp | 3 + 8 files changed, 1120 insertions(+) create mode 100644 src/Mod/TechDraw/Gui/Resources/icons/actions/TechDraw_SurfaceFinishSymbols.svg create mode 100644 src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.cpp create mode 100644 src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.h create mode 100644 src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.ui diff --git a/src/Mod/TechDraw/Gui/CMakeLists.txt b/src/Mod/TechDraw/Gui/CMakeLists.txt index 306111ac2c..21a7cb9a67 100644 --- a/src/Mod/TechDraw/Gui/CMakeLists.txt +++ b/src/Mod/TechDraw/Gui/CMakeLists.txt @@ -82,6 +82,7 @@ set(TechDrawGui_UIC_SRCS TaskRichAnno.ui TaskSectionView.ui TaskWeldingSymbol.ui + TaskSurfaceFinishSymbols.ui SymbolChooser.ui TaskMoveView.ui TaskProjection.ui @@ -186,6 +187,9 @@ SET(TechDrawGui_SRCS TaskWeldingSymbol.ui TaskWeldingSymbol.cpp TaskWeldingSymbol.h + TaskSurfaceFinishSymbols.ui + TaskSurfaceFinishSymbols.cpp + TaskSurfaceFinishSymbols.h TaskSelectLineAttributes.ui TaskSelectLineAttributes.cpp TaskSelectLineAttributes.h @@ -404,6 +408,7 @@ SET(TechDrawGuiTaskDlgs_SRCS TaskLineDecor.ui TaskRestoreLines.ui TaskWeldingSymbol.ui + TaskSurfaceFinishSymbols.ui SymbolChooser.ui TaskActiveView.ui TaskDetail.ui diff --git a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp index 7a34b42ee5..2a334f30f4 100644 --- a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp +++ b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp @@ -72,6 +72,7 @@ #include "ViewProviderViewPart.h" #include "QGIView.h" #include "QGVPage.h" +#include "TaskSurfaceFinishSymbols.h" using namespace TechDrawGui; using namespace TechDraw; @@ -1454,6 +1455,50 @@ bool CmdTechDrawWeldSymbol::isActive(void) return (havePage && haveView); } +//=========================================================================== +// TechDraw_SurfaceFinishSymbols +//=========================================================================== + +DEF_STD_CMD_A(CmdTechDrawSurfaceFinishSymbols) + +CmdTechDrawSurfaceFinishSymbols::CmdTechDrawSurfaceFinishSymbols() + : Command("TechDraw_SurfaceFinishSymbols") +{ + sAppModule = "TechDraw"; + sGroup = QT_TR_NOOP("TechDraw"); + sMenuText = QT_TR_NOOP("Create a Surface Finish Symbol"); + sToolTipText = QT_TR_NOOP("Select a view
\ + - click this button
\ + - select surface finish symbol attributes in opened panel"); + sWhatsThis = "TechDraw_SurfaceFinishSymbols"; + sStatusTip = sToolTipText; + sPixmap = "actions/TechDraw_SurfaceFinishSymbols"; +} + +void CmdTechDrawSurfaceFinishSymbols::activated(int iMsg) +{ + Q_UNUSED(iMsg); + std::vector selection = this->getSelection().getSelectionEx(); + if (selection.empty()) + { + QMessageBox::warning(Gui::getMainWindow(),QObject::tr("SurfaceFinishSymbols"),QObject::tr("Selection is empty")); + return; + } + TechDraw::DrawViewPart* objFeat = dynamic_cast (selection[0].getObject()); + if(!objFeat) + { + QMessageBox::warning(Gui::getMainWindow(),QObject::tr("SurfaceFinishSymbols"),QObject::tr("No object selected")); + return; + } + Gui::Control().showDialog(new TechDrawGui::TaskDlgSurfaceFinishSymbols(objFeat)); +} + +bool CmdTechDrawSurfaceFinishSymbols::isActive(void) +{ + bool havePage = DrawGuiUtil::needPage(this); + bool haveView = DrawGuiUtil::needView(this); + return havePage && haveView; +} void CreateTechDrawCommandsAnnotate(void) { @@ -1475,6 +1520,7 @@ void CreateTechDrawCommandsAnnotate(void) rcCmdMgr.addCommand(new CmdTechDrawDecorateLine()); rcCmdMgr.addCommand(new CmdTechDrawShowAll()); rcCmdMgr.addCommand(new CmdTechDrawWeldSymbol()); + rcCmdMgr.addCommand(new CmdTechDrawSurfaceFinishSymbols()); } //=========================================================================== diff --git a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc index 6d07c93fd5..9092f93518 100644 --- a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc +++ b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc @@ -45,6 +45,7 @@ icons/actions/TechDraw_ToggleFrame.svg icons/actions/TechDraw_View.svg icons/actions/TechDraw_WeldSymbol.svg + icons/actions/TechDraw_SurfaceFinishSymbols.svg icons/arrow-ccw.svg icons/arrow-cw.svg icons/arrow-down.svg diff --git a/src/Mod/TechDraw/Gui/Resources/icons/actions/TechDraw_SurfaceFinishSymbols.svg b/src/Mod/TechDraw/Gui/Resources/icons/actions/TechDraw_SurfaceFinishSymbols.svg new file mode 100644 index 0000000000..cab769fccc --- /dev/null +++ b/src/Mod/TechDraw/Gui/Resources/icons/actions/TechDraw_SurfaceFinishSymbols.svg @@ -0,0 +1,347 @@ + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Ra + + + \ No newline at end of file diff --git a/src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.cpp b/src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.cpp new file mode 100644 index 0000000000..279839af99 --- /dev/null +++ b/src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.cpp @@ -0,0 +1,382 @@ +/*************************************************************************** + * Copyright (c) 2022 edi * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#include "PreCompiled.h" +#include +#include +#include +#include +#include +#include +#include "TaskSurfaceFinishSymbols.h" +#include +#include +#include +#include + +using namespace Gui; +using namespace TechDraw; +using namespace TechDrawGui; + +SvgString::SvgString(int width, int height) +{ + svgStream << "\n"; + svgStream << "\n"; +} + +void SvgString::addLine(int x1, int y1, int x2, int y2) +{ + svgStream << "\n"; +} + +void SvgString::addCircle(int xCenter, int yCenter, int radius) +{ + svgStream << "\n"; +} + +void SvgString::addText(int xText, int yText, std::string text) +{ + svgStream << "" << text << "\n"; +} + +std::string SvgString::finish(void) +{ + svgStream << "\n"; + return svgStream.str(); +} + +//=========================================================================== +// TaskSurfaceFinishSymbols +//=========================================================================== + +TaskSurfaceFinishSymbols::TaskSurfaceFinishSymbols(TechDraw::DrawViewPart* view) : + selectedView(view), + ui(new Ui_TaskSurfaceFinishSymbols) +{ + raValues = {"RA50","RA25","RA12,5","RA6,3", + "RA3,2","RA1,6","RA0,8","RA0,4", + "RA0,2","RA0,1","RA0,05","RA0,025"}; + laySymbols = {"","=","⟂","X","M","C","R"}; + roughGrades = {"","N1","N2","N3","N4","N5", + "N6","N7","N8","N9","N10","N11"}; + ui->setupUi(this); + setUiEdit(); +} + +QPixmap TaskSurfaceFinishSymbols::baseSymbol(symbolType type) +// return QPixmap showing a base symbol +{ + QImage img (50,64,QImage::Format_ARGB32_Premultiplied); + img.fill(QColor(240,240,240)); + QPainter painter; + painter.begin(&img); + painter.setPen(QPen(Qt::black, 2, Qt::SolidLine, + Qt::RoundCap, Qt::RoundJoin)); + painter.setRenderHints(QPainter::Antialiasing | + QPainter::SmoothPixmapTransform | + QPainter::TextAntialiasing); + painter.drawLine(QLine(0,44,12,64)); + painter.drawLine(QLine(12,64,42,14)); + if (type == removeProhibit || type == removeProhibitAll) + painter.drawEllipse(QPoint(12,46),9,9); + if (type == removeRequired || type == removeRequiredAll) + painter.drawLine(QLine(0,44,24,44)); + if (type > removeRequired) + painter.drawEllipse(QPoint(42,14),6,6); + painter.end(); + return QPixmap::fromImage(img); +} + +std::string TaskSurfaceFinishSymbols::completeSymbol(void) +// return string showing the complete symbol +{ + SvgString symbol(150,64); + symbol.addLine(0,44,12,64); + symbol.addLine(12,64,42,14); + int moveLeft(0), maxTextLength(0); + if (activeIcon == removeProhibit || activeIcon == removeProhibitAll) + symbol.addCircle(12,46,9); + if (activeIcon == removeRequired || activeIcon == removeRequiredAll) + symbol.addLine(0,44,24,44); + if (activeIcon > removeRequired) + { + symbol.addCircle(42,14,6); + moveLeft = 5 ; + } + std::string methodText = leMethod->text().toStdString(); + symbol.addText(42+moveLeft,11,methodText); + int methodTextLength = methodText.length(); + if (isISO) + { + std::string raText = cbRA->itemText(cbRA->currentIndex()).toStdString(); + symbol.addText(42+moveLeft,30,raText); + int raTextLength = raText.length(); + maxTextLength = std::max(methodTextLength,raTextLength)*9.25+moveLeft; + } + else + { + std::string sampleText = leSamLength->text().toStdString(); + symbol.addText(42+moveLeft,30,sampleText); + int sampleTextLength = sampleText.length(); + maxTextLength = std::max(methodTextLength,sampleTextLength)*9.25+moveLeft; + std::string minRoughtText = cbMinRought->itemText(cbMinRought->currentIndex()).toStdString(); + symbol.addText(-10,35,minRoughtText); + std::string maxRoughtText = cbMaxRought->itemText(cbMaxRought->currentIndex()).toStdString(); + symbol.addText(-10,20,maxRoughtText); + } + symbol.addLine(42,14,42+maxTextLength,14); + symbol.addText(20,60,cbLay->itemText(cbLay->currentIndex()).toStdString()); + symbol.addText(-25,60,leAddition->text().toStdString()); + std::string symbolAsString = symbol.finish(); + return symbolAsString; +} + +TaskSurfaceFinishSymbols::~TaskSurfaceFinishSymbols() +{ + +} + +void TaskSurfaceFinishSymbols::updateTask() +{ +// blockUpdate = true; + +// blockUpdate = false; +} + + +void TaskSurfaceFinishSymbols::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(this); + } +} + +void TaskSurfaceFinishSymbols::setUiEdit() +// arrange widget at tool start +{ + setWindowTitle(tr("Surface Finish Symbols")); + // create icon pixmaps of QPushButtons + ui->pbIcon01->setIcon(baseSymbol(anyMethod)); + ui->pbIcon02->setIcon(baseSymbol(removeProhibit)); + ui->pbIcon03->setIcon(baseSymbol(removeRequired)); + ui->pbIcon04->setIcon(baseSymbol(anyMethodAll)); + ui->pbIcon05->setIcon(baseSymbol(removeProhibitAll)); + ui->pbIcon06->setIcon(baseSymbol(removeRequiredAll)); + activeIcon = anyMethod ; + isISO = true; + + // Create scene and all items used in the scene + symbolScene = new(QGraphicsScene); + ui->graphicsView->setScene(symbolScene); + // QLineEdit showing method + leMethod = new(QLineEdit); + leMethod->resize(90,20); + leMethod->setToolTip(QObject::tr("Method")); + QGraphicsProxyWidget* proxyMethod = symbolScene->addWidget(leMethod); + proxyMethod->setPos(2,-142); + // QLineEdit showing addition + leAddition = new(QLineEdit); + leAddition->resize(25,20); + leAddition->setToolTip(QObject::tr("Addition")); + QGraphicsProxyWidget* proxyAddition = symbolScene->addWidget(leAddition); + proxyAddition->setPos(-80,-85); + proxyAddition->setZValue(-2); + // QComboBox showing RA values + cbRA = new(QComboBox); + cbRA->resize(90,20); + for (std::string nextValue : raValues) + cbRA->addItem(QString::fromStdString(nextValue)); + cbRA->setToolTip(QObject::tr("Average roughness")); + proxyRA = symbolScene->addWidget(cbRA); + proxyRA->setPos(2,-113); + // QLineEdit showing sampling length value + leSamLength = new(QLineEdit); + leSamLength->resize(90,20); + leSamLength->setToolTip(QObject::tr("Roughness sampling length")); + proxySamLength = symbolScene->addWidget(leSamLength); + proxySamLength->setPos(2,-113); + proxySamLength->hide(); + // QComboBox showing lay symbol + cbLay = new(QComboBox); + cbLay->resize(40,20); + for (std::string nextLay : laySymbols) + cbLay->addItem(QString::fromStdString(nextLay)); + cbLay->setToolTip(QObject::tr("Lay symbol")); + QGraphicsProxyWidget* proxyLay = symbolScene->addWidget(cbLay); + proxyLay->setPos(-23,-85); + // QComboBox showing minimal roughness grade + cbMinRought = new(QComboBox); + cbMinRought->resize(55,20); + for (std::string nextGrade : roughGrades) + cbMinRought->addItem(QString::fromStdString(nextGrade)); + cbMinRought->setToolTip(QObject::tr("Minimum roughness grade number")); + proxyMinRough = symbolScene->addWidget(cbMinRought); + proxyMinRough->setPos(-80,-118); + proxyMinRough-> setZValue(1); + proxyMinRough->hide(); + // QComboBox showing maximal roughness grade + cbMaxRought = new(QComboBox); + cbMaxRought->resize(55,20); + for (std::string nextGrade : roughGrades) + cbMaxRought->addItem(QString::fromStdString(nextGrade)); + cbMaxRought->setToolTip(QObject::tr("Maximum roughness grade number")); + proxyMaxRough = symbolScene->addWidget(cbMaxRought); + proxyMaxRough->setPos(-80,-143); + proxyMaxRough->setZValue(1); + proxyMaxRough->hide(); + // add horizontal line + symbolScene->addLine(QLine(-8,-116,90,-116), + QPen(Qt::black,2,Qt::SolidLine, + Qt::RoundCap, Qt::RoundJoin)); + // add pixmap of the surface finish symbol + QIcon symbolIcon = ui->pbIcon01->icon(); + QGraphicsPixmapItem* pixmapItem = new(QGraphicsPixmapItem); + pixmapItem->setPixmap(symbolIcon.pixmap(50,64)); + pixmapItem->setPos(-50,-130); + pixmapItem->setZValue(-1); + symbolScene->addItem(pixmapItem); + + connect(ui->pbIcon01, SIGNAL(clicked()), this, SLOT(onIconChanged())); + connect(ui->pbIcon02, SIGNAL(clicked()), this, SLOT(onIconChanged())); + connect(ui->pbIcon03, SIGNAL(clicked()), this, SLOT(onIconChanged())); + connect(ui->pbIcon04, SIGNAL(clicked()), this, SLOT(onIconChanged())); + connect(ui->pbIcon05, SIGNAL(clicked()), this, SLOT(onIconChanged())); + connect(ui->pbIcon06, SIGNAL(clicked()), this, SLOT(onIconChanged())); + connect(ui->rbISO, SIGNAL(clicked()), this, SLOT(onISO())); + connect(ui->rbASME, SIGNAL(clicked()), this, SLOT(onASME())); +} + +void TaskSurfaceFinishSymbols::onIconChanged() +// Slot: change icon of surface finish symbol +{ + QObject* senderObj(this->sender()); + QPushButton* pressedButton = qobject_cast(senderObj); + if (!pressedButton) { + return; + } + + if (ui->pbIcon01 == pressedButton) activeIcon = anyMethod; + if (ui->pbIcon02 == pressedButton) activeIcon = removeProhibit; + if (ui->pbIcon03 == pressedButton) activeIcon = removeRequired; + if (ui->pbIcon04 == pressedButton) activeIcon = anyMethodAll; + if (ui->pbIcon05 == pressedButton) activeIcon = removeProhibitAll; + if (ui->pbIcon06 == pressedButton) activeIcon = removeRequiredAll; + + QIcon symbolIcon = pressedButton->icon(); + QGraphicsPixmapItem* pixmapItem = new(QGraphicsPixmapItem); + pixmapItem->setPixmap(symbolIcon.pixmap(50,64)); + pixmapItem->setPos(-50,-130); + pixmapItem->setZValue(-1); + symbolScene->addItem(pixmapItem); +} + +void TaskSurfaceFinishSymbols::onISO() +// Slot: show ISO template in scene +{ + isISO = true; + proxySamLength->hide(); + proxyMinRough->hide(); + proxyMaxRough->hide(); + proxyRA->show(); +} + +void TaskSurfaceFinishSymbols::onASME() +// Slot: show ASME template in scene +{ + isISO = false; + proxySamLength->show(); + proxyMinRough->show(); + proxyMaxRough->show(); + proxyRA->hide(); +} + +bool TaskSurfaceFinishSymbols::accept() +// Slot: dialog finished using OK +{ + Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Surface Finish Symbols")); + App::Document *doc = Application::Instance->activeDocument()->getDocument(); + App::DocumentObject *docObject = doc->addObject("TechDraw::DrawViewSymbol","SurfaceSymbol"); + TechDraw::DrawViewSymbol *surfaceSymbol = dynamic_cast(docObject); + surfaceSymbol->Symbol.setValue(completeSymbol()); + surfaceSymbol->Rotation.setValue(ui->leAngle->text().toDouble()); + TechDraw::DrawPage* page = selectedView->findParentPage(); + page->addView(surfaceSymbol); + Gui::Command::commitCommand(); + return true; +} + +bool TaskSurfaceFinishSymbols::reject() +{ + return true; +} + +//=========================================================================== +// TaskDlgSurfaceFinishSymbols// +//=========================================================================== + +TaskDlgSurfaceFinishSymbols::TaskDlgSurfaceFinishSymbols(TechDraw::DrawViewPart* view) + : TaskDialog() +{ + widget = new TaskSurfaceFinishSymbols(view); + taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/TechDraw_SurfaceFinishSymbols"), + widget->windowTitle(), true, nullptr); + taskbox->groupLayout()->addWidget(widget); + Content.push_back(taskbox); +} + +TaskDlgSurfaceFinishSymbols::~TaskDlgSurfaceFinishSymbols() +{ +} + +void TaskDlgSurfaceFinishSymbols::update() +{ +// widget->updateTask(); +} + +//==== calls from the TaskView =============================================================== +void TaskDlgSurfaceFinishSymbols::open() +{ +} + +void TaskDlgSurfaceFinishSymbols::clicked(int) +{ +} + +bool TaskDlgSurfaceFinishSymbols::accept() +{ + widget->accept(); + return true; +} + +bool TaskDlgSurfaceFinishSymbols::reject() +{ + widget->reject(); + return true; +} + +#include diff --git a/src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.h b/src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.h new file mode 100644 index 0000000000..9102a7216b --- /dev/null +++ b/src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.h @@ -0,0 +1,148 @@ +/*************************************************************************** + * Copyright (c) 2022 edi * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#ifndef TECHDRAWGUI_TASKSURFACEFINISHSYMBOLS_H +#define TECHDRAWGUI_TASKSURFACEFINISHSYMBOLS_H + +#include +#include + +class QComboBox; + +namespace App { +class DocumentObject; +} + +namespace TechDraw +{ +class DrawPage; +class DrawView; +class DrawViewPart; +class CosmeticEdge; +class LineFormat; +} + +namespace TechDraw +{ +class Face; +} + +namespace TechDrawGui +{ +class QGVPage; +class QGIView; +class QGIPrimPath; +class MDIViewPage; +class ViewProviderViewPart; +class Ui_TaskSurfaceFinishSymbols; + +class SvgString +// Class to reate a SVG as a string +{ + std::stringstream svgStream; + +public: + + SvgString(int width, int height); + void addLine(int x1, int y1, int x2, int y2); + void addCircle(int xCenter, int yCenter, int radius); + void addText(int xText, int yText, std::string text); + std::string finish(void); + +}; // SvgString + +class TaskSurfaceFinishSymbols : public QWidget +{ + Q_OBJECT + +public: + TaskSurfaceFinishSymbols(TechDraw::DrawViewPart* view); + ~TaskSurfaceFinishSymbols(); + +public Q_SLOTS: + +public: + virtual bool accept(); + virtual bool reject(); + void updateTask(); + +private Q_SLOTS: + void onIconChanged(); + void onISO(); + void onASME(); + +protected Q_SLOTS: + +protected: + void changeEvent(QEvent *e); + + void setUiEdit(void); + +private: + enum symbolType {anyMethod=0, removeProhibit, removeRequired, + anyMethodAll, removeProhibitAll, removeRequiredAll}; + QPixmap baseSymbol(symbolType type); + std::string completeSymbol(); + TechDraw::DrawViewPart* selectedView; + QGraphicsScene* symbolScene; + std::vector raValues, laySymbols, roughGrades; + QGraphicsProxyWidget *proxyRA, *proxySamLength, *proxyMinRough, *proxyMaxRough; + QLineEdit *leMethod, *leSamLength, *leAddition; + QComboBox *cbRA, *cbMinRought, *cbMaxRought, *cbLay; + symbolType activeIcon; + bool isISO; + std::unique_ptr ui; +}; // class TaskSurfaceFinishSymbols + +class TaskDlgSurfaceFinishSymbols : public Gui::TaskView::TaskDialog +{ + Q_OBJECT + +public: + TaskDlgSurfaceFinishSymbols(TechDraw::DrawViewPart* view); + ~TaskDlgSurfaceFinishSymbols(); + +public: + /// is called the TaskView when the dialog is opened + virtual void open(); + /// is called by the framework if an button is clicked which has no accept or reject role + virtual void clicked(int); + /// is called by the framework if the dialog is accepted (Ok) + virtual bool accept(); + /// is called by the framework if the dialog is rejected (Cancel) + virtual bool reject(); + /// is called by the framework if the user presses the help button + virtual void helpRequested() { return;} + virtual bool isAllowedAlterDocument(void) const + { return false; } + void update(); + +protected: + +private: + TaskSurfaceFinishSymbols* widget; + Gui::TaskView::TaskBox* taskbox; +}; // class TaskDlgSurfaceFinishSymbols + +} // namespace TechDrawGui + +#endif // #ifndef TECHDRAWGUI_TASKSURFACEFINISHSYMBOLS_H diff --git a/src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.ui b/src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.ui new file mode 100644 index 0000000000..c29b10231c --- /dev/null +++ b/src/Mod/TechDraw/Gui/TaskSurfaceFinishSymbols.ui @@ -0,0 +1,188 @@ + + + TechDrawGui::TaskSurfaceFinishSymbols + + + + 0 + 0 + 274 + 454 + + + + + 0 + 0 + + + + + 250 + 0 + + + + Surface Finish Symbols + + + + + + + + <html><head/><body><p>Material removal prohibited, whole part</p></body></html> + + + + + + + + + + <html><head/><body><p>Any method allowed, whole part</p></body></html> + + + + + + + + + + <html><head/><body><p>Material removal required, whole part</p></body></html> + + + + + + + + + + <html><head/><body><p>Material removal required</p></body></html> + + + + + + + + + + <html><head/><body><p>Material removal prohibited</p></body></html> + + + + + + + + + + <html><head/><body><p>Any method allowed</p></body></html> + + + + + + + + + + + + + + Symbol angle: + + + + + + + <html><head/><body><p>Rotation angle</p></body></html> + + + 0 + + + + + + + <html><head/><body><p>Use ISO standard</p></body></html> + + + ISO + + + true + + + + + + + <html><head/><body><p>Use ASME standard</p></body></html> + + + ASME + + + + + + + + + + 0 + 0 + + + + + 0 + 300 + + + + ArrowCursor + + + false + + + QFrame::NoFrame + + + 0 + + + + + 240 + 240 + 240 + + + + + + 0.000000000000000 + 0.000000000000000 + 3.000000000000000 + 0.000000000000000 + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Gui/Workbench.cpp b/src/Mod/TechDraw/Gui/Workbench.cpp index cd5a800842..6f6da5d751 100644 --- a/src/Mod/TechDraw/Gui/Workbench.cpp +++ b/src/Mod/TechDraw/Gui/Workbench.cpp @@ -212,6 +212,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const *draw << "TechDraw_DecorateLine"; *draw << "TechDraw_ShowAll"; *draw << "TechDraw_WeldSymbol"; + *draw << "TechDraw_SurfaceFinishSymbols"; *draw << "Separator"; *draw << "TechDraw_ProjectShape"; return root; @@ -352,6 +353,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const *anno << "TechDraw_DecorateLine"; *anno << "TechDraw_ShowAll"; *anno << "TechDraw_WeldSymbol"; + *anno << "TechDraw_SurfaceFinishSymbols"; return root; } @@ -491,6 +493,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const *anno << "TechDraw_DecorateLine"; *anno << "TechDraw_ShowAll"; *anno << "TechDraw_WeldSymbol"; + *anno << "TechDraw_SurfaceFinishSymbols"; return root; }