diff --git a/src/Mod/TechDraw/Gui/CMakeLists.txt b/src/Mod/TechDraw/Gui/CMakeLists.txt index 917dd22e0..40058de73 100644 --- a/src/Mod/TechDraw/Gui/CMakeLists.txt +++ b/src/Mod/TechDraw/Gui/CMakeLists.txt @@ -128,8 +128,6 @@ SET(TechDrawGuiView_SRCS QGIViewSpreadsheet.h QGIViewClip.cpp QGIViewClip.h - QGIHatch.cpp - QGIHatch.h TemplateTextField.cpp TemplateTextField.h ZVALUE.h diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.cpp b/src/Mod/TechDraw/Gui/MDIViewPage.cpp index 403a1d9f4..9084ac863 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.cpp +++ b/src/Mod/TechDraw/Gui/MDIViewPage.cpp @@ -353,102 +353,6 @@ int MDIViewPage::attachView(App::DocumentObject *obj) } -// wf: this is never executed??? -void MDIViewPage::preSelectionChanged(const QPoint &pos) -{ - QObject *obj = QObject::sender(); - - if(!obj) - return; - - auto view( dynamic_cast(obj) ); - if(!view) - return; - - QGraphicsItem* parent = view->parentItem(); - if(!parent) - return; - - TechDraw::DrawView *viewObj = view->getViewObject(); - std::stringstream ss; - - QGIFace *face = dynamic_cast(obj); - QGIEdge *edge = dynamic_cast(obj); - QGIVertex *vert = dynamic_cast(obj); - if(edge) { - ss << "Edge" << edge->getProjIndex(); - //bool accepted = - static_cast (Gui::Selection().setPreselect(viewObj->getDocument()->getName() - ,viewObj->getNameInDocument() - ,ss.str().c_str() - ,pos.x() - ,pos.y() - ,0)); - } else if(vert) { - ss << "Vertex" << vert->getProjIndex(); - //bool accepted = - static_cast (Gui::Selection().setPreselect(viewObj->getDocument()->getName() - ,viewObj->getNameInDocument() - ,ss.str().c_str() - ,pos.x() - ,pos.y() - ,0)); - } else if(face) { - ss << "Face" << face->getProjIndex(); //TODO: SectionFaces have ProjIndex = -1. (but aren't selectable?) Problem? - //bool accepted = - static_cast (Gui::Selection().setPreselect(viewObj->getDocument()->getName() - ,viewObj->getNameInDocument() - ,ss.str().c_str() - ,pos.x() - ,pos.y() - ,0)); - } else { - ss << ""; - Gui::Selection().setPreselect(viewObj->getDocument()->getName() - ,viewObj->getNameInDocument() - ,ss.str().c_str() - ,pos.x() - ,pos.y() - ,0); - } -} - -void MDIViewPage::blockSelection(const bool state) -{ - isSelectionBlocked = state; -} - - -void MDIViewPage::clearSelection() -{ - blockSelection(true); - std::vector views = m_view->getViews(); - - // Iterate through all views and unselect all - for (std::vector::iterator it = views.begin(); it != views.end(); ++it) { - QGIView *item = *it; - item->setSelected(false); - item->updateView(); - } - - blockSelection(false); -} - - -void MDIViewPage::selectFeature(App::DocumentObject *obj, const bool isSelected) -{ - // Update QGVPage's selection based on Selection made outside Drawing Interace - // wf: but this also executes for changes within the Drawing Interface? - QGIView *view = m_view->findView(obj); - - blockSelection(true); - if(view) { - view->setSelected(isSelected); - view->updateView(); - } - blockSelection(false); -} - void MDIViewPage::updateTemplate(bool forceUpdate) { @@ -899,23 +803,6 @@ QPrinter::PageSize MDIViewPage::getPageSize(int w, int h) const return ps; } - -void MDIViewPage::onSelectionChanged(const Gui::SelectionChanges& msg) -{ - if (msg.Type == Gui::SelectionChanges::ClrSelection) { - - } - else if (msg.Type == Gui::SelectionChanges::AddSelection || - msg.Type == Gui::SelectionChanges::RmvSelection) { - //bool select = (msg.Type == Gui::SelectionChanges::AddSelection); - // Check if it is a view object - } - else if (msg.Type == Gui::SelectionChanges::SetSelection) { - // do nothing here - } -} - - void MDIViewPage::setFrameState(bool state) { m_frameState = state; @@ -929,7 +816,6 @@ PyObject* MDIViewPage::getPyObject() Py_Return; } - void MDIViewPage::setRenderer(QAction *action) { #ifndef QT_NO_OPENGL @@ -971,6 +857,129 @@ void MDIViewPage::saveSVG() m_view->saveSvg(fn); } + +/////////////// Selection Routines /////////////////// +// wf: this is never executed??? +// needs a signal from Scene? hoverEvent? Scene does not emit signal for "preselect" +void MDIViewPage::preSelectionChanged(const QPoint &pos) +{ + QObject *obj = QObject::sender(); + + if(!obj) + return; + + auto view( dynamic_cast(obj) ); + if(!view) + return; + + QGraphicsItem* parent = view->parentItem(); + if(!parent) + return; + + TechDraw::DrawView *viewObj = view->getViewObject(); + std::stringstream ss; + + QGIFace *face = dynamic_cast(obj); + QGIEdge *edge = dynamic_cast(obj); + QGIVertex *vert = dynamic_cast(obj); + if(edge) { + ss << "Edge" << edge->getProjIndex(); + //bool accepted = + static_cast (Gui::Selection().setPreselect(viewObj->getDocument()->getName() + ,viewObj->getNameInDocument() + ,ss.str().c_str() + ,pos.x() + ,pos.y() + ,0)); + } else if(vert) { + ss << "Vertex" << vert->getProjIndex(); + //bool accepted = + static_cast (Gui::Selection().setPreselect(viewObj->getDocument()->getName() + ,viewObj->getNameInDocument() + ,ss.str().c_str() + ,pos.x() + ,pos.y() + ,0)); + } else if(face) { + ss << "Face" << face->getProjIndex(); //TODO: SectionFaces have ProjIndex = -1. (but aren't selectable?) Problem? + //bool accepted = + static_cast (Gui::Selection().setPreselect(viewObj->getDocument()->getName() + ,viewObj->getNameInDocument() + ,ss.str().c_str() + ,pos.x() + ,pos.y() + ,0)); + } else { + ss << ""; + Gui::Selection().setPreselect(viewObj->getDocument()->getName() + ,viewObj->getNameInDocument() + ,ss.str().c_str() + ,pos.x() + ,pos.y() + ,0); + } +} + +void MDIViewPage::blockSelection(const bool state) +{ + isSelectionBlocked = state; +} + + +void MDIViewPage::clearSelection() +{ + blockSelection(true); + std::vector views = m_view->getViews(); + + // Iterate through all views and unselect all + for (std::vector::iterator it = views.begin(); it != views.end(); ++it) { + QGIView *item = *it; + item->setSelected(false); + item->updateView(); + } + + blockSelection(false); +} + +//!Update QGVPage's selection based on Selection made outside Drawing Interace +//invoked from VPP +void MDIViewPage::selectFeature(App::DocumentObject *obj, const bool isSelected) +{ + App::DocumentObject* objCopy = obj; + TechDraw::DrawHatch* hatchObj = dynamic_cast(objCopy); + if (hatchObj) { //Hatch does not have a QGIV of it's own. mark parent as selected. + objCopy = hatchObj->getSourceView(); //possible to highlight subObject? + } + QGIView *view = m_view->findView(objCopy); + + blockSelection(true); + if(view) { + view->setSelected(isSelected); + view->updateView(); + } + blockSelection(false); +} + +//! invoked by selection change made in Tree? +// wf: seems redundant? executed, but no real logic. +void MDIViewPage::onSelectionChanged(const Gui::SelectionChanges& msg) +{ + if (msg.Type == Gui::SelectionChanges::ClrSelection) { + + } + else if (msg.Type == Gui::SelectionChanges::AddSelection || + msg.Type == Gui::SelectionChanges::RmvSelection) { + //bool add = (msg.Type == Gui::SelectionChanges::AddSelection); + // Check if it is a view object + std::string feat = msg.pObjectName; + std::string sub = msg.pSubName; + } + else if (msg.Type == Gui::SelectionChanges::SetSelection) { + // do nothing here wf: handled by VPP::onSelectionChanged? + } +} + +//! update FC Selection from QGraphicsScene selection //trigged by m_view->scene() signal void MDIViewPage::selectionChanged() { @@ -1004,6 +1013,9 @@ void MDIViewPage::selectionChanged() static_cast (Gui::Selection().addSelection(viewObj->getDocument()->getName(), viewObj->getNameInDocument(), ss.str().c_str())); + showStatusMsg(viewObj->getDocument()->getName(), + viewObj->getNameInDocument(), + ss.str().c_str()); continue; } @@ -1025,6 +1037,9 @@ void MDIViewPage::selectionChanged() static_cast (Gui::Selection().addSelection(viewObj->getDocument()->getName(), viewObj->getNameInDocument(), ss.str().c_str())); + showStatusMsg(viewObj->getDocument()->getName(), + viewObj->getNameInDocument(), + ss.str().c_str()); continue; } @@ -1046,6 +1061,9 @@ void MDIViewPage::selectionChanged() static_cast (Gui::Selection().addSelection(viewObj->getDocument()->getName(), viewObj->getNameInDocument(), ss.str().c_str())); + showStatusMsg(viewObj->getDocument()->getName(), + viewObj->getNameInDocument(), + ss.str().c_str()); continue; } @@ -1073,6 +1091,10 @@ void MDIViewPage::selectionChanged() std::string obj_name = viewObj->getNameInDocument(); Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str()); + showStatusMsg(doc_name.c_str(), + obj_name.c_str(), + ""); + } } @@ -1081,4 +1103,19 @@ void MDIViewPage::selectionChanged() blockSelection(false); } // end MDIViewPage::selectionChanged() +///////////////////end Selection Routines ////////////////////// + +void MDIViewPage::showStatusMsg(const char* s1, const char* s2, const char* s3) const +{ + QString msg = QString::fromUtf8("Selected: "); + msg.append(QObject::tr(" %1.%2.%3 ") + .arg(QString::fromUtf8(s1)) + .arg(QString::fromUtf8(s2)) + .arg(QString::fromUtf8(s3)) + ); + if (Gui::getMainWindow()) { + Gui::getMainWindow()->showMessage(msg,3000); + } +} + #include "moc_MDIViewPage.cpp" diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.h b/src/Mod/TechDraw/Gui/MDIViewPage.h index d804ef394..617e700ff 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.h +++ b/src/Mod/TechDraw/Gui/MDIViewPage.h @@ -95,6 +95,7 @@ protected: void findPrinterSettings(const QString&); QPrinter::PageSize getPageSize(int w, int h) const; void setDimensionGroups(void); + void showStatusMsg(const char* s1, const char* s2, const char* s3) const; private: QAction *m_nativeAction; diff --git a/src/Mod/TechDraw/Gui/QGIHatch.cpp b/src/Mod/TechDraw/Gui/QGIHatch.cpp deleted file mode 100644 index c195b37a8..000000000 --- a/src/Mod/TechDraw/Gui/QGIHatch.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2015 WandererFan * - * * - * 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_ - # include - # include - # include - # include - # include - # include -#endif - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "QGIView.h" -#include "QGIHatch.h" - -using namespace TechDrawGui; - -QGIHatch::QGIHatch(std::string parentHatch) : - m_hatch(parentHatch), - m_fill(Qt::NoBrush), - m_lastFill("") - //m_fill(Qt::Dense3Pattern) - //m_fill(Qt::CrossPattern) - //m_fill(Qt::Dense6Pattern) -{ - setCacheMode(QGraphicsItem::NoCache); - setFlag(QGraphicsItem::ItemIsSelectable, true); - setFlag(QGraphicsItem::ItemIsMovable, false); - setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true); - setFlag(QGraphicsItem::ItemSendsGeometryChanges,true); - setAcceptHoverEvents(true); - - Base::Reference hGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors"); - App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("NormalColor", 0x00000000)); - m_colNormal = fcColor.asValue(); - fcColor.setPackedValue(hGrp->GetUnsigned("SelectColor", 0x0000FF00)); - m_colSel = fcColor.asValue(); - fcColor.setPackedValue(hGrp->GetUnsigned("PreSelectColor", 0x00080800)); - m_colPre = fcColor.asValue(); - - m_pen.setCosmetic(true); - m_pen.setWidthF(1.); - //m_pen.setStyle(Qt::NoPen); - m_pen.setColor(m_colNormal); - m_brush.setStyle(m_fill); - setPrettyNormal(); -} - -QGIHatch::~QGIHatch() -{ -} - -QVariant QGIHatch::itemChange(GraphicsItemChange change, const QVariant &value) -{ - if (change == ItemSelectedHasChanged && scene()) { - if(isSelected()) { - setPrettySel(); - } else { - setPrettyNormal(); - } - } - return QGraphicsItem::itemChange(change, value); -} - -void QGIHatch::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -{ - setPrettyPre(); -} - -void QGIHatch::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - QGIView *view = dynamic_cast (parentItem()); - - if(!isSelected() && !view->isSelected()) { - setPrettyNormal(); - } -} - -void QGIHatch::setPrettyNormal() -{ - m_pen.setColor(m_colNormal); - m_brush.setColor(m_colNormal); - setPen(m_pen); - setBrush(m_brush); -} - -void QGIHatch::setPrettyPre() -{ - m_pen.setColor(m_colPre); - m_brush.setColor(m_colPre); - setPen(m_pen); - setBrush(m_brush); -} - -void QGIHatch::setPrettySel() -{ - m_pen.setColor(m_colSel); - m_brush.setColor(m_colSel); - setPen(m_pen); - setBrush(m_brush); -} - -void QGIHatch::setFill(std::string fillSpec) -{ - if (fillSpec.empty()) { - return; - } - - if (fillSpec == m_lastFill) { - return; - } - - QString qs(QString::fromStdString(fillSpec)); - m_lastFill = fillSpec; - //QString qs(QString::fromUtf8("../src/Mod/Drawing/patterns/simple.svg")); - //QString qs(QString::fromUtf8("../src/Mod/Drawing/patterns/square.svg")); - QSvgRenderer renderer(qs); - //QBitmap pixMap(64,64); //this size is scene units (mm) instead of pixels? - //QPixmap::fromImage(m_image); - //QImage(qt_patternForBrush(style, 0), 8, 8, 1, QImage::Format_MonoLSB); - //QPixmap::scaled(QSize,QTAspectmode,QTTransformmode) - QBitmap pixMap(renderer.defaultSize()); - pixMap.fill(Qt::white); //try Qt::transparent? - QPainter painter(&pixMap); - renderer.render(&painter); //svg texture -> bitmap - - m_texture = pixMap; - m_brush = QBrush(m_texture); - m_brush.setStyle(Qt::TexturePattern); - //m_brush = QBrush(Qt::CrossPattern); - //m_brush = QBrush(Qt::DiagCrossPattern); -} - -void QGIHatch::setColor(App::Color c) -{ - m_colNormal = c.asValue(); -} - -void QGIHatch::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) { - QStyleOptionGraphicsItem myOption(*option); - myOption.state &= ~QStyle::State_Selected; - painter->setRenderHints( QPainter::Antialiasing | QPainter::SmoothPixmapTransform ); //doesn't seem to change much - setPen(m_pen); - setBrush(m_brush); - QGraphicsPathItem::paint (painter, &myOption, widget); -} diff --git a/src/Mod/TechDraw/Gui/QGIHatch.h b/src/Mod/TechDraw/Gui/QGIHatch.h deleted file mode 100644 index 2e81de8d6..000000000 --- a/src/Mod/TechDraw/Gui/QGIHatch.h +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2015 WandererFan * - * * - * 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 DRAWINGGUI_QGRAPHICSITEMHATCH_H -#define DRAWINGGUI_QGRAPHICSITEMHATCH_H - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QPainter; -class QStyleOptionGraphicsItem; -QT_END_NAMESPACE - -namespace App { -class Color; -} - -namespace TechDraw { -class DrawHatch; -} - -namespace TechDrawGeometry { -class BaseGeom; -} - -namespace TechDrawGui -{ - -class TechDrawGuiExport QGIHatch : public QGraphicsPathItem -{ - -public: - explicit QGIHatch(std::string parentHatch); - ~QGIHatch(); - - enum {Type = QGraphicsItem::UserType + 122}; - int type() const { return Type;} - virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ); - -public: - std::string getHatchName() const { return m_hatch; } - void setPrettyNormal(); - void setPrettyPre(); - void setPrettySel(); - void setFill(std::string fillSpec); - void setColor(App::Color c); - -protected: - // Preselection events: - void hoverEnterEvent(QGraphicsSceneHoverEvent *event); - void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); - // Selection detection - QVariant itemChange(GraphicsItemChange change, const QVariant &value); - -protected: - std::string m_hatch; - -private: - QPen m_pen; - QBrush m_brush; - QColor m_colNormal; - QColor m_colPre; - QColor m_colSel; - QBitmap m_texture; - Qt::BrushStyle m_fill; - std::string m_lastFill; -}; - -} // namespace MDIViewPageGui - -#endif // DRAWINGGUI_QGRAPHICSITEMHATCH_H diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index 56ab770c1..78e974969 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -259,8 +259,7 @@ void QGIViewPart::updateView(bool update) for(QList::iterator it = items.begin(); it != items.end(); ++it) { if (dynamic_cast (*it) || dynamic_cast(*it) || - dynamic_cast(*it) || - dynamic_cast(*it)) { + dynamic_cast(*it)) { removeFromGroup(*it); scene()->removeItem(*it); @@ -326,62 +325,6 @@ void QGIViewPart::drawViewPart() } #endif //#if MOD_TECHDRAW_HANDLE_FACES -#if 0 - // Draw Hatches - std::vector hatchObjs = viewPart->getHatches(); - if (!hatchObjs.empty()) { - std::vector::iterator itHatch = hatchObjs.begin(); - for(; itHatch != hatchObjs.end(); itHatch++) { - //if hatchdirection == viewPartdirection { - TechDraw::DrawHatch* feat = (*itHatch); - const std::vector &sourceNames = feat->Source.getSubValues(); - std::vector unChained; - if (TechDraw::DrawUtil::getGeomTypeFromName(sourceNames.at(0)) == "Face") { - int idxFace = TechDraw::DrawUtil::getIndexFromName(sourceNames.at(0)); - unChained = viewPart->getProjFaceByIndex(idxFace); - } else { - std::vector::const_iterator itEdge = sourceNames.begin(); - //get all edge geometries for this hatch - for (; itEdge != sourceNames.end(); itEdge++) { - int idxEdge = TechDraw::DrawUtil::getIndexFromName((*itEdge)); - TechDrawGeometry::BaseGeom* edgeGeom = viewPart->getProjEdgeByIndex(idxEdge); - if (!edgeGeom) { - Base::Console().Log("Error - qgivp::drawViewPart - edgeGeom: %d is NULL\n",idxEdge); - } - unChained.push_back(edgeGeom); - } - } - - //chain edges tail to nose into a closed region - auto chained( TechDrawGeometry::GeometryUtils::chainGeoms(unChained) ); - - //iterate through the chain to make QPainterPath - std::vector::iterator itChain = chained.begin(); - QPainterPath hatchPath; - for (; itChain != chained.end(); itChain++) { - QPainterPath subPath; - if ((*itChain)->reversed) { - subPath = drawPainterPath((*itChain)).toReversed(); - } else { - subPath = drawPainterPath((*itChain)); - } - hatchPath.connectPath(subPath); - //_dumpPath("subpath",subPath); - } - - QGIHatch* hatch = new QGIHatch(feat->getNameInDocument()); - addToGroup(hatch); - hatch->setPos(0.0,0.0); - hatch->setPath(hatchPath); - hatch->setFill(feat->HatchPattern.getValue()); - hatch->setColor(feat->HatchColor.getValue()); - //_dumpPath("hatchPath",hatchPath); - hatch->setFlag(QGraphicsItem::ItemIsSelectable, true); - hatch->setZValue(ZVALUE::HATCH); - } - } -#endif - // Draw Edges const std::vector &geoms = viewPart->getEdgeGeometry(); std::vector::const_iterator itEdge = geoms.begin(); diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.h b/src/Mod/TechDraw/Gui/QGIViewPart.h index 21f6f931e..1ffee412b 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.h +++ b/src/Mod/TechDraw/Gui/QGIViewPart.h @@ -30,7 +30,6 @@ #include "QGIFace.h" #include "QGIEdge.h" #include "QGIVertex.h" -#include "QGIHatch.h" #include "../App/Geometry.h" diff --git a/src/Mod/TechDraw/Gui/QGVPage.h b/src/Mod/TechDraw/Gui/QGVPage.h index ed44b5430..f334295cc 100644 --- a/src/Mod/TechDraw/Gui/QGVPage.h +++ b/src/Mod/TechDraw/Gui/QGVPage.h @@ -46,7 +46,6 @@ namespace TechDrawGui class QGIView; class QGIViewDimension; class QGITemplate; -class QGIHatch; class TechDrawGuiExport QGVPage : public QGraphicsView { diff --git a/src/Mod/TechDraw/Gui/ViewProviderPage.cpp b/src/Mod/TechDraw/Gui/ViewProviderPage.cpp index 3f665ecdf..9383d04c4 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderPage.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderPage.cpp @@ -270,33 +270,31 @@ void ViewProviderPage::onSelectionChanged(const Gui::SelectionChanges& msg) for (std::vector::iterator it = objs.begin(); it != objs.end(); ++it) { Gui::SelectionSingleton::SelObj selObj = *it; - if(selObj.pObject == getPageObject()) continue; std::string str = msg.pSubName; // If it's a subfeature, dont select feature if (!str.empty()) { - if (TechDraw::DrawUtil::getGeomTypeFromName(str) == "Edge" || + if (TechDraw::DrawUtil::getGeomTypeFromName(str) == "Face" || + TechDraw::DrawUtil::getGeomTypeFromName(str) == "Edge" || TechDraw::DrawUtil::getGeomTypeFromName(str) == "Vertex") { - //TODO: handle Faces - // TODO implement me - } else { - view->selectFeature(selObj.pObject, true); + // TODO implement me wf: don't think this is ever executed } + } else { + view->selectFeature(selObj.pObject, true); } - } } else { bool selectState = (msg.Type == Gui::SelectionChanges::AddSelection) ? true : false; Gui::Document* doc = Gui::Application::Instance->getDocument(pcObject->getDocument()); App::DocumentObject *obj = doc->getDocument()->getObject(msg.pObjectName); if(obj) { - std::string str = msg.pSubName; // If it's a subfeature, dont select feature if (!str.empty()) { - if (TechDraw::DrawUtil::getGeomTypeFromName(str) == "Edge" || + if (TechDraw::DrawUtil::getGeomTypeFromName(str) == "Face" || + TechDraw::DrawUtil::getGeomTypeFromName(str) == "Edge" || TechDraw::DrawUtil::getGeomTypeFromName(str) == "Vertex") { // TODO implement me } else {