Skip to content

Commit

Permalink
PartDesign: Fix loft preview
Browse files Browse the repository at this point in the history
  • Loading branch information
ickby authored and wwmayer committed May 18, 2016
1 parent c5ca996 commit 4f8973f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 39 deletions.
8 changes: 8 additions & 0 deletions src/Mod/PartDesign/Gui/TaskLoftParameters.cpp
Expand Up @@ -79,6 +79,14 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView,bool newObj, Q
// Temporarily prevent unnecessary feature recomputes
for(QWidget* child : proxy->findChildren<QWidget*>())
child->blockSignals(true);

//add the profiles
for(auto obj : static_cast<PartDesign::Loft*>(LoftView->getObject())->Sections.getValues()) {

QString objn = QString::fromLatin1(obj->getNameInDocument());
if(!objn.isEmpty())
ui->listWidgetReferences->addItem(objn);
}

// activate and de-activate dialog elements as appropriate
for(QWidget* child : proxy->findChildren<QWidget*>())
Expand Down
47 changes: 8 additions & 39 deletions src/Mod/PartDesign/Gui/ViewProviderLoft.cpp
Expand Up @@ -78,52 +78,21 @@ bool ViewProviderLoft::doubleClicked(void)

bool ViewProviderLoft::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default || ModNum == 1 ) {

if (ModNum == ViewProvider::Default)
setPreviewDisplayMode(true);

// When double-clicking on the item for this pad the
// object unsets and sets its edit mode without closing
// the task panel
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
TaskDlgLoftParameters *padDlg = qobject_cast<TaskDlgLoftParameters *>(dlg);
if (padDlg && padDlg->getLoftView() != this)
padDlg = 0; // another pad left open its task panel
if (dlg && !padDlg) {
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?"));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
if (ret == QMessageBox::Yes)
Gui::Control().reject();
else
return false;
}

// clear the selection (convenience)
Gui::Selection().clearSelection();

// always change to PartDesign WB, remember where we come from
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
return ViewProviderAddSub::setEdit(ModNum);
}

// start the edit dialog
if (padDlg)
Gui::Control().showDialog(padDlg);
else
Gui::Control().showDialog(new TaskDlgLoftParameters(this,ModNum == 1));

return true;
}
else {
return ViewProviderPart::setEdit(ModNum);
}
TaskDlgFeatureParameters* ViewProviderLoft::getEditDialog() {
return new TaskDlgLoftParameters(this);
}


void ViewProviderLoft::unsetEdit(int ModNum) {

setPreviewDisplayMode(false);
PartDesignGui::ViewProvider::unsetEdit(ModNum);
ViewProviderAddSub::unsetEdit(ModNum);
}


Expand Down
2 changes: 2 additions & 0 deletions src/Mod/PartDesign/Gui/ViewProviderLoft.h
Expand Up @@ -49,6 +49,8 @@ class PartDesignGuiExport ViewProviderLoft : public ViewProviderAddSub
protected:
virtual bool setEdit(int ModNum);
virtual void unsetEdit(int ModNum);
virtual TaskDlgFeatureParameters* getEditDialog();

virtual QIcon getIcon(void) const;

private:
Expand Down

0 comments on commit 4f8973f

Please sign in to comment.