From 6002a73fd752a56a51d2d0b24ac588be9642f60c Mon Sep 17 00:00:00 2001 From: marioalexis Date: Fri, 21 Jun 2024 14:11:42 -0300 Subject: [PATCH] Fem: Use base class open and reject methods in constraint task panels --- src/Mod/Fem/Gui/TaskFemConstraint.cpp | 13 ++++---- src/Mod/Fem/Gui/TaskFemConstraintContact.cpp | 23 -------------- src/Mod/Fem/Gui/TaskFemConstraintContact.h | 2 -- .../Fem/Gui/TaskFemConstraintDisplacement.cpp | 25 +--------------- .../Fem/Gui/TaskFemConstraintDisplacement.h | 2 -- src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp | 25 +--------------- src/Mod/Fem/Gui/TaskFemConstraintFixed.h | 2 -- .../Gui/TaskFemConstraintFluidBoundary.cpp | 19 +----------- .../Fem/Gui/TaskFemConstraintFluidBoundary.h | 2 -- src/Mod/Fem/Gui/TaskFemConstraintForce.cpp | 26 +--------------- src/Mod/Fem/Gui/TaskFemConstraintForce.h | 2 -- src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp | 28 +---------------- src/Mod/Fem/Gui/TaskFemConstraintHeatflux.h | 2 -- .../TaskFemConstraintInitialTemperature.cpp | 30 ------------------- .../Gui/TaskFemConstraintInitialTemperature.h | 2 -- .../Gui/TaskFemConstraintPlaneRotation.cpp | 24 --------------- .../Fem/Gui/TaskFemConstraintPlaneRotation.h | 2 -- src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp | 25 +--------------- src/Mod/Fem/Gui/TaskFemConstraintPressure.h | 2 -- src/Mod/Fem/Gui/TaskFemConstraintPulley.cpp | 15 ---------- src/Mod/Fem/Gui/TaskFemConstraintPulley.h | 1 - .../Fem/Gui/TaskFemConstraintRigidBody.cpp | 25 +--------------- src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h | 2 -- src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp | 25 +--------------- src/Mod/Fem/Gui/TaskFemConstraintSpring.h | 2 -- .../Fem/Gui/TaskFemConstraintTemperature.cpp | 25 +--------------- .../Fem/Gui/TaskFemConstraintTemperature.h | 2 -- .../Fem/Gui/TaskFemConstraintTransform.cpp | 24 --------------- src/Mod/Fem/Gui/TaskFemConstraintTransform.h | 2 -- .../ViewProviderFemConstraintOnBoundary.cpp | 3 +- .../Gui/ViewProviderFemConstraintOnBoundary.h | 8 +++-- 31 files changed, 23 insertions(+), 367 deletions(-) diff --git a/src/Mod/Fem/Gui/TaskFemConstraint.cpp b/src/Mod/Fem/Gui/TaskFemConstraint.cpp index d8034cfc83..e735d36b7c 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraint.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraint.cpp @@ -195,12 +195,11 @@ bool TaskFemConstraint::KeyEvent(QEvent* e) void TaskDlgFemConstraint::open() { - ConstraintView->setVisible(true); - Gui::Command::runCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts + if (!Gui::Command::hasPendingCommand()) { + const char* typeName = ConstraintView->getObject()->getTypeId().getName(); + Gui::Command::openCommand(typeName); + ConstraintView->setVisible(true); + } } bool TaskDlgFemConstraint::accept() @@ -248,9 +247,9 @@ bool TaskDlgFemConstraint::reject() // roll back the changes Gui::Command::abortCommand(); Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); + Gui::Command::updateActive(); return true; } - #include "moc_TaskFemConstraint.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp index 50a9a548a5..8a78fd21a9 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp @@ -520,21 +520,6 @@ TaskDlgFemConstraintContact::TaskDlgFemConstraintContact( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintContact::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Contact constraint"); - Gui::Command::openCommand(static_cast(msg.toUtf8())); - ConstraintView->setVisible(true); - Gui::Command::runCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintContact::accept() { /* Note: */ @@ -572,12 +557,4 @@ bool TaskDlgFemConstraintContact::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintContact::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} #include "moc_TaskFemConstraintContact.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.h b/src/Mod/Fem/Gui/TaskFemConstraintContact.h index b5f78a6ec2..98d86ae79a 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.h @@ -75,9 +75,7 @@ class TaskDlgFemConstraintContact: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintContact(ViewProviderFemConstraintContact* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp index 6b16f103a2..0f408da3ac 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "TaskFemConstraintDisplacement.h" #include "ui_TaskFemConstraintDisplacement.h" @@ -625,21 +626,6 @@ TaskDlgFemConstraintDisplacement::TaskDlgFemConstraintDisplacement( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintDisplacement::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Displacement boundary condition"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintDisplacement::accept() { std::string name = ConstraintView->getObject()->getNameInDocument(); @@ -757,13 +743,4 @@ bool TaskDlgFemConstraintDisplacement::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintDisplacement::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintDisplacement.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h index d5b07a09cc..f90285a8b2 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h @@ -113,9 +113,7 @@ class TaskDlgFemConstraintDisplacement: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintDisplacement( ViewProviderFemConstraintDisplacement* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp index 3e70d70058..1bcb45f9b6 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "TaskFemConstraintFixed.h" #include "ui_TaskFemConstraintFixed.h" @@ -279,33 +280,9 @@ TaskDlgFemConstraintFixed::TaskDlgFemConstraintFixed(ViewProviderFemConstraintFi //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintFixed::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Fixed boundary condition"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintFixed::accept() { return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintFixed::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintFixed.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.h b/src/Mod/Fem/Gui/TaskFemConstraintFixed.h index 80b939e0c5..e7efbe4c98 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.h @@ -66,9 +66,7 @@ class TaskDlgFemConstraintFixed: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintFixed(ViewProviderFemConstraintFixed* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp index aafcd0f9de..e7cac57583 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include "ActiveAnalysisObserver.h" #include "TaskFemConstraintFluidBoundary.h" @@ -994,15 +995,6 @@ TaskDlgFemConstraintFluidBoundary::TaskDlgFemConstraintFluidBoundary( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintFluidBoundary::open() -{ - // a transaction is already open when creating this panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Fluid boundary condition"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - } -} - bool TaskDlgFemConstraintFluidBoundary::accept() { std::string name = ConstraintView->getObject()->getNameInDocument(); @@ -1109,13 +1101,4 @@ bool TaskDlgFemConstraintFluidBoundary::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintFluidBoundary::reject() -{ - Gui::Command::abortCommand(); // recover properties content - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintFluidBoundary.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.h b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.h index 66141fb441..3dc484dac8 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.h @@ -120,9 +120,7 @@ public: ViewProviderFemConstraintFluidBoundary* ConstraintView); /// is called by the framework if the dialog is accepted (Ok) - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp index 5067504f1a..fafe7e5fa2 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include "TaskFemConstraintForce.h" #include "ui_TaskFemConstraintForce.h" @@ -426,21 +427,6 @@ TaskDlgFemConstraintForce::TaskDlgFemConstraintForce(ViewProviderFemConstraintFo //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintForce::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Force load"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintForce::accept() { std::string name = ConstraintView->getObject()->getNameInDocument(); @@ -485,14 +471,4 @@ bool TaskDlgFemConstraintForce::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintForce::reject() -{ - // roll back the changes - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintForce.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.h b/src/Mod/Fem/Gui/TaskFemConstraintForce.h index 2563d2de6e..f166e75c53 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.h @@ -91,9 +91,7 @@ public: explicit TaskDlgFemConstraintForce(ViewProviderFemConstraintForce* ConstraintView); /// is called by the framework if the dialog is accepted (Ok) - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp index ffd4447fc7..df5b2cca8b 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "TaskFemConstraintHeatflux.h" #include "ui_TaskFemConstraintHeatflux.h" @@ -504,21 +505,6 @@ TaskDlgFemConstraintHeatflux::TaskDlgFemConstraintHeatflux( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintHeatflux::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Heat flux load"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintHeatflux::accept() { std::string name = ConstraintView->getObject()->getNameInDocument(); @@ -531,13 +517,10 @@ bool TaskDlgFemConstraintHeatflux::accept() "App.ActiveDocument.%s.AmbientTemp = %f", name.c_str(), parameterHeatflux->getAmbientTemp()); - /*Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.FaceTemp = %f", - name.c_str(), parameterHeatflux->getFaceTemp());*/ Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.FilmCoef = %f", name.c_str(), parameterHeatflux->getFilmCoef()); - Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Emissivity = %f", name.c_str(), @@ -551,13 +534,4 @@ bool TaskDlgFemConstraintHeatflux::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintHeatflux::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintHeatflux.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.h b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.h index a6cdda7235..50bf357deb 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.h @@ -81,9 +81,7 @@ class TaskDlgFemConstraintHeatflux: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintHeatflux(ViewProviderFemConstraintHeatflux* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.cpp b/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.cpp index c1d540025d..6b83844caa 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.cpp @@ -92,20 +92,6 @@ TaskDlgFemConstraintInitialTemperature::TaskDlgFemConstraintInitialTemperature( } //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintInitialTemperature::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Constraint initial temperature"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} bool TaskDlgFemConstraintInitialTemperature::accept() { @@ -118,13 +104,6 @@ bool TaskDlgFemConstraintInitialTemperature::accept() "App.ActiveDocument.%s.initialTemperature = \"%s\"", name.c_str(), parameterTemperature->get_temperature().c_str()); - } - catch (const Base::Exception& e) { - QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what())); - return false; - } - - try { Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); if (!ConstraintView->getObject()->isValid()) { throw Base::RuntimeError(ConstraintView->getObject()->getStatusString()); @@ -140,13 +119,4 @@ bool TaskDlgFemConstraintInitialTemperature::accept() return true; } -bool TaskDlgFemConstraintInitialTemperature::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintInitialTemperature.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.h b/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.h index ce5b554021..e71f5ea8e2 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.h @@ -62,9 +62,7 @@ class TaskDlgFemConstraintInitialTemperature: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintInitialTemperature( ViewProviderFemConstraintInitialTemperature* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp index df3a5c40ae..b260d91144 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp @@ -305,33 +305,9 @@ TaskDlgFemConstraintPlaneRotation::TaskDlgFemConstraintPlaneRotation( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintPlaneRotation::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Plane multi-point constraint"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintPlaneRotation::accept() { return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintPlaneRotation::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintPlaneRotation.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.h b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.h index 1a55a0e27e..ee1092ce32 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.h @@ -68,9 +68,7 @@ class TaskDlgFemConstraintPlaneRotation: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintPlaneRotation( ViewProviderFemConstraintPlaneRotation* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp index b740f84eea..acb0487626 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "TaskFemConstraintPressure.h" #include "ui_TaskFemConstraintPressure.h" @@ -295,21 +296,6 @@ TaskDlgFemConstraintPressure::TaskDlgFemConstraintPressure( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintPressure::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Pressure load"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintPressure::accept() { /* Note: */ @@ -335,13 +321,4 @@ bool TaskDlgFemConstraintPressure::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintPressure::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintPressure.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.h b/src/Mod/Fem/Gui/TaskFemConstraintPressure.h index c312290534..a9a35ba8c4 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.h @@ -71,9 +71,7 @@ class TaskDlgFemConstraintPressure: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintPressure(ViewProviderFemConstraintPressure* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPulley.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPulley.cpp index a15cf6b11d..63469fb883 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPulley.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPulley.cpp @@ -194,21 +194,6 @@ TaskDlgFemConstraintPulley::TaskDlgFemConstraintPulley( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintPulley::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Constraint pulley"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintPulley::accept() { std::string name = ConstraintView->getObject()->getNameInDocument(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPulley.h b/src/Mod/Fem/Gui/TaskFemConstraintPulley.h index c7ac7b0685..4dfde5d8ab 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPulley.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintPulley.h @@ -64,7 +64,6 @@ public: /// is called by the framework if the dialog is accepted (Ok) bool accept() override; - void open() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp index faac62ae61..9f08c67df5 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "TaskFemConstraintRigidBody.h" #include "ui_TaskFemConstraintRigidBody.h" @@ -652,21 +653,6 @@ TaskDlgFemConstraintRigidBody::TaskDlgFemConstraintRigidBody( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintRigidBody::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Constraint RigidBody"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintRigidBody::accept() { std::string name = ConstraintView->getObject()->getNameInDocument(); @@ -765,13 +751,4 @@ bool TaskDlgFemConstraintRigidBody::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintRigidBody::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintRigidBody.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h index dde1cad77a..1ce5745c52 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h @@ -81,9 +81,7 @@ class TaskDlgFemConstraintRigidBody: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintRigidBody(ViewProviderFemConstraintRigidBody* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp index 15660ea917..638a7e4e35 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "TaskFemConstraintSpring.h" #include "ui_TaskFemConstraintSpring.h" @@ -303,21 +304,6 @@ TaskDlgFemConstraintSpring::TaskDlgFemConstraintSpring( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintSpring::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Constraint spring"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintSpring::accept() { /* Note: */ @@ -349,13 +335,4 @@ bool TaskDlgFemConstraintSpring::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintSpring::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintSpring.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintSpring.h b/src/Mod/Fem/Gui/TaskFemConstraintSpring.h index 9802c10d66..c4fed681b6 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintSpring.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintSpring.h @@ -69,9 +69,7 @@ class TaskDlgFemConstraintSpring: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintSpring(ViewProviderFemConstraintSpring* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp index c17463acb6..5ebcb4ecbb 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include "TaskFemConstraintTemperature.h" #include "ui_TaskFemConstraintTemperature.h" @@ -359,21 +360,6 @@ TaskDlgFemConstraintTemperature::TaskDlgFemConstraintTemperature( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintTemperature::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Temperature boundary condition"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintTemperature::accept() { std::string name = ConstraintView->getObject()->getNameInDocument(); @@ -408,13 +394,4 @@ bool TaskDlgFemConstraintTemperature::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintTemperature::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintTemperature.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h index 889676b93c..2ff5e6df2c 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h @@ -77,9 +77,7 @@ class TaskDlgFemConstraintTemperature: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintTemperature(ViewProviderFemConstraintTemperature* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp index 3a0de63305..d7dd055f28 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp @@ -579,21 +579,6 @@ TaskDlgFemConstraintTransform::TaskDlgFemConstraintTransform( //==== calls from the TaskView =============================================================== -void TaskDlgFemConstraintTransform::open() -{ - // a transaction is already open at creation time of the panel - if (!Gui::Command::hasPendingCommand()) { - QString msg = QObject::tr("Local coordinate system"); - Gui::Command::openCommand((const char*)msg.toUtf8()); - ConstraintView->setVisible(true); - Gui::Command::doCommand( - Gui::Command::Doc, - ViewProviderFemConstraint::gethideMeshShowPartStr( - (static_cast(ConstraintView->getObject()))->getNameInDocument()) - .c_str()); // OvG: Hide meshes and show parts - } -} - bool TaskDlgFemConstraintTransform::accept() { /* Note: */ @@ -628,13 +613,4 @@ bool TaskDlgFemConstraintTransform::accept() return TaskDlgFemConstraint::accept(); } -bool TaskDlgFemConstraintTransform::reject() -{ - Gui::Command::abortCommand(); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()"); - Gui::Command::updateActive(); - - return true; -} - #include "moc_TaskFemConstraintTransform.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.h b/src/Mod/Fem/Gui/TaskFemConstraintTransform.h index d6e087c5a5..4219e3313e 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.h @@ -78,9 +78,7 @@ class TaskDlgFemConstraintTransform: public TaskDlgFemConstraint public: explicit TaskDlgFemConstraintTransform(ViewProviderFemConstraintTransform* ConstraintView); - void open() override; bool accept() override; - bool reject() override; }; } // namespace FemGui diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintOnBoundary.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintOnBoundary.cpp index 18d168b5a3..ed5772129b 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintOnBoundary.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintOnBoundary.cpp @@ -23,8 +23,9 @@ #include "PreCompiled.h" -#include "Mod/Fem/App/FemConstraint.h" #include +#include "Mod/Fem/App/FemConstraint.h" +#include #include #include diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintOnBoundary.h b/src/Mod/Fem/Gui/ViewProviderFemConstraintOnBoundary.h index 004e0e81ad..bca7164b1c 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintOnBoundary.h +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintOnBoundary.h @@ -24,10 +24,14 @@ #ifndef GUI_VIEWPROVIDERFEMCONSTRAINTONBOUNDARY_H #define GUI_VIEWPROVIDERFEMCONSTRAINTONBOUNDARY_H -#include - #include "ViewProviderFemConstraint.h" + +namespace Part +{ +class Feature; +} + namespace FemGui {