diff --git a/src/Mod/TechDraw/Gui/TaskCenterLine.cpp b/src/Mod/TechDraw/Gui/TaskCenterLine.cpp index 903c6952ff..5c0803899a 100644 --- a/src/Mod/TechDraw/Gui/TaskCenterLine.cpp +++ b/src/Mod/TechDraw/Gui/TaskCenterLine.cpp @@ -29,6 +29,7 @@ #endif // #ifndef _PreComp_ +#include #include #include @@ -133,6 +134,7 @@ TaskCenterLine::TaskCenterLine(TechDraw::DrawViewPart* partFeat, Base::Console().Error("TaskCenterLine - unknown geometry type: %s. Can not proceed.\n", geomType.c_str()); return; } + setUiPrimary(); } @@ -181,6 +183,7 @@ void TaskCenterLine::setUiPrimary() ui->qsbRotate->setValue(qAngle); int precision = Base::UnitsApi::getDecimals(); ui->qsbRotate->setDecimals(precision); + if (m_type == 0) // if face, then aligned is not possible ui->rbAligned->setEnabled(false); else @@ -202,8 +205,11 @@ void TaskCenterLine::setUiEdit() ui->lstSubList->addItem(listItem); } ui->cpLineColor->setColor(m_cl->m_format.m_color.asValue()); + connect(ui->cpLineColor, SIGNAL(changed()), this, SLOT(onColorChanged())); ui->dsbWeight->setValue(m_cl->m_format.m_weight); + connect(ui->dsbWeight, SIGNAL(valueChanged(double)), this, SLOT(onWeightChanged())); ui->cboxStyle->setCurrentIndex(m_cl->m_format.m_style - 1); + connect(ui->cboxStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(onStyleChanged())); ui->rbVertical->setChecked(false); ui->rbHorizontal->setChecked(false); @@ -223,10 +229,13 @@ void TaskCenterLine::setUiEdit() qVal.setUnit(Base::Unit::Length); qVal.setValue(m_cl->m_vShift); ui->qsbVertShift->setValue(qVal); + connect(ui->qsbVertShift, SIGNAL(valueChanged(double)), this, SLOT(onShiftVertChanged())); qVal.setValue(m_cl->m_hShift); ui->qsbHorizShift->setValue(qVal); + connect(ui->qsbHorizShift, SIGNAL(valueChanged(double)), this, SLOT(onShiftHorizChanged())); qVal.setValue(m_cl->m_extendBy); ui->qsbExtend->setValue(qVal); + connect(ui->qsbExtend, SIGNAL(valueChanged(double)), this, SLOT(onExtendChanged())); Base::Quantity qAngle; qAngle.setUnit(Base::Unit::Angle); @@ -234,6 +243,7 @@ void TaskCenterLine::setUiEdit() int precision = Base::UnitsApi::getDecimals(); ui->qsbRotate->setDecimals(precision); ui->qsbRotate->setValue(m_cl->m_rotate); + connect(ui->qsbRotate, SIGNAL(valueChanged(double)), this, SLOT(onRotationChanged())); if (m_cl->m_flip2Line) ui->cbFlip->setChecked(true); @@ -244,8 +254,74 @@ void TaskCenterLine::setUiEdit() ui->cbFlip->setEnabled(true); else ui->cbFlip->setEnabled(false); + connect(ui->cbFlip, SIGNAL(toggled(bool)), this, SLOT(onFlipChanged())); + + // connect the Orientation radio group box + connect(ui->bgOrientation, SIGNAL(buttonClicked(int)), this, SLOT(onOrientationChanged())); } +void TaskCenterLine::onOrientationChanged() +{ + if (ui->rbVertical->isChecked()) + m_cl->m_mode = CenterLine::CLMODE::VERTICAL; + else if (ui->rbHorizontal->isChecked()) + m_cl->m_mode = CenterLine::CLMODE::HORIZONTAL; + else if (ui->rbAligned->isChecked()) + m_cl->m_mode = CenterLine::CLMODE::ALIGNED; + m_partFeat->recomputeFeature(); +} + +void TaskCenterLine::onShiftHorizChanged() +{ + m_cl->m_hShift = ui->qsbHorizShift->rawValue(); + m_partFeat->recomputeFeature(); +} + +void TaskCenterLine::onShiftVertChanged() +{ + m_cl->m_vShift = ui->qsbVertShift->rawValue(); + m_partFeat->recomputeFeature(); +} + +void TaskCenterLine::onRotationChanged() +{ + m_cl->m_rotate = ui->qsbRotate->rawValue(); + m_partFeat->recomputeFeature(); +} + +void TaskCenterLine::onExtendChanged() +{ + m_cl->m_extendBy = ui->qsbExtend->rawValue(); + m_partFeat->recomputeFeature(); +} + +void TaskCenterLine::onColorChanged() +{ + App::Color ac; + ac.setValue(ui->cpLineColor->color()); + m_cl->m_format.m_color.setValue(ui->cpLineColor->color()); + m_partFeat->recomputeFeature(); +} + +void TaskCenterLine::onWeightChanged() +{ + m_cl->m_format.m_weight = ui->dsbWeight->value(); + m_partFeat->recomputeFeature(); +} + +void TaskCenterLine::onStyleChanged() +{ + m_cl->m_format.m_style = ui->cboxStyle->currentIndex() + 1; + m_partFeat->recomputeFeature(); +} + +void TaskCenterLine::onFlipChanged() +{ + m_cl->m_flip2Line = ui->cbFlip->isChecked(); + m_partFeat->recomputeFeature(); +} + + //****************************************************************************** void TaskCenterLine::createCenterLine(void) { diff --git a/src/Mod/TechDraw/Gui/TaskCenterLine.h b/src/Mod/TechDraw/Gui/TaskCenterLine.h index 6d1c3faee2..e63973e944 100644 --- a/src/Mod/TechDraw/Gui/TaskCenterLine.h +++ b/src/Mod/TechDraw/Gui/TaskCenterLine.h @@ -94,7 +94,6 @@ public: void enableTaskButtons(bool b); void setFlipped(bool b); - protected Q_SLOTS: protected: @@ -117,6 +116,17 @@ protected: Qt::PenStyle getCenterStyle(); double getExtendBy(); +private Q_SLOTS: + void onOrientationChanged(); + void onShiftHorizChanged(); + void onShiftVertChanged(); + void onRotationChanged(); + void onExtendChanged(); + void onColorChanged(); + void onWeightChanged(); + void onStyleChanged(); + void onFlipChanged(); + private: Ui_TaskCenterLine * ui; diff --git a/src/Mod/TechDraw/Gui/TaskCenterLine.ui b/src/Mod/TechDraw/Gui/TaskCenterLine.ui index 3440ebdbeb..4222c054b2 100644 --- a/src/Mod/TechDraw/Gui/TaskCenterLine.ui +++ b/src/Mod/TechDraw/Gui/TaskCenterLine.ui @@ -2,16 +2,19 @@ TechDrawGui::TaskCenterLine + + true + 0 0 380 - 393 + 374 - + 0 0 @@ -32,6 +35,13 @@ + + + + Base View + + + @@ -48,13 +58,6 @@ - - - - Base View - - - @@ -67,10 +70,16 @@ false + + + 0 + 0 + + 16777215 - 100 + 50 @@ -78,50 +87,67 @@ - - - - - Top to Bottom line - - - Vertical - - - true - - - - - - - true - - - Left to Right line - - - Horizontal - - - - - - - true - - - centerline between + + + + + + Orientation + + + + + + Top to Bottom line + + + Vertical + + + true + + + bgOrientation + + + + + + + true + + + Left to Right line + + + Horizontal + + + bgOrientation + + + + + + + true + + + centerline between - lines: in equal distance to the lines and with half of the angle the lines have to each other - points: in equal distance to the points - - - Aligned - - - - + + + Aligned + + + bgOrientation + + + + + @@ -359,4 +385,11 @@ see the FreeCAD Wiki '2LineCenterLine' for a description + + + + true + + +