diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp index fcbea6622..f94507f6d 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp @@ -29,6 +29,7 @@ #include "ui_TaskPadParameters.h" #include "TaskPadParameters.h" #include +#include #include #include #include @@ -55,6 +56,13 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent) ui->setupUi(proxy); QMetaObject::connectSlotsByName(this); + connect(ui->doubleSpinBox, SIGNAL(valueChanged(double)), + this, SLOT(onLengthChanged(double))); + connect(ui->checkBoxMirrored, SIGNAL(toggled(bool)), + this, SLOT(onMirrored(bool))); + connect(ui->checkBoxReversed, SIGNAL(toggled(bool)), + this, SLOT(onReversed(bool))); + this->groupLayout()->addWidget(proxy); PartDesign::Pad* pcPad = static_cast(PadView->getObject()); @@ -68,22 +76,41 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent) // check if the sketch has support Sketcher::SketchObject *pcSketch; - if(pcPad->Sketch.getValue() ){ - pcSketch = static_cast(pcPad->Sketch.getValue()); - if(pcSketch->Support.getValue() ) + if (pcPad->Sketch.getValue()) { + pcSketch = static_cast(pcPad->Sketch.getValue()); + if (pcSketch->Support.getValue()) // in case of sketch with support, reverse makes no sense (goes into the part) ui->checkBoxReversed->setEnabled(0); else ui->checkBoxReversed->setChecked(reversed); - } - ui->checkBoxReversed->setChecked(reversed); setFocus (); } +void TaskPadParameters::onLengthChanged(double len) +{ + PartDesign::Pad* pcPad = static_cast(PadView->getObject()); + pcPad->Length.setValue((float)len); + pcPad->getDocument()->recomputeFeature(pcPad); +} + +void TaskPadParameters::onMirrored(bool on) +{ + PartDesign::Pad* pcPad = static_cast(PadView->getObject()); + pcPad->MirroredExtent.setValue(on); + pcPad->getDocument()->recomputeFeature(pcPad); +} + +void TaskPadParameters::onReversed(bool on) +{ + PartDesign::Pad* pcPad = static_cast(PadView->getObject()); + pcPad->Reversed.setValue(on); + pcPad->getDocument()->recomputeFeature(pcPad); +} + double TaskPadParameters::getLength(void) const { return ui->doubleSpinBox->value(); @@ -165,7 +192,7 @@ bool TaskDlgPadParameters::reject() PartDesign::Pad* pcPad = static_cast(PadView->getObject()); Sketcher::SketchObject *pcSketch; App::DocumentObject *pcSupport; - if(pcPad->Sketch.getValue() ){ + if (pcPad->Sketch.getValue()) { pcSketch = static_cast(pcPad->Sketch.getValue()); pcSupport = pcSketch->Support.getValue(); } @@ -175,12 +202,11 @@ bool TaskDlgPadParameters::reject() 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(pcPad) ){ - if(pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) + if (!Gui::Application::Instance->getViewProvider(pcPad)) { + if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) Gui::Application::Instance->getViewProvider(pcSketch)->show(); - if(pcPad && Gui::Application::Instance->getViewProvider(pcSupport)) + if (pcSupport && Gui::Application::Instance->getViewProvider(pcSupport)) Gui::Application::Instance->getViewProvider(pcSupport)->show(); - } //Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.h b/src/Mod/PartDesign/Gui/TaskPadParameters.h index 3795902b0..c16493cad 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.h +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.h @@ -57,6 +57,9 @@ public: bool getMirroredExtent(void) const; private Q_SLOTS: + void onLengthChanged(double); + void onMirrored(bool); + void onReversed(bool); protected: void changeEvent(QEvent *e);