#include <XGUI_Viewer.h>
#include <XGUI_Workshop.h>
#include <XGUI_OperationMgr.h>
+ #include <XGUI_ViewWindow.h>
+#include <XGUI_SelectionMgr.h>
+ #include <XGUI_ViewPort.h>
#include <Config_PointerMessage.h>
#include <Config_ModuleReader.h>
ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
if (aPreviewOp) {
- XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
- if (aViewer) {
+ XGUI_SelectionMgr* aSelector = myWorkshop->selector();
+ if (aSelector) {
NCollection_List<TopoDS_Shape> aList;
- aViewer->getSelectedShapes(aList);
- XGUI_ViewWindow* aWindow = aViewer->activeViewWindow();
+ aSelector->selectedShapes(aList);
- aPreviewOp->setSelectedShapes(aList);
++ XGUI_ViewWindow* aWindow = myWorkshop->mainWindow()->viewer()->activeViewWindow();
+ if (aWindow) {
+ Handle(V3d_View) aView3d = aWindow->viewPort()->getView();
+ if ( !aView3d.IsNull() ) {
+ gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(thePoint, aView3d);
+ aPreviewOp->setSelectedShapes(aList, aPoint);
+ }
+ }
+ }
+ }
+ }
+
+ void PartSet_Module::onMouseMoved(QPoint thePoint)
+ {
+ ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
+ PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+ if (aPreviewOp) {
+ XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
+ if (aViewer) {
+ XGUI_ViewWindow* aWindow = aViewer->activeViewWindow();
+ if (aWindow) {
+ Handle(V3d_View) aView3d = aWindow->viewPort()->getView();
+ if ( !aView3d.IsNull() ) {
+ gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(thePoint, aView3d);
+ aPreviewOp->setMouseMovePoint(aPoint);
+ }
+ }
}
}
}
// So, displayer will be created on demand.
mySelector = new XGUI_SelectionMgr(this);
+ connect(mySelector, SIGNAL(selectionChanged()), this, SLOT(changeCurrentDocument()));
myOperationMgr = new XGUI_OperationMgr(this);
+ myActionsMgr = new XGUI_ActionsMgr(this);
connect(myOperationMgr, SIGNAL(operationStarted()), this, SLOT(onOperationStarted()));
connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
this, SLOT(onOperationStopped(ModuleBase_Operation*)));
}
return myDisplayer;
}
- }
+
+//******************************************************
+void XGUI_Workshop::changeCurrentDocument()
+{
+ QFeatureList aFeatures = objectBrowser()->selectedFeatures();
+
+ // Set current document
+ if (aFeatures.size() > 0) {
+ FeaturePtr aFeature = aFeatures.first();
+
+ boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+ boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aFeature->data()->docRef("PartDocument");
+ if (aDocRef)
+ aMgr->setCurrentDocument(aDocRef->value());
+ }
+}
+
+//******************************************************
+void XGUI_Workshop::salomeViewerSelectionChanged()
+{
+ emit salomeViewerSelection();
++}