+//******************************************************
+void NewGeom_Module::onViewManagerAdded( SUIT_ViewManager* theMgr )
+{
+ if ((!mySelector)) {
+ mySelector = createSelector(theMgr);
+ }
+}
+
+//******************************************************
+NewGeom_OCCSelector* NewGeom_Module::createSelector(SUIT_ViewManager* theMgr)
+{
+ if (theMgr->getType() == OCCViewer_Viewer::Type()) {
+ OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
+ NewGeom_OCCSelector* aSelector = new NewGeom_OCCSelector(aViewer,
+ getApp()->selectionMgr());
+ LightApp_SelectionMgr* aMgr = getApp()->selectionMgr();
+ QList<SUIT_Selector*> aList;
+ aMgr->selectors(aList);
+ foreach(SUIT_Selector* aSel, aList) {
+ aSel->setEnabled(aSel == aSelector);
+ }
+ myProxyViewer->setSelector(aSelector);
+ return aSelector;
+ }
+ return 0;
+}
+
+//******************************************************
+CAM_DataModel* NewGeom_Module::createDataModel()
+{
+ return new NewGeom_DataModel( this );
+}
+
+//******************************************************
+QAction* NewGeom_Module::addFeature(const QString& theWBName,
+ const QString& theId,
+ const QString& theTitle,
+ const QString& theTip,
+ const QIcon& theIcon,
+ const QKeySequence& theKeys,
+ bool isCheckable)
+{
+ int aMenu = createMenu(theWBName, -1, -1, 50);
+ int aTool = createTool(theWBName);
+
+ int aId = myActionsList.size();
+ myActionsList.append(theId);
+ SUIT_Desktop* aDesk = application()->desktop();
+ int aKeys = 0;
+ for (int i = 0; i < theKeys.count(); i++)
+ aKeys += theKeys[i];
+ QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
+ isCheckable);
+ aAction->setData(theId);
+ int aItemId = createMenu( aId, aMenu, -1, 10 );
+ int aToolId = createTool( aId, aTool );
+ return aAction;
+}
+
+//******************************************************
+QAction* NewGeom_Module::addEditCommand(const QString& theId,
+ const QString& theTitle,
+ const QString& theTip,
+ const QIcon& theIcon,
+ const QKeySequence& theKeys,
+ bool isCheckable)
+{
+ int aMenu = createMenu(tr( "MEN_DESK_EDIT" ), -1, -1);
+
+ int aId = myActionsList.size();
+ myActionsList.append(theId);
+ SUIT_Desktop* aDesk = application()->desktop();
+ int aKeys = 0;
+ for (int i = 0; i < theKeys.count(); i++)
+ aKeys += theKeys[i];
+ QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
+ isCheckable);
+ aAction->setData(theId);
+ createMenu( aId, aMenu, 10 );
+ return aAction;
+}
+
+//******************************************************
+void NewGeom_Module::addEditMenuSeparator()
+{
+ int aMenu = createMenu(tr( "MEN_DESK_EDIT" ), -1, -1);
+ createMenu( separator(), aMenu, -1, 10 );
+}