Fix #10 View Visibility
This commit is contained in:
parent
c37df54c0f
commit
a4061bb6a5
|
@ -67,11 +67,6 @@ DrawView::DrawView(void)
|
|||
ADD_PROPERTY_TYPE(Y ,(0),group,App::Prop_None,"Y position of the view on the page in modelling units (mm)");
|
||||
ADD_PROPERTY_TYPE(Rotation ,(0),group,App::Prop_None,"Rotation of the view on the page in degrees counterclockwise");
|
||||
|
||||
// The 'Visible' property is handled by the view provider exclusively. It has the 'Output' flag set to
|
||||
// avoid to call the execute() method. The view provider touches the page object, instead.
|
||||
App::PropertyType propType = static_cast<App::PropertyType>(App::Prop_Hidden|App::Prop_Output);
|
||||
ADD_PROPERTY_TYPE(Visible, (true),group,propType,"Control whether view is visible in page object");
|
||||
|
||||
ScaleType.setEnums(ScaleTypeEnums);
|
||||
ADD_PROPERTY_TYPE(ScaleType,((long)0),group, App::Prop_None, "Scale Type");
|
||||
ADD_PROPERTY_TYPE(Scale ,(1.0),group,App::Prop_None,"Scale factor of the view");
|
||||
|
|
|
@ -50,7 +50,6 @@ public:
|
|||
|
||||
App::PropertyEnumeration ScaleType;
|
||||
App::PropertyFloat Rotation;
|
||||
App::PropertyBool Visible;
|
||||
|
||||
/** @name methods overide Feature */
|
||||
//@{
|
||||
|
|
|
@ -63,18 +63,7 @@ DrawViewClip::DrawViewClip(void)
|
|||
ADD_PROPERTY_TYPE(ShowLabels ,(0) ,group,App::Prop_None,"Specifies if View labels appear within the clip area");
|
||||
ADD_PROPERTY_TYPE(Views ,(0) ,group,App::Prop_None,"The Views in this Clip group");
|
||||
|
||||
// The 'Visible' property is handled by the view provider exclusively. It has the 'Output' flag set to
|
||||
// avoid to call the execute() method. The view provider touches the page object, instead.
|
||||
App::PropertyType propType = static_cast<App::PropertyType>(App::Prop_Hidden|App::Prop_Output);
|
||||
ADD_PROPERTY_TYPE(Visible, (true),group,propType,"Control whether Clip is visible in page object");
|
||||
|
||||
// hide N/A properties
|
||||
//int bitReadOnly = 2;
|
||||
//int bitHidden = 3;
|
||||
//ScaleType.StatusBits.set(bitReadOnly, true);
|
||||
//ScaleType.StatusBits.set(bitHidden, true);
|
||||
//Scale.StatusBits.set(bitReadOnly, true);
|
||||
//Scale.StatusBits.set(bitHidden,true);
|
||||
ScaleType.setStatus(App::Property::ReadOnly,true);
|
||||
ScaleType.setStatus(App::Property::Hidden,true);
|
||||
Scale.setStatus(App::Property::ReadOnly,true);
|
||||
|
|
|
@ -49,7 +49,6 @@ public:
|
|||
App::PropertyFloat Height;
|
||||
App::PropertyBool ShowFrame;
|
||||
App::PropertyBool ShowLabels;
|
||||
App::PropertyBool Visible;
|
||||
App::PropertyLinkList Views;
|
||||
|
||||
void addView(DrawView *view);
|
||||
|
|
|
@ -626,8 +626,15 @@ void CmdTechDrawClipPlus::activated(int iMsg)
|
|||
std::string ClipName = clip->getNameInDocument();
|
||||
std::string ViewName = view->getNameInDocument();
|
||||
|
||||
double newX = clip->Width.getValue() / 2.0;
|
||||
double newY = clip->Height.getValue() / 2.0;
|
||||
|
||||
openCommand("ClipPlus");
|
||||
doCommand(Doc,"App.activeDocument().%s.ViewObject.Visibility = False",ViewName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.addView(App.activeDocument().%s)",ClipName.c_str(),ViewName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.X = %.3f",ViewName.c_str(),newX);
|
||||
doCommand(Doc,"App.activeDocument().%s.Y = %.3f",ViewName.c_str(),newY);
|
||||
doCommand(Doc,"App.activeDocument().%s.ViewObject.Visibility = True",ViewName.c_str());
|
||||
updateActive();
|
||||
commitCommand();
|
||||
}
|
||||
|
@ -694,7 +701,9 @@ void CmdTechDrawClipMinus::activated(int iMsg)
|
|||
std::string ViewName = view->getNameInDocument();
|
||||
|
||||
openCommand("ClipMinus");
|
||||
doCommand(Doc,"App.activeDocument().%s.ViewObject.Visibility = False",ViewName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.removeView(App.activeDocument().%s)",ClipName.c_str(),ViewName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.ViewObject.Visibility = True",ViewName.c_str());
|
||||
updateActive();
|
||||
commitCommand();
|
||||
}
|
||||
|
|
|
@ -102,6 +102,8 @@ QGIView::QGIView(const QPoint &pos, QGraphicsScene *scene)
|
|||
|
||||
m_border = new QGCustomBorder();
|
||||
addToGroup(m_border);
|
||||
|
||||
isVisible(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -298,6 +300,15 @@ void QGIView::toggleBorder(bool state)
|
|||
borderVisible = state;
|
||||
drawBorder();
|
||||
}
|
||||
void QGIView::draw()
|
||||
{
|
||||
if (isVisible()) {
|
||||
show();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
void QGIView::drawBorder()
|
||||
{
|
||||
if (!borderVisible) {
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include <QGraphicsItemGroup>
|
||||
#include <QObject>
|
||||
#include <QPen>
|
||||
#include <QFont>
|
||||
#include <App/PropertyLinks.h>
|
||||
|
||||
#include "../App/DrawView.h"
|
||||
|
@ -56,6 +58,9 @@ public:
|
|||
|
||||
virtual void toggleBorder(bool state = true);
|
||||
virtual void drawBorder(void);
|
||||
virtual void isVisible(bool state) { m_visibility = state; };
|
||||
virtual bool isVisible(void) {return m_visibility;};
|
||||
virtual void draw(void);
|
||||
|
||||
/// Methods to ensure that Y-Coordinates are orientated correctly.
|
||||
void setPosition(qreal x, qreal y);
|
||||
|
@ -78,6 +83,7 @@ Q_SIGNALS:
|
|||
void dirty();
|
||||
|
||||
protected:
|
||||
|
||||
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
// Mouse handling
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event );
|
||||
|
@ -93,6 +99,7 @@ protected:
|
|||
QHash<QString, QGraphicsItem*> alignHash;
|
||||
bool locked;
|
||||
bool borderVisible;
|
||||
bool m_visibility;
|
||||
bool m_innerView; //View is inside another View
|
||||
|
||||
QPen m_pen;
|
||||
|
|
|
@ -111,6 +111,10 @@ void QGIViewAnnotation::updateView(bool update)
|
|||
|
||||
void QGIViewAnnotation::draw()
|
||||
{
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawAnnotation();
|
||||
if (borderVisible) {
|
||||
drawBorder();
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
void updateView(bool update = false);
|
||||
void setViewAnnoFeature(TechDraw::DrawViewAnnotation *obj);
|
||||
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
virtual QRectF boundingRect() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -100,6 +100,10 @@ void QGIViewClip::updateView(bool update)
|
|||
|
||||
void QGIViewClip::draw()
|
||||
{
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawClip();
|
||||
if (borderVisible) {
|
||||
drawBorder();
|
||||
|
@ -132,18 +136,20 @@ void QGIViewClip::drawClip()
|
|||
for(std::vector<std::string>::iterator it = childNames.begin(); it != childNames.end(); it++) {
|
||||
QGIView* qgiv = getQGIVByName((*it));
|
||||
if (qgiv) {
|
||||
//TODO: why is qgiv never already in a group?
|
||||
//TODO: why is qgiv never already in a group?
|
||||
if (qgiv->group() != m_cliparea) {
|
||||
double x = qgiv->getViewObject()->X.getValue();
|
||||
double y = qgiv->getViewObject()->Y.getValue();
|
||||
qgiv->hide();
|
||||
m_cliparea->addToGroup(qgiv);
|
||||
qgiv->isInnerView(true);
|
||||
double x = qgiv->getViewObject()->X.getValue();
|
||||
double y = qgiv->getViewObject()->Y.getValue();
|
||||
qgiv->setPosition(x,y);
|
||||
if (viewClip->ShowLabels.getValue()) {
|
||||
qgiv->toggleBorder(true);
|
||||
} else {
|
||||
qgiv->toggleBorder(false);
|
||||
}
|
||||
qgiv->show();
|
||||
}
|
||||
} else {
|
||||
Base::Console().Warning("Logic error? - drawClip() - qgiv for %s not found\n",(*it).c_str()); //gview for feature !exist
|
||||
|
@ -189,4 +195,3 @@ QRectF QGIViewClip::boundingRect() const
|
|||
}
|
||||
|
||||
#include "moc_QGIViewClip.cpp"
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
virtual void updateView(bool update = false);
|
||||
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
virtual QRectF boundingRect() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -324,6 +324,10 @@ void QGIViewDimension::datumLabelDragFinished()
|
|||
|
||||
void QGIViewDimension::draw()
|
||||
{
|
||||
if (!isVisible()) { //should this be controlled by parent ViewPart?
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawViewDimension *dim = dynamic_cast<TechDraw::DrawViewDimension *>(getViewObject());
|
||||
if((!dim) || //nothing to draw, don't try
|
||||
(!dim->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) ||
|
||||
|
|
|
@ -272,6 +272,7 @@ void QGIViewPart::updateView(bool update)
|
|||
void QGIViewPart::draw() {
|
||||
drawViewPart();
|
||||
drawBorder();
|
||||
QGIView::draw();
|
||||
}
|
||||
|
||||
void QGIViewPart::drawViewPart()
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
virtual void updateView(bool update = false);
|
||||
void tidy();
|
||||
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
virtual QRectF boundingRect() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -58,6 +58,10 @@ QGIViewSection::~QGIViewSection()
|
|||
|
||||
void QGIViewSection::draw()
|
||||
{
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QGIViewPart::draw();
|
||||
drawSectionFace();
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
explicit QGIViewSection(const QPoint &position, QGraphicsScene *scene);
|
||||
~QGIViewSection();
|
||||
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
void updateView(bool update = false);
|
||||
enum {Type = QGraphicsItem::UserType + 108};
|
||||
int type() const { return Type;}
|
||||
|
|
|
@ -100,6 +100,10 @@ void QGIViewSymbol::updateView(bool update)
|
|||
|
||||
void QGIViewSymbol::draw()
|
||||
{
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawSvg();
|
||||
if (borderVisible) {
|
||||
drawBorder();
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
void updateView(bool update = false);
|
||||
void setViewSymbolFeature(TechDraw::DrawViewSymbol *obj);
|
||||
|
||||
virtual void draw();
|
||||
virtual void draw() override;
|
||||
virtual QRectF boundingRect() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include <Gui/ViewProviderFeature.h>
|
||||
|
||||
#include "ViewProviderDrawingView.h"
|
||||
|
||||
namespace TechDraw{
|
||||
class DrawViewAnnotation;
|
||||
}
|
||||
|
@ -34,7 +36,7 @@ namespace TechDraw{
|
|||
namespace TechDrawGui {
|
||||
|
||||
|
||||
class TechDrawGuiExport ViewProviderAnnotation : public Gui::ViewProviderDocumentObject
|
||||
class TechDrawGuiExport ViewProviderAnnotation : public ViewProviderDrawingView
|
||||
{
|
||||
PROPERTY_HEADER(TechDrawGui::ViewProviderAnnotation);
|
||||
|
||||
|
|
|
@ -35,13 +35,21 @@
|
|||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawViewClip.h>
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include "ViewProviderPage.h"
|
||||
#include "ViewProviderDrawingView.h"
|
||||
|
||||
#include "QGVPage.h"
|
||||
#include "MDIViewPage.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
|
@ -51,9 +59,9 @@ ViewProviderDrawingView::ViewProviderDrawingView()
|
|||
{
|
||||
sPixmap = "TechDraw_Tree_View";
|
||||
|
||||
// Do not show in property editor
|
||||
//DisplayMode.StatusBits.set(3, true);
|
||||
// Do not show in property editor why? wf
|
||||
DisplayMode.setStatus(App::Property::ReadOnly,true);
|
||||
m_docReady = true;
|
||||
}
|
||||
|
||||
ViewProviderDrawingView::~ViewProviderDrawingView()
|
||||
|
@ -62,7 +70,6 @@ ViewProviderDrawingView::~ViewProviderDrawingView()
|
|||
|
||||
void ViewProviderDrawingView::attach(App::DocumentObject *pcFeat)
|
||||
{
|
||||
// call parent attach method
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
}
|
||||
|
||||
|
@ -77,38 +84,74 @@ std::vector<std::string> ViewProviderDrawingView::getDisplayModes(void) const
|
|||
return StrList;
|
||||
}
|
||||
|
||||
void ViewProviderDrawingView::onChanged(const App::Property *prop)
|
||||
{
|
||||
App::DocumentObject* obj = getObject();
|
||||
if (!obj || obj->isRestoring()) {
|
||||
Gui::ViewProviderDocumentObject::onChanged(prop);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop == &Visibility) {
|
||||
if(Visibility.getValue()) {
|
||||
show();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
Gui::ViewProviderDocumentObject::onChanged(prop);
|
||||
}
|
||||
|
||||
void ViewProviderDrawingView::show(void)
|
||||
{
|
||||
ViewProviderDocumentObject::show();
|
||||
|
||||
App::DocumentObject* obj = getObject();
|
||||
TechDraw::DrawView* obj = getViewObject();
|
||||
if (!obj || obj->isRestoring())
|
||||
return;
|
||||
|
||||
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawView::getClassTypeId())) {
|
||||
// The 'Visible' property is marked as 'Output'. To update the drawing on recompute
|
||||
// the parent page object is touched.
|
||||
static_cast<TechDraw::DrawView*>(obj)->Visible.setValue(true);
|
||||
std::vector<App::DocumentObject*> inp = obj->getInList();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = inp.begin(); it != inp.end(); ++it)
|
||||
(*it)->touch();
|
||||
QGIView* qView = getQView();
|
||||
if (qView) {
|
||||
qView->isVisible(true);
|
||||
qView->draw();
|
||||
qView->show();
|
||||
}
|
||||
}
|
||||
ViewProviderDocumentObject::show();
|
||||
}
|
||||
|
||||
void ViewProviderDrawingView::hide(void)
|
||||
{
|
||||
ViewProviderDocumentObject::hide();
|
||||
|
||||
App::DocumentObject* obj = getObject();
|
||||
TechDraw::DrawView* obj = getViewObject();
|
||||
if (!obj || obj->isRestoring())
|
||||
return;
|
||||
|
||||
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawView::getClassTypeId())) {
|
||||
// The 'Visible' property is marked as 'Output'. To update the drawing on recompute
|
||||
// the parent page object is touched.
|
||||
static_cast<TechDraw::DrawView*>(obj)->Visible.setValue(false);
|
||||
std::vector<App::DocumentObject*> inp = obj->getInList();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = inp.begin(); it != inp.end(); ++it)
|
||||
(*it)->touch();
|
||||
QGIView* qView = getQView();
|
||||
if (qView) {
|
||||
qView->isVisible(false);
|
||||
qView->draw();
|
||||
qView->hide();
|
||||
}
|
||||
}
|
||||
ViewProviderDocumentObject::hide();
|
||||
}
|
||||
|
||||
QGIView* ViewProviderDrawingView::getQView(void)
|
||||
{
|
||||
QGIView *qView = nullptr;
|
||||
if (m_docReady){
|
||||
Gui::Document* guiDoc = Gui::Application::Instance->getDocument(getViewObject()->getDocument());
|
||||
Gui::ViewProvider* vp = guiDoc->getViewProvider(getViewObject()->findParentPage());
|
||||
ViewProviderPage* dvp = dynamic_cast<ViewProviderPage*>(vp);
|
||||
if (dvp) {
|
||||
if (dvp->getMDIViewPage()) {
|
||||
if (dvp->getMDIViewPage()->getQGVPage()) {
|
||||
qView = dynamic_cast<QGIView *>(dvp->getMDIViewPage()->getQGVPage()->findView(getViewObject()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return qView;
|
||||
}
|
||||
|
||||
bool ViewProviderDrawingView::isShow(void) const
|
||||
|
@ -118,17 +161,24 @@ bool ViewProviderDrawingView::isShow(void) const
|
|||
|
||||
void ViewProviderDrawingView::startRestoring()
|
||||
{
|
||||
// do nothing
|
||||
m_docReady = false;
|
||||
Gui::ViewProviderDocumentObject::startRestoring();
|
||||
}
|
||||
|
||||
void ViewProviderDrawingView::finishRestoring()
|
||||
{
|
||||
// do nothing
|
||||
m_docReady = true;
|
||||
if (Visibility.getValue()) {
|
||||
show();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
Gui::ViewProviderDocumentObject::finishRestoring();
|
||||
}
|
||||
|
||||
void ViewProviderDrawingView::updateData(const App::Property*)
|
||||
{
|
||||
}
|
||||
//void ViewProviderDrawingView::updateData(const App::Property*)
|
||||
//{
|
||||
//}
|
||||
|
||||
TechDraw::DrawView* ViewProviderDrawingView::getViewObject() const
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <Gui/ViewProviderFeature.h>
|
||||
#include <Gui/ViewProviderDocumentObjectGroup.h>
|
||||
#include "QGIView.h"
|
||||
|
||||
namespace TechDraw{
|
||||
class DrawView;
|
||||
|
@ -34,7 +35,6 @@ namespace TechDraw{
|
|||
|
||||
namespace TechDrawGui {
|
||||
|
||||
|
||||
class TechDrawGuiExport ViewProviderDrawingView : public Gui::ViewProviderDocumentObject
|
||||
{
|
||||
PROPERTY_HEADER(TechDrawGui::ViewProviderDrawingView);
|
||||
|
@ -51,19 +51,25 @@ public:
|
|||
virtual bool useNewSelectionModel(void) const {return false;}
|
||||
/// returns a list of all possible modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const;
|
||||
virtual void updateData(const App::Property*);
|
||||
//virtual void updateData(const App::Property*);
|
||||
/// Hide the object in the view
|
||||
virtual void hide(void);
|
||||
/// Show the object in the view
|
||||
virtual void show(void);
|
||||
virtual bool isShow(void) const;
|
||||
|
||||
virtual void onChanged(const App::Property *prop);
|
||||
QGIView* getQView(void);
|
||||
|
||||
/** @name Restoring view provider from document load */
|
||||
//@{
|
||||
virtual void startRestoring();
|
||||
virtual void finishRestoring();
|
||||
//@}
|
||||
TechDraw::DrawView* getViewObject() const;
|
||||
|
||||
private:
|
||||
bool m_docReady; //sb MDI + QGraphicsScene ready
|
||||
};
|
||||
|
||||
} // namespace TechDrawGui
|
||||
|
|
|
@ -73,7 +73,7 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderPage, Gui::ViewProviderDocumentObject)
|
|||
|
||||
ViewProviderPage::ViewProviderPage()
|
||||
: view(0),
|
||||
restoreState(false)
|
||||
m_docReady(true)
|
||||
{
|
||||
sPixmap = "TechDraw_Tree_Page";
|
||||
|
||||
|
@ -325,13 +325,13 @@ void ViewProviderPage::onChanged(const App::Property *prop)
|
|||
|
||||
void ViewProviderPage::startRestoring()
|
||||
{
|
||||
restoreState = true;
|
||||
m_docReady = false;
|
||||
Gui::ViewProviderDocumentObject::startRestoring();
|
||||
}
|
||||
|
||||
void ViewProviderPage::finishRestoring()
|
||||
{
|
||||
restoreState = false;
|
||||
m_docReady = true;
|
||||
static_cast<void>(showMDIViewPage());
|
||||
Gui::ViewProviderDocumentObject::finishRestoring();
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
virtual void updateData(const App::Property* prop);
|
||||
virtual void startRestoring();
|
||||
virtual void finishRestoring();
|
||||
bool isRestoring(void) {return restoreState;}
|
||||
bool isRestoring(void) {return !m_docReady;}
|
||||
|
||||
TechDraw::DrawPage* getPageObject() const;
|
||||
void unsetEdit(int ModNum);
|
||||
|
@ -94,11 +94,10 @@ protected:
|
|||
|
||||
private:
|
||||
QPointer<MDIViewPage> view;
|
||||
bool restoreState;
|
||||
bool m_docReady;
|
||||
};
|
||||
|
||||
} // namespace TechDrawGui
|
||||
|
||||
|
||||
#endif // DRAWINGGUI_VIEWPROVIDERPAGE_H
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include <QPointer>
|
||||
|
||||
#include "ViewProviderDrawingView.h"
|
||||
|
||||
namespace TechDraw{
|
||||
class DrawProjGroup;
|
||||
}
|
||||
|
@ -35,7 +37,7 @@ namespace TechDraw{
|
|||
namespace TechDrawGui {
|
||||
|
||||
|
||||
class TechDrawGuiExport ViewProviderProjGroup : public Gui::ViewProviderDocumentObject
|
||||
class TechDrawGuiExport ViewProviderProjGroup : public ViewProviderDrawingView
|
||||
{
|
||||
PROPERTY_HEADER(TechDrawGui::ViewProviderProjGroup);
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <Gui/ViewProviderFeature.h>
|
||||
|
||||
#include "ViewProviderSymbol.h"
|
||||
|
||||
namespace TechDraw{
|
||||
class DrawViewSpreadsheet;
|
||||
}
|
||||
|
@ -33,7 +35,7 @@ namespace TechDraw{
|
|||
namespace TechDrawGui {
|
||||
|
||||
|
||||
class TechDrawGuiExport ViewProviderSpreadsheet : public Gui::ViewProviderDocumentObject
|
||||
class TechDrawGuiExport ViewProviderSpreadsheet : public ViewProviderSymbol
|
||||
{
|
||||
PROPERTY_HEADER(TechDrawGui::ViewProviderSpreadsheet);
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include <Gui/ViewProviderFeature.h>
|
||||
|
||||
#include "ViewProviderDrawingView.h"
|
||||
|
||||
namespace TechDraw{
|
||||
class DrawViewSymbol;
|
||||
}
|
||||
|
@ -34,7 +36,7 @@ namespace TechDraw{
|
|||
namespace TechDrawGui {
|
||||
|
||||
|
||||
class TechDrawGuiExport ViewProviderSymbol : public Gui::ViewProviderDocumentObject
|
||||
class TechDrawGuiExport ViewProviderSymbol : public ViewProviderDrawingView
|
||||
{
|
||||
PROPERTY_HEADER(TechDrawGui::ViewProviderSymbol);
|
||||
|
||||
|
|
|
@ -91,36 +91,31 @@ std::vector<App::DocumentObject*> ViewProviderViewClip::claimChildren(void) cons
|
|||
|
||||
void ViewProviderViewClip::show(void)
|
||||
{
|
||||
ViewProviderDrawingView::show();
|
||||
|
||||
//TODO: not sure that clip members need to be touched when hiding clip group
|
||||
App::DocumentObject* obj = getObject();
|
||||
if (!obj || obj->isRestoring())
|
||||
return;
|
||||
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawViewClip::getClassTypeId())) {
|
||||
// The 'Visible' property is marked as 'Output'. To update the drawing on recompute
|
||||
// the parent page object is touched.
|
||||
static_cast<TechDraw::DrawViewClip*>(obj)->Visible.setValue(true);
|
||||
std::vector<App::DocumentObject*> inp = obj->getInList();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = inp.begin(); it != inp.end(); ++it)
|
||||
(*it)->touch();
|
||||
}
|
||||
ViewProviderDrawingView::show();
|
||||
|
||||
}
|
||||
|
||||
void ViewProviderViewClip::hide(void)
|
||||
{
|
||||
ViewProviderDrawingView::hide();
|
||||
|
||||
//TODO: not sure that clip members need to be touched when hiding clip group
|
||||
App::DocumentObject* obj = getObject();
|
||||
if (!obj || obj->isRestoring())
|
||||
return;
|
||||
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawViewClip::getClassTypeId())) {
|
||||
// The 'Visible' property is marked as 'Output'. To update the drawing on recompute
|
||||
// the parent page object is touched.
|
||||
static_cast<TechDraw::DrawViewClip*>(obj)->Visible.setValue(false);
|
||||
std::vector<App::DocumentObject*> inp = obj->getInList();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = inp.begin(); it != inp.end(); ++it)
|
||||
(*it)->touch();
|
||||
}
|
||||
ViewProviderDrawingView::hide();
|
||||
}
|
||||
|
||||
bool ViewProviderViewClip::isShow(void) const
|
||||
|
@ -128,20 +123,6 @@ bool ViewProviderViewClip::isShow(void) const
|
|||
return Visibility.getValue();
|
||||
}
|
||||
|
||||
void ViewProviderViewClip::startRestoring()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void ViewProviderViewClip::finishRestoring()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void ViewProviderViewClip::updateData(const App::Property*)
|
||||
{
|
||||
}
|
||||
|
||||
TechDraw::DrawViewClip* ViewProviderViewClip::getObject() const
|
||||
{
|
||||
return dynamic_cast<TechDraw::DrawViewClip*>(pcObject);
|
||||
|
|
|
@ -50,7 +50,6 @@ public:
|
|||
virtual bool useNewSelectionModel(void) const {return false;}
|
||||
/// returns a list of all possible modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const;
|
||||
virtual void updateData(const App::Property*);
|
||||
TechDraw::DrawViewClip* getObject() const;
|
||||
|
||||
/// Hide the object in the view
|
||||
|
@ -60,11 +59,6 @@ public:
|
|||
virtual bool isShow(void) const;
|
||||
std::vector<App::DocumentObject*> claimChildren(void) const;
|
||||
|
||||
/** @name Restoring view provider from document load */
|
||||
//@{
|
||||
virtual void startRestoring();
|
||||
virtual void finishRestoring();
|
||||
//@}
|
||||
};
|
||||
} // namespace TechDrawGui
|
||||
|
||||
|
|
|
@ -112,11 +112,6 @@ std::vector<App::DocumentObject*> ViewProviderViewPart::claimChildren(void) cons
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void ViewProviderViewPart::updateData(const App::Property*)
|
||||
{
|
||||
}
|
||||
|
||||
TechDraw::DrawViewPart* ViewProviderViewPart::getViewPart() const
|
||||
{
|
||||
return dynamic_cast<TechDraw::DrawViewPart*>(pcObject);
|
||||
|
|
|
@ -47,7 +47,6 @@ public:
|
|||
virtual bool useNewSelectionModel(void) const {return false;}
|
||||
/// returns a list of all possible modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const;
|
||||
virtual void updateData(const App::Property*);
|
||||
|
||||
public:
|
||||
virtual std::vector<App::DocumentObject*> claimChildren(void) const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user