RuledSurface fixes, Switch Part_Mirror to SVG icon

RuledSurface fixes,
  claim children
  correct tool tip
  change default name from "Filled_shape" to "Ruled Surface"

Part_Mirror
  Switched icon in the tool bar, menu, and tree from
  the existing PNG icon to the also existing SVG icon
This commit is contained in:
jmaustpc 2013-03-24 01:01:47 +11:00 committed by Yorik van Havre
parent f18ddea1b3
commit 0ccbcffbf5
6 changed files with 54 additions and 15 deletions

View File

@ -118,7 +118,7 @@ App::DocumentObjectExecReturn *RuledSurface::execute(void)
this->Shape.setValue(shell);
}
else {
return new App::DocumentObjectExecReturn("Curves must either be edges or wires.");
return new App::DocumentObjectExecReturn("Curves must either be both edges or both wires.");
}
return App::DocumentObject::StdReturn;
}

View File

@ -860,7 +860,7 @@ CmdPartMirror::CmdPartMirror()
sToolTipText = QT_TR_NOOP("Mirroring a selected shape");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "Part_MirrorPNG";
sPixmap = "Part_Mirror.svg";
}
void CmdPartMirror::activated(int iMsg)
@ -1227,7 +1227,7 @@ CmdPartRuledSurface::CmdPartRuledSurface()
sAppModule = "Part";
sGroup = QT_TR_NOOP("Part");
sMenuText = QT_TR_NOOP("Create ruled surface");
sToolTipText = QT_TR_NOOP("Create a ruled surface from two curves");
sToolTipText = QT_TR_NOOP("Create a ruled surface from either two Edges or two wires");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "Part_RuledSurface";
@ -1316,7 +1316,7 @@ void CmdPartRuledSurface::activated(int iMsg)
}
openCommand("Create ruled surface");
doCommand(Doc, "FreeCAD.ActiveDocument.addObject('Part::RuledSurface','Filled shape')");
doCommand(Doc, "FreeCAD.ActiveDocument.addObject('Part::RuledSurface', 'Ruled Surface')");
doCommand(Doc, "FreeCAD.ActiveDocument.ActiveObject.Curve1=(FreeCAD.ActiveDocument.%s,['%s'])"
,obj1.c_str(), link1.c_str());
doCommand(Doc, "FreeCAD.ActiveDocument.ActiveObject.Curve2=(FreeCAD.ActiveDocument.%s,['%s'])"

View File

@ -182,7 +182,7 @@ TaskMirroring::TaskMirroring()
{
widget = new Mirroring();
taskbox = new Gui::TaskView::TaskBox(
Gui::BitmapFactory().pixmap("Part_MirrorPNG"),
Gui::BitmapFactory().pixmap("Part_Mirror.svg"),
widget->windowTitle(), false, 0);
taskbox->groupLayout()->addWidget(widget);
Content.push_back(taskbox);

View File

@ -57,7 +57,7 @@ PROPERTY_SOURCE(PartGui::ViewProviderMirror, PartGui::ViewProviderPart)
ViewProviderMirror::ViewProviderMirror()
{
sPixmap = "Part_MirrorPNG";
sPixmap = "Part_Mirror.svg";
pcEditNode = new SoSeparator();
pcEditNode->ref();
}

View File

@ -30,6 +30,9 @@
#include <Base/Parameter.h>
#include "ViewProviderRuledSurface.h"
#include <Mod/Part/App/PartFeatures.h>
#include <Gui/Application.h>
//#include "Tree.h"
@ -56,6 +59,47 @@ ViewProviderRuledSurface::~ViewProviderRuledSurface()
}
std::vector<App::DocumentObject*> ViewProviderRuledSurface::claimChildren() const
{
std::vector<App::DocumentObject*> temp;
temp.push_back(static_cast<Part::RuledSurface*>(getObject())->Curve1.getValue());
temp.push_back(static_cast<Part::RuledSurface*>(getObject())->Curve2.getValue());
return temp;
}
void ViewProviderRuledSurface::updateData(const App::Property* prop)
{
PartGui::ViewProviderPart::updateData(prop);
if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) {
const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
(prop)->getValues();
}
/* //The following hides the Children shapes. If the edges from which the Ruled Surface was created
* were selected from the subshapes of another shape, it is likely that one would not want to hide the shape
* hence this section is commented out
Part::RuledSurface* pRuledSurface = static_cast<Part::RuledSurface*>(getObject());
App::DocumentObject *pCurve1 = pRuledSurface->Curve1.getValue();
App::DocumentObject *pCurve2 = pRuledSurface->Curve2.getValue();
if (pCurve1)
Gui::Application::Instance->hideViewProvider(pCurve1);
if (pCurve2)
Gui::Application::Instance->hideViewProvider(pCurve2);*/
}
bool ViewProviderRuledSurface::onDelete(const std::vector<std::string> &)
{
// get the input shape
Part::RuledSurface* pRuledSurface = static_cast<Part::RuledSurface*>(getObject());
App::DocumentObject *pCurve1 = pRuledSurface->Curve1.getValue();
App::DocumentObject *pCurve2 = pRuledSurface->Curve2.getValue();
if (pCurve1)
Gui::Application::Instance->showViewProvider(pCurve1);
if (pCurve2)
Gui::Application::Instance->showViewProvider(pCurve2);
return true;
}
// **********************************************************************************

View File

@ -27,16 +27,7 @@
#include "ViewProvider.h"
class TopoDS_Shape;
class TopoDS_Face;
class SoSeparator;
class SbVec3f;
class SoTransform;
namespace Gui {
class View3DInventorViewer;
class SoFCSelection;
}
namespace PartGui {
@ -52,6 +43,10 @@ public:
virtual ~ViewProviderRuledSurface();
std::vector<std::string> getDisplayModes(void) const;
std::vector<App::DocumentObject*> claimChildren() const;
void updateData(const App::Property*);
bool onDelete(const std::vector<std::string> &);
protected: