diff --git a/src/Mod/TechDraw/App/DrawProjGroup.cpp b/src/Mod/TechDraw/App/DrawProjGroup.cpp index 658357aeed..7dc9eea4d8 100644 --- a/src/Mod/TechDraw/App/DrawProjGroup.cpp +++ b/src/Mod/TechDraw/App/DrawProjGroup.cpp @@ -204,13 +204,6 @@ Base::BoundBox3d DrawProjGroup::getBoundingBox() const bbox.Add(bb); } } - // This /should/ leave the centre of the bounding box at (0,0) except when - // we're in the process of updating the anchor view's position (eg called - // by moveToCentre()) - if (anchorView) { //TODO: It looks like we might be getting called before an anchor view is set - weird... - bbox.MoveX(anchorView->X.getValue()); - bbox.MoveY(anchorView->Y.getValue()); - } return bbox; } @@ -302,18 +295,6 @@ void DrawProjGroup::minimumBbViews(DrawProjGroupItem *viewPtrs[10], height = row0h + row1h + row2h; } - -void DrawProjGroup::moveToCentre(void) -{ - // Update the anchor view's X and Y to keep the bounding box centred on the origin - Base::BoundBox3d tempbbox = getBoundingBox(); - DrawProjGroupItem *anchorView = dynamic_cast(Anchor.getValue()); - if (anchorView) { - anchorView->X.setValue((tempbbox.MinX + tempbbox.MaxX) / -2.0); - anchorView->Y.setValue((tempbbox.MinY + tempbbox.MaxY) / -2.0); - } -} - App::DocumentObject * DrawProjGroup::getProjObj(const char *viewProjType) const { for( auto it : Views.getValues() ) { @@ -382,14 +363,16 @@ App::DocumentObject * DrawProjGroup::addProjection(const char *viewProjType) view->Type.setValue( viewProjType ); view->Label.setValue( viewProjType ); view->Source.setValues( Source.getValues() ); - if (strcmp(viewProjType, "Front") != 0 ) { + if (strcmp(viewProjType, "Front") != 0 ) { //not Front! vecs = getDirsFromFront(view); view->Direction.setValue(vecs.first); view->RotationVector.setValue(vecs.second); + } else { //Front + view->LockPosition.setValue(true); //lock "Front" position within DPG (note not Page!). + view->LockPosition.setStatus(App::Property::ReadOnly,true); //Front should stay locked. } addView(view); //from DrawViewCollection - moveToCentre(); if (view != getAnchor()) { //anchor is done elsewhere view->recomputeFeature(); } @@ -414,7 +397,6 @@ int DrawProjGroup::removeProjection(const char *viewProjType) if ( strcmp(viewProjType, projPtr->Type.getValueAsString()) == 0 ) { removeView(projPtr); // Remove from collection getDocument()->removeObject( it->getNameInDocument() ); // Remove from the document - moveToCentre(); return Views.getValues().size(); } } @@ -517,7 +499,11 @@ std::pair DrawProjGroup::getDirsFromFront(std::st Base::Vector3d DrawProjGroup::getXYPosition(const char *viewTypeCStr) { - Base::Vector3d result; + Base::Vector3d result(0.0,0.0,0.0); + //Front view position is always (0,0) + if (strcmp(viewTypeCStr, "Front") == 0 ) { // Front! + return result; + } const int idxCount = 10; DrawProjGroupItem *viewPtrs[idxCount]; arrangeViewPointers(viewPtrs); @@ -779,11 +765,6 @@ void DrawProjGroup::updateChildren(void) } } -//void DrawProjGroup::updateChildren(const App::Property* prop) -//{ -// view->....setValue(s)(prop->getValue(s)); -//} - /*! * tell children DPGIs that parent DPG has changed Source */ diff --git a/src/Mod/TechDraw/App/DrawProjGroup.h b/src/Mod/TechDraw/App/DrawProjGroup.h index 5a807f7ca9..0a176b4dcf 100644 --- a/src/Mod/TechDraw/App/DrawProjGroup.h +++ b/src/Mod/TechDraw/App/DrawProjGroup.h @@ -130,9 +130,6 @@ public: protected: void onChanged(const App::Property* prop) override; - //! Moves anchor view to keep our bounding box centre on the origin - void moveToCentre(); - /// Annoying helper - keep in sync with DrawProjGroupItem::TypeEnums /*! * \todo {See note regarding App::PropertyEnumeration on my wiki page http://freecadweb.org/wiki/User:Ian.rees} diff --git a/src/Mod/TechDraw/App/DrawView.cpp b/src/Mod/TechDraw/App/DrawView.cpp index 930b454956..4ba7ce9870 100644 --- a/src/Mod/TechDraw/App/DrawView.cpp +++ b/src/Mod/TechDraw/App/DrawView.cpp @@ -140,10 +140,6 @@ void DrawView::onChanged(const App::Property* prop) } } } -// if (prop == &X || //nothing needs to be calculated, just the graphic needs to be shifted. -// prop == &Y) { -// requestPaint(); -// } } App::DocumentObject::onChanged(prop); } diff --git a/src/Mod/TechDraw/Gui/QGIProjGroup.cpp b/src/Mod/TechDraw/Gui/QGIProjGroup.cpp index 8cb45b9844..bcc0300210 100644 --- a/src/Mod/TechDraw/Gui/QGIProjGroup.cpp +++ b/src/Mod/TechDraw/Gui/QGIProjGroup.cpp @@ -52,10 +52,11 @@ QGIProjGroup::QGIProjGroup() m_origin->setParentItem(this); // In place to ensure correct drawing and bounding box calculations - m_backgroundItem = new QGraphicsRectItem(); - m_backgroundItem->setPen(QPen(QColor(Qt::black))); + // WF: obs? not even part of QGIGroup! + m_groupBackground = new QGraphicsRectItem(); + m_groupBackground->setPen(QPen(QColor(Qt::black))); - //addToGroup(m_backgroundItem); + //addToGroup(m_groupBackground); setFlag(ItemIsSelectable, false); setFlag(ItemIsMovable, true); setFiltersChildEvents(true); @@ -116,7 +117,8 @@ QVariant QGIProjGroup::itemChange(GraphicsItemChange change, const QVariant &val QString type = QString::fromLatin1(projItemPtr->Type.getValueAsString()); if (type == QString::fromLatin1("Front")) { - gView->setLocked(true); + gView->setLocked(true); //this locks in GUI only + fView->LockPosition.setValue(true); //lock in App also installSceneEventFilter(gView); App::DocumentObject *docObj = getViewObject(); TechDraw::DrawProjGroup *projectionGroup = dynamic_cast(docObj); @@ -136,7 +138,6 @@ QVariant QGIProjGroup::itemChange(GraphicsItemChange change, const QVariant &val return QGIViewCollection::itemChange(change, value); } - void QGIProjGroup::mousePressEvent(QGraphicsSceneMouseEvent * event) { QGIView *qAnchor = getAnchorQItem(); @@ -208,7 +209,7 @@ QGIView * QGIProjGroup::getAnchorQItem() const void QGIProjGroup::updateView(bool update) { - m_backgroundItem->setRect(boundingRect()); + m_groupBackground->setRect(boundingRect()); return QGIViewCollection::updateView(update); } @@ -217,3 +218,4 @@ void QGIProjGroup::drawBorder() //QGIProjGroup does not have a border! // Base::Console().Message("TRACE - QGIProjGroup::drawBorder - doing nothing!!\n"); } + diff --git a/src/Mod/TechDraw/Gui/QGIProjGroup.h b/src/Mod/TechDraw/Gui/QGIProjGroup.h index f52f4cf23f..3f0d434e0f 100644 --- a/src/Mod/TechDraw/Gui/QGIProjGroup.h +++ b/src/Mod/TechDraw/Gui/QGIProjGroup.h @@ -67,7 +67,7 @@ private: /// Convenience function TechDraw::DrawProjGroup * getDrawView(void) const; - QGraphicsRectItem *m_backgroundItem; + QGraphicsRectItem *m_groupBackground; QGraphicsItem* m_origin; QPoint mousePos; };