Fix #3810 X/Y Property Update on Locked View

- fixes x/y update when position locked for simple
  Views and ProjectionGroups.
This commit is contained in:
wandererfan
2019-01-29 20:59:57 -05:00
committed by wmayer
parent 97614e0341
commit a0e3ab1a40
7 changed files with 104 additions and 41 deletions

View File

@@ -27,6 +27,7 @@
#endif
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Base/Console.h>
#include <Base/Exception.h>
@@ -45,8 +46,8 @@ PROPERTY_SOURCE(TechDraw::DrawViewCollection, TechDraw::DrawView)
DrawViewCollection::DrawViewCollection()
{
nowUnsetting = false;
static const char *group = "Drawing view";
ADD_PROPERTY_TYPE(Views ,(0), group, App::Prop_None,"Attached Views");
static const char *group = "Collection";
ADD_PROPERTY_TYPE(Views ,(0), group, App::Prop_None,"Collection Views");
Views.setScope(App::LinkScope::Global);
}
@@ -54,6 +55,31 @@ DrawViewCollection::~DrawViewCollection()
{
}
void DrawViewCollection::onChanged(const App::Property* prop)
{
TechDraw::DrawView::onChanged(prop);
}
short DrawViewCollection::mustExecute() const
{
if (Views.isTouched()) {
return 1;
} else {
return TechDraw::DrawView::mustExecute();
}
}
App::DocumentObjectExecReturn *DrawViewCollection::execute(void)
{
if (!keepUpdated()) {
return App::DocumentObject::StdReturn;
}
lockChildren();
return DrawView::execute();
}
int DrawViewCollection::addView(DrawView *view)
{
// Add the new view to the collection
@@ -106,15 +132,6 @@ void DrawViewCollection::rebuildViewList()
Views.setValues(newViews);
}
short DrawViewCollection::mustExecute() const
{
if (Views.isTouched()) {
return 1;
} else {
return TechDraw::DrawView::mustExecute();
}
}
int DrawViewCollection::countChildren()
{
//Count the children recursively if needed
@@ -138,9 +155,15 @@ void DrawViewCollection::onDocumentRestored()
DrawView::execute();
}
void DrawViewCollection::onChanged(const App::Property* prop)
void DrawViewCollection::lockChildren(void)
{
TechDraw::DrawView::onChanged(prop);
for (auto& v:Views.getValues()) {
TechDraw::DrawView *view = dynamic_cast<TechDraw::DrawView *>(v);
if (!view) {
throw Base::ValueError("DrawViewCollection::lockChildren bad View\n");
}
view->handleXYLock();
}
}
void DrawViewCollection::unsetupObject()
@@ -162,17 +185,6 @@ void DrawViewCollection::unsetupObject()
Views.setValues(emptyViews);
}
App::DocumentObjectExecReturn *DrawViewCollection::execute(void)
{
if (!keepUpdated()) {
return App::DocumentObject::StdReturn;
}
return DrawView::execute();
}
QRectF DrawViewCollection::getRect() const
{
QRectF result;