Fem: Clean up constraint view providers
This commit is contained in:
committed by
Chris Hennes
parent
d733fe0b34
commit
7feb0c742c
@@ -29,7 +29,7 @@
|
||||
#include "Mod/Fem/App/FemConstraintSpring.h"
|
||||
#include <Gui/Control.h>
|
||||
|
||||
#include "TaskFemConstraintSpring.h" //TODO do next
|
||||
#include "TaskFemConstraintSpring.h"
|
||||
#include "ViewProviderFemConstraintSpring.h"
|
||||
|
||||
|
||||
@@ -47,44 +47,18 @@ ViewProviderFemConstraintSpring::ViewProviderFemConstraintSpring()
|
||||
|
||||
ViewProviderFemConstraintSpring::~ViewProviderFemConstraintSpring() = default;
|
||||
|
||||
// FIXME setEdit needs a careful review
|
||||
bool ViewProviderFemConstraintSpring::setEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// When double-clicking on the item for this constraint the
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
TaskDlgFemConstraintSpring* constrDlg =
|
||||
qobject_cast<TaskDlgFemConstraintSpring*>(dlg); // check this out too
|
||||
if (constrDlg && constrDlg->getConstraintView() != this) {
|
||||
constrDlg = nullptr; // another constraint left open its task panel
|
||||
}
|
||||
if (dlg && !constrDlg) {
|
||||
if (constraintDialog) {
|
||||
// Ignore the request to open another dialog
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
constraintDialog = new TaskFemConstraintSpring(this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Gui::Control().closeDialog();
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Control().showDialog(new TaskDlgFemConstraintSpring(this));
|
||||
|
||||
// start the edit dialog
|
||||
if (constrDlg) {
|
||||
Gui::Control().showDialog(constrDlg);
|
||||
}
|
||||
else {
|
||||
Gui::Control().showDialog(new TaskDlgFemConstraintSpring(this));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return ViewProviderDocumentObject::setEdit(ModNum); // clazy:exclude=skipped-base-method
|
||||
return ViewProviderFemConstraintOnBoundary::setEdit(ModNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user