Fem: Clean up constraint view providers

This commit is contained in:
marioalexis
2024-06-19 14:04:14 -03:00
committed by Chris Hennes
parent d733fe0b34
commit 7feb0c742c
20 changed files with 57 additions and 761 deletions

View File

@@ -53,40 +53,14 @@ ViewProviderFemConstraintTransform::ViewProviderFemConstraintTransform()
ViewProviderFemConstraintTransform::~ViewProviderFemConstraintTransform() = default;
// FIXME setEdit needs a careful review
bool ViewProviderFemConstraintTransform::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();
TaskDlgFemConstraintTransform* constrDlg =
qobject_cast<TaskDlgFemConstraintTransform*>(dlg);
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 TaskFemConstraintTransform(this);
return true;
}
}
Gui::Control().closeDialog();
// clear the selection (convenience)
Gui::Selection().clearSelection();
Gui::Control().showDialog(new TaskDlgFemConstraintTransform(this));
// start the edit dialog
if (constrDlg) {
Gui::Control().showDialog(constrDlg);
}
else {
Gui::Control().showDialog(new TaskDlgFemConstraintTransform(this));
}
return true;
}
else {