PartDesign: Fix pipe preview display

When a base feature was available the preview mode did not show the pipe and also set the visibility of the pipe to false
This commit is contained in:
Stefan Tröger 2016-04-14 20:19:16 +02:00 committed by wmayer
parent 62f563938b
commit c5ca99658b
3 changed files with 14 additions and 49 deletions

View File

@ -90,10 +90,8 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView,bool newObj, Q
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(PipeView->getObject());
Gui::Document* doc = Gui::Application::Instance->activeDocument();
//make sure th euser sees al important things: the base feature to select edges and the
//make sure th euser sees al important things: the
//spine/auxillery spine he already selected
if(pipe->BaseFeature.getValue())
doc->getViewProvider(pipe->BaseFeature.getValue())->show();
if(pipe->Spine.getValue()) {
auto* svp = doc->getViewProvider(pipe->Spine.getValue());
spineShow = svp->isShow();
@ -156,10 +154,8 @@ TaskPipeParameters::~TaskPipeParameters()
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
Gui::Document* doc = Gui::Application::Instance->activeDocument();
//make sure th euser sees al important things: the base feature to select edges and the
//make sure th euser sees al important things: the
//spine/auxillery spine he already selected
if(pipe->BaseFeature.getValue())
doc->getViewProvider(pipe->BaseFeature.getValue())->hide();
if(pipe->Spine.getValue()) {
auto* svp = doc->getViewProvider(pipe->Spine.getValue());
svp->setVisible(spineShow);

View File

@ -76,49 +76,11 @@ bool ViewProviderPipe::doubleClicked(void)
return true;
}
bool ViewProviderPipe::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default || ModNum == 1 ) {
bool ViewProviderPipe::setEdit(int ModNum) {
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();
TaskDlgPipeParameters *padDlg = qobject_cast<TaskDlgPipeParameters *>(dlg);
if (padDlg && padDlg->getPipeView() != 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");
// start the edit dialog
if (padDlg)
Gui::Control().showDialog(padDlg);
else
Gui::Control().showDialog(new TaskDlgPipeParameters(this,ModNum == 1));
return true;
}
else {
return ViewProviderPart::setEdit(ModNum);
}
return PartDesignGui::ViewProvider::setEdit(ModNum);
}
void ViewProviderPipe::unsetEdit(int ModNum) {
@ -127,6 +89,10 @@ void ViewProviderPipe::unsetEdit(int ModNum) {
}
TaskDlgFeatureParameters* ViewProviderPipe::getEditDialog() {
return new TaskDlgPipeParameters(this, false);
}
bool ViewProviderPipe::onDelete(const std::vector<std::string> &s)
{/*
PartDesign::Pipe* pcPipe = static_cast<PartDesign::Pipe*>(getObject());

View File

@ -47,9 +47,12 @@ public:
void highlightReferences(const bool on, bool auxillery);
protected:
virtual QIcon getIcon(void) const;
virtual bool setEdit(int ModNum);
virtual void unsetEdit(int ModNum);
virtual QIcon getIcon(void) const;
/// Returns a newly created TaskDlgPipeParameters
virtual TaskDlgFeatureParameters *getEditDialog();
private:
std::vector<App::Color> originalLineColors;