Salome HOME
Redesign of selection process
[modules/shaper.git] / src / XGUI / XGUI_ModuleConnector.cpp
1 // File:        XGUI_ModuleConnector.cpp
2 // Created:     3 June 2014
3 // Author:      Vitaly Smetannikov
4
5 #include "XGUI_ModuleConnector.h"
6 #include "XGUI_Workshop.h"
7 #include "XGUI_ViewerProxy.h"
8 #include "XGUI_SelectionMgr.h"
9 #include "XGUI_Selection.h"
10 #include "XGUI_OperationMgr.h"
11 #include "XGUI_Displayer.h"
12
13 XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop)
14     : ModuleBase_IWorkshop(theWorkshop),
15       myWorkshop(theWorkshop)
16 {
17   XGUI_SelectionMgr* aSelector = myWorkshop->selector();
18   connect(aSelector, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
19   
20   XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
21
22   connect(anOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)), 
23     this, SIGNAL(operationStarted(ModuleBase_Operation*)));
24   connect(anOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), 
25     this, SIGNAL(operationStopped(ModuleBase_Operation*)));
26 }
27
28 XGUI_ModuleConnector::~XGUI_ModuleConnector()
29 {
30 }
31
32 ModuleBase_ISelection* XGUI_ModuleConnector::selection() const
33 {
34   return myWorkshop->selector()->selection();
35 }
36
37 ModuleBase_IModule* XGUI_ModuleConnector::module() const
38 {
39   return myWorkshop->module();
40 }
41
42 ModuleBase_IViewer* XGUI_ModuleConnector::viewer() const
43 {
44   return myWorkshop->viewer();
45 }
46
47 ModuleBase_Operation* XGUI_ModuleConnector::currentOperation() const
48 {
49   return myWorkshop->operationMgr()->currentOperation();
50 }
51
52
53 void XGUI_ModuleConnector::activateSubShapesSelection(const QIntList& theTypes)
54 {
55   XGUI_Displayer* aDisp = myWorkshop->displayer();
56   aDisp->openLocalContext();
57   aDisp->activateObjectsOutOfContext();
58   aDisp->setSelectionModes(theTypes);
59 }
60
61 void XGUI_ModuleConnector::deactivateSubShapesSelection()
62 {
63   XGUI_Displayer* aDisp = myWorkshop->displayer();
64   aDisp->closeLocalContexts(false);
65 }