diff --git a/src/Mod/PartDesign/App/FeatureLoft.cpp b/src/Mod/PartDesign/App/FeatureLoft.cpp index 7f567fbd1..b856ccf04 100644 --- a/src/Mod/PartDesign/App/FeatureLoft.cpp +++ b/src/Mod/PartDesign/App/FeatureLoft.cpp @@ -104,25 +104,28 @@ App::DocumentObjectExecReturn *Loft::execute(void) //build up multisections auto multisections = Sections.getValues(); + if(multisections.empty()) + return new App::DocumentObjectExecReturn("Loft: At least one section is needed"); + std::vector> wiresections; for(TopoDS_Wire& wire : wires) wiresections.push_back(std::vector(1, wire)); for(App::DocumentObject* obj : multisections) { if(!obj->isDerivedFrom(Part::Feature::getClassTypeId())) - return new App::DocumentObjectExecReturn("All sections need to be part features"); + return new App::DocumentObjectExecReturn("Loft: All sections need to be part features"); TopExp_Explorer ex; int i=0; for (ex.Init(static_cast(obj)->Shape.getValue(), TopAbs_WIRE); ex.More(); ex.Next()) { wiresections[i].push_back(TopoDS::Wire(ex.Current())); if(i>=wiresections.size()) - return new App::DocumentObjectExecReturn("Sections need to have the same amount of inner wires as the base section"); + return new App::DocumentObjectExecReturn("Loft: Sections need to have the same amount of inner wires as the base section"); ++i; } if(igetSolid(mkFuse.Shape()); // lets check if the result is a solid if (boolOp.IsNull()) - return new App::DocumentObjectExecReturn("Resulting shape is not a solid"); + return new App::DocumentObjectExecReturn("Loft: Resulting shape is not a solid"); boolOp = refineShapeIfActive(boolOp); Shape.setValue(boolOp); @@ -198,12 +202,12 @@ App::DocumentObjectExecReturn *Loft::execute(void) BRepAlgoAPI_Cut mkCut(base, result); if (!mkCut.IsDone()) - return new App::DocumentObjectExecReturn("Subtracting the loft failed"); + return new App::DocumentObjectExecReturn("Loft: Subtracting the loft failed"); // we have to get the solids (fuse sometimes creates compounds) TopoDS_Shape boolOp = this->getSolid(mkCut.Shape()); // lets check if the result is a solid if (boolOp.IsNull()) - return new App::DocumentObjectExecReturn("Resulting shape is not a solid"); + return new App::DocumentObjectExecReturn("Loft: Resulting shape is not a solid"); boolOp = refineShapeIfActive(boolOp); Shape.setValue(boolOp); @@ -218,7 +222,7 @@ App::DocumentObjectExecReturn *Loft::execute(void) return new App::DocumentObjectExecReturn(e->GetMessageString()); } catch (...) { - return new App::DocumentObjectExecReturn("A fatal error occurred when making the loft"); + return new App::DocumentObjectExecReturn("Loft: A fatal error occurred when making the loft"); } } diff --git a/src/Mod/PartDesign/Gui/CMakeLists.txt b/src/Mod/PartDesign/Gui/CMakeLists.txt index 8d8d176da..b17dd789a 100644 --- a/src/Mod/PartDesign/Gui/CMakeLists.txt +++ b/src/Mod/PartDesign/Gui/CMakeLists.txt @@ -51,6 +51,7 @@ set(PartDesignGui_MOC_HDRS TaskBooleanParameters.h TaskPrimitiveParameters.h TaskPipeParameters.h + TaskLoftParameters.h ) fc_wrap_cpp(PartDesignGui_MOC_SRCS ${PartDesignGui_MOC_HDRS}) SOURCE_GROUP("Moc" FILES ${PartDesignGui_MOC_SRCS}) @@ -80,6 +81,7 @@ set(PartDesignGui_UIC_SRCS TaskPipeParameters.ui TaskPipeOrientation.ui TaskPipeScaling.ui + TaskLoftParameters.ui ) qt4_wrap_ui(PartDesignGui_UIC_HDRS ${PartDesignGui_UIC_SRCS}) @@ -213,6 +215,9 @@ SET(PartDesignGuiTaskDlgs_SRCS TaskPipeScaling.ui TaskPipeParameters.h TaskPipeParameters.cpp + TaskLoftParameters.ui + TaskLoftParameters.h + TaskLoftParameters.cpp ) SOURCE_GROUP("TaskDialogs" FILES ${PartDesignGuiTaskDlgs_SRCS}) diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 377895e59..0995ea107 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -1363,6 +1363,86 @@ bool CmdPartDesignSubtractivePipe::isActive(void) return hasActiveDocument(); } + +//=========================================================================== +// PartDesign_Additive_Loft +//=========================================================================== +DEF_STD_CMD_A(CmdPartDesignAdditiveLoft); + +CmdPartDesignAdditiveLoft::CmdPartDesignAdditiveLoft() + : Command("PartDesign_AdditiveLoft") +{ + sAppModule = "PartDesign"; + sGroup = QT_TR_NOOP("PartDesign"); + sMenuText = QT_TR_NOOP("Additive pipe"); + sToolTipText = QT_TR_NOOP("Sweep a selected sketch along a path or to other profiles"); + sWhatsThis = "PartDesign_Additive_Loft"; + sStatusTip = sToolTipText; + sPixmap = "PartDesign_Additive_Loft"; +} + +void CmdPartDesignAdditiveLoft::activated(int iMsg) +{ + Gui::Command* cmd = this; + auto worker = [cmd](Part::Part2DObject* sketch, std::string FeatName) { + + if (FeatName.empty()) return; + + // specific parameters for pipe + Gui::Command::updateActive(); + + finishSketchBased(cmd, sketch, FeatName); + cmd->adjustCameraPosition(); + }; + + prepareSketchBased(this, "AdditiveLoft", worker); +} + +bool CmdPartDesignAdditiveLoft::isActive(void) +{ + return hasActiveDocument(); +} + + +//=========================================================================== +// PartDesign_Subtractive_Loft +//=========================================================================== +DEF_STD_CMD_A(CmdPartDesignSubtractiveLoft); + +CmdPartDesignSubtractiveLoft::CmdPartDesignSubtractiveLoft() + : Command("PartDesign_SubtractiveLoft") +{ + sAppModule = "PartDesign"; + sGroup = QT_TR_NOOP("PartDesign"); + sMenuText = QT_TR_NOOP("Subtractive pipe"); + sToolTipText = QT_TR_NOOP("Sweep a selected sketch along a path or to other profiles and remove it from the body"); + sWhatsThis = "PartDesign_Subtractive_Loft"; + sStatusTip = sToolTipText; + sPixmap = "PartDesign_Subtractive_Loft"; +} + +void CmdPartDesignSubtractiveLoft::activated(int iMsg) +{ + Gui::Command* cmd = this; + auto worker = [cmd](Part::Part2DObject* sketch, std::string FeatName) { + + if (FeatName.empty()) return; + + // specific parameters for pipe + Gui::Command::updateActive(); + + finishSketchBased(cmd, sketch, FeatName); + cmd->adjustCameraPosition(); + }; + + prepareSketchBased(this, "SubtractiveLoft", worker); +} + +bool CmdPartDesignSubtractiveLoft::isActive(void) +{ + return hasActiveDocument(); +} + //=========================================================================== // Common utility functions for Dressup features //=========================================================================== @@ -2157,6 +2237,10 @@ void CreatePartDesignCommands(void) rcCmdMgr.addCommand(new CmdPartDesignPocket()); rcCmdMgr.addCommand(new CmdPartDesignRevolution()); rcCmdMgr.addCommand(new CmdPartDesignGroove()); + rcCmdMgr.addCommand(new CmdPartDesignAdditivePipe); + rcCmdMgr.addCommand(new CmdPartDesignSubtractivePipe); + rcCmdMgr.addCommand(new CmdPartDesignAdditiveLoft); + rcCmdMgr.addCommand(new CmdPartDesignSubtractiveLoft); rcCmdMgr.addCommand(new CmdPartDesignFillet()); rcCmdMgr.addCommand(new CmdPartDesignDraft()); @@ -2170,6 +2254,4 @@ void CreatePartDesignCommands(void) rcCmdMgr.addCommand(new CmdPartDesignMultiTransform()); rcCmdMgr.addCommand(new CmdPartDesignBoolean()); - rcCmdMgr.addCommand(new CmdPartDesignAdditivePipe); - rcCmdMgr.addCommand(new CmdPartDesignSubtractivePipe); } diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp new file mode 100644 index 000000000..3e3a34c5b --- /dev/null +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp @@ -0,0 +1,331 @@ +/*************************************************************************** + * Copyright (c) 2015 Stefan Tröger * + * * + * 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" + +#ifndef _PreComp_ +# include +# include +# include +# include +# include +#endif + +#include "ui_TaskLoftParameters.h" +#include "TaskLoftParameters.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "TaskSketchBasedParameters.h" +#include "ReferenceSelection.h" +#include "Workbench.h" + +using namespace PartDesignGui; +using namespace Gui; + +/* TRANSLATOR PartDesignGui::TaskLoftParameters */ + +TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView,bool newObj, QWidget *parent) + : TaskSketchBasedParameters(LoftView, parent, "PartDesign_Additive_Loft",tr("Loft parameters")) +{ + // we need a separate container widget to add all controls to + proxy = new QWidget(this); + ui = new Ui_TaskLoftParameters(); + ui->setupUi(proxy); + QMetaObject::connectSlotsByName(this); + + connect(ui->buttonRefAdd, SIGNAL(toggled(bool)), + this, SLOT(onRefButtonAdd(bool))); + connect(ui->buttonRefRemove, SIGNAL(toggled(bool)), + this, SLOT(onRefButtonRemvove(bool))); + connect(ui->checkBoxRuled, SIGNAL(toggled(bool)), + this, SLOT(onRuled(bool))); + connect(ui->checkBoxClosed, SIGNAL(toggled(bool)), + this, SLOT(onClosed(bool))); + + this->groupLayout()->addWidget(proxy); + + // Temporarily prevent unnecessary feature recomputes + for(QWidget* child : proxy->findChildren()) + child->blockSignals(true); + + + + // activate and de-activate dialog elements as appropriate + for(QWidget* child : proxy->findChildren()) + child->blockSignals(false); + + updateUI(0); +} + +void TaskLoftParameters::updateUI(int index) +{ +} + +void TaskLoftParameters::onSelectionChanged(const Gui::SelectionChanges& msg) +{ + if (selectionMode == none) + return; + + if (msg.Type == Gui::SelectionChanges::AddSelection) { + if (referenceSelected(msg)) { + if (selectionMode == refAdd) { + QString objn = QString::fromStdString(msg.pObjectName); + if(!objn.isEmpty()) + ui->listWidgetReferences->addItem(objn); + } + else if (selectionMode == refRemove) { + QString objn = QString::fromStdString(msg.pObjectName); + if(!objn.isEmpty()) + removeFromListWidget(ui->listWidgetReferences, objn); + } + clearButtons(); + //static_cast(vp)->highlightReferences(false, true); + recomputeFeature(); + } + clearButtons(); + exitSelectionMode(); + } +} + + +bool TaskLoftParameters::referenceSelected(const Gui::SelectionChanges& msg) const { + + + if ((msg.Type == Gui::SelectionChanges::AddSelection) && ( + (selectionMode == refAdd) || (selectionMode == refRemove))) { + + if (strcmp(msg.pDocName, vp->getObject()->getDocument()->getName()) != 0) + return false; + + // not allowed to reference ourself + const char* fname = vp->getObject()->getNameInDocument(); + if (strcmp(msg.pObjectName, fname) == 0) + return false; + + //every selection needs to be a profile in itself, hence currently only full objects are + //supported, not individual edges of a part + + //change the references + std::vector refs = static_cast(vp->getObject())->Sections.getValues(); + App::DocumentObject* obj = vp->getObject()->getDocument()->getObject(msg.pObjectName); + std::vector::iterator f = std::find(refs.begin(), refs.end(), obj); + + if (selectionMode == refAdd) { + if (f == refs.end()) + refs.push_back(obj); + else + return false; // duplicate selection + } else { + if (f != refs.end()) + refs.erase(f); + else + return false; + } + + static_cast(vp->getObject())->Sections.setValues(refs); + return true; + } + + return false; +} + +void TaskLoftParameters::removeFromListWidget(QListWidget* widget, QString name) { + + QList items = widget->findItems(name, Qt::MatchExactly); + if (!items.empty()) { + for (QList::const_iterator i = items.begin(); i != items.end(); i++) { + QListWidgetItem* it = widget->takeItem(widget->row(*i)); + delete it; + } + } +} + +void TaskLoftParameters::clearButtons() { + + ui->buttonRefAdd->setChecked(false); + ui->buttonRefRemove->setChecked(false); +} + +void TaskLoftParameters::exitSelectionMode() { + + selectionMode = none; + Gui::Selection().clearSelection(); +} + +TaskLoftParameters::~TaskLoftParameters() +{ + delete ui; +} + +void TaskLoftParameters::changeEvent(QEvent *e) +{/* + TaskBox::changeEvent(e); + if (e->type() == QEvent::LanguageChange) { + ui->spinOffset->blockSignals(true); + ui->lengthEdit->blockSignals(true); + ui->lengthEdit2->blockSignals(true); + ui->lineFaceName->blockSignals(true); + ui->changeMode->blockSignals(true); + int index = ui->changeMode->currentIndex(); + ui->retranslateUi(proxy); + ui->changeMode->clear(); + ui->changeMode->addItem(tr("Dimension")); + ui->changeMode->addItem(tr("To last")); + ui->changeMode->addItem(tr("To first")); + ui->changeMode->addItem(tr("Up to face")); + ui->changeMode->addItem(tr("Two dimensions")); + ui->changeMode->setCurrentIndex(index); + + QStringList parts = ui->lineFaceName->text().split(QChar::fromAscii(':')); + QByteArray upToFace = ui->lineFaceName->property("FaceName").toByteArray(); + int faceId = -1; + bool ok = false; + if (upToFace.indexOf("Face") == 0) { + faceId = upToFace.remove(0,4).toInt(&ok); + } +#if QT_VERSION >= 0x040700 + ui->lineFaceName->setPlaceholderText(tr("No face selected")); +#endif + ui->lineFaceName->setText(ok ? + parts[0] + QString::fromAscii(":") + tr("Face") + QString::number(faceId) : + tr("No face selected")); + ui->spinOffset->blockSignals(false); + ui->lengthEdit->blockSignals(false); + ui->lengthEdit2->blockSignals(false); + ui->lineFaceName->blockSignals(false); + ui->changeMode->blockSignals(false); + }*/ +} + +void TaskLoftParameters::onClosed(bool val) { + static_cast(vp->getObject())->Closed.setValue(val); + recomputeFeature(); +} + +void TaskLoftParameters::onRuled(bool val) { + static_cast(vp->getObject())->Ruled.setValue(val); + recomputeFeature(); +} + +void TaskLoftParameters::onRefButtonAdd(bool checked) { + if (checked) { + Gui::Selection().clearSelection(); + selectionMode = refAdd; + //static_cast(vp)->highlightReferences(true, true); + } +} + +void TaskLoftParameters::onRefButtonRemvove(bool checked) { + + if (checked) { + Gui::Selection().clearSelection(); + selectionMode = refRemove; + //static_cast(vp)->highlightReferences(true, true); + } +} + + +//************************************************************************** +//************************************************************************** +// TaskDialog +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TaskDlgLoftParameters::TaskDlgLoftParameters(ViewProviderLoft *LoftView,bool newObj) + : TaskDlgSketchBasedParameters(LoftView) +{ + assert(LoftView); + parameter = new TaskLoftParameters(LoftView,newObj); + + Content.push_back(parameter); +} + +TaskDlgLoftParameters::~TaskDlgLoftParameters() +{ + +} + +//==== calls from the TaskView =============================================================== + + +bool TaskDlgLoftParameters::accept() +{ + std::string name = vp->getObject()->getNameInDocument(); + + try { + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); + if (!vp->getObject()->isValid()) + throw Base::Exception(vp->getObject()->getStatusString()); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + Gui::Command::commitCommand(); + } + catch (const Base::Exception& e) { + QMessageBox::warning(parameter, tr("Input error"), QString::fromUtf8(e.what())); + return false; + } + + return true; +} + +//bool TaskDlgLoftParameters::reject() +//{ +// // get the support and Sketch +// PartDesign::Loft* pcLoft = static_cast(LoftView->getObject()); +// Sketcher::SketchObject *pcSketch = 0; +// App::DocumentObject *pcSupport = 0; +// if (pcLoft->Sketch.getValue()) { +// pcSketch = static_cast(pcLoft->Sketch.getValue()); +// pcSupport = pcSketch->Support.getValue(); +// } +// +// // roll back the done things +// Gui::Command::abortCommand(); +// Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); +// +// // if abort command deleted the object the support is visible again +// if (!Gui::Application::Instance->getViewProvider(pcLoft)) { +// if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) +// Gui::Application::Instance->getViewProvider(pcSketch)->show(); +// if (pcSupport && Gui::Application::Instance->getViewProvider(pcSupport)) +// Gui::Application::Instance->getViewProvider(pcSupport)->show(); +// } +// +// //Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); +// //Gui::Command::commitCommand(); +// +// return true; +//} + + + +#include "moc_TaskLoftParameters.cpp" diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.h b/src/Mod/PartDesign/Gui/TaskLoftParameters.h new file mode 100644 index 000000000..db1e80814 --- /dev/null +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.h @@ -0,0 +1,106 @@ +/*************************************************************************** + * Copyright (c) 2015 Stefan Tröger * + * * + * 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 GUI_TASKVIEW_TaskLoftParameters_H +#define GUI_TASKVIEW_TaskLoftParameters_H + +#include +#include +#include + +#include "TaskSketchBasedParameters.h" +#include "ViewProviderLoft.h" + +class Ui_TaskLoftParameters; +class QListWidget; + +namespace App { +class Property; +} + +namespace Gui { +class ViewProvider; +} + +namespace PartDesignGui { + + + +class TaskLoftParameters : public TaskSketchBasedParameters +{ + Q_OBJECT + +public: + TaskLoftParameters(ViewProviderLoft *LoftView,bool newObj=false,QWidget *parent = 0); + ~TaskLoftParameters(); + +private Q_SLOTS: + void onRefButtonAdd(bool); + void onRefButtonRemvove(bool); + void onClosed(bool); + void onRuled(bool); + +protected: + void changeEvent(QEvent *e); + +private: + void onSelectionChanged(const Gui::SelectionChanges& msg); + void updateUI(int index); + bool referenceSelected(const Gui::SelectionChanges& msg) const; + void removeFromListWidget(QListWidget*w, QString name); + void clearButtons(); + void exitSelectionMode(); + +private: + QWidget* proxy; + Ui_TaskLoftParameters* ui; + + enum selectionModes { none, refAdd, refRemove }; + selectionModes selectionMode = none; +}; + +/// simulation dialog for the TaskView +class TaskDlgLoftParameters : public TaskDlgSketchBasedParameters +{ + Q_OBJECT + +public: + TaskDlgLoftParameters(ViewProviderLoft *LoftView,bool newObj=false); + ~TaskDlgLoftParameters(); + + ViewProviderLoft* getLoftView() const + { return static_cast(vp); } + + +public: + /// 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) + +protected: + TaskLoftParameters *parameter; +}; + +} //namespace PartDesignGui + +#endif // GUI_TASKVIEW_TASKAPPERANCE_H diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.ui b/src/Mod/PartDesign/Gui/TaskLoftParameters.ui new file mode 100644 index 000000000..81116e74c --- /dev/null +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.ui @@ -0,0 +1,204 @@ + + + PartDesignGui::TaskLoftParameters + + + + 0 + 0 + 285 + 305 + + + + Form + + + + + + 1 + + + + + + + + Closed + + + + + + + Ruled surface + + + + + + + + + true + + + Add Section + + + true + + + false + + + + + + + Remove Section + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + + + Final scaling factor + + + + + + + + 0 + 0 + + + + 2 + + + 0.000000000000000 + + + 99999.000000000000000 + + + 1.000000000000000 + + + + + + + + + + + + + + + Scaling factor + + + + + + + + 0 + 0 + + + + -9999.000000000000000 + + + 9999.000000000000000 + + + 1.000000000000000 + + + + + + + Derivative at start + + + + + + + + 0 + 0 + + + + -99.000000000000000 + + + + + + + Derivative at end + + + + + + + + 0 + 0 + + + + -99.000000000000000 + + + + + + + + + + + + + + diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp index fd476bb08..fa4abac0b 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp @@ -500,8 +500,15 @@ bool TaskPipeOrientation::referenceSelected(const SelectionChanges& msg) const { return false; } -void TaskPipeOrientation::removeFromListWidget(QListWidget* w, QString name) { +void TaskPipeOrientation::removeFromListWidget(QListWidget* widget, QString name) { + QList items = widget->findItems(name, Qt::MatchExactly); + if (!items.empty()) { + for (QList::const_iterator i = items.begin(); i != items.end(); i++) { + QListWidgetItem* it = widget->takeItem(widget->row(*i)); + delete it; + } + } } void TaskPipeOrientation::updateUI(int idx) { @@ -664,8 +671,15 @@ bool TaskPipeScaling::referenceSelected(const SelectionChanges& msg) const { return false; } -void TaskPipeScaling::removeFromListWidget(QListWidget* w, QString name) { +void TaskPipeScaling::removeFromListWidget(QListWidget* widget, QString name) { + QList items = widget->findItems(name, Qt::MatchExactly); + if (!items.empty()) { + for (QList::const_iterator i = items.begin(); i != items.end(); i++) { + QListWidgetItem* it = widget->takeItem(widget->row(*i)); + delete it; + } + } } void TaskPipeScaling::updateUI(int idx) { diff --git a/src/Mod/PartDesign/Gui/TaskPipeScaling.ui b/src/Mod/PartDesign/Gui/TaskPipeScaling.ui index 206937968..9b9c0e31e 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeScaling.ui +++ b/src/Mod/PartDesign/Gui/TaskPipeScaling.ui @@ -58,18 +58,11 @@ - 0 + 1 - - - - Automaticly build profile from sections - - - diff --git a/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp b/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp index 10959bb93..8a58f1081 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp @@ -82,7 +82,7 @@ bool ViewProviderLoft::setEdit(int ModNum) if (ModNum == ViewProvider::Default || ModNum == 1 ) { setPreviewDisplayMode(true); - /* + // When double-clicking on the item for this pad the // object unsets and sets its edit mode without closing // the task panel @@ -114,7 +114,7 @@ bool ViewProviderLoft::setEdit(int ModNum) Gui::Control().showDialog(padDlg); else Gui::Control().showDialog(new TaskDlgLoftParameters(this,ModNum == 1)); - */ + return true; } else { diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index 6b845b138..0556abb8d 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -654,6 +654,8 @@ void Workbench::activated() "PartDesign_Groove", "PartDesign_AdditivePipe", "PartDesign_SubtractivePipe", + "PartDesign_AdditiveLoft", + "PartDesign_SubtractiveLoft", 0}; Watcher.push_back(new Gui::TaskView::TaskWatcherCommands( "SELECT Sketcher::SketchObject COUNT 1", @@ -751,6 +753,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const << "PartDesign_Groove" << "PartDesign_AdditivePipe" << "PartDesign_SubtractivePipe" + << "PartDesign_AdditiveLoft" + << "PartDesign_SubtractiveLoft" << "PartDesign_Fillet" << "PartDesign_Chamfer" << "PartDesign_Draft" @@ -809,6 +813,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const << "PartDesign_Groove" << "PartDesign_AdditivePipe" << "PartDesign_SubtractivePipe" + << "PartDesign_AdditiveLoft" + << "PartDesign_SubtractiveLoft" << "PartDesign_Fillet" << "PartDesign_Chamfer" << "PartDesign_Draft"