class CAM_Study;
class CAM_DataModel;
class CAM_Application;
-class CAM_ViewExtender;
#ifdef WIN32
#pragma warning( disable: 4251 )
void setToolShown( QAction*, const bool );
void setToolShown( const int, const bool );
- //! Returns Module dedicated extension for Viewer. Returns 0 if module has no extension
- virtual CAM_ViewExtender* getViewExtender() { return 0; }
-
public slots:
virtual bool activateModule( SUIT_Study* );
virtual bool deactivateModule( SUIT_Study* );
+++ /dev/null
-// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef CAM_VIEWEXTENDER_H
-#define CAM_VIEWEXTENDER_H
-
-#include "CAM.h"
-
-class QtxActionToolMgr;
-class QMenu;
-class SUIT_ViewModel;
-class SUIT_ViewWindow;
-/*!
- An interface which can be used as a module dedicated extension for Viewer
-*/
-class CAM_EXPORT CAM_ViewExtender
-{
-public:
- //! Creates a New toolbar containing extending actions. Returns New Toolbar Id
- virtual int createToolbar(SUIT_ViewWindow* ) = 0;
- virtual void contextMenuPopup(QMenu* ) = 0;
- virtual void activate(SUIT_ViewModel*) = 0;
- virtual void deactivate(SUIT_ViewModel*) = 0;
-};
-
-#endif
CAM_DataModel.h \
CAM_DataObject.h \
CAM_Module.h \
- CAM_Study.h \
- CAM_ViewExtender.h
+ CAM_Study.h
dist_libCAM_la_SOURCES= \
CAM_Application.cxx \
resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", vm->spacemouseBtn(2) ),
resMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", vm->spacemouseBtn(3) ) );
new LightApp_VTKSelector( vm, mySelMgr );
- vm->connectToApplication(this);
}
#else
viewMgr = new VTKViewer_ViewManager( activeStudy(), desktop() );
if ( objectBrowser() )
objectBrowser()->updateTree();
- //emit moduleActivated(mod);
return res;
}
#include "SUIT_ViewModel.h"
#include "SUIT_ViewManager.h"
-#include "CAM_Module.h"
-#include "CAM_Application.h"
#include <SALOME_Actor.h>
#include <QtxActionToolMgr.h>
-#include <CAM_ViewExtender.h>
-
// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study.
// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from
// SALOMEDS::StudyManager - no linkage with SalomeApp.
*/
SVTK_Viewer::SVTK_Viewer()
{
- myActiveModule = 0;
myTrihedronSize = 105;
myTrihedronRelative = true;
myIncrementSpeed = 10;
connect(aViewWindow, SIGNAL( actorRemoved(VTKViewer_Actor*) ),
this, SLOT(onActorRemoved(VTKViewer_Actor*)));
- if (myActiveModule) {
- CAM_ViewExtender* aExtender = myActiveModule->getViewExtender();
- if (aExtender) {
- QtxActionToolMgr* aMgr = aViewWindow->toolMgr();
- myExtToolBarId = aExtender->createToolbar(aViewWindow);
- }
- }
return aViewWindow;
}
thePopup->addAction( (*it)->toggleViewAction() );
aView->RefreshDumpImage();
}
- if (myActiveModule) {
- CAM_ViewExtender* aExtender = myActiveModule->getViewExtender();
- if (aExtender) {
- aExtender->contextMenuPopup(thePopup);
- }
- }
}
/*!
aView->Repaint();
}
-void SVTK_Viewer::connectToApplication( CAM_Application* theApp )
-{
- onModuleActivated(theApp->activeModule());
- connect(theApp, SIGNAL(moduleActivated(CAM_Module*)),
- this, SLOT(onModuleActivated(CAM_Module*)));
-}
-
-
-void SVTK_Viewer::onModuleActivated( CAM_Module* mod )
-{
- CAM_Module* aModule = dynamic_cast<CAM_Module*>(mod);
- if (aModule) {
- if (myActiveModule != aModule) {
- CAM_ViewExtender* aExtender = (myActiveModule)? myActiveModule->getViewExtender() : 0;
- if (aExtender)
- aExtender->deactivate(this);
-
- myActiveModule = aModule;
- aExtender = myActiveModule->getViewExtender();
- if (aExtender)
- aExtender->activate(this);
-
- updateToolBars();
- }
- }
-}
-
-
-void SVTK_Viewer::updateToolBars()
-{
- if (!myActiveModule) return;
-
- CAM_ViewExtender* aExtender = myActiveModule->getViewExtender();
- int aNewId = -1;
- QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
- for(int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
- if(SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
- if(TViewWindow* aViewWnd = dynamic_cast<TViewWindow*>(aViewWindow)) {
- QtxActionToolMgr* aMgr = aViewWnd->toolMgr();
- if (myExtToolBarId != -1)
- aMgr->removeToolBar(myExtToolBarId);
- if (aExtender)
- aNewId = aExtender->createToolbar(aViewWnd);
- }
- }
- }
- myExtToolBarId = aNewId;
-}
void SVTK_Viewer::onActorAdded(VTKViewer_Actor* theActor)
{
class QMouseEvent;
class SVTK_ViewWindow;
-class CAM_Module;
-class CAM_Application;
-class CAM_Module;
class VTKViewer_Actor;
//! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View
//! See #SALOME_View::Repaint()
virtual void Repaint();
-
- virtual void connectToApplication(CAM_Application* theApp);
-
signals:
void actorAdded(SVTK_ViewWindow*, VTKViewer_Actor*);
void actorRemoved(SVTK_ViewWindow*, VTKViewer_Actor*);
void onDumpView();
void onChangeBgColor();
- void onModuleActivated( CAM_Module* mod );
void onActorAdded(VTKViewer_Actor*);
void onActorRemoved(VTKViewer_Actor*);
int myProjMode;
int myStyle;
int mySpaceBtn[3];
-
- CAM_Module* myActiveModule;
- int myExtToolBarId;
};
#endif