#include <AppElements_ViewWindow.h>
#include <AppElements_Viewer.h>
+#include <QEvent>
+
XGUI_ViewerProxy::XGUI_ViewerProxy(XGUI_Workshop* theParent)
: ModuleBase_IViewer(theParent),
myWorkshop(theParent)
return myWorkshop->salomeConnector()->viewer()->activeView();
} else {
AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
- return (aViewer->activeViewWindow()) ? aViewer->activeViewWindow()->viewPort()->getView() :
+ return (aViewer->activeViewWindow()) ? aViewer->activeViewWindow()->viewPortApp()->getView() :
Handle(V3d_View)();
}
}
Handle(V3d_View) aView3d = activeView();
if (!aView3d.IsNull()) {
aView3d->SetProj(theX, theY, theZ);
- aView3d->FitAll(0.01, true, true);
+ aView3d->FitAll(0.01, true);
aView3d->SetZSize(0.);
}
}
} else {
AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
if (aViewer->activeViewWindow())
- aViewer->activeViewWindow()->viewPort()->fitAll();
+ aViewer->activeViewWindow()->viewPortApp()->fitAll();
}
}
this, SIGNAL(deleteView(ModuleBase_IViewWindow*)));
connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)),
- this, SIGNAL(viewCreated(ModuleBase_IViewWindow*)));
+ this, SLOT(onViewCreated(ModuleBase_IViewWindow*)));
connect(aViewer, SIGNAL(activated(ModuleBase_IViewWindow*)),
this, SIGNAL(activated(ModuleBase_IViewWindow*)));
connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
SIGNAL(contextMenuRequested(QContextMenuEvent*)));
-
} else {
AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
}
}
+bool XGUI_ViewerProxy::eventFilter(QObject *theObject, QEvent *theEvent)
+{
+ if (theEvent->type() == QEvent::Enter) {
+ emit enterViewPort();
+ }
+ else if (theEvent->type() == QEvent::Leave) {
+ emit leaveViewPort();
+ }
+ return ModuleBase_IViewer::eventFilter(theObject, theEvent);
+}
void XGUI_ViewerProxy::onTryCloseView(AppElements_ViewWindow* theWnd)
{
emit deleteView(theWnd);
}
+void XGUI_ViewerProxy::onViewCreated(ModuleBase_IViewWindow* theWnd)
+{
+ theWnd->viewPort()->installEventFilter(this);
+
+ emit viewCreated(theWnd);
+}
+
void XGUI_ViewerProxy::onViewCreated(AppElements_ViewWindow* theWnd)
{
+ theWnd->viewPort()->installEventFilter(this);
+
emit viewCreated(theWnd);
}
{
myWorkshop->displayer()->removeFilters();
}
+
+//***************************************
+void XGUI_ViewerProxy::update()
+{
+ myWorkshop->displayer()->updateViewer();
+}
+
+//***************************************
+bool XGUI_ViewerProxy::canDragByMouse() const
+{
+ if (myWorkshop->isSalomeMode()) {
+ ModuleBase_IViewer* aViewer = myWorkshop->salomeConnector()->viewer();
+ return aViewer->canDragByMouse();
+ } else {
+ return true;
+ }
+}