3 #include "NewGeom_Module.h"
4 #include "NewGeom_DataModel.h"
6 #include <XGUI_Workshop.h>
8 #include <LightApp_Application.h>
9 #include <LightApp_SelectionMgr.h>
10 #include <LightApp_OCCSelector.h>
11 #include <OCCViewer_ViewModel.h>
12 #include <SUIT_Selector.h>
14 #include <SUIT_Desktop.h>
15 #include <SUIT_ViewManager.h>
17 #include <QtxActionMenuMgr.h>
20 NewGeom_EXPORT CAM_Module* createModule() {
21 return new NewGeom_Module();
24 NewGeom_EXPORT char* getModuleVersion() {
30 //******************************************************
31 NewGeom_Module::NewGeom_Module()
32 : LightApp_Module( "NewGeom" )
34 myWorkshop = new XGUI_Workshop(this);
37 //******************************************************
38 NewGeom_Module::~NewGeom_Module()
42 //******************************************************
43 void NewGeom_Module::initialize(CAM_Application* theApp)
45 LightApp_Module::initialize(theApp);
47 myWorkshop->startApplication();
50 //******************************************************
51 void NewGeom_Module::windows(QMap<int, int>& theWndMap) const
53 theWndMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
56 //******************************************************
57 void NewGeom_Module::viewManagers(QStringList& theList) const
59 theList.append( OCCViewer_Viewer::Type() );
62 //******************************************************
63 bool NewGeom_Module::activateModule(SUIT_Study* theStudy)
65 bool isDone = LightApp_Module::activateModule(theStudy);
70 SUIT_ViewManager* aMgr = application()->viewManager(OCCViewer_Viewer::Type());
72 OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(aMgr->getViewModel());
78 //******************************************************
79 bool NewGeom_Module::deactivateModule(SUIT_Study* theStudy)
81 setMenuShown( false );
82 setToolShown( false );
83 return LightApp_Module::deactivateModule(theStudy);
86 //******************************************************
87 CAM_DataModel* NewGeom_Module::createDataModel()
89 return new NewGeom_DataModel( this );
92 //******************************************************
93 void NewGeom_Module::addFeature(const QString& theWBName,
95 const QString& theTitle,
96 const QString& theTip,
100 const char* theMember,
101 const QKeySequence& theKeys)
103 int aMenu = createMenu(theWBName, -1, -1, 50);
104 int aTool = createTool(theWBName);
106 int aId = myActionsList.size();
107 myActionsList.append(theId);
108 SUIT_Desktop* aDesk = application()->desktop();
110 for (int i = 0; i < theKeys.count(); i++)
112 createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
113 isCheckable, theReciever, theMember);
114 int aItemId = createMenu( aId, aMenu, -1, 10 );
115 int aToolId = createTool( aId, aTool );
118 //******************************************************
119 void NewGeom_Module::addEditCommand(const QString& theId,
120 const QString& theTitle,
121 const QString& theTip,
122 const QIcon& theIcon,
124 QObject* theReciever,
125 const char* theMember,
126 const QKeySequence& theKeys)
128 int aMenu = createMenu(tr( "MEN_DESK_EDIT" ), -1, -1);
130 int aId = myActionsList.size();
131 myActionsList.append(theId);
132 SUIT_Desktop* aDesk = application()->desktop();
134 for (int i = 0; i < theKeys.count(); i++)
136 createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
137 isCheckable, theReciever, theMember);
138 createMenu( aId, aMenu, 10 );
141 //******************************************************
142 void NewGeom_Module::addEditMenuSeparator()
144 int aMenu = createMenu(tr( "MEN_DESK_EDIT" ), -1, -1);
145 createMenu( separator(), aMenu, -1, 10 );
148 //******************************************************
149 QMainWindow* NewGeom_Module::desktop() const
151 return application()->desktop();
154 //******************************************************
155 QString NewGeom_Module::commandId(const QAction* theCmd) const
157 int aId = actionId(theCmd);
158 if (aId < myActionsList.size())
159 return myActionsList[aId];
163 //******************************************************
164 QAction* NewGeom_Module::command(const QString& theId) const
166 int aId = myActionsList.indexOf(theId);
167 if ((aId != -1) && (aId < myActionsList.size())) {
173 //******************************************************
174 Handle(AIS_InteractiveContext) NewGeom_Module::AISContext() const
176 Handle(AIS_InteractiveContext) aContext;
177 SUIT_ViewManager* aMgr = application()->viewManager(OCCViewer_Viewer::Type());
179 OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(aMgr->getViewModel());
180 aContext = aViewer->getAISContext();
185 //******************************************************
186 void NewGeom_Module::selectionChanged()
188 LightApp_Module::selectionChanged();
189 //myWorkshop->salomeViewerSelectionChanged();