PD: eliminate the boolean argument from TaskSketchBasedParameters::onSelectReference
This commit is contained in:
@@ -33,7 +33,7 @@ namespace PartDesignGui {
|
||||
// https://stackoverflow.com/questions/1448396/how-to-use-enums-as-flags-in-c
|
||||
|
||||
enum class AllowSelection {
|
||||
NONE = 0,
|
||||
NONE = 0, /**< This is used to indicate to stop the selection */
|
||||
EDGE = 1 << 0, /**< Allow picking edges */
|
||||
FACE = 1 << 1, /**< Allow picking faces */
|
||||
PLANAR = 1 << 2, /**< Allow only linear edges and planar faces */
|
||||
|
||||
@@ -411,9 +411,9 @@ void TaskExtrudeParameters::onDirectionCBChanged(int num)
|
||||
// to distinguish that this is the direction selection
|
||||
selectionFace = false;
|
||||
setDirectionMode(num);
|
||||
TaskSketchBasedParameters::onSelectReference(true, AllowSelection::EDGE |
|
||||
AllowSelection::PLANAR |
|
||||
AllowSelection::CIRCLE);
|
||||
TaskSketchBasedParameters::onSelectReference(AllowSelection::EDGE |
|
||||
AllowSelection::PLANAR |
|
||||
AllowSelection::CIRCLE);
|
||||
}
|
||||
else {
|
||||
if (lnk.getValue()) {
|
||||
@@ -566,7 +566,7 @@ void TaskExtrudeParameters::onButtonFace(const bool pressed)
|
||||
selectionFace = true;
|
||||
|
||||
// only faces are allowed
|
||||
TaskSketchBasedParameters::onSelectReference(pressed, AllowSelection::FACE);
|
||||
TaskSketchBasedParameters::onSelectReference(pressed ? AllowSelection::FACE : AllowSelection::NONE);
|
||||
|
||||
// Update button if onButtonFace() is called explicitly
|
||||
ui->buttonFace->setChecked(pressed);
|
||||
|
||||
@@ -425,9 +425,9 @@ void TaskHelixParameters::onAxisChanged(int num)
|
||||
App::PropertyLinkSub& lnk = *(axesInList[num]);
|
||||
if (lnk.getValue() == 0) {
|
||||
// enter reference selection mode
|
||||
TaskSketchBasedParameters::onSelectReference(true, AllowSelection::EDGE |
|
||||
AllowSelection::PLANAR |
|
||||
AllowSelection::CIRCLE);
|
||||
TaskSketchBasedParameters::onSelectReference(AllowSelection::EDGE |
|
||||
AllowSelection::PLANAR |
|
||||
AllowSelection::CIRCLE);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -262,9 +262,9 @@ void TaskRevolutionParameters::onAxisChanged(int num)
|
||||
App::PropertyLinkSub &lnk = *(axesInList[num]);
|
||||
if (lnk.getValue() == 0) {
|
||||
// enter reference selection mode
|
||||
TaskSketchBasedParameters::onSelectReference(true, AllowSelection::EDGE |
|
||||
AllowSelection::PLANAR |
|
||||
AllowSelection::CIRCLE);
|
||||
TaskSketchBasedParameters::onSelectReference(AllowSelection::EDGE |
|
||||
AllowSelection::PLANAR |
|
||||
AllowSelection::CIRCLE);
|
||||
} else {
|
||||
if (!pcRevolution->getDocument()->isIn(lnk.getValue())){
|
||||
Base::Console().Error("Object was deleted\n");
|
||||
|
||||
@@ -112,7 +112,7 @@ void TaskSketchBasedParameters::finishReferenceSelection(App::DocumentObject* pr
|
||||
}
|
||||
}
|
||||
|
||||
void TaskSketchBasedParameters::onSelectReference(const bool pressed, AllowSelectionFlags allow) {
|
||||
void TaskSketchBasedParameters::onSelectReference(AllowSelectionFlags allow) {
|
||||
// Note: Even if there is no solid, App::Plane and Part::Datum can still be selected
|
||||
|
||||
PartDesign::ProfileBased* pcSketchBased = dynamic_cast<PartDesign::ProfileBased*>(vp->getObject());
|
||||
@@ -120,7 +120,7 @@ void TaskSketchBasedParameters::onSelectReference(const bool pressed, AllowSelec
|
||||
// The solid this feature will be fused to
|
||||
App::DocumentObject* prevSolid = pcSketchBased->getBaseObject( /* silent =*/ true );
|
||||
|
||||
if (pressed) {
|
||||
if (AllowSelectionFlags::Int(allow) != int(AllowSelection::NONE)) {
|
||||
startReferenceSelection(pcSketchBased, prevSolid);
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelectionGate(new ReferenceSelection(prevSolid, allow));
|
||||
@@ -135,7 +135,7 @@ void TaskSketchBasedParameters::onSelectReference(const bool pressed, AllowSelec
|
||||
|
||||
void TaskSketchBasedParameters::exitSelectionMode()
|
||||
{
|
||||
onSelectReference(false, AllowSelection::NONE);
|
||||
onSelectReference(AllowSelection::NONE);
|
||||
}
|
||||
|
||||
QVariant TaskSketchBasedParameters::setUpToFace(const QString& text)
|
||||
|
||||
@@ -54,7 +54,13 @@ protected:
|
||||
const QString onAddSelection(const Gui::SelectionChanges& msg);
|
||||
virtual void startReferenceSelection(App::DocumentObject* profile, App::DocumentObject* base);
|
||||
virtual void finishReferenceSelection(App::DocumentObject* profile, App::DocumentObject* base);
|
||||
void onSelectReference(const bool pressed, AllowSelectionFlags);
|
||||
/*!
|
||||
* \brief onSelectReference
|
||||
* Start reference selection mode to allow to select objects of the type defined
|
||||
* with \a AllowSelectionFlags.
|
||||
* If AllowSelection::NONE is passed the selection mode is finished.
|
||||
*/
|
||||
void onSelectReference(AllowSelectionFlags);
|
||||
void exitSelectionMode();
|
||||
QVariant setUpToFace(const QString& text);
|
||||
/// Try to find the name of a feature with the given label.
|
||||
|
||||
Reference in New Issue
Block a user