diff --git a/src/Gui/ViewProvider.h b/src/Gui/ViewProvider.h index 1e0e2c587..8b5648e1f 100644 --- a/src/Gui/ViewProvider.h +++ b/src/Gui/ViewProvider.h @@ -185,12 +185,14 @@ public: Transform, Cutting, Color, - Mirror, + Mirror + //FIXME: Never do such stuff in the base system +/*, Fillet, Sketch, Pad, Pocket, - Revolve + Revolve*/ }; protected: /// is called by the document when the provider goes in edit mode diff --git a/src/Mod/Part/Gui/ViewProviderMirror.cpp b/src/Mod/Part/Gui/ViewProviderMirror.cpp index e99287ba0..356007c51 100644 --- a/src/Mod/Part/Gui/ViewProviderMirror.cpp +++ b/src/Mod/Part/Gui/ViewProviderMirror.cpp @@ -205,13 +205,13 @@ void ViewProviderFillet::setupContextMenu(QMenu* menu, QObject* receiver, const { QAction* act; act = menu->addAction(QObject::tr("Edit fillet edges"), receiver, member); - act->setData(QVariant((int)ViewProvider::Fillet)); + act->setData(QVariant((int)ViewProvider::Default)); PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member); } bool ViewProviderFillet::setEdit(int ModNum) { - if (ModNum == ViewProvider::Default || ModNum == ViewProvider::Fillet) { + if (ModNum == ViewProvider::Default ) { if (Gui::Control().activeDialog()) return false; Part::Fillet* fillet = static_cast(getObject()); @@ -226,7 +226,7 @@ bool ViewProviderFillet::setEdit(int ModNum) void ViewProviderFillet::unsetEdit(int ModNum) { - if (ModNum == ViewProvider::Default || ModNum == ViewProvider::Fillet) { + if (ModNum == ViewProvider::Default) { Gui::Control().closeDialog(); } else { diff --git a/src/Mod/PartDesign/App/FeatureFillet.h b/src/Mod/PartDesign/App/FeatureFillet.h index cf3ced550..0b5d43f20 100644 --- a/src/Mod/PartDesign/App/FeatureFillet.h +++ b/src/Mod/PartDesign/App/FeatureFillet.h @@ -45,10 +45,10 @@ public: /// recalculate the feature App::DocumentObjectExecReturn *execute(void); short mustExecute() const; - /// returns the type name of the view provider - //const char* getViewProviderName(void) const { - // return "PartGui::ViewProviderFillet"; - //} + // returns the type name of the view provider + const char* getViewProviderName(void) const { + return "PartDesignGui::ViewProviderFillet"; + } //@} }; diff --git a/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp b/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp index 32bcfb52d..11dd3a7d0 100644 --- a/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp +++ b/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp @@ -34,6 +34,7 @@ #include "Workbench.h" #include "ViewProviderPocket.h" #include "ViewProviderPad.h" +#include "ViewProviderFillet.h" #include "ViewProviderRevolution.h" #include "TaskChamfer.h" @@ -78,10 +79,12 @@ void PartDesignGuiExport initPartDesignGui() CreatePartDesignCommands(); PartDesignGui::Workbench ::init(); + PartDesignGui::ViewProvider ::init(); PartDesignGui::ViewProviderPocket ::init(); PartDesignGui::ViewProviderPad ::init(); PartDesignGui::ViewProviderRevolution::init(); PartDesignGui::ViewProviderChamfer ::init(); + PartDesignGui::ViewProviderFillet ::init(); // add resources and reloads the translators loadPartDesignResource(); diff --git a/src/Mod/PartDesign/Gui/CMakeLists.txt b/src/Mod/PartDesign/Gui/CMakeLists.txt index 6af110fce..459c3ea34 100644 --- a/src/Mod/PartDesign/Gui/CMakeLists.txt +++ b/src/Mod/PartDesign/Gui/CMakeLists.txt @@ -29,6 +29,7 @@ set(PartDesignGui_MOC_HDRS TaskPadParameters.h TaskPatternRectangularParameters.h TaskPocketParameters.h + TaskFilletParameters.h TaskHoleParameters.h TaskRevolutionParameters.h ) @@ -42,6 +43,7 @@ set(PartDesignGui_UIC_SRCS TaskPadParameters.ui TaskPatternRectangularParameters.ui TaskPocketParameters.ui + TaskFilletParameters.ui TaskHoleParameters.ui TaskRevolutionParameters.ui ) @@ -56,6 +58,8 @@ SET(PartDesignGuiViewProvider_SRCS ViewProviderHole.h ViewProviderPocket.cpp ViewProviderPocket.h + ViewProviderFillet.cpp + ViewProviderFillet.h ViewProviderRevolution.cpp ViewProviderRevolution.h ViewProviderPatternRectangular.cpp @@ -76,6 +80,9 @@ SET(PartDesignGuiTaskDlgs_SRCS TaskPocketParameters.ui TaskPocketParameters.cpp TaskPocketParameters.h + TaskFilletParameters.ui + TaskFilletParameters.cpp + TaskFilletParameters.h TaskRevolutionParameters.ui TaskRevolutionParameters.cpp TaskRevolutionParameters.h diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 2722c8ed3..dd57f1c4f 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -354,8 +354,7 @@ void CmdPartDesignFillet::activated(int iMsg) doCommand(Doc,"App.activeDocument().addObject(\"PartDesign::Fillet\",\"%s\")",FeatName.c_str()); doCommand(Doc,"App.activeDocument().%s.Base = %s",FeatName.c_str(),SelString.c_str()); doCommand(Gui,"Gui.activeDocument().hide(\"%s\")",selection[0].getFeatName()); - updateActive(); - commitCommand(); + doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); copyVisual(FeatName.c_str(), "ShapeColor", selection[0].getFeatName()); copyVisual(FeatName.c_str(), "LineColor", selection[0].getFeatName()); diff --git a/src/Mod/PartDesign/Gui/Makefile.am b/src/Mod/PartDesign/Gui/Makefile.am index 6d1518c08..7eabd9369 100644 --- a/src/Mod/PartDesign/Gui/Makefile.am +++ b/src/Mod/PartDesign/Gui/Makefile.am @@ -7,12 +7,14 @@ BUILT_SOURCES=\ moc_TaskPadParameters.cpp \ moc_TaskPatternRectangularParameters.cpp \ moc_TaskPocketParameters.cpp \ + moc_TaskFilletParameters.cpp \ moc_TaskHoleParameters.cpp \ moc_TaskRevolutionParameters.cpp \ ui_TaskChamfer.h \ ui_TaskPadParameters.h \ ui_TaskPatternRectangularParameters.h \ ui_TaskPocketParameters.h \ + ui_TaskFilletParameters.h \ ui_TaskHoleParameters.h \ ui_TaskRevolutionParameters.h @@ -21,6 +23,7 @@ libPartDesignGui_la_UI=\ TaskPadParameters.ui \ TaskPatternRectangularParameters.ui \ TaskPocketParameters.ui \ + TaskFilletParameters.ui \ TaskHoleParameters.ui \ TaskRevolutionParameters.ui @@ -37,6 +40,8 @@ libPartDesignGui_la_SOURCES=\ TaskPatternRectangularParameters.h \ TaskPocketParameters.cpp \ TaskPocketParameters.h \ + TaskFilletParameters.cpp \ + TaskFilletParameters.h \ TaskRevolutionParameters.cpp \ TaskRevolutionParameters.h \ TaskHoleParameters.cpp \ @@ -49,6 +54,8 @@ libPartDesignGui_la_SOURCES=\ ViewProviderPad.h \ ViewProviderPocket.cpp \ ViewProviderPocket.h \ + ViewProviderFillet.cpp \ + ViewProviderFillet.h \ ViewProviderRevolution.cpp \ ViewProviderRevolution.h \ ViewProviderPatternRectangular.cpp \ diff --git a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp new file mode 100644 index 000000000..e15856cda --- /dev/null +++ b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp @@ -0,0 +1,168 @@ +/*************************************************************************** + * Copyright (c) 2011 Juergen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#ifndef _PreComp_ +#endif + +#include "ui_TaskFilletParameters.h" +#include "TaskFilletParameters.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace PartDesignGui; +using namespace Gui; + +/* TRANSLATOR PartDesignGui::TaskFilletParameters */ + +TaskFilletParameters::TaskFilletParameters(ViewProviderFillet *FilletView,QWidget *parent) + : TaskBox(Gui::BitmapFactory().pixmap("PartDesign_Fillet"),tr("Fillet parameters"),true, parent),FilletView(FilletView) +{ + // we need a separate container widget to add all controls to + proxy = new QWidget(this); + ui = new Ui_TaskFilletParameters(); + ui->setupUi(proxy); + QMetaObject::connectSlotsByName(this); + + connect(ui->doubleSpinBox, SIGNAL(valueChanged(double)), + this, SLOT(onLengthChanged(double))); + + this->groupLayout()->addWidget(proxy); + + PartDesign::Fillet* pcFillet = static_cast(FilletView->getObject()); + double r = pcFillet->Radius.getValue(); + + ui->doubleSpinBox->setMaximum(INT_MAX); + ui->doubleSpinBox->setValue(r); + ui->doubleSpinBox->selectAll(); + + + setFocus (); +} + +void TaskFilletParameters::onLengthChanged(double len) +{ + PartDesign::Fillet* pcFillet = static_cast(FilletView->getObject()); + pcFillet->Radius.setValue((float)len); + pcFillet->getDocument()->recomputeFeature(pcFillet); +} + +double TaskFilletParameters::getLength(void) const +{ + return ui->doubleSpinBox->value(); +} + + +TaskFilletParameters::~TaskFilletParameters() +{ + delete ui; +} + +void TaskFilletParameters::changeEvent(QEvent *e) +{ + TaskBox::changeEvent(e); + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(proxy); + } +} + +//************************************************************************** +//************************************************************************** +// TaskDialog +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TaskDlgFilletParameters::TaskDlgFilletParameters(ViewProviderFillet *FilletView) + : TaskDialog(),FilletView(FilletView) +{ + assert(FilletView); + parameter = new TaskFilletParameters(FilletView); + + Content.push_back(parameter); +} + +TaskDlgFilletParameters::~TaskDlgFilletParameters() +{ + +} + +//==== calls from the TaskView =============================================================== + + +void TaskDlgFilletParameters::open() +{ + +} + +void TaskDlgFilletParameters::clicked(int) +{ + +} + +bool TaskDlgFilletParameters::accept() +{ + std::string name = FilletView->getObject()->getNameInDocument(); + + //Gui::Command::openCommand("Fillet changed"); + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Radius = %f",name.c_str(),parameter->getLength()); + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + Gui::Command::commitCommand(); + + return true; +} + +bool TaskDlgFilletParameters::reject() +{ + // get the support and Sketch + PartDesign::Fillet* pcFillet = static_cast(FilletView->getObject()); + App::DocumentObject *pcSupport; + pcSupport = pcFillet->Base.getValue(); + + // role back the done things + Gui::Command::abortCommand(); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + + // if abort command deleted the object the support is visible again + if (!Gui::Application::Instance->getViewProvider(pcFillet)) { + if (pcSupport && Gui::Application::Instance->getViewProvider(pcSupport)) + Gui::Application::Instance->getViewProvider(pcSupport)->show(); + } + + return true; +} + + + +#include "moc_TaskFilletParameters.cpp" diff --git a/src/Mod/PartDesign/Gui/TaskFilletParameters.h b/src/Mod/PartDesign/Gui/TaskFilletParameters.h new file mode 100644 index 000000000..1c63ffc10 --- /dev/null +++ b/src/Mod/PartDesign/Gui/TaskFilletParameters.h @@ -0,0 +1,109 @@ +/*************************************************************************** + * Copyright (c) 2011 Juergen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef GUI_TASKVIEW_TaskFilletParameters_H +#define GUI_TASKVIEW_TaskFilletParameters_H + +#include +#include +#include + +#include "ViewProviderFillet.h" + +class Ui_TaskFilletParameters; + +namespace App { +class Property; +} + +namespace Gui { +class ViewProvider; +} + +namespace PartDesignGui { + + + +class TaskFilletParameters : public Gui::TaskView::TaskBox +{ + Q_OBJECT + +public: + TaskFilletParameters(ViewProviderFillet *FilletView,QWidget *parent = 0); + ~TaskFilletParameters(); + + double getLength(void) const; + +private Q_SLOTS: + void onLengthChanged(double); + +protected: + void changeEvent(QEvent *e); + +private: + +private: + QWidget* proxy; + Ui_TaskFilletParameters* ui; + ViewProviderFillet *FilletView; +}; + +/// simulation dialog for the TaskView +class TaskDlgFilletParameters : public Gui::TaskView::TaskDialog +{ + Q_OBJECT + +public: + TaskDlgFilletParameters(ViewProviderFillet *FilletView); + ~TaskDlgFilletParameters(); + + ViewProviderFillet* getFilletView() const + { return FilletView; } + + +public: + /// is called the TaskView when the dialog is opened + virtual void open(); + /// is called by the framework if an button is clicked which has no accept or reject role + virtual void clicked(int); + /// is called by the framework if the dialog is accepted (Ok) + virtual bool accept(); + /// is called by the framework if the dialog is rejected (Cancel) + virtual bool reject(); + /// is called by the framework if the user presses the help button + virtual bool isAllowedAlterDocument(void) const + { return false; } + + /// returns for Close and Help button + virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const + { return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; } + +protected: + ViewProviderFillet *FilletView; + + TaskFilletParameters *parameter; +}; + +} //namespace PartDesignGui + +#endif // GUI_TASKVIEW_TASKAPPERANCE_H diff --git a/src/Mod/PartDesign/Gui/TaskFilletParameters.ui b/src/Mod/PartDesign/Gui/TaskFilletParameters.ui new file mode 100644 index 000000000..086da7871 --- /dev/null +++ b/src/Mod/PartDesign/Gui/TaskFilletParameters.ui @@ -0,0 +1,42 @@ + + + PartDesignGui::TaskFilletParameters + + + + 0 + 0 + 135 + 40 + + + + Form + + + + + + + + Radius: + + + + + + + 0.000000000000000 + + + 999999999.000000000000000 + + + + + + + + + + diff --git a/src/Mod/PartDesign/Gui/ViewProvider.cpp b/src/Mod/PartDesign/Gui/ViewProvider.cpp index 562579a5d..4252b2933 100644 --- a/src/Mod/PartDesign/Gui/ViewProvider.cpp +++ b/src/Mod/PartDesign/Gui/ViewProvider.cpp @@ -44,6 +44,9 @@ ViewProvider::~ViewProvider() bool ViewProvider::doubleClicked(void) { + std::string Msg("Change "); + Msg += this->pcObject->getNameInDocument(); + Gui::Command::openCommand(Msg.c_str()); Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s',0)",this->pcObject->getNameInDocument()); return true; } diff --git a/src/Mod/PartDesign/Gui/ViewProviderFillet.cpp b/src/Mod/PartDesign/Gui/ViewProviderFillet.cpp new file mode 100644 index 000000000..cd427c3c0 --- /dev/null +++ b/src/Mod/PartDesign/Gui/ViewProviderFillet.cpp @@ -0,0 +1,130 @@ +/*************************************************************************** + * Copyright (c) 2011 Juergen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#ifndef _PreComp_ +#endif + +#include "ViewProviderFillet.h" +#include "TaskFilletParameters.h" +#include +#include +#include +#include +#include + + +using namespace PartDesignGui; + +PROPERTY_SOURCE(PartDesignGui::ViewProviderFillet,PartDesignGui::ViewProvider) + +ViewProviderFillet::ViewProviderFillet() +{ +} + +ViewProviderFillet::~ViewProviderFillet() +{ +} + + +void ViewProviderFillet::setupContextMenu(QMenu* menu, QObject* receiver, const char* member) +{ + QAction* act; + act = menu->addAction(QObject::tr("Edit pocket"), receiver, member); + act->setData(QVariant((int)ViewProvider::Default)); + PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member); +} + +bool ViewProviderFillet::setEdit(int ModNum) +{ + if (ModNum == ViewProvider::Default ) { + // When double-clicking on the item for this fillet the + // object unsets and sets its edit mode without closing + // the task panel + Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); + TaskDlgFilletParameters *padDlg = qobject_cast(dlg); + if (padDlg && padDlg->getFilletView() != 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().closeDialog(); + else + return false; + } + + // clear the selection (convenience) + Gui::Selection().clearSelection(); + //if(ModNum == 1) + // Gui::Command::openCommand("Change fillet parameters"); + + // start the edit dialog + if (padDlg) + Gui::Control().showDialog(padDlg); + else + Gui::Control().showDialog(new TaskDlgFilletParameters(this)); + + return true; + } + else { + return PartGui::ViewProviderPart::setEdit(ModNum); + } +} + +void ViewProviderFillet::unsetEdit(int ModNum) +{ + if (ModNum == ViewProvider::Default ) { + // and update the pad + //getSketchObject()->getDocument()->recompute(); + + // when pressing ESC make sure to close the dialog + Gui::Control().closeDialog(); + } + else { + PartGui::ViewProviderPart::unsetEdit(ModNum); + } +} + +bool ViewProviderFillet::onDelete(const std::vector &) +{ + // get the support and Sketch + PartDesign::Fillet* pcFillet = static_cast(getObject()); + App::DocumentObject *pcSupport; + if (pcFillet->Base.getValue()){ + pcSupport = static_cast(pcFillet->Base.getValue()); + } + + // if abort command deleted the object the support is visible again + if (pcSupport && Gui::Application::Instance->getViewProvider(pcSupport)) + Gui::Application::Instance->getViewProvider(pcSupport)->show(); + + return true; +} + + diff --git a/src/Mod/PartDesign/Gui/ViewProviderFillet.h b/src/Mod/PartDesign/Gui/ViewProviderFillet.h new file mode 100644 index 000000000..0c9a01ff1 --- /dev/null +++ b/src/Mod/PartDesign/Gui/ViewProviderFillet.h @@ -0,0 +1,58 @@ +/*************************************************************************** + * Copyright (c) 2011 Juergen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef PARTGUI_ViewProviderFillet_H +#define PARTGUI_ViewProviderFillet_H + +#include "ViewProvider.h" + + +namespace PartDesignGui { + +class PartDesignGuiExport ViewProviderFillet : public ViewProvider +{ + PROPERTY_HEADER(PartDesignGui::ViewProviderFillet); + +public: + /// constructor + ViewProviderFillet(); + /// destructor + virtual ~ViewProviderFillet(); + + /// grouping handling + void setupContextMenu(QMenu*, QObject*, const char*); + + virtual bool onDelete(const std::vector &); + +protected: + virtual bool setEdit(int ModNum); + virtual void unsetEdit(int ModNum); + +}; + + + +} // namespace PartDesignGui + + +#endif // PARTGUI_ViewProviderFillet_H diff --git a/src/Mod/PartDesign/Gui/ViewProviderPad.cpp b/src/Mod/PartDesign/Gui/ViewProviderPad.cpp index 79d6f1ee7..35947f258 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPad.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderPad.cpp @@ -58,13 +58,13 @@ void ViewProviderPad::setupContextMenu(QMenu* menu, QObject* receiver, const cha { QAction* act; act = menu->addAction(QObject::tr("Edit pad"), receiver, member); - act->setData(QVariant((int)ViewProvider::Pad)); + act->setData(QVariant((int)ViewProvider::Default)); PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member); } bool ViewProviderPad::setEdit(int ModNum) { - if (ModNum == ViewProvider::Default || ModNum == ViewProvider::Pad) { + if (ModNum == ViewProvider::Default ) { // When double-clicking on the item for this pad the // object unsets and sets its edit mode without closing // the task panel @@ -87,8 +87,8 @@ bool ViewProviderPad::setEdit(int ModNum) // clear the selection (convenience) Gui::Selection().clearSelection(); - if (ModNum == 1) - Gui::Command::openCommand("Change pad parameters"); + //if (ModNum == 1) + // Gui::Command::openCommand("Change pad parameters"); // start the edit dialog if (padDlg) @@ -105,7 +105,7 @@ bool ViewProviderPad::setEdit(int ModNum) void ViewProviderPad::unsetEdit(int ModNum) { - if (ModNum == ViewProvider::Default || ModNum == ViewProvider::Pad) { + if (ModNum == ViewProvider::Default) { // and update the pad //getSketchObject()->getDocument()->recompute(); diff --git a/src/Mod/PartDesign/Gui/ViewProviderPocket.cpp b/src/Mod/PartDesign/Gui/ViewProviderPocket.cpp index 0ad8876c6..99a56a014 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPocket.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderPocket.cpp @@ -37,7 +37,7 @@ using namespace PartDesignGui; -PROPERTY_SOURCE(PartDesignGui::ViewProviderPocket,PartGui::ViewProviderPart) +PROPERTY_SOURCE(PartDesignGui::ViewProviderPocket,PartDesignGui::ViewProvider) ViewProviderPocket::ViewProviderPocket() { @@ -59,13 +59,13 @@ void ViewProviderPocket::setupContextMenu(QMenu* menu, QObject* receiver, const { QAction* act; act = menu->addAction(QObject::tr("Edit pocket"), receiver, member); - act->setData(QVariant((int)ViewProvider::Pocket)); + act->setData(QVariant((int)ViewProvider::Default)); PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member); } bool ViewProviderPocket::setEdit(int ModNum) { - if (ModNum == ViewProvider::Default || ModNum == ViewProvider::Pocket) { + if (ModNum == ViewProvider::Default ) { // When double-clicking on the item for this pad the // object unsets and sets its edit mode without closing // the task panel @@ -88,8 +88,8 @@ bool ViewProviderPocket::setEdit(int ModNum) // clear the selection (convenience) Gui::Selection().clearSelection(); - if(ModNum == 1) - Gui::Command::openCommand("Change pocket parameters"); + //if(ModNum == ViewProvider::Default) + // Gui::Command::openCommand("Change pocket parameters"); // start the edit dialog if (padDlg) @@ -106,7 +106,7 @@ bool ViewProviderPocket::setEdit(int ModNum) void ViewProviderPocket::unsetEdit(int ModNum) { - if (ModNum == ViewProvider::Default || ModNum == ViewProvider::Pocket) { + if (ModNum == ViewProvider::Default ) { // and update the pad //getSketchObject()->getDocument()->recompute(); diff --git a/src/Mod/PartDesign/Gui/ViewProviderPocket.h b/src/Mod/PartDesign/Gui/ViewProviderPocket.h index 8e03072e4..701cb77ff 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPocket.h +++ b/src/Mod/PartDesign/Gui/ViewProviderPocket.h @@ -31,7 +31,7 @@ namespace PartDesignGui { class PartDesignGuiExport ViewProviderPocket : public ViewProvider { - PROPERTY_HEADER(PartGui::ViewProviderPocket); + PROPERTY_HEADER(PartDesignGui::ViewProviderPocket); public: /// constructor diff --git a/src/Mod/PartDesign/Gui/ViewProviderRevolution.cpp b/src/Mod/PartDesign/Gui/ViewProviderRevolution.cpp index 7e17cf6c9..fe8ed944a 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderRevolution.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderRevolution.cpp @@ -59,13 +59,13 @@ void ViewProviderRevolution::setupContextMenu(QMenu* menu, QObject* receiver, co { QAction* act; act = menu->addAction(QObject::tr("Edit revolution"), receiver, member); - act->setData(QVariant((int)ViewProvider::Revolve)); + act->setData(QVariant((int)ViewProvider::Default)); PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member); } bool ViewProviderRevolution::setEdit(int ModNum) { - if (ModNum == ViewProvider::Default || ModNum == ViewProvider::Revolve) { + if (ModNum == ViewProvider::Default ) { // When double-clicking on the item for this pad the // object unsets and sets its edit mode without closing // the task panel @@ -88,8 +88,8 @@ bool ViewProviderRevolution::setEdit(int ModNum) // clear the selection (convenience) Gui::Selection().clearSelection(); - if (ModNum == 1) - Gui::Command::openCommand("Change revolution parameters"); + //if (ModNum == 1) + // Gui::Command::openCommand("Change revolution parameters"); // start the edit dialog if (padDlg) @@ -106,7 +106,7 @@ bool ViewProviderRevolution::setEdit(int ModNum) void ViewProviderRevolution::unsetEdit(int ModNum) { - if (ModNum == ViewProvider::Default || ModNum == ViewProvider::Revolve) { + if (ModNum == ViewProvider::Default) { // and update the pad //getSketchObject()->getDocument()->recompute();