Part: use the just-added methods to make properties read-only

This commit is contained in:
DeepSOIC 2016-08-08 21:48:50 +03:00
parent 369a7032b4
commit 507b39e3fc
2 changed files with 4 additions and 22 deletions

View File

@ -140,16 +140,6 @@ App::DocumentObjectExecReturn *AttachableObject::execute()
return Part::Feature::execute();
}
namespace Attacher {
void setReadonlyness(App::Property &prop, bool on)
{
unsigned long status = prop.getStatus();
prop.setStatus(App::Property::ReadOnly, on);
if (status != prop.getStatus())
App::GetApplication().signalChangePropertyEditor(prop);
}
}
void AttachableObject::onChanged(const App::Property* prop)
{
if(! this->isRestoring()){
@ -172,8 +162,8 @@ void AttachableObject::onChanged(const App::Property* prop)
}
eMapMode mmode = eMapMode(this->MapMode.getValue());
setReadonlyness(this->superPlacement, !bAttached);
setReadonlyness(this->Placement, bAttached && mmode != mmTranslate); //for mmTranslate, orientation should remain editable even when attached.
this->superPlacement.setReadOnly(!bAttached);
this->Placement.setReadOnly(bAttached && mmode != mmTranslate); //for mmTranslate, orientation should remain editable even when attached.
}
}

View File

@ -67,20 +67,12 @@ short Revolution::mustExecute() const
return 0;
}
void setReadonlyness(App::Property &prop, bool on)
{
unsigned long status = prop.getStatus();
prop.setStatus(App::Property::ReadOnly, on);
if (status != prop.getStatus())
App::GetApplication().signalChangePropertyEditor(prop);
}
void Revolution::onChanged(const App::Property* prop)
{
if(! this->isRestoring()){
if(prop == &AxisLink){
setReadonlyness(Base, AxisLink.getValue() != nullptr);
setReadonlyness(Axis, AxisLink.getValue() != nullptr);
Base.setReadOnly(AxisLink.getValue() != nullptr);
Axis.setReadOnly(AxisLink.getValue() != nullptr);
}
}
Part::Feature::onChanged(prop);