From 44f15d586848c4e17152f10e2b1afaec166169b0 Mon Sep 17 00:00:00 2001 From: jrheinlaender Date: Mon, 5 Nov 2012 18:28:17 +0430 Subject: [PATCH] Pad/Pocket: Fixed bug that led to failed UpToFace when finishing the feature (thanks to wmayer for pointing this out) --- src/Mod/PartDesign/Gui/TaskPadParameters.cpp | 24 ++++++------- .../PartDesign/Gui/TaskPocketParameters.cpp | 34 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp index 7d181de8c..6cea2cd49 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp @@ -97,10 +97,10 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent) double l2 = pcPad->Length2.getValue(); int index = pcPad->Type.getValue(); // must extract value here, clear() kills it! std::vector subStrings = pcPad->UpToFace.getSubValues(); - std::string upToFace; + std::string upToFace; int faceId = -1; - if (!subStrings.empty()) { - upToFace = subStrings.front(); + if (!subStrings.empty()) { + upToFace = subStrings.front(); if (upToFace.substr(0,4) == "Face") faceId = std::atoi(&upToFace[4]); } @@ -116,8 +116,8 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent) // According to bug #0000521 the reversed option // shouldn't be de-activated if the pad has a support face ui->checkBoxReversed->setChecked(reversed); - ui->lineFaceName->setText(faceId >= 0 ? - tr("Face") + QString::number(faceId) : + ui->lineFaceName->setText(faceId >= 0 ? + tr("Face") + QString::number(faceId) : tr("No face selected")); ui->lineFaceName->setProperty("FaceName", QByteArray(upToFace.c_str())); ui->changeMode->clear(); @@ -212,7 +212,7 @@ void TaskPadParameters::onSelectionChanged(const Gui::SelectionChanges& msg) } if (strcmp(msg.pObjectName, support->getNameInDocument()) != 0) return; - + std::vector upToFaces(1,subName); pcPad->UpToFace.setValue(support, upToFaces); if (updateView()) @@ -228,7 +228,7 @@ void TaskPadParameters::onSelectionChanged(const Gui::SelectionChanges& msg) ui->lineFaceName->blockSignals(true); ui->lineFaceName->setText(tr("No face selected")); ui->lineFaceName->setProperty("FaceName", QByteArray()); - ui->lineFaceName->blockSignals(false); + ui->lineFaceName->blockSignals(false); } } @@ -303,7 +303,7 @@ void TaskPadParameters::onButtonFace(const bool pressed) { doc->setShow(support->getNameInDocument()); } Gui::Selection().clearSelection(); - Gui::Selection().addSelectionGate + Gui::Selection().addSelectionGate (new ReferenceSelection(support, false, true, false)); } else { Gui::Selection().rmvSelectionGate(); @@ -351,7 +351,7 @@ void TaskPadParameters::onUpdateView(bool on) { if (on) { PartDesign::Pad* pcPad = static_cast(PadView->getObject()); - pcPad->getDocument()->recomputeFeature(pcPad); + pcPad->getDocument()->recomputeFeature(pcPad); } } @@ -472,14 +472,14 @@ bool TaskDlgPadParameters::accept() Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Midplane = %i",name.c_str(),parameter->getMidplane()?1:0); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Length2 = %f",name.c_str(),parameter->getLength2()); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Type = %u",name.c_str(),parameter->getMode()); - QByteArray facename = parameter->getFaceName(); + std::string facename = parameter->getFaceName().data(); PartDesign::Pad* pcPad = static_cast(PadView->getObject()); Part::Feature* support = pcPad->getSupport(); - if (support != NULL && !facename.isEmpty()) { + if (support != NULL && !facename.empty()) { QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])"); buf = buf.arg(QString::fromUtf8(support->getNameInDocument())); - buf = buf.arg(QString::fromUtf8(facename.data())); + buf = buf.arg(QString::fromStdString(facename)); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.UpToFace = %s", name.c_str(), buf.toStdString().c_str()); } else Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.UpToFace = None", name.c_str()); diff --git a/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp b/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp index e465f2aaf..152943a5a 100644 --- a/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp @@ -89,10 +89,10 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge bool midplane = pcPocket->Midplane.getValue(); int index = pcPocket->Type.getValue(); // must extract value here, clear() kills it! std::vector subStrings = pcPocket->UpToFace.getSubValues(); - std::string upToFace; + std::string upToFace; int faceId = -1; - if (!subStrings.empty()) { - upToFace = subStrings.front(); + if (!subStrings.empty()) { + upToFace = subStrings.front(); if (upToFace.substr(0,4) == "Face") faceId = std::atoi(&upToFace[4]); } @@ -102,8 +102,8 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge ui->doubleSpinBox->setMaximum(INT_MAX); ui->doubleSpinBox->setValue(l); ui->checkBoxMidplane->setChecked(midplane); - ui->lineFaceName->setText(faceId >= 0 ? - tr("Face") + QString::number(faceId) : + ui->lineFaceName->setText(faceId >= 0 ? + tr("Face") + QString::number(faceId) : tr("No face selected")); ui->lineFaceName->setProperty("FaceName", QByteArray(upToFace.c_str())); ui->changeMode->clear(); @@ -192,7 +192,7 @@ void TaskPocketParameters::onSelectionChanged(const Gui::SelectionChanges& msg) } if (strcmp(msg.pObjectName, support->getNameInDocument()) != 0) return; - + std::vector upToFaces(1,subName); pcPocket->UpToFace.setValue(support, upToFaces); if (updateView()) @@ -241,13 +241,13 @@ void TaskPocketParameters::onModeChanged(int index) pcPocket->Length.setValue(oldLength); ui->doubleSpinBox->setValue(oldLength); break; - case 1: - oldLength = pcPocket->Length.getValue(); - pcPocket->Type.setValue("ThroughAll"); + case 1: + oldLength = pcPocket->Length.getValue(); + pcPocket->Type.setValue("ThroughAll"); break; - case 2: - oldLength = pcPocket->Length.getValue(); - pcPocket->Type.setValue("UpToFirst"); + case 2: + oldLength = pcPocket->Length.getValue(); + pcPocket->Type.setValue("UpToFirst"); break; case 3: // Because of the code at the begining of Pocket::execute() which is used to detect @@ -257,7 +257,7 @@ void TaskPocketParameters::onModeChanged(int index) pcPocket->Length.setValue(0.0); ui->doubleSpinBox->setValue(0.0); break; - default: + default: pcPocket->Type.setValue("Length"); } @@ -282,7 +282,7 @@ void TaskPocketParameters::onButtonFace(const bool pressed) { doc->setShow(support->getNameInDocument()); } Gui::Selection().clearSelection(); - Gui::Selection().addSelectionGate + Gui::Selection().addSelectionGate (new ReferenceSelection(support, false, true, false)); } else { Gui::Selection().rmvSelectionGate(); @@ -430,13 +430,13 @@ bool TaskDlgPocketParameters::accept() //Gui::Command::openCommand("Pocket changed"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Length = %f",name.c_str(),parameter->getLength()); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Type = %u",name.c_str(),parameter->getMode()); - QByteArray facename = parameter->getFaceName(); + std::string facename = parameter->getFaceName().data(); PartDesign::Pocket* pcPocket = static_cast(PocketView->getObject()); Part::Feature* support = pcPocket->getSupport(); - if (support != NULL && !facename.isEmpty()) { + if (support != NULL && !facename.empty()) { QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])"); buf = buf.arg(QString::fromUtf8(support->getNameInDocument())); - buf = buf.arg(QString::fromUtf8(facename.data())); + buf = buf.arg(QString::fromStdString(facename)); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.UpToFace = %s", name.c_str(), buf.toStdString().c_str()); } else Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.UpToFace = None", name.c_str());