STD_Application::createEmptyStudy();
- //SUIT_Study* newStudy = activeStudy();
- //if ( study != newStudy )
- //{
- // CAM_Study* camStudy = dynamic_cast<CAM_Study*>( newStudy );
- // for ( ModuleListIterator it( myModules ); it.current(); ++it )
- // camStudy->insertDataModel( it.current()->dataModel() );
- //}
+ SUIT_Study* newStudy = activeStudy();
+ if ( study != newStudy )
+ {
+ CAM_Study* camStudy = dynamic_cast<CAM_Study*>( newStudy );
+ for ( ModuleListIterator it( myModules ); it.current(); ++it )
+ camStudy->insertDataModel( it.current()->dataModel() );
+ }
}
LDFLAGS+=$(QT_MT_LIBS) $(CAS_KERNEL)
-LIBS+= -L${GUI_ROOT_DIR}/lib/salome -lsuit -lqtx -L/usr/X11R6/lib -lGLU
+LIBS+= -L${GUI_ROOT_DIR}/lib/salome -lsuit -L/usr/X11R6/lib -lGLU
@CONCLUDE@
SUBDIRS = Qtx SUIT STD CAF CAM SUITApp VTKViewer OCCViewer GLViewer \
LogWindow Event OBJECT Prs PyInterp PythonConsole ObjBrowser \
- RegistryDisplay Plot2d TOOLSGUI SOCC SVTK SPlot2d LightApp Session SalomeApp SALOME_SWIG SALOME_PY SUPERVGraph SALOME_PYQT Style ResExporter
+ RegistryDisplay Plot2d TOOLSGUI SOCC SVTK SPlot2d Session SalomeApp SALOME_SWIG SALOME_PY SUPERVGraph SALOME_PYQT Style ResExporter
@MODULE@
BIN =
BIN_SRC =
-CPPFLAGS+=$(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(QT_INCLUDES) $(OGL_INCLUDES)
+CPPFLAGS+=$(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(QT_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS+= $(PYTHON_LIBS) $(VTK_LIBS) $(QT_LIBS) $(OGL_LIBS) $(CAS_LDPATH) -lTKV3d -lVTKViewer -lsuit
plot2d_splines.png \
plot2d_zoom.png
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES)
+CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES) -I$(KERNEL_ROOT_DIR)/include/salome
-LDFLAGS+=$(QWT_LIBS) $(QT_MT_LIBS) -lsuit
+LDFLAGS+=$(QWT_LIBS) $(QT_MT_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome -lsuit
@CONCLUDE@
#include "SUIT_ResourceMgr.h"
#include "SUIT_Application.h"
+//#include "utilities.h"
+
#include "qapplication.h"
#include <qtoolbar.h>
#include <qtoolbutton.h>
if ( xmark-2 == pnt.x() ) {
xCoord = majXmark;
xFound = true;
+// MESSAGE("Plot2d_ViewFrame::getInfo : close maj X mark("<<i<<") = "<<majXmark<<" "<<xmark<<" "<<pnt.x());
break;
}
}
if ( xmark-2 == pnt.x() ) {
xCoord = minXmark;
xFound = true;
+// MESSAGE("Plot2d_ViewFrame::getInfo : close min X mark("<<i<<") = "<<minXmark<<" "<<xmark<<" "<<pnt.x());
break;
}
}
if ( cols[ "blue-min" ] > color.blue() )
cols[ "blue-min" ] = color.blue();
}
+ for (IList::Iterator it = mars.begin(); it != mars.end(); ++it)
+ MESSAGE("markers( " << it.key() << ") = " << it.data() );
+ for (IList::Iterator it = lins.begin(); it != lins.end(); ++it)
+ MESSAGE("lines( " << it.key() << ") = " << it.data() );
+ for (SList::Iterator it = cols.begin(); it != cols.end(); ++it)
+ MESSAGE("colors( " << it.key() << ") = " << it.data() );
#endif
Plot2d_SetupViewDlg* dlg = new Plot2d_SetupViewDlg( this, true, mySecondY );
BIN =
BIN_SRC =
-CPPFLAGS+=
+CPPFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS+=
LIB_MOC = PyInterp_Watcher.h
-CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_INCLUDES)
+CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_INCLUDES) -I$(KERNEL_ROOT_DIR)/include/salome
LDFLAGS+= $(PYTHON_LIBS) $(QT_MT_LIBS)
#include <vector>
#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)!
+#include <Container_init_python.hxx>
#include <cStringIO.h>
+#include <utilities.h>
+
+
using namespace std;
+
+//#ifdef _DEBUG_
+//static int MYDEBUG = 1;
+//static int MYPYDEBUG = 1;
+//#else
+//static int MYDEBUG = 0;
+//static int MYPYDEBUG = 0;
+//#endif
+
+
PyLockWrapper::PyLockWrapper(PyThreadState* theThreadState):
myThreadState(theThreadState),
- mySaveThreadState(0)
+ mySaveThreadState(KERNEL_PYTHON::_gtstate)
{
PyEval_AcquireLock();
mySaveThreadState = PyThreadState_Swap(myThreadState); // store previous current in save,
// set local in current
+// if(MYDEBUG) MESSAGE(" PyLockWrapper "<<this<<" aqcuired: new thread state "<<myThreadState<<" ; old thread state "<<mySaveThreadState);
}
PyLockWrapper::~PyLockWrapper(){
PyThreadState_Swap(mySaveThreadState); // restore previous current (no need to get local,
PyEval_ReleaseLock(); // local thread state* already in _tstate
+// if(MYDEBUG) MESSAGE(" PyLockWrapper "<<this<<" released: new thread state "<<mySaveThreadState);
}
class PyReleaseLock{
public:
~PyReleaseLock(){
+// if(MYPYDEBUG) MESSAGE("~PyReleaseLock()");
PyEval_ReleaseLock();
}
};
*/
PyInterp_base::PyInterp_base(): _tstate(0), _vout(0), _verr(0), _g(0), _atFirst(true)
{
+// if(MYPYDEBUG) MESSAGE("PyInterp_base::PyInterp_base() - this = "<<this);
}
PyInterp_base::~PyInterp_base()
{
+// if(MYPYDEBUG) MESSAGE("PyInterp_base::~PyInterp_base() - this = "<<this);
PyLockWrapper aLock(_tstate);
//Py_EndInterpreter(_tstate);
}
init_python();
// Here the global lock is released
+// if(MYPYDEBUG) MESSAGE("PyInterp_base::initialize() - this = "<<this<<"; _gtstate = "<<_gtstate);
// The lock will be acquired in initState. Make provision to release it on exit
PyReleaseLock aReleaseLock;
// used to interpret & compile commands
PyObjWrapper m(PyImport_ImportModule("codeop"));
if(!m){
+// INFOS("PyInterp_base::initialize() - PyImport_ImportModule('codeop') failed");
PyErr_Print();
+ ASSERT(0);
return;
}
void PyInterp_base::init_python()
{
- static PyThreadState *_gtstate = 0;
-
- _atFirst = false;
- if (Py_IsInitialized())
- return;
-
- Py_SetProgramName(_argv[0]);
- Py_Initialize(); // Initialize the interpreter
- PySys_SetArgv(_argc, _argv);
- PyEval_InitThreads(); // Create (and acquire) the interpreter lock
- _gtstate = PyEval_SaveThread(); // Release global thread state
+ /*
+ * Initialize the main state (_gtstate) if not already done
+ * The lock is released on init_python output
+ * It is the caller responsability to acquire it if needed
+ */
+ MESSAGE("PyInterp_base::init_python");
+ ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main
+ SCRUTE(KERNEL_PYTHON::_gtstate);
// if(!_gtstate){
// PyReleaseLock aReleaseLock;
// Py_Initialize(); // Initialize the interpreter
PySys_SetObject("stdout",PySys_GetObject("__stdout__"));
PySys_SetObject("stderr",PySys_GetObject("__stderr__"));
+// if(MYPYDEBUG) MESSAGE("PyInterp_base::initRun() - this = "<<this<<"; _verr = "<<_verr<<"; _vout = "<<_vout);
return 0;
}
~PyInterp_base();
virtual void initialize();
- virtual void init_python();
- // init_python() made virtual to:
- // 1. Remove dependency on KERNEL in light SALOME configuration
- // 2. Allow redefinition of this method in SalomeApp_PyInterp class (it should be empty there and rely on KERNEL_PYTHON)
+ static void init_python();
virtual int run(const char *command);
#include "STD_MDIDesktop.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Study.h"
-#include "LightApp_SelectionMgr.h"
+#include "SalomeApp_SelectionMgr.h"
#include "OB_Browser.h"
#include "QtxAction.h"
void SALOME_Selection::Clear()
{
class TEvent: public SALOME_Event {
- LightApp_SelectionMgr* mySelMgr;
+ SalomeApp_SelectionMgr* mySelMgr;
public:
- TEvent( LightApp_SelectionMgr* selMgr )
+ TEvent( SalomeApp_SelectionMgr* selMgr )
: mySelMgr( selMgr ) {}
virtual void Execute() {
if ( mySelMgr )
void SALOME_Selection::ClearFilters()
{
class TEvent: public SALOME_Event {
- LightApp_SelectionMgr* mySelMgr;
+ SalomeApp_SelectionMgr* mySelMgr;
public:
- TEvent( LightApp_SelectionMgr* selMgr )
+ TEvent( SalomeApp_SelectionMgr* selMgr )
: mySelMgr( selMgr ) {}
virtual void Execute() {
if ( mySelMgr )
#include <qobject.h>
#include <qcolor.h>
-class LightApp_SelectionMgr;
+class SalomeApp_SelectionMgr;
class SalomeApp_Application;
class QMenuBar;
class QPopupMenu;
void onSelMgrDestroyed();
private:
- LightApp_SelectionMgr* mySelMgr;
+ SalomeApp_SelectionMgr* mySelMgr;
SALOME_Selection( QObject* );
};
#include "SalomeApp_Study.h"
#include "SalomeApp_Module.h"
#include "SalomeApp_DataObject.h"
-#include "LightApp_SelectionMgr.h"
+#include "SalomeApp_SelectionMgr.h"
#include "SALOME_Prs.h"
#include "SOCC_ViewModel.h"
#include "SVTK_ViewModel.h"
TSelectedCountEvent() : myResult( 0 ) {}
virtual void Execute() {
if ( SalomeApp_Application* anApp = getApplication() ) {
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
- LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ SalomeApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
if ( aStudy && aSelMgr ) {
SALOME_ListIO anIOList;
aSelMgr->selectedObjects( anIOList );
TGetSelectedEvent( int theIndex ) : myIndex( theIndex ) {}
virtual void Execute() {
if ( SalomeApp_Application* anApp = getApplication() ) {
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
- LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ SalomeApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
if ( aStudy && aSelMgr ) {
SALOME_ListIO anIOList;
aSelMgr->selectedObjects( anIOList );
TEvent( const char* theEntry ) : myEntry( theEntry ) {}
virtual void Execute() {
if ( SalomeApp_Application* anApp = getApplication() ) {
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
- LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ SalomeApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
if ( aStudy && aSelMgr ) {
SALOME_ListIO anIOList;
anIOList.Append( new SALOME_InteractiveObject( myEntry, "", "" ) );
TEvent( const char* theEntry ) : myEntry( theEntry ) {}
virtual void Execute() {
if ( SalomeApp_Application* anApp = getApplication() ) {
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
- LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ SalomeApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
if ( aStudy && aSelMgr ) {
SALOME_ListIO anIOList;
- // VSR: temporary solution, until LightApp_SelectionMgr::unsetSelectedObjects() method appears
+ // VSR: temporary solution, until SalomeApp_SelectionMgr::unsetSelectedObjects() method appears
// Lately this should be replaced by the following:
// anIOList.Append( new SALOME_InteractiveObject( myEntry, "", "" ) );
// aSelMgr->unsetSelectedObjects( anIOList );
TEvent() {}
virtual void Execute() {
if ( SalomeApp_Application* anApp = getApplication() ) {
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
- LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ SalomeApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
if ( aStudy && aSelMgr )
aSelMgr->clearSelected();
}
LIB_MOC = SOCC_ViewModel.h \
SOCC_ViewWindow.h
-CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS)
+LIB_CLIENT_IDL = SALOMEDS.idl \
+ SALOME_Exception.idl \
+ SALOME_ModuleCatalog.idl \
+ SALOME_GenericObj.idl
-LDFLAGS+=$(QT_MT_LIBS)
-LIBS+= -lsuit -lSalomeObject -lSalomePrs -lOCCViewer
+CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome
+
+LDFLAGS+=$(QT_MT_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome
+LIBS+= -lsuit -lSalomeObject -lSalomePrs -lOCCViewer -lOpUtil
@CONCLUDE@
#include "ToolsGUI.h"
-// Temporarily commented to avoid awful dependecy on SALOMEDS
-// TODO: better mechanism of storing display/erse status in a study
-// should be provided...
-//#include <SALOMEconfig.h>
-//#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOMEDS)
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Visual3d_View.hxx>
#include <SALOME_AISShape.hxx>
#include <SALOME_AISObject.hxx>
-// Temporarily commented to avoid awful dependecy on SALOMEDS
-// TODO: better mechanism of storing display/erse status in a study
-// should be provided...
-//#include <Utils_ORB_INIT.hxx>
-//#include <Utils_SINGLETON.hxx>
-//#include <SALOME_ModuleCatalog_impl.hxx>
-//#include <SALOME_NamingService.hxx>
+#include <Utils_ORB_INIT.hxx>
+#include <Utils_SINGLETON.hxx>
+#include <SALOME_ModuleCatalog_impl.hxx>
+#include <SALOME_NamingService.hxx>
-//#include "SALOMEDSClient.hxx"
-//#include "SALOMEDS_StudyManager.hxx"
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDS_StudyManager.hxx"
#include <AIS_TypeOfIso.hxx>
// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from
// SALOMEDS::StudyManager - no linkage with SalomeApp.
-// Temporarily commented to avoid awful dependecy on SALOMEDS
-// TODO: better mechanism of storing display/erse status in a study
-// should be provided...
-//static _PTR(Study) getStudyDS()
-//{
-// SALOMEDSClient_Study* aStudy = NULL;
-// _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
+static _PTR(Study) getStudyDS()
+{
+ SALOMEDSClient_Study* aStudy = NULL;
+ _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
// get id of SUIT_Study, if it's a SalomeApp_Study, it will return
// id of its underlying SALOMEDS::Study
-// SUIT_Application* app = SUIT_Session::session()->activeApplication();
-// if ( !app ) return _PTR(Study)(aStudy);
-// SUIT_Study* stud = app->activeStudy();
-// if ( !stud ) return _PTR(Study)(aStudy);
-// const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if ( !app ) return _PTR(Study)(aStudy);
+ SUIT_Study* stud = app->activeStudy();
+ if ( !stud ) return _PTR(Study)(aStudy);
+ const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
// get SALOMEDS_Study with this id from StudyMgr
-// return aMgr->GetStudyByID( id );
-//}
+ return aMgr->GetStudyByID( id );
+}
SOCC_Viewer::SOCC_Viewer( bool DisplayTrihedron )
: OCCViewer_Viewer( DisplayTrihedron )
return;
// get SALOMEDS Study
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- // _PTR(Study) study(getStudyDS());
+ _PTR(Study) study(getStudyDS());
// get context
Handle (AIS_InteractiveContext) ic = getAISContext();
bDisplayed = true;
// Set visibility flag
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //Handle(SALOME_InteractiveObject) anObj =
- // Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
- //if ( !anObj.IsNull() && anObj->hasEntry() )
- //{
- // if ( study )
- // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
- //}
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
+ if ( !anObj.IsNull() && anObj->hasEntry() )
+ {
+ if ( study )
+ ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
+ }
+
break;
}
}
ic->Display( anAIS, false );
// Set visibility flag
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //Handle(SALOME_InteractiveObject) anObj =
- // Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
- //if ( !anObj.IsNull() && anObj->hasEntry() )
- //{
- // if ( study )
- // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
- //}
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
+ if ( !anObj.IsNull() && anObj->hasEntry() )
+ {
+ if ( study )
+ ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
+ }
// Deactivate object if necessary
if ( !anOCCPrs->ToActivate() )
return;
// get SALOMEDS Study
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- // _PTR(Study) study(getStudyDS());
+ _PTR(Study) study(getStudyDS());
// get context
Handle(AIS_InteractiveContext) ic = getAISContext();
ic->Erase( anAIS, false, forced ? false : true );
// Set visibility flag if necessary
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //if ( !forced )
- //{
- // Handle(SALOME_InteractiveObject) anObj =
- // Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
- // if ( !anObj.IsNull() && anObj->hasEntry() )
- // {
- // if ( study )
- // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
- // }
- //}
+ if ( !forced )
+ {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
+ if ( !anObj.IsNull() && anObj->hasEntry() )
+ {
+ if ( study )
+ ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
+ }
+ }
}
}
}
void SOCC_Viewer::EraseAll( const bool forced )
{
// get SALOMEDS Study
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- // _PTR(Study) study(getStudyDS());
+ _PTR(Study) study(getStudyDS());
// get context
Handle(AIS_InteractiveContext) ic = getAISContext();
ic->Erase( anIO, false, forced ? false : true );
// Set visibility flag if necessary
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //if ( !forced ) {
- // Handle(SALOME_InteractiveObject) anObj =
- // Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
-
- // if ( !anObj.IsNull() && anObj->hasEntry() ) {
- // if ( study )
- // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
- // }
- //}
+ if ( !forced ) {
+ Handle(SALOME_InteractiveObject) anObj =
+ Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
+
+ if ( !anObj.IsNull() && anObj->hasEntry() ) {
+ if ( study )
+ ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
+ }
+ }
}
// display trihedron if necessary
SVTK_ViewModel.h \
SVTK_ViewManager.h
-CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS)
+LIB_CLIENT_IDL = SALOMEDS.idl \
+ SALOME_Exception.idl \
+ SALOME_ModuleCatalog.idl \
+ SALOME_GenericObj.idl
-LDFLAGS+=$(QT_MT_LIBS) $(OCC_LIBS) $(VTK_LIBS)
-LIBS+= -lsuit -lCAM -lSalomeObject -lSalomePrs -lVTKViewer
+CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome
+
+LDFLAGS+=$(QT_MT_LIBS) $(OCC_LIBS) $(VTK_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome
+LIBS+= -lsuit -lCAM -lSalomeObject -lSalomePrs -lVTKViewer -lOpUtil
@CONCLUDE@
#include <vtkPolyData.h>
#include <vtkShrinkFilter.h>
+//#include "utilities.h"
+
using namespace std;
#ifdef _DEBUG_
#include "SVTK_InteractorStyle.h"
+#include "utilities.h"
+
#include "VTKViewer_CellRectPicker.h"
#include "VTKViewer_Utilities.h"
#include "VTKViewer_RectPicker.h"
using namespace std;
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
namespace
{
int
SVTK_InteractorStyle
::~SVTK_InteractorStyle()
{
+ if(MYDEBUG) INFOS("SVTK_InteractorStyle::~SVTK_InteractorStyle()");
myViewWindow->RemoveActor(myPreSelectionActor);
}
Handle(SALOME_InteractiveObject) anIO = aSActor->getIO();
if(aSelectionMode != EdgeOfCellSelection) {
if(CheckDimensionId(aSelectionMode,aSActor,anObjId)){
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId);
if (GetSelector()->IsSelected(anIO)) {
// This IO is already in the selection
GetSelector()->AddOrRemoveIndex(anIO,anObjId,myShiftState);
}
int anEdgeId = GetEdgeId(picker,aSActor,anObjId);
if (anEdgeId >= 0) {
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId<<"; EdgeId : "<<anEdgeId);
GetSelector()->AddOrRemoveIndex(anIO,anObjId,false);
GetSelector()->AddOrRemoveIndex(anIO,-anEdgeId-1,true);
GetSelector()->AddIObject(aSActor);
this->HighlightProp( NULL );
GetSelector()->ClearIObjects();
}
+ if(MYDEBUG) INFOS(" PointId : "<<anObjId);
GetSelector()->AddOrRemoveIndex(anIO,anObjId,myShiftState);
GetSelector()->AddIObject(aSActor);
}
continue;
VTKViewer_CellDataSet cellList = picker->GetCellData(aActor);
if ( !cellList.empty() ) {
+ if(MYDEBUG) INFOS ( " NAME Actor : " << aSActor->getName() );
TColStd_MapOfInteger anIndexes;
VTKViewer_CellDataSet::iterator it;
for ( it = cellList.begin(); it != cellList.end(); ++it ) {
if(aResult){
mySelectedActor = aSActor;
myElemId = anObjId;
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId);
myInteractor->setCellData(anObjId,aSActor,myPreSelectionActor);
}
}
mySelectedActor = aSActor;
myEdgeId = anEdgeId;
myElemId = anObjId;
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId<<"; EdgeId : "<<anEdgeId);
myInteractor->setEdgeData(anObjId,aSActor,-anEdgeId-1,myPreSelectionActor);
}
}
if(!anIsSameObjId) {
mySelectedActor = aSActor;
myNodeId = anObjId;
+ if(MYDEBUG) INFOS(" PointId : "<<anObjId);
myInteractor->setPointData(anObjId,aSActor,myPreSelectionActor);
}
myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
#include <TColStd_IndexedMapOfInteger.hxx>
+#include "utilities.h"
+
using namespace std;
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
SVTK_RenderWindowInteractor*
SVTK_RenderWindowInteractor
::New()
SVTK_RenderWindowInteractor
::~SVTK_RenderWindowInteractor()
{
+ if(MYDEBUG) INFOS("SVTK_RenderWindowInteractor::~SVTK_RenderWindowInteractor()");
+
delete mTimer ;
myViewWindow->RemoveActor(myCellActor);
#include "SVTK_ViewWindow.h"
#include "SVTK_SelectorDef.h"
+#include "utilities.h"
SVTK_SelectorDef
::SVTK_SelectorDef()
#include "SALOME_Actor.h"
#include "SALOME_InteractiveObject.hxx"
-// Temporarily commented to avoid awful dependecy on SALOMEDS
-// TODO: better mechanism of storing display/erse status in a study
-// should be provided...
-//#include "Utils_ORB_INIT.hxx"
-//#include "Utils_SINGLETON.hxx"
-//#include "SALOME_ModuleCatalog_impl.hxx"
-//#include "SALOME_NamingService.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "SALOME_ModuleCatalog_impl.hxx"
+#include "SALOME_NamingService.hxx"
-//#include "SALOMEDSClient.hxx"
-//#include "SALOMEDS_StudyManager.hxx"
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDS_StudyManager.hxx"
// 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.
-// Temporarily commented to avoid awful dependecy on SALOMEDS
-// TODO: better mechanism of storing display/erse status in a study
-// should be provided...
-//static _PTR(Study) getStudyDS()
-//{
-// SALOMEDSClient_Study* aStudy = NULL;
-// _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
+static _PTR(Study) getStudyDS()
+{
+ SALOMEDSClient_Study* aStudy = NULL;
+ _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
+
// get id of SUIT_Study, if it's a SalomeApp_Study, it will return
// id of its underlying SALOMEDS::Study
-// SUIT_Application* app = SUIT_Session::session()->activeApplication();
-// if ( !app ) return _PTR(Study)(aStudy);
-// SUIT_Study* stud = app->activeStudy();
-// if ( !stud ) return _PTR(Study)(aStudy);
-// const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if ( !app ) return _PTR(Study)(aStudy);
+ SUIT_Study* stud = app->activeStudy();
+ if ( !stud ) return _PTR(Study)(aStudy);
+ const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
// get SALOMEDS_Study with this id from StudyMgr
-// return aMgr->GetStudyByID( id );
-//}
+ return aMgr->GetStudyByID( id );
+}
//==========================================================
SVTK_Viewer::SVTK_Viewer()
return;
if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
// get SALOMEDS Study
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- // _PTR(Study) aStudy(getStudyDS());
+ _PTR(Study) aStudy(getStudyDS());
anActorCollection->InitTraversal();
while(vtkActor* anActor = anActorCollection->GetNextActor()){
if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
// Set visibility flag
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
- // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);
- //}
+ Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+ if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+ ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);
+ }
// just display the object
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
return;
if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
// get SALOMEDS Study
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //_PTR(Study) aStudy(getStudyDS());
+ _PTR(Study) aStudy(getStudyDS());
anActorCollection->InitTraversal();
while(vtkActor* anActor = anActorCollection->GetNextActor())
if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
// Set visibility flag
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
- // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
- //}
+ Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+ if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+ ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+ }
// just display the object
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
SVTK_Viewer
::EraseAll( const bool forced )
{
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //_PTR(Study) aStudy(getStudyDS());
+ _PTR(Study) aStudy(getStudyDS());
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
while(vtkActor* anActor = anActorCollection->GetNextActor()){
if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
// Set visibility flag
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- //if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
- // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+ Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+ if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
+ ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
if(forced)
aRenderer->RemoveActor(anAct);
else{
# header files
EXPORT_HEADERS= SalomeApp.h \
+ SalomeApp_AboutDlg.h \
SalomeApp_Application.h \
SalomeApp_DataModel.h \
SalomeApp_DataObject.h \
+ SalomeApp_DataOwner.h \
+ SalomeApp_OCCSelector.h \
+ SalomeApp_VTKSelector.h \
+ SalomeApp_OBSelector.h \
+ SalomeApp_GLSelector.h \
SalomeApp_Module.h \
SalomeApp_Study.h \
+ SalomeApp_WidgetContainer.h \
SalomeApp_ExceptionHandler.h \
+ SalomeApp_RootObject.h \
+ SalomeApp_SelectionMgr.h \
SalomeApp_EventFilter.h \
+ SalomeApp_Preferences.h \
+ SalomeApp_PreferencesDlg.h \
SalomeApp_Tools.h \
+ SalomeApp_NameDlg.h \
SalomeApp_ImportOperation.h \
+ SalomeApp_DataSubOwner.h \
+ SalomeApp_Selection.h \
SalomeApp_Filter.h \
SalomeApp_TypeFilter.h \
+ SalomeApp_OBFilter.h \
SalomeApp_StudyPropertiesDlg.h \
SalomeApp_CheckFileDlg.h \
SalomeApp_Operation.h \
LIB = libSalomeApp.la
LIB_SRC= SalomeApp_Module.cxx \
+ SalomeApp_AboutDlg.cxx \
SalomeApp_Application.cxx \
SalomeApp_DataModel.cxx \
SalomeApp_DataObject.cxx \
+ SalomeApp_DataOwner.cxx \
+ SalomeApp_OCCSelector.cxx \
+ SalomeApp_VTKSelector.cxx \
+ SalomeApp_OBSelector.cxx \
+ SalomeApp_GLSelector.cxx \
SalomeApp_Study.cxx \
+ SalomeApp_WidgetContainer.cxx \
SalomeApp_ExceptionHandler.cxx \
+ SalomeApp_SelectionMgr.cxx \
SalomeApp_EventFilter.cxx \
+ SalomeApp_Preferences.cxx \
+ SalomeApp_PreferencesDlg.cxx \
SalomeApp_PyInterp.cxx \
SalomeApp_Tools.cxx \
+ SalomeApp_NameDlg.cxx \
SalomeApp_ImportOperation.cxx \
+ SalomeApp_DataSubOwner.cxx \
+ SalomeApp_ModuleDlg.cxx \
+ SalomeApp_Selection.cxx \
SalomeApp_Filter.cxx \
SalomeApp_TypeFilter.cxx \
+ SalomeApp_OBFilter.cxx \
SalomeApp_StudyPropertiesDlg.cxx \
SalomeApp_ListView.cxx \
SalomeApp_CheckFileDlg.cxx \
SalomeApp_Dialog.cxx \
SalomeApp_SwitchOp.cxx
-LIB_MOC = SalomeApp_Application.h \
+LIB_MOC = SalomeApp_AboutDlg.h \
+ SalomeApp_Application.h \
SalomeApp_DataModel.h \
+ SalomeApp_OBSelector.h \
+ SalomeApp_OCCSelector.h \
+ SalomeApp_VTKSelector.h \
+ SalomeApp_GLSelector.h \
SalomeApp_Module.h \
SalomeApp_Study.h \
+ SalomeApp_SelectionMgr.h \
+ SalomeApp_WidgetContainer.h \
+ SalomeApp_Preferences.h \
+ SalomeApp_PreferencesDlg.h \
+ SalomeApp_NameDlg.h \
+ SalomeApp_ModuleDlg.h \
SalomeApp_StudyPropertiesDlg.h \
SalomeApp_ListView.h \
SalomeApp_CheckFileDlg.h \
SALOME_Exception.idl \
SALOME_GenericObj.idl
-RESOURCES_FILES = icon_select.png \
+RESOURCES_FILES = icon_about.png \
+ icon_applogo.png \
+ icon_default.png \
+ icon_module.png \
+ icon_module_big.png \
+ icon_select.png \
SalomeApp.ini \
SalomeApp.xml
CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS)
-LIBS+= -lsuit -lstd -lCAM -lObjBrowser -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lLightApp -lSalomeContainer -lToolsGUI
+LIBS+= -lsuit -lstd -lCAM -lObjBrowser -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lSalomeContainer -lToolsGUI
@CONCLUDE@
#include "SalomeApp_Study.h"
#include "SalomeApp_Module.h"
+#include "SalomeApp_OBFilter.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_EventFilter.h"
+#include "SalomeApp_WidgetContainer.h"
+#include "SalomeApp_AboutDlg.h"
+#include "SalomeApp_ModuleDlg.h"
+#include "SalomeApp_Preferences.h"
+#include "SalomeApp_PreferencesDlg.h"
#include "SalomeApp_StudyPropertiesDlg.h"
-
#include "SalomeApp_CheckFileDlg.h"
-#include "LightApp_Application.h"
-#include "LightApp_Preferences.h"
-#include "LightApp_WidgetContainer.h"
-#include "LightApp_SelectionMgr.h"
+#include "SalomeApp_GLSelector.h"
+#include "SalomeApp_OBSelector.h"
+#include "SalomeApp_OCCSelector.h"
+#include "SalomeApp_VTKSelector.h"
+#include "SalomeApp_SelectionMgr.h"
+
+#include <LogWindow.h>
+
+#include <GLViewer_Viewer.h>
+#include <GLViewer_ViewManager.h>
+
+#include <Plot2d_ViewManager.h>
+#include <SPlot2d_ViewModel.h>
+
+#include <OCCViewer_ViewManager.h>
+#include <SOCC_ViewModel.h>
+
+#include <SVTK_ViewModel.h>
+#include <SVTK_ViewManager.h>
+
+#include <STD_TabDesktop.h>
#include "STD_LoadStudiesDlg.h"
#include <SUIT_Tools.h>
#include <SUIT_Session.h>
+#include <SUIT_Accel.h>
+
+#include <QtxToolBar.h>
+#include <QtxMRUAction.h>
+#include <QtxDockAction.h>
+#include <QtxResourceEdit.h>
#include <OB_Browser.h>
#include <SALOME_LifeCycleCORBA.hxx>
#include <qmap.h>
+#include <qdir.h>
+#include <qlabel.h>
+#include <qimage.h>
#include <qaction.h>
+#include <qmenubar.h>
#include <qcombobox.h>
+#include <qmessagebox.h>
+#include <qapplication.h>
#include <qlistbox.h>
#include <qregexp.h>
#include "SALOMEDS_StudyManager.hxx"
-#include "SALOMEDS_SObject.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
#define OBJECT_BROWSER_WIDTH 300
+/*!Image for empty icon.*/
+static const char* imageEmptyIcon[] = {
+"20 20 1 1",
+". c None",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"....................",
+"...................."};
+
/*!Create new instance of SalomeApp_Application.*/
extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication()
{
return new SalomeApp_Application();
}
+SalomeApp_Preferences* SalomeApp_Application::_prefs_ = 0;
+
/*
Class : SalomeApp_Application
Description : Application containing SalomeApp module
*/
+/*!Constructor.*/
SalomeApp_Application::SalomeApp_Application()
-: LightApp_Application()
+: CAM_Application( false ),
+myPrefs( 0 )
{
+ STD_TabDesktop* desk = new STD_TabDesktop();
+
+ setDesktop( desk );
+
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ QPixmap aLogo = aResMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ), false );
+
+ desktop()->setIcon( aLogo );
+ desktop()->setDockableMenuBar( true );
+ desktop()->setDockableStatusBar( false );
+
+ // base logo (salome itself)
+ desktop()->addLogo( "_app_base", aResMgr->loadPixmap( "SalomeApp", tr( "APP_BASE_LOGO" ), false ) );
+ // extra logo (salome-based application)
+ desktop()->addLogo( "_app_extra", aResMgr->loadPixmap( "SalomeApp", tr( "APP_EXTRA_LOGO" ), false ) );
+
+ clearViewManagers();
+
+ mySelMgr = new SalomeApp_SelectionMgr( this );
+
+ myAccel = new SUIT_Accel( desktop() );
+ myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanDown, CTRL+Key_Down, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomIn, CTRL+Key_Plus, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomOut, CTRL+Key_Minus, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomFit, CTRL+Key_Asterisk, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateLeft, ALT+Key_Left, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanDown, CTRL+Key_Down, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomIn, CTRL+Key_Plus, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomOut, CTRL+Key_Minus, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomFit, CTRL+Key_Asterisk, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateLeft, ALT+Key_Left, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, VTKViewer_Viewer::Type() );
+
+ connect( desk, SIGNAL( closing( SUIT_Desktop*, QCloseEvent* ) ),
+ this, SLOT( onDesktopClosing( SUIT_Desktop*, QCloseEvent* ) ) );
+
+ connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) );
}
/*!Destructor.
+ *\li Save window geometry.
+ *\li Save desktop geometry.
+ *\li Save resource maneger.
+ *\li Delete selection manager.
*\li Destroy event filter.
*/
SalomeApp_Application::~SalomeApp_Application()
{
+ saveWindowsGeometry();
+
+ if ( resourceMgr() )
+ {
+ if ( desktop() )
+ desktop()->saveGeometry( resourceMgr(), "desktop" );
+ resourceMgr()->save();
+ }
+
+ delete mySelMgr;
+
SalomeApp_EventFilter::Destroy();
}
/*!Start application.*/
void SalomeApp_Application::start()
{
- LightApp_Application::start();
+ if ( desktop() )
+ desktop()->loadGeometry( resourceMgr(), "desktop" );
+
+ CAM_Application::start();
+
+ QAction* a = action( ViewWindowsId );
+ if ( a && a->inherits( "QtxDockAction" ) )
+ ((QtxDockAction*)a)->setAutoPlace( true );
SalomeApp_EventFilter::Init();
+
+ updateWindows();
+ updateViewManagers();
+
+ putInfo( "" );
+}
+
+/*!Gets application name.*/
+QString SalomeApp_Application::applicationName() const
+{
+ return tr( "APP_NAME" );
+}
+
+/*!Gets application version.*/
+QString SalomeApp_Application::applicationVersion() const
+{
+ static QString _app_version;
+
+ if ( _app_version.isEmpty() )
+ {
+ QString resVersion = tr( "APP_VERSION" );
+ if ( resVersion != "APP_VERSION" )
+ {
+ _app_version = resVersion;
+ }
+ else
+ {
+ QString path( ::getenv( "GUI_ROOT_DIR" ) );
+ if ( !path.isEmpty() )
+ path += QDir::separator();
+ path += QString( "bin/salome/VERSION" );
+
+ QFile vf( path );
+ if ( vf.open( IO_ReadOnly ) )
+ {
+ QString line;
+ vf.readLine( line, 1024 );
+ vf.close();
+
+ if ( !line.isEmpty() )
+ {
+ while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) )
+ line.remove( line.length() - 1, 1 );
+
+ int idx = line.findRev( ":" );
+ if ( idx != -1 )
+ _app_version = line.mid( idx + 1 ).stripWhiteSpace();
+ }
+ }
+ }
+ }
+ return _app_version;
+}
+
+/*!Load module by \a name.*/
+CAM_Module* SalomeApp_Application::loadModule( const QString& name )
+{
+ CAM_Module* mod = CAM_Application::loadModule( name );
+ if ( mod )
+ {
+ connect( this, SIGNAL( studyOpened() ), mod, SLOT( onModelOpened() ) );
+ connect( this, SIGNAL( studySaved() ), mod, SLOT( onModelSaved() ) );
+ connect( this, SIGNAL( studyClosed() ), mod, SLOT( onModelClosed() ) );
+ }
+ return mod;
+}
+
+/*!Activate module by \a modName*/
+bool SalomeApp_Application::activateModule( const QString& modName )
+{
+ QString actName;
+ CAM_Module* prevMod = activeModule();
+
+ if ( prevMod )
+ actName = prevMod->moduleName();
+
+ if ( actName == modName )
+ return true;
+
+ putInfo( tr( "ACTIVATING_MODULE" ).arg( modName ) );
+
+ saveWindowsGeometry();
+
+ bool status = CAM_Application::activateModule( modName );
+
+ updateModuleActions();
+
+ putInfo( "" );
+
+ if ( !status )
+ return false;
+
+ updateWindows();
+ updateViewManagers();
+
+ return true;
+}
+
+/*!Gets selection manager.*/
+SalomeApp_SelectionMgr* SalomeApp_Application::selectionMgr() const
+{
+ return mySelMgr;
}
/*!Create actions:*/
void SalomeApp_Application::createActions()
{
- LightApp_Application::createActions();
+ STD_Application::createActions();
SUIT_Desktop* desk = desktop();
-
+ SUIT_ResourceMgr* resMgr = resourceMgr();
+
//! Dump study
createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIconSet(),
tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
0, desk, false, this, SLOT( onDumpStudy() ) );
-
+
//! Load script
createAction( LoadScriptId, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), QIconSet(),
tr( "MEN_DESK_FILE_LOAD_SCRIPT" ), tr( "PRP_DESK_FILE_LOAD_SCRIPT" ),
tr( "MEN_DESK_PROPERTIES" ), tr( "PRP_DESK_PROPERTIES" ),
0, desk, false, this, SLOT( onProperties() ) );
+ //! Preferences
+ createAction( PreferencesId, tr( "TOT_DESK_PREFERENCES" ), QIconSet(),
+ tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
+ CTRL+Key_P, desk, false, this, SLOT( onPreferences() ) );
+
//! Catalog Generator
createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ), QIconSet(),
tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ),
tr( "MEN_DESK_REGISTRY_DISPLAY" ), tr( "PRP_DESK_REGISTRY_DISPLAY" ),
0, desk, false, this, SLOT( onRegDisplay() ) );
- int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
+ //! MRU
+ QtxMRUAction* mru = new QtxMRUAction( tr( "TOT_DESK_MRU" ), tr( "MEN_DESK_MRU" ), desk );
+ connect( mru, SIGNAL( activated( QString ) ), this, SLOT( onMRUActivated( QString ) ) );
+ registerAction( MRUId, mru );
+
+ //! default icon for neutral point ('SALOME' module)
+ QPixmap defIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ), false );
+ if ( defIcon.isNull() )
+ defIcon = QPixmap( imageEmptyIcon );
+
+ //! default icon for any module
+ QPixmap modIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_MODULE_ICO" ), false );
+ if ( modIcon.isNull() )
+ modIcon = QPixmap( imageEmptyIcon );
+
+ QToolBar* modTBar = new QtxToolBar( true, desk );
+ modTBar->setLabel( tr( "INF_TOOLBAR_MODULES" ) );
+
+ QActionGroup* modGroup = new QActionGroup( this );
+ modGroup->setExclusive( true );
+ modGroup->setUsesDropDown( true );
+
+ QAction* a = createAction( -1, tr( "APP_NAME" ), defIcon, tr( "APP_NAME" ),
+ tr( "PRP_APP_MODULE" ), 0, desk, true );
+ modGroup->add( a );
+ myActions.insert( QString(), a );
+
+ QMap<QString, QString> iconMap;
+ moduleIconNames( iconMap );
+
+ const int iconSize = 20;
+
+ modGroup->addTo( modTBar );
+ modTBar->addSeparator();
+
+ QStringList modList;
+ modules( modList, false );
+
+ for ( QStringList::Iterator it = modList.begin(); it != modList.end(); ++it )
+ {
+ if ( (*it).isEmpty() )
+ continue;
+
+ QString iconName;
+ if ( iconMap.contains( *it ) )
+ iconName = iconMap[*it];
+
+ QString modName = moduleName( *it );
+
+ QPixmap icon = resMgr->loadPixmap( modName, iconName, false );
+ if ( icon.isNull() )
+ icon = modIcon;
+
+ icon.convertFromImage( icon.convertToImage().smoothScale( iconSize, iconSize, QImage::ScaleMin ) );
+
+ QAction* a = createAction( -1, *it, icon, *it, tr( "PRP_MODULE" ).arg( *it ), 0, desk, true );
+ a->addTo( modTBar );
+ modGroup->add( a );
+
+ myActions.insert( *it, a );
+ }
+
+ SUIT_Tools::simplifySeparators( modTBar );
+
+ //! New window
+
+ int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
+ int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
+ createMenu( separator(), windowMenu, -1, 1 );
+
+ QMap<int, int> accelMap;
+ accelMap[NewGLViewId] = ALT+Key_G;
+ accelMap[NewPlot2dId] = ALT+Key_P;
+ accelMap[NewOCCViewId] = ALT+Key_O;
+ accelMap[NewVTKViewId] = ALT+Key_K;
+
+ for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
+ {
+ QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ), QIconSet(),
+ tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
+ tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
+ accelMap.contains( id ) ? accelMap[id] : 0, desk, false, this, SLOT( onNewWindow() ) );
+ createMenu( a, newWinMenu, -1 );
+ }
+ connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) );
+
+ int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
createMenu( DumpStudyId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
createMenu( PropertiesId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
+ createMenu( PreferencesId, fileMenu, 15, -1 );
+ createMenu( separator(), fileMenu, -1, 15, -1 );
int toolsMenu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 50 );
createMenu( CatalogGenId, toolsMenu, 10, -1 );
createMenu( RegDisplayId, toolsMenu, 10, -1 );
createMenu( separator(), toolsMenu, -1, 15, -1 );
+
+ /*
+ createMenu( separator(), fileMenu, -1, 100, -1 );
+ createMenu( MRUId, fileMenu, 100, -1 );
+ createMenu( separator(), fileMenu, -1, 100, -1 );
+ */
+}
+
+/*!On module activation action.*/
+void SalomeApp_Application::onModuleActivation( QAction* a )
+{
+ if ( !a )
+ return;
+
+ QString modName = a->menuText();
+ if ( modName == tr( "APP_NAME" ) )
+ modName = QString::null;
+
+ // Force user to create/open a study before module activation
+ QMap<QString, QString> iconMap;
+ moduleIconNames( iconMap );
+ QPixmap icon = resourceMgr()->loadPixmap( moduleName( modName ), iconMap[ modName ], false );
+ if ( icon.isNull() )
+ icon = resourceMgr()->loadPixmap( "SalomeApp", tr( "APP_MODULE_BIG_ICO" ), false ); // default icon for any module
+
+ bool cancelled = false;
+ while ( !modName.isEmpty() && !activeStudy() && !cancelled ){
+ SalomeApp_ModuleDlg aDlg( desktop(), modName, icon );
+ int res = aDlg.exec();
+
+ switch ( res ){
+ case 1:
+ onNewDoc();
+ break;
+ case 2:
+ onOpenDoc();
+ break;
+ case 3:
+ //onLoadStudy();
+ //break;
+ case 0:
+ default:
+ putInfo( tr("INF_CANCELLED") );
+ myActions[QString()]->setOn( true );
+ cancelled = true;
+ }
+ }
+
+ if ( !cancelled )
+ activateModule( modName );
+}
+
+/*!Default module activation.*/
+QString SalomeApp_Application::defaultModule() const
+{
+ QStringList aModuleNames;
+ modules( aModuleNames, false ); // obtain a complete list of module names for the current configuration
+ //! If there's the one and only module --> activate it automatically
+ //! TODO: Possible improvement - default module can be taken from preferences
+ return aModuleNames.count() > 1 ? "" : ( aModuleNames.count() ? aModuleNames.first() : "" );
+}
+
+/*!On new window slot.*/
+void SalomeApp_Application::onNewWindow()
+{
+ const QObject* obj = sender();
+ if ( !obj || !obj->inherits( "QAction" ) )
+ return;
+
+ QString type;
+ int id = actionId( (QAction*)obj );
+ switch ( id )
+ {
+ case NewGLViewId:
+ type = GLViewer_Viewer::Type();
+ break;
+ case NewPlot2dId:
+ type = Plot2d_Viewer::Type();
+ break;
+ case NewOCCViewId:
+ type = OCCViewer_Viewer::Type();
+ break;
+ case NewVTKViewId:
+ type = VTKViewer_Viewer::Type();
+ break;
+ }
+
+ if ( !type.isEmpty() )
+ createViewManager( type );
+}
+
+//=======================================================================
+// name : onNewDoc
+/*! Purpose : SLOT. Create new document*/
+//=======================================================================
+void SalomeApp_Application::onNewDoc()
+{
+ SUIT_Study* study = activeStudy();
+
+ saveWindowsGeometry();
+
+ CAM_Application::onNewDoc();
+
+ if ( !study ) // new study will be create in THIS application
+ {
+ updateWindows();
+ updateViewManagers();
+ }
+}
+
+//=======================================================================
+// name : onOpenDoc
+/*! Purpose : SLOT. Open new document*/
+//=======================================================================
+void SalomeApp_Application::onOpenDoc()
+{
+ SUIT_Study* study = activeStudy();
+ saveWindowsGeometry();
+
+ CAM_Application::onOpenDoc();
+
+ if ( !study ) // new study will be create in THIS application
+ {
+ updateWindows();
+ updateViewManagers();
+ }
+}
+
+/*! Purpose : SLOT. Open new document with \a aName.*/
+bool SalomeApp_Application::onOpenDoc( const QString& aName )
+{
+ bool res = CAM_Application::onOpenDoc( aName );
+
+ QAction* a = action( MRUId );
+ if ( a && a->inherits( "QtxMRUAction" ) )
+ {
+ QtxMRUAction* mru = (QtxMRUAction*)a;
+ if ( res )
+ mru->insert( aName );
+ else
+ mru->remove( aName );
+ }
+ return res;
}
/*!SLOT. Load document.*/
name = studyname;
name.replace( QRegExp(":"), "/" );
- if (LightApp_Application::onLoadDoc(name))
- {
+ if(onLoadDoc(name)) {
updateWindows();
updateViewManagers();
updateObjectBrowser(true);
}
}
+
+/*!SLOT. Load document with \a aName.*/
+bool SalomeApp_Application::onLoadDoc( const QString& aName )
+{
+ bool res = CAM_Application::onLoadDoc( aName );
+
+ /*jfa tmp:QAction* a = action( MRUId );
+ if ( a && a->inherits( "QtxMRUAction" ) )
+ {
+ QtxMRUAction* mru = (QtxMRUAction*)a;
+ if ( res )
+ mru->insert( aName );
+ else
+ mru->remove( aName );
+ }*/
+ return res;
+}
+
+/*!Private SLOT. Selection.*/
+void SalomeApp_Application::onSelection()
+{
+ onSelectionChanged();
+
+ if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
+ ((SalomeApp_Module*)activeModule())->selectionChanged();
+}
+
/*!SLOT. Copy objects to study maneger from selection maneger..*/
-void SalomeApp_Application::onCopy()
+void SalomeApp_Application::onCopy()
{
SALOME_ListIO list;
- LightApp_SelectionMgr* mgr = selectionMgr();
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(list);
-
+
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
- if(study == NULL) return;
-
+ if(study == NULL) return;
+
_PTR(Study) stdDS = study->studyDS();
if(!stdDS) return;
- SALOME_ListIteratorOfListIO it( list );
+ SALOME_ListIteratorOfListIO it( list );
if(it.More())
{
_PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
}
/*!SLOT. Paste objects to study maneger from selection manager.*/
-void SalomeApp_Application::onPaste()
+void SalomeApp_Application::onPaste()
{
SALOME_ListIO list;
- LightApp_SelectionMgr* mgr = selectionMgr();
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(list);
-
+
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
if(study == NULL) return;
-
+
_PTR(Study) stdDS = study->studyDS();
if(!stdDS) return;
-
- SALOME_ListIteratorOfListIO it( list );
+
+ SALOME_ListIteratorOfListIO it( list );
if(it.More())
{
_PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
try {
studyMgr()->Paste(so);
updateObjectBrowser( true );
- updateActions(); //SRN: BugID IPAL9377, case 3
+ updateActions(); //SRN: BugID IPAL9377, case 3
}
catch(...) {
}
void SalomeApp_Application::onSelectionChanged()
{
SALOME_ListIO list;
- LightApp_SelectionMgr* mgr = selectionMgr();
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(list);
-
+
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
if(study == NULL) return;
-
+
_PTR(Study) stdDS = study->studyDS();
if(!stdDS) return;
-
- QAction* qaction;
- SALOME_ListIteratorOfListIO it( list );
+ QAction* qaction;
+
+ SALOME_ListIteratorOfListIO it( list );
if(it.More() && list.Extent() == 1)
{
_PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
+
qaction = action(EditCopyId);
- SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
- if(aSO && studyMgr()->CanCopy(so) ) qaction->setEnabled(true);
- else qaction->setEnabled(false);
-
+ if(studyMgr()->CanCopy(so) ) qaction->setEnabled(true);
+ else qaction->setEnabled(false);
+
qaction = action(EditPasteId);
- if( aSO && studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
+ if( studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
else qaction->setEnabled(false);
}
else {
- qaction = action(EditCopyId);
- qaction->setEnabled(false);
+ qaction = action(EditCopyId);
+ qaction->setEnabled(false);
qaction = action(EditPasteId);
qaction->setEnabled(false);
}
}
+/*!Update object browser.*/
+void SalomeApp_Application::onRefresh()
+{
+ updateObjectBrowser( true );
+}
+
/*!Delete references.*/
void SalomeApp_Application::onDeleteReferences()
{
SALOME_ListIO aList;
- LightApp_SelectionMgr* mgr = selectionMgr();
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(aList);
if (aList.Extent() < 1) return;
updateObjectBrowser();
}
+/*!Private SLOT. */
+void SalomeApp_Application::onOpenWith()
+{
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ SALOME_ListIO aList;
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
+ mgr->selectedObjects(aList);
+ if (aList.Extent() != 1)
+ {
+ QApplication::restoreOverrideCursor();
+ return;
+ }
+ Handle(SALOME_InteractiveObject) aIObj = aList.First();
+ QString aModuleName(aIObj->getComponentDataType());
+ QString aModuleTitle = moduleTitle(aModuleName);
+ activateModule(aModuleTitle);
+ QApplication::restoreOverrideCursor();
+}
+
+bool SalomeApp_Application::useStudy(const QString& theName)
+{
+ createEmptyStudy();
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
+ bool res = false;
+ if (aStudy)
+ res = aStudy->loadDocument( theName );
+ updateDesktopTitle();
+ updateCommandsStatus();
+ return res;
+}
+
+/*!Set active study.
+ *\param study - SUIT_Study.
+ */
+void SalomeApp_Application::setActiveStudy( SUIT_Study* study )
+{
+ CAM_Application::setActiveStudy( study );
+
+ activateWindows();
+}
+
//=======================================================================
// name : createNewStudy
/*! Purpose : Create new study*/
}
//=======================================================================
-// name : updateCommandsStatus
+// name : createNewStudy
/*! Purpose : Enable/Disable menu items and toolbar buttons. Rebuild menu*/
//=======================================================================
void SalomeApp_Application::updateCommandsStatus()
{
- LightApp_Application::updateCommandsStatus();
+ CAM_Application::updateCommandsStatus();
+
+ for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
+ {
+ QAction* a = action( id );
+ if ( a )
+ a->setEnabled( activeStudy() );
+ }
// Dump study menu
QAction* a = action( DumpStudyId );
a = action( LoadScriptId );
if ( a )
a->setEnabled( activeStudy() );
-
+
a = action( PropertiesId );
if( a )
a->setEnabled( activeStudy() );
-
+
a = action(EditCopyId);
- a->setEnabled(false);
+ a->setEnabled(false);
a = action(EditPasteId);
- a->setEnabled(false);
+ a->setEnabled(false);
}
-/*!Private SLOT. On dump study.*/
-void SalomeApp_Application::onDumpStudy( )
+//=======================================================================
+// name : onHelpAbout
+/*! Purpose : SLOT. Display "About" message box*/
+//=======================================================================
+void SalomeApp_Application::onHelpAbout()
{
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
- if ( !appStudy ) return;
- _PTR(Study) aStudy = appStudy->studyDS();
-
- QStringList aFilters;
- aFilters.append( tr( "PYTHON_FILES_FILTER" ) );
+ SalomeApp_AboutDlg* dlg = new SalomeApp_AboutDlg( applicationName(), applicationVersion(), desktop() );
+ dlg->exec();
+ delete dlg;
+}
- SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( desktop(), false, tr("PUBLISH_IN_STUDY"), true, true);
- fd->setCaption( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
- fd->setFilters( aFilters );
- fd->SetChecked(true);
- fd->exec();
- QString aFileName = fd->selectedFile();
- bool toPublish = fd->IsChecked();
- delete fd;
+QWidget* SalomeApp_Application::window( const int flag, const int studyId ) const
+{
+ QWidget* wid = 0;
- if(!aFileName.isEmpty()) {
- QFileInfo aFileInfo(aFileName);
- aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish );
+ int sId = studyId;
+ if ( sId < 0 )
+ {
+ if ( !activeStudy() )
+ return 0;
+ else
+ sId = activeStudy()->id();
}
+
+ if ( myWindows.contains( flag ) )
+ wid = myWindows[flag]->widget( sId );
+
+ return wid;
}
-/*!Private SLOT. On load script.*/
-void SalomeApp_Application::onLoadScript( )
+/*!Adds window to application.
+ *\param wid - QWidget
+ *\param flag - key wor window
+ *\param studyId - study id
+ * Flag used how identificator of window in windows list.
+ */
+void SalomeApp_Application::addWindow( QWidget* wid, const int flag, const int studyId )
{
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
- if ( !appStudy ) return;
- _PTR(Study) aStudy = appStudy->studyDS();
-
- if ( aStudy->GetProperties()->IsLocked() ) {
- SUIT_MessageBox::warn1 ( desktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
+ if ( !wid )
return;
- }
- QStringList filtersList;
- filtersList.append(tr("PYTHON_FILES_FILTER"));
- filtersList.append(tr("ALL_FILES_FILTER"));
-
- QString aFile = SUIT_FileDlg::getFileName( desktop(), "", filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true );
+ int sId = studyId;
+ if ( sId < 0 )
+ {
+ if ( !activeStudy() )
+ return;
+ else
+ sId = activeStudy()->id();
+ }
- if ( !aFile.isEmpty() )
+ if ( !myWindows.contains( flag ) )
{
- QString command = QString("execfile(\"%1\")").arg(aFile);
+ QMap<int, int> winMap;
+ currentWindows( winMap );
- PythonConsole* pyConsole = pythonConsole();
+ myWindows.insert( flag, new SalomeApp_WidgetContainer( flag, desktop() ) );
+ if ( winMap.contains( flag ) )
+ desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] );
- if ( pyConsole )
- pyConsole->exec( command );
+ myWindows[flag]->setResizeEnabled( true );
+ myWindows[flag]->setCloseMode( QDockWindow::Always );
+ myWindows[flag]->setName( QString( "dock_window_%1" ).arg( flag ) );
}
-}
-/*!Gets file filter.
- *\retval QString "(*.hdf)"
+ QFont f;
+ if( wid->inherits( "PythonConsole" ) )
+ f = ( ( PythonConsole* )wid )->font();
+ else
+ f = wid->font();
+
+ myWindows[flag]->insert( sId, wid );
+ wid->setFont( f );
+
+ setWindowShown( flag, !myWindows[flag]->isEmpty() );
+}
+
+/*!Remove window from application.
+ *\param flag - key wor window
+ *\param studyId - study id
+ * Flag used how identificator of window in windows list.
+ */
+void SalomeApp_Application::removeWindow( const int flag, const int studyId )
+{
+ if ( !myWindows.contains( flag ) )
+ return;
+
+ int sId = studyId;
+ if ( sId < 0 )
+ {
+ if ( !activeStudy() )
+ return;
+ else
+ sId = activeStudy()->id();
+ }
+
+ QWidget* wid = myWindows[flag]->widget( sId );
+ myWindows[flag]->remove( sId );
+ delete wid;
+
+ setWindowShown( flag, !myWindows[flag]->isEmpty() );
+}
+
+/*!Gets window.
+ *\param flag - key wor window
+ *\param studyId - study id
+ * Flag used how identificator of window in windows list.
+ */
+QWidget* SalomeApp_Application::getWindow( const int flag, const int studyId )
+{
+ QWidget* wid = window( flag, studyId );
+ if ( !wid )
+ addWindow( wid = createWindow( flag ), flag, studyId );
+
+ return wid;
+}
+
+/*!Check is window visible?(with identificator \a type)*/
+bool SalomeApp_Application::isWindowVisible( const int type ) const
+{
+ bool res = false;
+ if ( myWindows.contains( type ) )
+ {
+ SUIT_Desktop* desk = ((SalomeApp_Application*)this)->desktop();
+ res = desk && desk->appropriate( myWindows[type] );
+ }
+ return res;
+}
+
+/*!Sets window show or hide.
+ *\param type - window identificator.
+ *\param on - true/false (window show/hide)
+ */
+void SalomeApp_Application::setWindowShown( const int type, const bool on )
+{
+ if ( !desktop() || !myWindows.contains( type ) )
+ return;
+
+ QDockWindow* dw = myWindows[type];
+ desktop()->setAppropriate( dw, on );
+ on ? dw->show() : dw->hide();
+}
+
+OB_Browser* SalomeApp_Application::objectBrowser()
+{
+ OB_Browser* ob = 0;
+ QWidget* wid = getWindow( WT_ObjectBrowser );
+ if ( wid->inherits( "OB_Browser" ) )
+ ob = (OB_Browser*)wid;
+ return ob;
+}
+
+/*!Gets "LogWindow".*/
+LogWindow* SalomeApp_Application::logWindow()
+{
+ LogWindow* lw = 0;
+ QWidget* wid = getWindow( WT_LogWindow );
+ if ( wid->inherits( "LogWindow" ) )
+ lw = (LogWindow*)wid;
+ return lw;
+}
+
+/*!Get "PythonConsole"*/
+PythonConsole* SalomeApp_Application::pythonConsole()
+{
+ PythonConsole* console = 0;
+ QWidget* wid = getWindow( WT_PyConsole );
+ if ( wid->inherits( "PythonConsole" ) )
+ console = (PythonConsole*)wid;
+ return console;
+}
+
+/*!Gets preferences.*/
+SalomeApp_Preferences* SalomeApp_Application::preferences() const
+{
+ return preferences( false );
+}
+
+/*!Gets view manager*/
+SUIT_ViewManager* SalomeApp_Application::getViewManager( const QString& vmType, const bool create )
+{
+ SUIT_ViewManager* aVM = viewManager( vmType );
+ SUIT_ViewManager* anActiveVM = CAM_Application::activeViewManager();
+
+ if ( anActiveVM && anActiveVM->getType() == vmType )
+ aVM = anActiveVM;
+
+ if ( aVM && create )
+ {
+ if ( !aVM->getActiveView() )
+ aVM->createView();
+ else
+ aVM->getActiveView()->setFocus();
+ }
+ else if ( create )
+ aVM = createViewManager( vmType );
+
+ return aVM;
+}
+
+/*!Create view manager.*/
+SUIT_ViewManager* SalomeApp_Application::createViewManager( const QString& vmType )
+{
+ SUIT_ResourceMgr* resMgr = resourceMgr();
+
+ SUIT_ViewManager* viewMgr = 0;
+ if ( vmType == GLViewer_Viewer::Type() )
+ {
+ viewMgr = new GLViewer_ViewManager( activeStudy(), desktop() );
+ new SalomeApp_GLSelector( (GLViewer_Viewer2d*)viewMgr->getViewModel(), mySelMgr );
+ }
+ else if ( vmType == Plot2d_Viewer::Type() )
+ {
+ viewMgr = new Plot2d_ViewManager( activeStudy(), desktop() );
+ viewMgr->setViewModel( new SPlot2d_Viewer() );// custom view model, which extends SALOME_View interface
+ }
+ else if ( vmType == OCCViewer_Viewer::Type() )
+ {
+ viewMgr = new OCCViewer_ViewManager( activeStudy(), desktop() );
+ SOCC_Viewer* vm = new SOCC_Viewer();
+ vm->setBackgroundColor( resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) );
+ vm->setTrihedronSize( resMgr->integerValue( "OCCViewer", "trihedron_size", vm->trihedronSize() ) );
+ int u( 1 ), v( 1 );
+ vm->isos( u, v );
+ u = resMgr->integerValue( "OCCViewer", "iso_number_u", u );
+ v = resMgr->integerValue( "OCCViewer", "iso_number_v", v );
+ vm->setIsos( u, v );
+ viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface
+ new SalomeApp_OCCSelector( (OCCViewer_Viewer*)viewMgr->getViewModel(), mySelMgr );
+ }
+ else if ( vmType == SVTK_Viewer::Type() )
+ {
+ viewMgr = new SVTK_ViewManager( activeStudy(), desktop() );
+ SVTK_Viewer* vm = (SVTK_Viewer*)viewMgr->getViewModel();
+ vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
+ vm->setTrihedronSize( resMgr->integerValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ) );
+ new SalomeApp_VTKSelector((SVTK_Viewer*)viewMgr->getViewModel(),mySelMgr);
+ }
+
+ if ( !viewMgr )
+ return 0;
+
+ addViewManager( viewMgr );
+ SUIT_ViewWindow* viewWin = viewMgr->createViewWindow();
+
+ if ( viewWin && desktop() )
+ viewWin->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) );
+
+ connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
+ this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
+
+ return viewMgr;
+}
+
+void SalomeApp_Application::onCloseView( SUIT_ViewManager* theVM )
+{
+ removeViewManager( theVM );
+}
+
+/*!Private SLOT. On study created.*/
+void SalomeApp_Application::onStudyCreated( SUIT_Study* theStudy )
+{
+ SUIT_DataObject* aRoot = 0;
+ if ( theStudy && theStudy->root() )
+ {
+ aRoot = theStudy->root();
+ //aRoot->setName( tr( "DATA_MODELS" ) );
+ }
+ if ( objectBrowser() != 0 )
+ objectBrowser()->setRootObject( aRoot );
+
+ activateModule( defaultModule() );
+
+ activateWindows();
+}
+
+/*!Private SLOT. On study opened.*/
+void SalomeApp_Application::onStudyOpened( SUIT_Study* theStudy )
+{
+ SUIT_DataObject* aRoot = 0;
+ if ( theStudy && theStudy->root() )
+ {
+ aRoot = theStudy->root();
+ //aRoot->dump();
+ }
+ if ( objectBrowser() != 0 ) {
+ objectBrowser()->setRootObject( aRoot );
+ }
+
+ activateModule( defaultModule() );
+
+ activateWindows();
+
+ emit studyOpened();
+}
+
+void SalomeApp_Application::onStudySaved( SUIT_Study* )
+{
+ emit studySaved();
+}
+
+/*!Private SLOT. On study closed.*/
+void SalomeApp_Application::onStudyClosed( SUIT_Study* )
+{
+ emit studyClosed();
+
+ activateModule( "" );
+
+ saveWindowsGeometry();
+}
+
+/*!Private SLOT. On dump study.*/
+void SalomeApp_Application::onDumpStudy( )
+{
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( !appStudy ) return;
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ QStringList aFilters;
+ aFilters.append( tr( "PYTHON_FILES_FILTER" ) );
+
+ SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( desktop(), false, tr("PUBLISH_IN_STUDY"), true, true);
+ fd->setCaption( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
+ fd->setFilters( aFilters );
+ fd->SetChecked(true);
+ fd->exec();
+ QString aFileName = fd->selectedFile();
+ bool toPublish = fd->IsChecked();
+ delete fd;
+
+ if(!aFileName.isEmpty()) {
+ QFileInfo aFileInfo(aFileName);
+ aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish );
+ }
+}
+
+/*!Private SLOT. On load script.*/
+void SalomeApp_Application::onLoadScript( )
+{
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( !appStudy ) return;
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ if ( aStudy->GetProperties()->IsLocked() ) {
+ SUIT_MessageBox::warn1 ( desktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK") );
+ return;
+ }
+
+ QStringList filtersList;
+ filtersList.append(tr("PYTHON_FILES_FILTER"));
+ filtersList.append(tr("ALL_FILES_FILTER"));
+
+ QString aFile = SUIT_FileDlg::getFileName( desktop(), "", filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true );
+
+ if ( !aFile.isEmpty() )
+ {
+ QString command = QString("execfile(\"%1\")").arg(aFile);
+
+ PythonConsole* pyConsole = pythonConsole();
+
+ if ( pyConsole )
+ pyConsole->exec( command );
+ }
+}
+
+/*!Private SLOT. On preferences.*/
+void SalomeApp_Application::onPreferences()
+{
+ QApplication::setOverrideCursor( Qt::waitCursor );
+
+ SalomeApp_PreferencesDlg* prefDlg = new SalomeApp_PreferencesDlg( preferences( true ), desktop());
+
+ QApplication::restoreOverrideCursor();
+
+ if ( !prefDlg )
+ return;
+
+ prefDlg->exec();
+
+ delete prefDlg;
+}
+
+/*!Private SLOT. On open document with name \a aName.*/
+void SalomeApp_Application::onMRUActivated( QString aName )
+{
+ onOpenDoc( aName );
+}
+
+/*!Private SLOT. On preferences changed.*/
+void SalomeApp_Application::onPreferenceChanged( QString& modName, QString& section, QString& param )
+{
+ SalomeApp_Module* sMod = 0;
+ CAM_Module* mod = module( modName );
+ if ( mod && mod->inherits( "SalomeApp_Module" ) )
+ sMod = (SalomeApp_Module*)mod;
+
+ if ( sMod )
+ sMod->preferencesChanged( section, param );
+ else
+ preferencesChanged( section, param );
+}
+
+/*!Gets file filter.
+ *\retval QString "(*.hdf)"
*/
QString SalomeApp_Application::getFileFilter() const
{
return "(*.hdf)";
}
+/*!Remove all windows from study.*/
+void SalomeApp_Application::beforeCloseDoc( SUIT_Study* s )
+{
+ CAM_Application::beforeCloseDoc( s );
+
+ for ( WindowMap::ConstIterator itr = myWindows.begin(); s && itr != myWindows.end(); ++itr )
+ removeWindow( itr.key(), s->id() );
+}
+
+/*!Update actions.*/
+void SalomeApp_Application::updateActions()
+{
+ updateCommandsStatus();
+}
+
/*!Create window.*/
QWidget* SalomeApp_Application::createWindow( const int flag )
{
- QWidget* wid = LightApp_Application::createWindow(flag);
+ QWidget* wid = 0;
+
SUIT_ResourceMgr* resMgr = resourceMgr();
if ( flag == WT_ObjectBrowser )
{
- OB_Browser* ob = (OB_Browser*)wid;
+ OB_Browser* ob = new OB_Browser( desktop() );
+ ob->setAutoUpdate( true );
+ ob->setAutoOpenLevel( 1 );
+ ob->setCaption( tr( "OBJECT_BROWSER" ) );
+ ob->resize( OBJECT_BROWSER_WIDTH, ob->height() );
+ ob->setFilter( new SalomeApp_OBFilter( selectionMgr() ) );
+
+ ob->setNameTitle( tr( "OBJ_BROWSER_NAME" ) );
+
bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
- if ( ob != 0 ) {
- for ( int i = SalomeApp_DataObject::CT_Value; i <= SalomeApp_DataObject::CT_RefEntry; i++ )
- {
- ob->addColumn( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), i );
- ob->setColumnShown( i, resMgr->booleanValue( "ObjectBrowser",
- QString().sprintf( "visibility_column_%d", i ), true ) );
- }
+ for ( int i = SalomeApp_DataObject::CT_Value; i <= SalomeApp_DataObject::CT_RefEntry; i++ )
+ {
+ ob->addColumn( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), i );
+ ob->setColumnShown( i, resMgr->booleanValue( "ObjectBrowser",
+ QString().sprintf( "visibility_column_%d", i ), true ) );
}
ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
+
+ // Create OBSelector
+ new SalomeApp_OBSelector( ob, mySelMgr );
+
+ wid = ob;
+
+ ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
- else if ( flag == WT_PyConsole )
+ else if ( flag == WT_PyConsole )
{
- delete wid;
- wid = 0;
PythonConsole* pyCons = new PythonConsole( desktop(), new SalomeApp_PyInterp() );
pyCons->setCaption( tr( "PYTHON_CONSOLE" ) );
+ pyCons->setFont( resMgr->fontValue( "PyConsole", "font" ) );
wid = pyCons;
+
// pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
+ else if ( flag == WT_LogWindow )
+ {
+ LogWindow* logWin = new LogWindow( desktop() );
+ logWin->setCaption( tr( "LOG_WINDOW" ) );
+ wid = logWin;
+
+ logWin->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
+ }
+
return wid;
}
-/*!Create preferences.*/
-void SalomeApp_Application::createPreferences( LightApp_Preferences* pref )
+/*!Default windows(Object Browser, Python Console).
+ * Adds to map \a aMap.
+ */
+void SalomeApp_Application::defaultWindows( QMap<int, int>& aMap ) const
{
- LightApp_Application::createPreferences(pref);
+ aMap.insert( WT_ObjectBrowser, Qt::DockLeft );
+ aMap.insert( WT_PyConsole, Qt::DockBottom );
+ // aMap.insert( WT_LogWindow, Qt::DockBottom );
+}
+
+/*!Default view manager.*/
+void SalomeApp_Application::defaultViewManagers( QStringList& ) const
+{
+ /*!Do nothing.*/
+}
+
+/*!Gets preferences.
+ * Create preferences, if \a crt = true.
+ */
+SalomeApp_Preferences* SalomeApp_Application::preferences( const bool crt ) const
+{
+ if ( myPrefs )
+ return myPrefs;
+
+ SalomeApp_Application* that = (SalomeApp_Application*)this;
+
+ if ( !_prefs_ && crt )
+ {
+ _prefs_ = new SalomeApp_Preferences( resourceMgr() );
+ that->createPreferences( _prefs_ );
+ }
+ that->myPrefs = _prefs_;
+
+ QPtrList<SUIT_Application> appList = SUIT_Session::session()->applications();
+ for ( QPtrListIterator<SUIT_Application> appIt ( appList ); appIt.current(); ++appIt )
+ {
+ if ( !appIt.current()->inherits( "SalomeApp_Application" ) )
+ continue;
+
+ SalomeApp_Application* app = (SalomeApp_Application*)appIt.current();
+
+ QStringList modNameList;
+ app->modules( modNameList, false );
+ for ( QStringList::const_iterator it = modNameList.begin(); it != modNameList.end(); ++it )
+ {
+ int id = _prefs_->addPreference( *it );
+ _prefs_->setItemProperty( id, "info", tr( "PREFERENCES_NOT_LOADED" ).arg( *it ) );
+ }
+
+ ModuleList modList;
+ app->modules( modList );
+ for ( ModuleListIterator itr( modList ); itr.current(); ++itr )
+ {
+ SalomeApp_Module* mod = 0;
+ if ( itr.current()->inherits( "SalomeApp_Module" ) )
+ mod = (SalomeApp_Module*)itr.current();
+
+ if ( mod && !_prefs_->hasModule( mod->moduleName() ) )
+ {
+ int modCat = _prefs_->addPreference( mod->moduleName() );
+ _prefs_->setItemProperty( modCat, "info", QString::null );
+ mod->createPreferences();
+ }
+ }
+ }
+
+ connect( myPrefs, SIGNAL( preferenceChanged( QString&, QString&, QString& ) ),
+ this, SLOT( onPreferenceChanged( QString&, QString&, QString& ) ) );
+
+ return myPrefs;
+}
+
+/*!Add new module to application.*/
+void SalomeApp_Application::moduleAdded( CAM_Module* mod )
+{
+ CAM_Application::moduleAdded( mod );
+
+ SalomeApp_Module* salomeMod = 0;
+ if ( mod && mod->inherits( "SalomeApp_Module" ) )
+ salomeMod = (SalomeApp_Module*)mod;
+
+ if ( myPrefs && salomeMod && !myPrefs->hasModule( salomeMod->moduleName() ) )
+ {
+ int modCat = myPrefs->addPreference( mod->moduleName() );
+ myPrefs->setItemProperty( modCat, "info", QString::null );
+ salomeMod->createPreferences();
+ }
+}
+
+/*!Create preferences.*/
+void SalomeApp_Application::createPreferences( SalomeApp_Preferences* pref )
+{
if ( !pref )
return;
int salomeCat = pref->addPreference( tr( "PREF_CATEGORY_SALOME" ) );
+
+ int genTab = pref->addPreference( tr( "PREF_TAB_GENERAL" ), salomeCat );
+ int studyGroup = pref->addPreference( tr( "PREF_GROUP_STUDY" ), genTab );
+ pref->setItemProperty( studyGroup, "columns", 1 );
+
+ pref->addPreference( tr( "PREF_MULTI_FILE" ), studyGroup, SalomeApp_Preferences::Bool, "Study", "multi_file" );
+ pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, SalomeApp_Preferences::Bool, "Study", "ascii_file" );
+ int undoPref = pref->addPreference( tr( "PREF_UNDO_LEVEL" ), studyGroup, SalomeApp_Preferences::IntSpin, "Study", "undo_level" );
+ pref->setItemProperty( undoPref, "min", 1 );
+ pref->setItemProperty( undoPref, "max", 100 );
+
+ int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab );
+ pref->setItemProperty( extgroup, "columns", 1 );
+ int apppref = pref->addPreference( tr( "PREF_APP" ), extgroup, SalomeApp_Preferences::File, "ExternalBrowser", "application" );
+ pref->setItemProperty( apppref, "existing", true );
+ pref->setItemProperty( apppref, "flags", QFileInfo::ExeUser );
+
+ pref->addPreference( tr( "PREF_PARAM" ), extgroup, SalomeApp_Preferences::String, "ExternalBrowser", "parameters" );
+
+ int pythonConsoleGroup = pref->addPreference( tr( "PREF_GROUP_PY_CONSOLE" ), genTab );
+ pref->setItemProperty( pythonConsoleGroup, "columns", 1 );
+ pref->addPreference( tr( "PREF_FONT" ), pythonConsoleGroup, SalomeApp_Preferences::Font, "PyConsole", "font" );
+
+
+
int obTab = pref->addPreference( tr( "PREF_TAB_OBJBROWSER" ), salomeCat );
int defCols = pref->addPreference( tr( "PREF_GROUP_DEF_COLUMNS" ), obTab );
for ( int i = SalomeApp_DataObject::CT_Value; i <= SalomeApp_DataObject::CT_RefEntry; i++ )
{
pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), defCols,
- LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) );
+ SalomeApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) );
}
pref->setItemProperty( defCols, "columns", 1 );
int objSetGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SETTINGS" ), obTab );
- pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, LightApp_Preferences::Bool, "ObjectBrowser", "auto_size" );
+ pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, SalomeApp_Preferences::Bool, "ObjectBrowser", "auto_size" );
+
+ int viewTab = pref->addPreference( tr( "PREF_TAB_VIEWERS" ), salomeCat );
+
+ int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), viewTab );
+
+ int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), viewTab );
+
+ int plot2dGroup = pref->addPreference( tr( "PREF_GROUP_PLOT2DVIEWER" ), viewTab );
+
+ pref->setItemProperty( occGroup, "columns", 1 );
+ pref->setItemProperty( vtkGroup, "columns", 1 );
+ pref->setItemProperty( plot2dGroup, "columns", 1 );
+
+ int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup,
+ SalomeApp_Preferences::IntSpin, "OCCViewer", "trihedron_size" );
+ pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup,
+ SalomeApp_Preferences::Color, "OCCViewer", "background" );
+
+ pref->setItemProperty( occTS, "min", 1 );
+ pref->setItemProperty( occTS, "max", 150 );
+
+ int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup,
+ SalomeApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
+ int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup,
+ SalomeApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" );
+
+ pref->setItemProperty( isoU, "min", 0 );
+ pref->setItemProperty( isoU, "max", 100000 );
+
+ pref->setItemProperty( isoV, "min", 0 );
+ pref->setItemProperty( isoV, "max", 100000 );
+
+ int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGroup,
+ SalomeApp_Preferences::IntSpin, "VTKViewer", "trihedron_size" );
+ pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup,
+ SalomeApp_Preferences::Color, "VTKViewer", "background" );
+
+ pref->setItemProperty( vtkTS, "min", 1 );
+ pref->setItemProperty( vtkTS, "max", 150 );
+
+ pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup,
+ SalomeApp_Preferences::Bool, "Plot2d", "ShowLegend" );
+
+ int legendPosition = pref->addPreference( tr( "PREF_LEGEND_POSITION" ), plot2dGroup,
+ SalomeApp_Preferences::Selector, "Plot2d", "LegendPos" );
+ QStringList aLegendPosList;
+ aLegendPosList.append( tr("PREF_LEFT") );
+ aLegendPosList.append( tr("PREF_RIGHT") );
+ aLegendPosList.append( tr("PREF_TOP") );
+ aLegendPosList.append( tr("PREF_BOTTOM") );
+
+ QValueList<QVariant> anIndexesList;
+ anIndexesList.append(0);
+ anIndexesList.append(1);
+ anIndexesList.append(2);
+ anIndexesList.append(3);
+
+ pref->setItemProperty( legendPosition, "strings", aLegendPosList );
+ pref->setItemProperty( legendPosition, "indexes", anIndexesList );
+
+ int curveType = pref->addPreference( tr( "PREF_CURVE_TYPE" ), plot2dGroup,
+ SalomeApp_Preferences::Selector, "Plot2d", "CurveType" );
+ QStringList aCurveTypesList;
+ aCurveTypesList.append( tr("PREF_POINTS") );
+ aCurveTypesList.append( tr("PREF_LINES") );
+ aCurveTypesList.append( tr("PREF_SPLINE") );
+
+ anIndexesList.clear();
+ anIndexesList.append(0);
+ anIndexesList.append(1);
+ anIndexesList.append(2);
+
+ pref->setItemProperty( curveType, "strings", aCurveTypesList );
+ pref->setItemProperty( curveType, "indexes", anIndexesList );
+
+ int markerSize = pref->addPreference( tr( "PREF_MARKER_SIZE" ), plot2dGroup,
+ SalomeApp_Preferences::IntSpin, "Plot2d", "MarkerSize" );
+
+ pref->setItemProperty( markerSize, "min", 0 );
+ pref->setItemProperty( markerSize, "max", 100 );
+
+ QStringList aScaleModesList;
+ aScaleModesList.append( tr("PREF_LINEAR") );
+ aScaleModesList.append( tr("PREF_LOGARITHMIC") );
+
+ anIndexesList.clear();
+ anIndexesList.append(0);
+ anIndexesList.append(1);
+
+ int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup,
+ SalomeApp_Preferences::Selector, "Plot2d", "HorScaleMode" );
+
+ pref->setItemProperty( horScale, "strings", aScaleModesList );
+ pref->setItemProperty( horScale, "indexes", anIndexesList );
+
+ int verScale = pref->addPreference( tr( "PREF_VERT_AXIS_SCALE" ), plot2dGroup,
+ SalomeApp_Preferences::Selector, "Plot2d", "VerScaleMode" );
+
+ pref->setItemProperty( verScale, "strings", aScaleModesList );
+ pref->setItemProperty( verScale, "indexes", anIndexesList );
+
+ pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), plot2dGroup,
+ SalomeApp_Preferences::Color, "Plot2d", "Background" );
+
+ int dirTab = pref->addPreference( tr( "PREF_TAB_DIRECTORIES" ), salomeCat );
+ int dirGroup = pref->addPreference( tr( "PREF_GROUP_DIRECTORIES" ), dirTab );
+ pref->setItemProperty( dirGroup, "columns", 1 );
+ pref->addPreference( tr( "" ), dirGroup,
+ SalomeApp_Preferences::DirList, "FileDlg", "QuickDirList" );
+}
+
+void SalomeApp_Application::preferencesChanged( const QString& sec, const QString& param )
+{
+ SUIT_ResourceMgr* resMgr = resourceMgr();
+ if ( !resMgr )
+ return;
+
+ if ( sec == QString( "OCCViewer" ) && param == QString( "trihedron_size" ) )
+ {
+ int sz = resMgr->integerValue( sec, param, -1 );
+ QPtrList<SUIT_ViewManager> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current() && sz >= 0; ++it )
+ {
+ SUIT_ViewModel* vm = it.current()->getViewModel();
+ if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setTrihedronSize( sz );
+ occVM->getAISContext()->UpdateCurrentViewer();
+ }
+ }
+
+ if ( sec == QString( "VTKViewer" ) && param == QString( "trihedron_size" ) )
+ {
+ int sz = resMgr->integerValue( sec, param, -1 );
+ QPtrList<SUIT_ViewManager> lst;
+ viewManagers( SVTK_Viewer::Type(), lst );
+ for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current() && sz >= 0; ++it )
+ {
+ SUIT_ViewModel* vm = it.current()->getViewModel();
+ if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
+ continue;
+
+ SVTK_Viewer* vtkVM = (SVTK_Viewer*)vm;
+ vtkVM->setTrihedronSize( sz );
+ vtkVM->Repaint();
+ }
+ }
+
+ if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) )
+ {
+ QPtrList<SUIT_ViewManager> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ int u = resMgr->integerValue( sec, "iso_number_u" );
+ int v = resMgr->integerValue( sec, "iso_number_v" );
+ for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it )
+ ((OCCViewer_Viewer*)it.current())->setIsos( u, v );
+ }
+
+ if( sec=="ObjectBrowser" )
+ {
+ if( param=="auto_size" )
+ {
+ OB_Browser* ob = objectBrowser();
+ if( !ob )
+ return;
+
+ bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
+ ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
+
+ updateObjectBrowser( false );
+ }
+ }
+
+ if( sec=="PyConsole" )
+ {
+ if( param=="font" )
+ if( pythonConsole() )
+ pythonConsole()->setFont( resMgr->fontValue( "PyConsole", "font" ) );
+ }
}
/*!Update desktop title.*/
QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false );
if ( !sName.isEmpty() ) {
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
- if ( study ) {
- _PTR(Study) stdDS = study->studyDS();
- if(stdDS) {
- if ( stdDS->GetProperties()->IsLocked() ) {
- aTitle += QString( " - [%1 (%2)]").arg( sName ).arg( tr( "STUDY_LOCKED" ) );
- } else {
- aTitle += QString( " - [%1]" ).arg( sName );
- }
- }
+ _PTR(Study) stdDS = study->studyDS();
+ if(stdDS) {
+ if ( stdDS->GetProperties()->IsLocked() ) {
+ aTitle += QString( " - [%1 (%2)]").arg( sName ).arg( tr( "STUDY_LOCKED" ) );
+ } else {
+ aTitle += QString( " - [%1]" ).arg( sName );
+ }
}
}
}
desktop()->setCaption( aTitle );
}
+/*!Update windows after close document.*/
+void SalomeApp_Application::afterCloseDoc()
+{
+ updateWindows();
+
+ CAM_Application::afterCloseDoc();
+}
+
/*!Gets CORBA::ORB_var*/
CORBA::ORB_var SalomeApp_Application::orb()
{
return anIOR;
}
+/*!Adds icon names for modules.*/
+void SalomeApp_Application::moduleIconNames( QMap<QString, QString>& iconMap ) const
+{
+ iconMap.clear();
+
+ SUIT_ResourceMgr* resMgr = resourceMgr();
+ if ( !resMgr )
+ return;
+
+ QStringList modList;
+ modules( modList, false );
+
+ for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it )
+ {
+ QString modName = *it;
+ QString modIntr = moduleName( modName );
+ QString modIcon = resMgr->stringValue( modIntr, "icon", QString::null );
+
+ if ( modIcon.isEmpty() )
+ continue;
+
+ if ( SUIT_Tools::extension( modIcon ).isEmpty() )
+ modIcon += QString( ".png" );
+
+ iconMap.insert( modName, modIcon );
+ }
+}
+
+/*!Update module action.*/
+void SalomeApp_Application::updateModuleActions()
+{
+ QString modName;
+ if ( activeModule() )
+ modName = activeModule()->moduleName();
+
+ if ( myActions.contains( modName ) )
+ myActions[modName]->setOn( true );
+}
+
+/*!Gets current windows.
+ *\param winMap - output current windows map.
+ */
+void SalomeApp_Application::currentWindows( QMap<int, int>& winMap ) const
+{
+ winMap.clear();
+ if ( !activeStudy() )
+ return;
+
+ if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
+ ((SalomeApp_Module*)activeModule())->windows( winMap );
+ else
+ defaultWindows( winMap );
+}
+
+/*!Gets current view managers.
+ *\param lst - output current view managers list.
+ */
+void SalomeApp_Application::currentViewManagers( QStringList& lst ) const
+{
+ lst.clear();
+ if ( !activeStudy() )
+ return;
+
+ if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
+ ((SalomeApp_Module*)activeModule())->viewManagers( lst );
+ else
+ defaultViewManagers( lst );
+}
+
+/*!Update windows.*/
+void SalomeApp_Application::updateWindows()
+{
+ QMap<int, int> winMap;
+ currentWindows( winMap );
+
+ for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
+ getWindow( it.key() );
+
+ loadWindowsGeometry();
+
+ for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
+ setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) );
+}
+
+/*!Update view managers.*/
+void SalomeApp_Application::updateViewManagers()
+{
+ QStringList lst;
+ currentViewManagers( lst );
+
+ for ( QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it )
+ getViewManager( *it, true );
+}
+
+/*!Load windows geometry.*/
+void SalomeApp_Application::loadWindowsGeometry()
+{
+ QtxDockAction* dockMgr = 0;
+
+ QAction* a = action( ViewWindowsId );
+ if ( a && a->inherits( "QtxDockAction" ) )
+ dockMgr = (QtxDockAction*)a;
+
+ if ( !dockMgr )
+ return;
+
+ QString modName;
+ if ( activeModule() )
+ modName = moduleLibrary( activeModule()->moduleName(), false );
+
+ QString section = QString( "windows_geometry" );
+ if ( !modName.isEmpty() )
+ section += QString( "." ) + modName;
+
+ dockMgr->loadGeometry( resourceMgr(), section, false );
+ dockMgr->restoreGeometry();
+}
+
+/*!Save windows geometry.*/
+void SalomeApp_Application::saveWindowsGeometry()
+{
+ QtxDockAction* dockMgr = 0;
+
+ QAction* a = action( ViewWindowsId );
+ if ( a && a->inherits( "QtxDockAction" ) )
+ dockMgr = (QtxDockAction*)a;
+
+ if ( !dockMgr )
+ return;
+
+ QString modName;
+ if ( activeModule() )
+ modName = moduleLibrary( activeModule()->moduleName(), false );
+
+ QString section = QString( "windows_geometry" );
+ if ( !modName.isEmpty() )
+ section += QString( "." ) + modName;
+
+ dockMgr->storeGeometry();
+ dockMgr->saveGeometry( resourceMgr(), section, false );
+}
+
+/*!Activate windows.*/
+void SalomeApp_Application::activateWindows()
+{
+ if ( activeStudy() )
+ {
+ for ( WindowMap::Iterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
+ itr.data()->activate( activeStudy()->id() );
+ }
+}
+
/*!Private SLOT. On preferences.*/
void SalomeApp_Application::onProperties()
{
updateDesktopTitle();
}
+/*!*/
+QString SalomeApp_Application::getFileName( bool open, const QString& initial, const QString& filters,
+ const QString& caption, QWidget* parent )
+{
+ if ( !parent )
+ parent = desktop();
+ QStringList fls = QStringList::split( ";;", filters, false );
+ return SUIT_FileDlg::getFileName( parent, initial, fls, caption, open, true );
+}
+
+/*!*/
+QString SalomeApp_Application::getDirectory( const QString& initial, const QString& caption, QWidget* parent )
+{
+ if ( !parent )
+ parent = desktop();
+ return SUIT_FileDlg::getExistingDirectory( parent, initial, caption, true );
+}
+
+/*!*/
+QStringList SalomeApp_Application::getOpenFileNames( const QString& initial, const QString& filters,
+ const QString& caption, QWidget* parent )
+{
+ if ( !parent )
+ parent = desktop();
+ QStringList fls = QStringList::split( ";;", filters, false );
+ return SUIT_FileDlg::getOpenFileNames( parent, initial, fls, caption, true );
+}
+
/*!*/
void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title )
{
- LightApp_Application::contextMenuPopup( type, thePopup, title );
+ CAM_Application::contextMenuPopup( type, thePopup, title );
OB_Browser* ob = objectBrowser();
if ( !ob || type != ob->popupClientType() )
return;
+ thePopup->insertSeparator();
+ thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
+
// Get selected objects
SALOME_ListIO aList;
- LightApp_SelectionMgr* mgr = selectionMgr();
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(aList);
// "Delete reference" item should appear only for invalid references
{
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
_PTR(Study) aStudyDS = aStudy->studyDS();
- _PTR(SObject) anObj;
+ _PTR(SObject) anObj;
+
for ( SALOME_ListIteratorOfListIO it( aList ); it.More() && isInvalidRefs; it.Next() )
{
if ( it.Value()->hasEntry() )
{
_PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() );
- SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(aSObject.get());
- if( aSO )
- if ( aSObject->ReferencedObject(anObj) == false || !QString(anObj->GetName().c_str()).isEmpty() )
- isInvalidRefs = false;
+ if ( aSObject->ReferencedObject(anObj) == false || !QString(anObj->GetName().c_str()).isEmpty() )
+ isInvalidRefs = false;
}
}
}
if (currentModule && currentModule->moduleName() == aModuleTitle)
return;
thePopup->insertItem( tr( "MEN_OPENWITH" ), this, SLOT( onOpenWith() ) );
+
}
/*!Update obect browser*/
void SalomeApp_Application::updateObjectBrowser( const bool updateModels )
{
+ // update existing data models (already loaded SComponents)
+ if ( updateModels )
+ {
+ for ( ModuleListIterator it = modules(); it.current(); ++it )
+ {
+ CAM_DataModel* camDM = it.current()->dataModel();
+ if ( camDM && camDM->inherits( "SalomeApp_DataModel" ) )
+ ((SalomeApp_DataModel*)camDM)->update();
+ }
+ }
// update "non-existing" (not loaded yet) data models
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
- if ( study )
+ if ( study )
{
_PTR(Study) stdDS = study->studyDS();
- if( stdDS )
+ if( stdDS )
{
- for ( _PTR(SComponentIterator) it ( stdDS->NewComponentIterator() ); it->More(); it->Next() )
+ for ( _PTR(SComponentIterator) it ( stdDS->NewComponentIterator() ); it->More(); it->Next() )
{
- _PTR(SComponent) aComponent ( it->Value() );
+ _PTR(SComponent) aComponent ( it->Value() );
if ( aComponent->ComponentDataType() == "Interface Applicative" )
continue; // skip the magic "Interface Applicative" component
-
+
SalomeApp_DataModel::BuildTree( aComponent, study->root(), study, /*skipExisitng=*/true );
}
}
}
- LightApp_Application::updateObjectBrowser(updateModels);
+
+ if ( objectBrowser() )
+ {
+ objectBrowser()->updateGeometry();
+ objectBrowser()->updateTree();
+ }
+}
+
+/*!Protected SLOT.On desktop activated.*/
+void SalomeApp_Application::onDesktopActivated()
+{
+ CAM_Application::onDesktopActivated();
+ SalomeApp_Module* aModule = dynamic_cast<SalomeApp_Module*>(activeModule());
+ if(aModule)
+ aModule->studyActivated();
+}
+
+/*!Create empty study.*/
+void SalomeApp_Application::createEmptyStudy()
+{
+ CAM_Application::createEmptyStudy();
+ if ( objectBrowser() )
+ objectBrowser()->updateTree();
+}
+
+/*!Activate module \a mod.*/
+bool SalomeApp_Application::activateModule( CAM_Module* mod )
+{
+ bool res = CAM_Application::activateModule( mod );
+ if ( objectBrowser() )
+ objectBrowser()->updateTree();
+ return res;
}
/*!Display Catalog Genenerator dialog */
regWnd->setActiveWindow();
}
-/*!Private SLOT. */
-void SalomeApp_Application::onOpenWith()
+/*!return keyborad accelerators manager object */
+SUIT_Accel* SalomeApp_Application::accel() const
{
- QApplication::setOverrideCursor( Qt::waitCursor );
- SALOME_ListIO aList;
- LightApp_SelectionMgr* mgr = selectionMgr();
- mgr->selectedObjects(aList);
- if (aList.Extent() != 1)
- {
- QApplication::restoreOverrideCursor();
- return;
- }
- Handle(SALOME_InteractiveObject) aIObj = aList.First();
- QString aModuleName(aIObj->getComponentDataType());
- QString aModuleTitle = moduleTitle(aModuleName);
- activateModule(aModuleTitle);
- QApplication::restoreOverrideCursor();
+ return myAccel;
}
#endif // _MSC_VER > 1000
#include "SalomeApp.h"
-#include <LightApp_Application.h>
+#include <CAM_Application.h>
#include <CORBA.h>
class QComboBox;
class QDockWindow;
-class LightApp_Preferences;
+class LogWindow;
+class OB_Browser;
+class PythonConsole;
class SalomeApp_Module;
+class SalomeApp_Preferences;
+class SalomeApp_SelectionMgr;
+class SalomeApp_WidgetContainer;
+class SUIT_Accel;
class SALOME_LifeCycleCORBA;
Description : Application containing SalomeApp module
*/
-class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
+class SALOMEAPP_EXPORT SalomeApp_Application : public CAM_Application
{
Q_OBJECT
public:
- enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
- CatalogGenId, RegDisplayId, UserID };
+ typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
+
+ enum { ModulesListId = STD_Application::UserID, NewGLViewId,
+ NewPlot2dId, NewOCCViewId, NewVTKViewId, DumpStudyId,
+ LoadScriptId, PropertiesId, PreferencesId, MRUId,
+ CatalogGenId, RegDisplayId, UserID };
public:
SalomeApp_Application();
virtual ~SalomeApp_Application();
+
+ virtual QString applicationName() const;
+ virtual QString applicationVersion() const;
+
+ virtual CAM_Module* loadModule( const QString& );
+ virtual bool activateModule( const QString& );
+
+ virtual bool useStudy( const QString& );
+
+ SalomeApp_SelectionMgr* selectionMgr() const;
+
+ LogWindow* logWindow();
+ OB_Browser* objectBrowser();
+ PythonConsole* pythonConsole();
- virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
virtual void updateObjectBrowser( const bool = true );
+ SalomeApp_Preferences* preferences() const;
+
virtual QString getFileFilter() const;
+ virtual QString getFileName( bool open, const QString& initial, const QString& filters,
+ const QString& caption, QWidget* parent );
+ virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
+ virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
+ const QString& caption, QWidget* parent );
SUIT_ViewManager* getViewManager( const QString&, const bool );
+ void updateActions();
+
+ QWidget* getWindow( const int, const int = -1 );
+
+ QWidget* window( const int, const int = -1 ) const;
+ void addWindow( QWidget*, const int, const int = -1 );
+ void removeWindow( const int, const int = -1 );
+
+ bool isWindowVisible( const int ) const;
+ void setWindowShown( const int, const bool );
+
virtual void start();
+ virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
+
+ virtual void createEmptyStudy();
+
+ SUIT_Accel* accel() const;
+
static CORBA::ORB_var orb();
static SALOMEDSClient_StudyManager* studyMgr();
static SALOME_NamingService* namingService();
static SALOME_LifeCycleCORBA* lcc();
static QString defaultEngineIOR();
+signals:
+ void studyOpened();
+ void studySaved();
+ void studyClosed();
+
public slots:
+ virtual void onNewDoc();
+ virtual void onOpenDoc();
+ virtual void onHelpAbout();
+ virtual bool onOpenDoc( const QString& );
virtual void onLoadDoc();
+ virtual bool onLoadDoc( const QString& );
virtual void onCopy();
virtual void onPaste();
+private slots:
+ void onSelection();
+ void onRefresh();
+ void onDeleteReferences();
+
protected:
virtual void createActions();
virtual SUIT_Study* createNewStudy();
virtual QWidget* createWindow( const int );
+ virtual void defaultWindows( QMap<int, int>& ) const;
+ virtual void defaultViewManagers( QStringList& ) const;
+
+ virtual void setActiveStudy( SUIT_Study* );
virtual void updateCommandsStatus();
+
virtual void onSelectionChanged();
- virtual void createPreferences( LightApp_Preferences* );
+ virtual void beforeCloseDoc( SUIT_Study* );
+ virtual void afterCloseDoc();
+
+ virtual void moduleAdded( CAM_Module* );
+ virtual bool activateModule( CAM_Module* = 0 );
+
+ SalomeApp_Preferences* preferences( const bool ) const;
+
+ virtual void createPreferences( SalomeApp_Preferences* );
+ virtual void preferencesChanged( const QString&, const QString& );
virtual void updateDesktopTitle();
+protected slots:
+ virtual void onDesktopActivated();
+
private slots:
- void onDeleteReferences();
+ void onNewWindow();
+ void onModuleActivation( QAction* );
+ void onCloseView( SUIT_ViewManager* );
+
+ void onStudyCreated( SUIT_Study* );
+ void onStudyOpened( SUIT_Study* );
+ void onStudySaved( SUIT_Study* );
+ void onStudyClosed( SUIT_Study* );
+
void onProperties();
void onDumpStudy();
void onLoadScript();
+ void onPreferences();
+ void onMRUActivated( QString );
+
void onCatalogGen();
void onRegDisplay();
+
+ void onPreferenceChanged( QString&, QString&, QString& );
void onOpenWith();
+
+private:
+ void updateWindows();
+ void updateViewManagers();
+ void updateModuleActions();
+
+ void loadWindowsGeometry();
+ void saveWindowsGeometry();
+
+ void updatePreference( const QString&, const QString&, const QString& );
+
+ QString defaultModule() const;
+ void currentWindows( QMap<int, int>& ) const;
+ void currentViewManagers( QStringList& ) const;
+ SUIT_ViewManager* createViewManager( const QString& vmType );
+ void moduleIconNames( QMap<QString, QString>& ) const;
+
+ void activateWindows();
+
+private:
+ typedef QMap<QString, QAction*> ActionMap;
+ typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
+
+private:
+ SalomeApp_Preferences* myPrefs;
+ SalomeApp_SelectionMgr* mySelMgr;
+ ActionMap myActions;
+ WindowMap myWindows;
+
+ SUIT_Accel* myAccel;
+
+ static SalomeApp_Preferences* _prefs_;
};
#ifdef WIN32
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Study.h"
+#include "SalomeApp_RootObject.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Module.h"
#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
#include "SalomeApp_Engine_i.hxx"
-#include "LightApp_RootObject.h"
-
#include <CAM_DataObject.h>
#include <SUIT_Application.h>
for ( DataObjectListIterator it( allComponents ); it.current(); ++it ) {
SUIT_DataObject* componentObj = it.current();
if ( componentObj->name() == aSName ) {
- //mkr : modifications for update already published in
- //object browser, but not loaded yet component
- LightApp_Application* anApp = dynamic_cast<LightApp_Application*>
- ( SUIT_Session::session()->activeApplication() );
- // asv : corresponding DataObjects are DELETED before update (so they are re-built).
+ // mkr : modifications for update of already published in
+ // object browser, but not loaded yet components
+ CAM_Application* anApp = dynamic_cast<CAM_Application*>
+ (SUIT_Session::session()->activeApplication());
+
+ // asv : corresponding DataObjects are DELETED before update (so they are re-built).
if (anApp && !anApp->module(aSName)) { // if module is not loaded, delete it's DataObject
// jfa: remove children before DataObject deletion
DataObjectList chilren = componentObj->children(/*recursive=*/true);
/*!Purpose : Constructor*/
//=======================================================================
SalomeApp_DataModel::SalomeApp_DataModel( CAM_Module* theModule )
-: LightApp_DataModel( theModule )
+: CAM_DataModel( theModule )
{
}
// Function : open
/*! Purpose : Open data model*/
//================================================================
-bool SalomeApp_DataModel::open( const QString& name, CAM_Study* study )
+bool SalomeApp_DataModel::open( const QString&, CAM_Study* study )
{
SalomeApp_Study* aDoc = dynamic_cast<SalomeApp_Study*>( study );
if ( !aDoc )
if ( anId.isEmpty() )
return true; // Probably nothing to load
+ QString anEngine = getModule()->engineIOR();
+ if ( anEngine == "-1" ) {
+ // Module doesn't have a CORBA engine and doesn't use
+ // a default one -> SALOMEDS persistence cannot be used
+ return false;
+ }
+
+ if ( anEngine.isEmpty() ) {
+ // Module use a default engine
+ //TODO: deside, if the below code has to be copyed in a light data model to avoid bulding of data tree twice
+ anEngine = SalomeApp_Application::defaultEngineIOR();
+ }
+
_PTR(Study) aStudy ( aDoc->studyDS() ); // shared_ptr cannot be used here
_PTR(SComponent) aSComp ( aStudy->FindComponentID( std::string( anId.latin1() ) ) );
- if ( aSComp )
- buildTree( aSComp, 0, aDoc );
- LightApp_DataModel::open(name, study);
+ if ( aSComp ) {
+ _PTR(StudyBuilder) aBuilder( aStudy->NewBuilder() );
+ if ( aBuilder ) {
+ try {
+ aBuilder->LoadWith( aSComp, std::string( anEngine.latin1() ) );
+ }
+ catch( const SALOME::SALOME_Exception& ) {
+ // Oops, something went wrong while loading -> return an error
+ return false;
+ }
+
+ // Something has been read -> create data model tree
+ buildTree( aSComp, 0, aDoc );
+ }
+ } else {
+ // Don't return false here, for there might be no data
+ // for a given component in the study yet
+ }
+
+ emit opened(); //TODO: is it really needed? to be removed maybe...
+ return true;
+}
+
+//================================================================
+// Function : save
+/*! Purpose : Emit saved()*/
+//================================================================
+bool SalomeApp_DataModel::save()
+{
+ emit saved();
+ return true;
+}
+
+//================================================================
+// Function : saveAs
+/*! Purpose : Emit saved() */
+//================================================================
+bool SalomeApp_DataModel::saveAs( const QString&, CAM_Study* )
+{
+ emit saved();
+ return true;
+}
+
+//================================================================
+// Function : close
+/*! Purpose : Emit closed()*/
+//================================================================
+bool SalomeApp_DataModel::close()
+{
+ emit closed();
return true;
}
// Function : update
/*! Purpose : Update application.*/
//================================================================
-void SalomeApp_DataModel::update( LightApp_DataObject*, LightApp_Study* study )
+void SalomeApp_DataModel::update( SalomeApp_DataObject*, SalomeApp_Study* study )
{
- SalomeApp_Study* aSStudy = 0;
- LightApp_RootObject* studyRoot = 0;
+ SalomeApp_RootObject* studyRoot = 0;
_PTR(SObject) sobj;
SalomeApp_DataObject* modelRoot = dynamic_cast<SalomeApp_DataObject*>( root() );
if ( !modelRoot ){ // not yet connected to a study -> try using <study> argument
- aSStudy = dynamic_cast<SalomeApp_Study*>( study );
- if ( !aSStudy )
- aSStudy = dynamic_cast<SalomeApp_Study*>( getModule()->getApp()->activeStudy() );
- if ( aSStudy ){
- studyRoot = dynamic_cast<LightApp_RootObject*>( aSStudy->root() );
- if ( studyRoot ) {
- QString anId = getRootEntry( aSStudy );
- if ( !anId.isEmpty() ){ // if nothing is published in the study for this module -> do nothing
- _PTR(Study) aStudy ( aSStudy->studyDS() );
- sobj = aStudy->FindComponentID( std::string( anId.latin1() ) );
- }
+ if ( !study )
+ study = dynamic_cast<SalomeApp_Study*>( getModule()->getApp()->activeStudy() );
+
+ if ( study ){
+ studyRoot = dynamic_cast<SalomeApp_RootObject*>( study->root() );
+ QString anId = getRootEntry( study );
+ if ( !anId.isEmpty() ){ // if nothing is published in the study for this module -> do nothing
+ _PTR(Study) aStudy ( study->studyDS() );
+ sobj = aStudy->FindComponentID( std::string( anId.latin1() ) );
}
}
}
else{
- studyRoot = dynamic_cast<LightApp_RootObject*>( modelRoot->root() );
- if ( studyRoot ) {
- aSStudy = dynamic_cast<SalomeApp_Study*>( study );
- if ( aSStudy ) {
- aSStudy = dynamic_cast<SalomeApp_Study*>( studyRoot->study() ); // <study> value should not change here theoretically, but just to make sure
- if ( aSStudy ) {
- _PTR(Study) aStudy ( aSStudy->studyDS() );
- // modelRoot->object() cannot be reused here: it is about to be deleted by buildTree() soon
- sobj = aStudy->FindComponentID( std::string( modelRoot->entry().latin1() ) );
- }
- }
- }
+ studyRoot = dynamic_cast<SalomeApp_RootObject*>( modelRoot->root() );
+ study = studyRoot->study(); // <study> value should not change here theoretically, but just to make sure
+ _PTR(Study) aStudy ( study->studyDS() );
+
+ // modelRoot->object() cannot be reused here: it is about to be deleted by buildTree() soon
+ sobj = aStudy->FindComponentID( std::string( modelRoot->entry().latin1() ) );
}
- buildTree( sobj, studyRoot, aSStudy );
+ buildTree( sobj, studyRoot, study );
}
//================================================================
SalomeApp_Study* SalomeApp_DataModel::getStudy() const
{
if(!root()) return 0;
- LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root()->root() );
+ SalomeApp_RootObject* aRoot = dynamic_cast<SalomeApp_RootObject*>( root()->root() );
if ( !aRoot )
return 0;
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( aRoot->study() );
- if ( !aStudy )
- return 0;
- return aStudy;
+ return aRoot->study();
}
//================================================================
}
return anEntry;
}
+
+//================================================================
+// Function : isModified
+/*! Purpose : default implementation, always returns false so as not to mask study's isModified()*/
+//================================================================
+bool SalomeApp_DataModel::isModified() const
+{
+ return false;
+}
+
+//================================================================
+// Function : isSaved
+/*! Purpose : default implementation, always returns true so as not to mask study's isSaved()*/
+//================================================================
+bool SalomeApp_DataModel::isSaved() const
+{
+ return true;
+}
+
+// BEGIN: methods to be used by CORBAless modules
+
+//================================================================
+// Function : GetListOfFiles
+/*! Purpose : to be used by CORBAless modules*/
+//================================================================
+std::vector<std::string> SalomeApp_DataModel::GetListOfFiles() const
+ //(const int theStudyId, const char* theComponentName) const
+{
+ SUIT_Study* anActiveStudy = getModule()->getApp()->activeStudy();
+ if (anActiveStudy) {
+ int aStudyId = anActiveStudy->id();
+ SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
+ if (aDefaultEngine) {
+ return aDefaultEngine->GetListOfFiles(aStudyId, module()->name());
+ }
+ }
+
+ std::vector<std::string> aListOfFiles;
+ return aListOfFiles;
+}
+
+//================================================================
+// Function : SetListOfFiles
+/*! Purpose : to be used by CORBAless modules*/
+//================================================================
+void SalomeApp_DataModel::SetListOfFiles (const std::vector<std::string> theListOfFiles)
+ //(const std::vector<std::string> theListOfFiles,
+ // const int theStudyId,
+ // const char* theComponentName)
+{
+ SUIT_Study* anActiveStudy = getModule()->getApp()->activeStudy();
+ if (anActiveStudy) {
+ int aStudyId = anActiveStudy->id();
+ SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
+ if (aDefaultEngine) {
+ aDefaultEngine->SetListOfFiles(theListOfFiles, aStudyId, module()->name());
+ }
+ }
+}
+
+//================================================================
+// Function : GetTmpDir
+/*! Purpose : Static method. To be used by CORBAless modules*/
+//================================================================
+std::string SalomeApp_DataModel::GetTmpDir (const char* theURL,
+ const bool isMultiFile)
+{
+ std::string anURLDir = SALOMEDS_Tool::GetDirFromPath(theURL);
+ std::string aTmpDir = isMultiFile ? anURLDir : SALOMEDS_Tool::GetTmpDir();
+ return aTmpDir;
+}
+
+//================================================================
+// Function : RemoveTemporaryFiles
+/*! Purpose : to be used by CORBAless modules*/
+//================================================================
+void SalomeApp_DataModel::RemoveTemporaryFiles (const bool isMultiFile) const
+{
+ if (isMultiFile)
+ return;
+
+ std::vector<std::string> aListOfFiles = GetListOfFiles();
+ if (aListOfFiles.size() > 0) {
+ std::string aTmpDir = aListOfFiles[0];
+
+ const int n = aListOfFiles.size() - 1;
+ SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
+ aSeq->length(n);
+ for (int i = 0; i < n; i++)
+ aSeq[i] = CORBA::string_dup(aListOfFiles[i + 1].c_str());
+
+ SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
+ }
+}
+
+// END: methods to be used by CORBAless modules
#endif // _MSC_VER > 1000
#include "SalomeApp.h"
-#include "LightApp_DataModel.h"
+#include "CAM_DataModel.h"
#include "SALOMEDSClient.hxx"
class SalomeApp_Module;
class SalomeApp_Study;
class SalomeApp_DataObject;
+class SalomeApp_SelectionMgr;
// Class : SalomeApp_DataModel
/// Description : Base class of data model
-class SALOMEAPP_EXPORT SalomeApp_DataModel : public LightApp_DataModel
+class SALOMEAPP_EXPORT SalomeApp_DataModel : public CAM_DataModel
{
Q_OBJECT
SalomeApp_DataModel ( CAM_Module* theModule );
virtual ~SalomeApp_DataModel();
+ /** @name These methods should be redefined in successors.*/
+ //@{
virtual bool open( const QString&, CAM_Study* );
- virtual void update( LightApp_DataObject* = 0, LightApp_Study* = 0 );
+ virtual bool save();
+ virtual bool saveAs( const QString&, CAM_Study* );
+ virtual bool close();
- QString getRootEntry( SalomeApp_Study* ) const;
- SalomeApp_Module* getModule() const;
+ virtual void update( SalomeApp_DataObject* = 0, SalomeApp_Study* = 0 );
+
+ virtual bool isModified() const;
+ virtual bool isSaved() const;
+ //@}
+
+signals:
+ void opened();
+ void saved();
+ void closed();
protected:
+ SalomeApp_Module* getModule() const;
SalomeApp_Study* getStudy() const;
virtual void buildTree(const _PTR(SObject)&, SUIT_DataObject*, SalomeApp_Study* );
+
+ /** @name methods to be used by CORBAless modules*/
+ //@{
+ std::vector<std::string> GetListOfFiles () const;
+ void SetListOfFiles (const std::vector<std::string> theListOfFiles);
+
+ static std::string GetTmpDir (const char* theURL,
+ const bool isMultiFile);
+
+ void RemoveTemporaryFiles (const bool isMultiFile) const;
+ //@}
+ // END: methods to be used by CORBAless modules
+
+private:
+ QString getRootEntry( SalomeApp_Study* ) const;
};
#endif
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Study.h"
-#include "LightApp_RootObject.h"
+#include "SalomeApp_RootObject.h"
#include <SUIT_Application.h>
#include <SUIT_ResourceMgr.h>
#include <SALOMEDSClient_AttributeTableOfReal.hxx>
#include <SALOMEDSClient_AttributeTableOfInteger.hxx>
+/*!
+ Class: SalomeApp_DataObject::Key
+ Level: Internal
+*/
+class SalomeApp_DataObject::Key : public SUIT_DataObjectKey
+{
+public:
+ Key( const QString& );
+ virtual ~Key();
+
+ virtual bool isLess( const SUIT_DataObjectKey* ) const;
+ virtual bool isEqual( const SUIT_DataObjectKey* ) const;
+
+private:
+ QString myEntry;
+};
+
+/*!Constructor. Initialize by \a entry.*/
+SalomeApp_DataObject::Key::Key( const QString& entry )
+: SUIT_DataObjectKey(),
+ myEntry( entry )
+{
+}
+
+/*!Destructor. Do nothing.*/
+SalomeApp_DataObject::Key::~Key()
+{
+}
+
+/*!Checks: Is current key less than \a other.*/
+bool SalomeApp_DataObject::Key::isLess( const SUIT_DataObjectKey* other ) const
+{
+ Key* that = (Key*)other;
+ return myEntry < that->myEntry;
+}
+
+/*!Checks: Is current key equal with \a other.*/
+bool SalomeApp_DataObject::Key::isEqual( const SUIT_DataObjectKey* other ) const
+{
+ Key* that = (Key*)other;
+ return myEntry == that->myEntry;
+}
+
/*
Class: SalomeApp_DataObject
Level: Public
*/
/*!Constructor. Initialize by \a parent*/
SalomeApp_DataObject::SalomeApp_DataObject( SUIT_DataObject* parent )
-: LightApp_DataObject( parent ),
- CAM_DataObject( parent )
+: CAM_DataObject( parent )
{
}
/*!Constructor. Initialize by \a parent and SObject*/
SalomeApp_DataObject::SalomeApp_DataObject( const _PTR(SObject)& sobj, SUIT_DataObject* parent )
-: LightApp_DataObject( parent ),
- CAM_DataObject( parent )
+: CAM_DataObject( parent )
{
myObject = sobj;
}
return QString::null;
}
+/*!Create and return new key object.*/
+SUIT_DataObjectKey* SalomeApp_DataObject::key() const
+{
+ QString str = entry();
+ return new Key( str );
+}
+
/*!Gets name of object.*/
QString SalomeApp_DataObject::name() const
{
_PTR(AttributePixMap) aPixAttr ( anAttr );
if ( aPixAttr->HasPixMap() ){
QString pixmapName = QObject::tr( aPixAttr->GetPixMap().c_str() );
- LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
+ SalomeApp_RootObject* aRoot = dynamic_cast<SalomeApp_RootObject*>( root() );
if ( aRoot && aRoot->study() ) {
QPixmap pixmap = aRoot->study()->application()->resourceMgr()->loadPixmap( componentDataType(), pixmapName, false );
return pixmap;
return QString( "Object \'%1\', module \'%2\', ID=%3" ).arg( name() ).arg( componentDataType() ).arg( entry() );
}
+/*!Gets component object.
+ *\retval SUIT_DataObject.
+ */
+SUIT_DataObject* SalomeApp_DataObject::componentObject() const
+{
+ SUIT_DataObject* compObj = 0; // for root object (invisible SALOME_ROOT_OBJECT)
+
+ if ( parent() && parent() == root() )
+ compObj = (SUIT_DataObject*)this; // for component-level objects
+ else
+ {
+ compObj = parent(); // for lower level objects
+ while ( compObj && compObj->parent() != root() )
+ compObj = compObj->parent();
+ }
+
+ return compObj;
+}
+
/*!Get component type.*/
QString SalomeApp_DataObject::componentDataType() const
{
#include "SalomeApp.h"
-#include "LightApp_DataObject.h"
+#include "CAM_DataObject.h"
#include "CAM_RootObject.h"
#include "SALOMEDSClient.hxx"
class SalomeApp_Study;
-class SALOMEAPP_EXPORT SalomeApp_DataObject : public LightApp_DataObject
+class SALOMEAPP_EXPORT SalomeApp_DataObject : public virtual CAM_DataObject
{
+ class Key;
public:
enum { CT_Value, CT_Entry, CT_IOR, CT_RefEntry };
virtual QString text( const int ) const;
virtual QColor color( const ColorRole ) const;
+ virtual SUIT_DataObjectKey* key() const;
virtual QString entry() const;
/*! location of corresponding SALOMEDS::SObject */
bool isReference() const;
_PTR(SObject) referencedObject() const;
+ SUIT_DataObject* componentObject() const;
/*! GEOM, SMESH, VISU, etc.*/
QString componentDataType() const;
#include "SalomeApp_Study.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Application.h"
-
-#include "LightApp_Preferences.h"
+#include "SalomeApp_Preferences.h"
#include "SalomeApp_UpdateFlags.h"
#include "SalomeApp_Operation.h"
#include "SalomeApp_SwitchOp.h"
-#include "SUIT_Operation.h"
-#include "CAM_DataModel.h"
+#include <OB_Browser.h>
+
+#include <CAM_Study.h>
-#include "OB_Browser.h"
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
-#include <qstring.h>
-#include <qmap.h>
+#include <QtxPopupMgr.h>
#include <SVTK_ViewWindow.h>
#include <OCCViewer_ViewWindow.h>
/*!Constructor.*/
SalomeApp_Module::SalomeApp_Module( const QString& name )
-: LightApp_Module( name ),
+: CAM_Module( name ),
+myPopupMgr( 0 ),
mySwitchOp( 0 )
{
}
delete mySwitchOp;
}
-/*!Gets application.*/
-SalomeApp_Application* SalomeApp_Module::getApp() const
+/*!Initialize module.*/
+void SalomeApp_Module::initialize( CAM_Application* app )
{
- return (SalomeApp_Application*)application();
+ CAM_Module::initialize( app );
+
+ SUIT_ResourceMgr* resMgr = app ? app->resourceMgr() : 0;
+ if ( resMgr )
+ resMgr->raiseTranslators( name() );
}
/*!Activate module.*/
bool SalomeApp_Module::activateModule( SUIT_Study* study )
{
- bool res = LightApp_Module::activateModule( study );
+ bool res = CAM_Module::activateModule( study );
+
+ if ( res && application() && application()->resourceMgr() )
+ application()->resourceMgr()->raiseTranslators( name() );
if ( mySwitchOp == 0 )
mySwitchOp = new SalomeApp_SwitchOp( this );
-
+
return res;
}
/*!Deactivate module.*/
-bool SalomeApp_Module::deactivateModule( SUIT_Study* study )
+bool SalomeApp_Module::deactivateModule( SUIT_Study* )
{
- bool res = LightApp_Module::deactivateModule( study );
-
delete mySwitchOp;
mySwitchOp = 0;
+
+ return true;
+}
- return res;
+/*!NOT IMPLEMENTED*/
+void SalomeApp_Module::selectionChanged()
+{
+}
+
+/*!NOT IMPLEMENTED*/
+void SalomeApp_Module::MenuItem()
+{
+}
+
+/*!NOT IMPLEMENTED*/
+void SalomeApp_Module::windows( QMap<int, int>& ) const
+{
+}
+
+/*!NOT IMPLEMENTED*/
+void SalomeApp_Module::viewManagers( QStringList& ) const
+{
+}
+
+/*!NOT IMPLEMENTED*/
+void SalomeApp_Module::createPreferences()
+{
+}
+
+/*!NOT IMPLEMENTED*/
+void SalomeApp_Module::preferencesChanged( const QString&, const QString& )
+{
+}
+
+/*!Gets application.*/
+SalomeApp_Application* SalomeApp_Module::getApp() const
+{
+ return (SalomeApp_Application*)application();
+}
+
+/*!NOT IMPLEMENTED*/
+void SalomeApp_Module::onModelOpened()
+{
+}
+
+/*!NOT IMPLEMENTED*/
+void SalomeApp_Module::onModelSaved()
+{
+}
+
+/*!NOT IMPLEMENTED*/
+void SalomeApp_Module::onModelClosed()
+{
+}
+
+/*!Gets popup manager.(create if not exist)*/
+QtxPopupMgr* SalomeApp_Module::popupMgr()
+{
+ if ( !myPopupMgr )
+ myPopupMgr = new QtxPopupMgr( 0, this );
+ return myPopupMgr;
+}
+
+/*!Gets preferences.*/
+SalomeApp_Preferences* SalomeApp_Module::preferences() const
+{
+ SalomeApp_Preferences* pref = 0;
+ if ( getApp() )
+ pref = getApp()->preferences();
+ return pref;
}
/*!Create new instance of data model and return it.*/
return new SalomeApp_DataModel(this);
}
+/*!Update object browser.*/
+void SalomeApp_Module::updateObjBrowser( bool updateDataModel, SUIT_DataObject* root )
+{
+ if( updateDataModel )
+ if( CAM_DataModel* aDataModel = dataModel() )
+ if( SalomeApp_DataModel* aModel = dynamic_cast<SalomeApp_DataModel*>( aDataModel ) )
+ aModel->update( 0, dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
+ getApp()->objectBrowser()->updateTree( root );
+}
+
+/*!Context menu popup.*/
+void SalomeApp_Module::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ )
+{
+ SalomeApp_Selection* sel = createSelection();
+ sel->init( client, getApp()->selectionMgr() );
+ popupMgr()->updatePopup( menu, sel );
+ delete sel;
+}
+
+/*!Create and return instance of SalomeApp_Selection.*/
+SalomeApp_Selection* SalomeApp_Module::createSelection() const
+{
+ return new SalomeApp_Selection();
+}
+
+/*!Add preference to preferences.*/
+int SalomeApp_Module::addPreference( const QString& label )
+{
+ SalomeApp_Preferences* pref = preferences();
+ if ( !pref )
+ return -1;
+
+ int catId = pref->addPreference( moduleName(), -1 );
+ if ( catId == -1 )
+ return -1;
+
+ return pref->addPreference( label, catId );
+}
+
+/*!Add preference to preferences.*/
+int SalomeApp_Module::addPreference( const QString& label, const int pId, const int type,
+ const QString& section, const QString& param )
+{
+ SalomeApp_Preferences* pref = preferences();
+ if ( !pref )
+ return -1;
+
+ return pref->addPreference( moduleName(), label, pId, type, section, param );
+}
+
+/*!Gets property of preferences.*/
+QVariant SalomeApp_Module::preferenceProperty( const int id, const QString& prop ) const
+{
+ QVariant var;
+ SalomeApp_Preferences* pref = preferences();
+ if ( pref )
+ var = pref->itemProperty( id, prop );
+ return var;
+}
+
+
+/*!Set property of preferences.*/
+void SalomeApp_Module::setPreferenceProperty( const int id, const QString& prop, const QVariant& var )
+{
+ SalomeApp_Preferences* pref = preferences();
+ if ( pref )
+ pref->setItemProperty( id, prop, var );
+}
+
/*!
* \brief Update something in accordance with update flags
* \param theFlags - update flags
if ( theFlags & UF_Model )
{
if( CAM_DataModel* aDataModel = dataModel() )
- if( SalomeApp_DataModel* aModel = dynamic_cast<SalomeApp_DataModel*>( aDataModel ) ) {
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
- if (aStudy)
- aModel->update( 0, aStudy );
- }
+ if( SalomeApp_DataModel* aModel = dynamic_cast<SalomeApp_DataModel*>( aDataModel ) )
+ aModel->update( 0, dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
}
if ( theFlags & UF_ObjBrowser )
getApp()->objectBrowser()->updateTree( 0 );
#define SALOMEAPP_MODULE_H
#include "SalomeApp.h"
+#include "SalomeApp_Selection.h"
-#include <LightApp_Module.h>
+#include <CAM_Module.h>
#include <string>
-class CAM_DataModel;
-class SUIT_DataObject;
+class QDockWindow;
+
+class CAM_Study;
+
+class QtxPopupMgr;
+
class SUIT_Operation;
-class SalomeApp_Application;
+class SUIT_Convertor;
+class SUIT_ViewModel;
+class SUIT_DataObject;
+class SalomeApp_DataModel;
+class SalomeApp_Application;
+class SalomeApp_Preferences;
+class SalomeApp_SelectionManager;
class SalomeApp_Operation;
class SalomeApp_SwitchOp;
/*!
* \brief Base class for all salome modules
*/
-class SALOMEAPP_EXPORT SalomeApp_Module : public LightApp_Module
+class SALOMEAPP_EXPORT SalomeApp_Module : public CAM_Module
{
Q_OBJECT
SalomeApp_Module( const QString& );
virtual ~SalomeApp_Module();
+ virtual void initialize( CAM_Application* );
+ virtual void windows( QMap<int, int>& ) const;
+ virtual void viewManagers( QStringList& ) const;
+
/*! engineIOR() should be a pure virtual method, to avoid logical errors!\n
* Implementation in derived classes can return the following values:\n
* module`s engine IOR - means that this is a standard SALOME module with a CORBA engine
* \li "-1" - means that this is a light module, SALOMEDS persistence is not used at all\n
*/
virtual QString engineIOR() const = 0;
+
+ virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
+
+ virtual void createPreferences();
/*! Convenient shortcuts*/
// ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
// for their own purposes
+ void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
+ // Update object bropwser ( for updating model or whole object browser use update() method
+ // can be used )
+
+ virtual void selectionChanged();
+ virtual void preferencesChanged( const QString&, const QString& );
+
+ virtual void studyActivated() {};
+
public slots:
virtual bool activateModule( SUIT_Study* );
virtual bool deactivateModule( SUIT_Study* );
+ void MenuItem();
+
protected slots:
+ virtual void onModelSaved();
+ virtual void onModelOpened();
+ virtual void onModelClosed();
virtual void onOperationStopped( SUIT_Operation* );
virtual void onOperationDestroyed();
- protected:
- virtual CAM_DataModel* createDataModel();
+protected:
+ QtxPopupMgr* popupMgr();
+ SalomeApp_Preferences* preferences() const;
+ virtual CAM_DataModel* createDataModel();
+ virtual SalomeApp_Selection* createSelection() const;
virtual void updateControls();
/*! Module stores operations in map. This method starts operation by id.
*/
virtual SalomeApp_Operation* createOperation( const int ) const;
+ int addPreference( const QString& label );
+ int addPreference( const QString& label, const int pId, const int = -1,
+ const QString& section = QString::null,
+ const QString& param = QString::null );
+ QVariant preferenceProperty( const int, const QString& ) const;
+ void setPreferenceProperty( const int, const QString&, const QVariant& );
+
private:
typedef QMap<int,SalomeApp_Operation*> MapOfOperation;
private:
+ QtxPopupMgr* myPopupMgr;
MapOfOperation myOperations;
- SalomeApp_SwitchOp* mySwitchOp;
+ SalomeApp_SwitchOp* mySwitchOp;
};
#endif
#include <SalomeApp_Module.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Operation.h>
-#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_SelectionMgr.h>
#include <SalomeApp_Dialog.h>
#include <SUIT_Desktop.h>
*
* This method provided for convinience calls SalomeApp_Application::selectionMgr() one
*/
-LightApp_SelectionMgr* SalomeApp_Operation::selectionMgr() const
+SalomeApp_SelectionMgr* SalomeApp_Operation::selectionMgr() const
{
SUIT_Application* app = application();
if ( app != 0 && app->inherits( "SalomeApp_Application" ) )
class SalomeApp_Module;
class SalomeApp_Application;
class SalomeApp_Operation;
-class LightApp_SelectionMgr;
+class SalomeApp_SelectionMgr;
class SalomeApp_Dialog;
class SUIT_Desktop;
SUIT_Desktop* desktop() const;
SUIT_Operation* activeOperation() const;
- LightApp_SelectionMgr* selectionMgr() const;
+ SalomeApp_SelectionMgr* selectionMgr() const;
void update( const int );
void setAutoResumed( const bool );
#include <utilities.h>
#include <Container_init_python.hxx>
-
-#include <string>
-#include <vector>
-
-#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)!
-
-#include <cStringIO.h>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
/*!
* constructor : multi Python interpreter, one per SALOME study.
return true;
}
-
-void SalomeApp_PyInterp::init_python()
-{
- /*
- * Initialize the main state (_gtstate) if not already done
- * The lock is released on init_python output
- * It is the caller responsability to acquire it if needed
- */
- MESSAGE("PyInterp_base::init_python");
- ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main
- SCRUTE(KERNEL_PYTHON::_gtstate);
-// if(!_gtstate){
-// PyReleaseLock aReleaseLock;
-// Py_Initialize(); // Initialize the interpreter
-// PyEval_InitThreads(); // Initialize and acquire the global interpreter lock
-// PySys_SetArgv(_argc,_argv); // initialize sys.argv
-// _gtstate = PyThreadState_Get();
-// }
-}
-
SalomeApp_PyInterp();
virtual ~SalomeApp_PyInterp();
- virtual void init_python();
-
protected:
virtual bool initContext();
};
#include "SalomeApp_Module.h"
#include "SalomeApp_DataModel.h"
-#include "LightApp_RootObject.h"
+#include "SalomeApp_RootObject.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Application.h"
-#include "SalomeApp_Engine_i.hxx"
#include <OB_Browser.h>
#include <SUIT_ResourceMgr.h>
-#include <qptrlist.h>
-
#include "utilities.h"
-#include "string.h"
-#include "vector.h"
-
-#include "SALOMEDS_Tool.hxx"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOME_Exception)
/*!
Constructor.
*/
SalomeApp_Study::SalomeApp_Study( SUIT_Application* app )
-: LightApp_Study( app )
+: CAM_Study( app )
{
}
setStudyDS( study );
setStudyName( aName );
- LightApp_Study::createDocument();
+ // create myRoot
+ setRoot( new SalomeApp_RootObject( this ) );
+
+ CAM_Study::createDocument();
+
+ emit created( this );
}
//=======================================================================
setStudyDS( study );
- bool res = LightApp_Study::openDocument( theFileName );
-
+ setRoot( new SalomeApp_RootObject( this ) ); // create myRoot
+
+ // update loaded data models: call open() and update() on them.
+ ModelList dm_s;
+ dataModels( dm_s );
+ for ( ModelListIterator it( dm_s ); it.current(); ++it )
+ openDataModel( studyName(), it.current() );
+
+ // this will build a SUIT_DataObject-s tree under myRoot member field
+ // passing "false" in order NOT to rebuild existing data models' trees - it was done in previous step
+ // but tree that corresponds to not-loaded data models will be updated any way.
+ ((SalomeApp_Application*)application())->updateObjectBrowser( false );
+
+ bool res = CAM_Study::openDocument( theFileName );
+ emit opened( this );
+
return res;
}
setStudyDS( study );
- bool res = LightApp_Study::loadDocument( theStudyName );
+ setRoot( new SalomeApp_RootObject( this ) ); // create myRoot
+
+ //SRN: BugID IPAL9021, put there the same code as in a method openDocument
+
+ // update loaded data models: call open() and update() on them.
+ ModelList dm_s;
+ dataModels( dm_s );
+ for ( ModelListIterator it( dm_s ); it.current(); ++it )
+ openDataModel( studyName(), it.current() );
+
+ // this will build a SUIT_DataObject-s tree under myRoot member field
+ // passing "false" in order NOT to rebuild existing data models' trees - it was done in previous step
+ // but tree that corresponds to not-loaded data models will be updated any way.
+ ((SalomeApp_Application*)application())->updateObjectBrowser( false );
+
+ bool res = CAM_Study::openDocument( theStudyName );
+ emit opened( this );
+
+ //SRN: BugID IPAL9021: End
return res;
}
//=======================================================================
// name : saveDocumentAs
-/*! Purpose : Save document*/
+/*! Purpose : Save document */
//=======================================================================
bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
{
+ ModelList list; dataModels( list );
+
+ SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
+ for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() )
+ aModel->saveAs( theFileName, this );
+
// save SALOMEDS document
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
if( !resMgr )
return false;
- bool res = LightApp_Study::saveDocumentAs( theFileName ); //SRN: BugID IPAL9377, removed usage of uninitialized variable <res>
bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ),
isAscii = resMgr->booleanValue( "Study", "ascii_file", true );
isAscii ? SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
SalomeApp_Application::studyMgr()->SaveAs ( theFileName.latin1(), studyDS(), isMultiFile );
+ bool res = CAM_Study::saveDocumentAs( theFileName ); //SRN: BugID IPAL9377, removed usage of uninitialized variable <res>
+
+ if ( res )
+ emit saved( this );
+
return res;
}
//=======================================================================
// name : saveDocument
-/*! Purpose : Save document*/
+/*! Purpose : Save document */
//=======================================================================
void SalomeApp_Study::saveDocument()
{
+ ModelList list; dataModels( list );
+
+ SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
+ for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() )
+ aModel->save();
+
+ CAM_Study::saveDocument();
+
// save SALOMEDS document
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
if( !resMgr )
return;
- LightApp_Study::saveDocument();
bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ),
isAscii = resMgr->booleanValue( "Study", "ascii_file", true );
isAscii ? SalomeApp_Application::studyMgr()->SaveASCII( studyDS(), isMultiFile ) :
SalomeApp_Application::studyMgr()->Save ( studyDS(), isMultiFile );
+
+ emit saved( this );
}
//================================================================
// Function : closeDocument
-/*! Purpose : Close document*/
+/*! Purpose : Close document */
//================================================================
void SalomeApp_Study::closeDocument(bool permanently)
{
- LightApp_Study::closeDocument(permanently);
+ // Inform everybody that this study is going to close when it's most safe to,
+ // i.e. in the very beginning
+ emit closed( this );
// close SALOMEDS document
_PTR(Study) studyPtr = studyDS();
SALOMEDSClient_Study* aStudy = 0;
setStudyDS( _PTR(Study)(aStudy) );
}
+
+ CAM_Study::closeDocument(permanently);
}
//================================================================
// Function : isModified
-// Purpose :
+/*! Purpose : Check data model on modifications.*/
//================================================================
bool SalomeApp_Study::isModified() const
{
bool isAnyChanged = studyDS() && studyDS()->IsModified();
- if (!isAnyChanged)
- isAnyChanged = LightApp_Study::isModified();
+ ModelList list; dataModels( list );
+ SalomeApp_DataModel* aModel = 0;
+ for ( QPtrListIterator<CAM_DataModel> it( list ); it.current() && !isAnyChanged; ++it ){
+ aModel = dynamic_cast<SalomeApp_DataModel*>( it.current() );
+ if ( aModel )
+ isAnyChanged = aModel->isModified();
+ }
return isAnyChanged;
}
bool SalomeApp_Study::isSaved() const
{
bool isAllSaved = studyDS() && studyDS()->GetPersistentReference().size();
- if (!isAllSaved)
- isAllSaved = LightApp_Study::isModified();
+ ModelList list; dataModels( list );
+ SalomeApp_DataModel* aModel = 0;
+ for ( QPtrListIterator<CAM_DataModel> it( list ); it.current() && isAllSaved; ++it ){
+ aModel = dynamic_cast<SalomeApp_DataModel*>( it.current() );
+ if ( aModel )
+ isAllSaved = aModel->isSaved();
+ }
return isAllSaved;
}
CAM_Study::dataModelInserted(dm);
// Create SComponent for module, using default engine (CORBAless)
- // SalomeApp_Module* aModule = (SalomeApp_Module*)(dm->module());
- SalomeApp_Module* aModule = dynamic_cast<SalomeApp_Module*>( dm->module() );
- // 1. aModule == 0 means that this is a light module (no CORBA enigine)
- // 2. engineIOR == "" means this is a full module but without CORBA engine
- if (!aModule || aModule->engineIOR().isEmpty()) {
- // Check SComponent existance
- _PTR(Study) aStudy = studyDS();
- if (!aStudy)
- return;
- _PTR(SComponent) aComp = aStudy->FindComponent(dm->module()->name());
- if (!aComp) {
- // Create SComponent
- _PTR(StudyBuilder) aBuilder = studyDS()->NewBuilder();
- aComp = aBuilder->NewComponent(dm->module()->name());
-
- // Set default engine IOR
- aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().latin1());
+ SalomeApp_Module* aModule = (SalomeApp_Module*)(dm->module());
+ if (aModule) {
+ QString anEngineIOR = aModule->engineIOR();
+ if (anEngineIOR.isEmpty()) { // CORBAless module
+ // Check SComponent existance
+ _PTR(SComponent) aComp = studyDS()->FindComponent(dm->module()->name());
+ if (!aComp) {
+ // Create SComponent
+ _PTR(StudyBuilder) aBuilder = studyDS()->NewBuilder();
+ aComp = aBuilder->NewComponent(dm->module()->name());
+
+ // Set default engine IOR
+ aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().latin1());
+ }
}
}
}
if (!dm)
return false;
- // SalomeApp_DataModel* aDM = (SalomeApp_DataModel*)(dm);
- SalomeApp_Module* aModule = dynamic_cast<SalomeApp_Module*>( dm->module() );
- _PTR(Study) aStudy = studyDS(); // shared_ptr cannot be used here
- _PTR(SComponent) aSComp;
- QString anEngine;
- // 1. aModule == 0 means that this is a light module (no CORBA enigine)
- // 2. engineIOR == "" means this is a full module but without CORBA engine
- if (!aModule || aModule->engineIOR().isEmpty()) {
- anEngine = SalomeApp_Application::defaultEngineIOR();
- aSComp = aStudy->FindComponent(dm->module()->name());
- }
- else {
- SalomeApp_DataModel* aDM = dynamic_cast<SalomeApp_DataModel*>( dm );
- if ( aDM ) {
- QString anId = aDM->getRootEntry( this );
- if ( anId.isEmpty() )
- return true; // Probably nothing to load
-
- if ( aDM ) {
- anEngine = aDM->getModule()->engineIOR();
- if ( anEngine == "-1" ) {
- // Module doesn't have a CORBA engine and doesn't use
- // a default one -> SALOMEDS persistence cannot be used
- return false;
- }
- }
- if ( anEngine.isEmpty() ) {
- // Module use a default engine
- //TODO: deside, if the below code has to be copyed in a light data model to avoid bulding of data tree twice
- anEngine = SalomeApp_Application::defaultEngineIOR();
- }
- aSComp = aStudy->FindComponentID( std::string( anId.latin1() ) );
- }
- }
- if ( aSComp ) {
- _PTR(StudyBuilder) aBuilder( aStudy->NewBuilder() );
- if ( aBuilder ) {
- try {
- aBuilder->LoadWith( aSComp, std::string( anEngine.latin1() ) );
- }
- catch( const SALOME::SALOME_Exception& ) {
- // Oops, something went wrong while loading -> return an error
- return false;
- }
- // Something has been read -> create data model tree
- // aDM->buildTree( aSComp, 0, this );
- }
- } else {
- // Don't return false here, for there might be no data
- // for a given component in the study yet
- }
- if (dm && dm->open(studyName, this)) {
+ SalomeApp_DataModel* aDM = (SalomeApp_DataModel*)(dm);
+ if (aDM && aDM->open(studyName, this)) {
// Something has been read -> create data model tree
- LightApp_DataModel* aDM = dynamic_cast<LightApp_DataModel*>( dm );
- if ( aDM )
- aDM->update(NULL, this);
+ aDM->update(NULL, this);
return true;
}
+
return false;
}
return newName;
}
-//================================================================
-// Function : GetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-std::vector<std::string> SalomeApp_Study::GetListOfFiles() const
-{
- SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
- if (aDefaultEngine) {
- const char* aName = ((CAM_Application*)application())->activeModule()->name();
- return aDefaultEngine->GetListOfFiles(id(), aName);
- }
-
- std::vector<std::string> aListOfFiles;
- return aListOfFiles;
-}
-
-//================================================================
-// Function : SetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-void SalomeApp_Study::SetListOfFiles (const std::vector<std::string> theListOfFiles)
-{
- SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
- if (aDefaultEngine) {
- const char* aName = ((CAM_Application*)application())->activeModule()->name();
- aDefaultEngine->SetListOfFiles(theListOfFiles, id(), aName);
- }
-}
-
-//================================================================
-// Function : GetTmpDir
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-std::string SalomeApp_Study::GetTmpDir (const char* theURL,
- const bool isMultiFile)
-{
- std::string anURLDir = SALOMEDS_Tool::GetDirFromPath(theURL);
- std::string aTmpDir = isMultiFile ? anURLDir : SALOMEDS_Tool::GetTmpDir();
- return aTmpDir;
-}
-
-//================================================================
-// Function : RemoveTemporaryFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-void SalomeApp_Study::RemoveTemporaryFiles (const bool isMultiFile) const
-{
- if (isMultiFile)
- return;
-
- std::vector<std::string> aListOfFiles = GetListOfFiles();
- if (aListOfFiles.size() > 0) {
- std::string aTmpDir = aListOfFiles[0];
-
- const int n = aListOfFiles.size() - 1;
- SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
- aSeq->length(n);
- for (int i = 0; i < n; i++)
- aSeq[i] = CORBA::string_dup(aListOfFiles[i + 1].c_str());
-
- SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
- }
-}
-
-// END: methods to be used by CORBAless modules
-
void SalomeApp_Study::deleteReferencesTo( _PTR( SObject ) obj )
{
_PTR(StudyBuilder) sb = studyDS()->NewBuilder();
}
}
}
-
#include "SalomeApp.h"
-#include <LightApp_Study.h>
+#include <CAM_Study.h>
#ifdef WIN32
#pragma warning( disable:4251 )
#include "SALOMEDSClient.hxx"
-class SALOMEAPP_EXPORT SalomeApp_Study : public LightApp_Study
+class SALOMEAPP_EXPORT SalomeApp_Study : public CAM_Study
{
Q_OBJECT
_PTR(Study) studyDS() const;
- virtual std::vector<std::string> GetListOfFiles () const;
- virtual void SetListOfFiles (const std::vector<std::string> theListOfFiles);
- virtual std::string GetTmpDir (const char* theURL,
- const bool isMultiFile);
- virtual void RemoveTemporaryFiles (const bool isMultiFile) const;
-
// to delete all references to object, whose have the same component
void deleteReferencesTo( _PTR( SObject ) );
+signals:
+ void saved( SUIT_Study* );
+ void opened( SUIT_Study* );
+ void closed( SUIT_Study* );
+ void created( SUIT_Study* );
+
protected:
virtual void dataModelInserted( const CAM_DataModel* );
virtual bool openDataModel( const QString&, CAM_DataModel* );
_PTR(Study) myStudyDS;
};
+
#ifdef WIN32
#pragma warning( default:4251 )
#endif
#include "SalomeApp_TypeFilter.h"
-#include "LightApp_DataOwner.h"
+#include "SalomeApp_DataOwner.h"
#include "SalomeApp_Study.h"
#include <SALOMEDS_SObject.hxx>
*/
bool SalomeApp_TypeFilter::isOk( const SUIT_DataOwner* sOwner ) const
{
- const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*> ( sOwner );
+ const SalomeApp_DataOwner* owner = dynamic_cast<const SalomeApp_DataOwner*> ( sOwner );
SalomeApp_Study* aDoc = getStudy();
if (owner && aDoc && aDoc->studyDS())
<parameter name="xterm" value="no"/>
<parameter name="portkill" value="no"/>
<parameter name="killall" value="no"/>
- <parameter name="modules" value="GEOM,LIGHT,SMESH,VISU,SUPERV,MED,COMPONENT"/>
+ <parameter name="modules" value="GEOM,SMESH,VISU,SUPERV,MED,COMPONENT"/>
<parameter name="pyModules" value=""/>
<parameter name="embedded" value="SalomeAppEngine,study"/>
<parameter name="standalone" value="pyContainer,cppContainer,registry,moduleCatalog"/>
<parameter name="SalomeApp" value="${SUITRoot}/resources"/>
<parameter name="OB" value="${SUITRoot}/resources"/>
<parameter name="CAM" value="${SUITRoot}/resources"/>
- <parameter name="LightApp" value="${SUITRoot}/resources"/>
<parameter name="GEOM" value="${GEOM_ROOT_DIR}/share/salome/resources"/>
- <parameter name="LIGHT" value="${LIGHT_ROOT_DIR}/share/salome/resources"/>
<parameter name="SMESH" value="${SMESH_ROOT_DIR}/share/salome/resources"/>
<parameter name="VISU" value="${VISU_ROOT_DIR}/share/salome/resources"/>
<parameter name="SUPERV" value="${SUPERV_ROOT_DIR}/share/salome/resources"/>
<parameter name="name" value="Geometry"/>
<parameter name="icon" value="ModuleGeom.png"/>
</section>
- <section name="LIGHT">
- <parameter name="name" value="Light"/>
- <parameter name="icon" value="LIGHT.png"/>
- </section>
<section name="SMESH">
<parameter name="name" value="Mesh"/>
<parameter name="icon" value="ModuleMesh.png"/>
<!-- Here go other common user preferences -->
</section>
<section name="ObjectBrowser" >
- <parameter value="true" name="auto_size" />
+ <parameter value="false" name="auto_size" />
<parameter value="true" name="visibility_column_0" />
<parameter value="false" name="visibility_column_1" />
<parameter value="false" name="visibility_column_2" />
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
+msgid "ABOUT"
+msgstr "icon_about.png"
+
+msgid "ABOUT_SPLASH"
+msgstr "icon_about.png"
+
+msgid "APP_DEFAULT_ICO"
+msgstr "icon_default.png"
+
+msgid "APP_MODULE_ICO"
+msgstr "icon_module.png"
+
+msgid "APP_MODULE_BIG_ICO"
+msgstr "icon_module_big.png"
+
msgid "ICON_SELECT"
msgstr "icon_select.png"
+msgid "APP_BASE_LOGO"
+msgstr "icon_applogo.png"
+
//=======================================================================================
+msgid "SalomeApp_Application::OBJECT_BROWSER"
+msgstr "Object Browser"
+
msgid "SalomeApp_Application::PYTHON_CONSOLE"
msgstr "Python Console"
+msgid "SalomeApp_Application::LOG_WINDOW"
+msgstr "Message Window"
+
+msgid "SalomeApp_Application::DATA_MODELS"
+msgstr "Data models"
+
+msgid "SalomeApp_Application::NEW_WINDOW_0"
+msgstr "GL view"
+
+msgid "SalomeApp_Application::NEW_WINDOW_1"
+msgstr "Plot2d view"
+
+msgid "SalomeApp_Application::NEW_WINDOW_2"
+msgstr "OCC view"
+
+msgid "SalomeApp_Application::NEW_WINDOW_3"
+msgstr "VTK view"
+
msgid "SalomeApp_Application::TOT_DESK_FILE_DUMP_STUDY"
msgstr "Dump study"
msgid "SalomeApp_Application::TOT_FILE_DESK_PREFERENCES"
msgstr "Preferences"
+msgid "SalomeApp_Application::MEN_DESK_PREFERENCES"
+msgstr "Preferences..."
+
+msgid "SalomeApp_Application::PRP_DESK_PREFERENCES"
+msgstr "Allow to change the preferences"
+
msgid "SalomeApp_Application::MEN_DESK_TOOLS"
msgstr "Tools"
msgid "SalomeApp_Application::PRP_DESK_PROPERTIES"
msgstr "Edits study properties"
-msgid "SalomeApp_Application::PREF_CATEGORY_SALOME"
-msgstr "SALOME"
-
-msgid "SalomeApp_Application::PREF_TAB_OBJBROWSER"
-msgstr "Object browser"
+msgid "SalomeApp_Application::MEN_REFRESH"
+msgstr "Refresh"
msgid "SalomeApp_Application::MEN_OPENWITH"
-msgstr "Activate module"
+msgstr "Activate Module"
msgid "SalomeApp_Application::MEN_DELETE_REFERENCE"
msgstr "Delete Reference"
msgid "SalomeApp_Application::MEN_VIEW_WNDS"
msgstr "Windows"
+msgid "SalomeApp_Application::PRP_MODULE"
+msgstr "Switch to the module \"%1\""
+
+msgid "SalomeApp_Application::PRP_APP_MODULE"
+msgstr "Switch to SALOME platform neutral point"
+
+msgid "SalomeApp_Application::INF_TOOLBAR_MODULES"
+msgstr "Modules"
+
+msgid "SalomeApp_Application::INF_CANCELLED"
+msgstr "Module activation cancelled"
+
//=======================================================================================
+msgid "SalomeApp_Application::PREFERENCES_NOT_LOADED"
+msgstr "Preferences for module \"<b>%1</b>\" will be available when the module will be loaded"
+
+msgid "SalomeApp_Application::PREF_FONT"
+msgstr "Font"
+
+msgid "SalomeApp_Application::PREF_CATEGORY_SALOME"
+msgstr "SALOME"
+
+msgid "SalomeApp_Application::PREF_TAB_GENERAL"
+msgstr "General"
+
+msgid "SalomeApp_Application::PREF_TAB_OBJBROWSER"
+msgstr "Object browser"
+
+msgid "SalomeApp_Application::PREF_GROUP_EXT_BROWSER"
+msgstr "External browser"
+
+msgid "SalomeApp_Application::PREF_APP"
+msgstr "Application"
+
+msgid "SalomeApp_Application::PREF_PARAM"
+msgstr "Parameters"
+
msgid "SalomeApp_Application::PREF_GROUP_DEF_COLUMNS"
msgstr "Default columns"
msgid "SalomeApp_Application::PREF_AUTO_SIZE"
msgstr "Auto size columns"
+msgid "SalomeApp_Application::PREF_GROUP_STUDY"
+msgstr "Study properties"
+
+msgid "SalomeApp_Application::PREF_GROUP_PY_CONSOLE"
+msgstr "Python console properties"
+
+msgid "SalomeApp_Application::PREF_TAB_VIEWERS"
+msgstr "Viewers"
+
+msgid "SalomeApp_Application::PREF_GROUP_OCCVIEWER"
+msgstr "OCC Viewer 3d"
+
+msgid "SalomeApp_Application::PREF_MULTI_FILE"
+msgstr "Multi file save"
+
+msgid "SalomeApp_Application::PREF_ASCII_FILE"
+msgstr "ASCII save"
+
+msgid "SalomeApp_Application::PREF_UNDO_LEVEL"
+msgstr "Undo level"
+
+msgid "SalomeApp_Application::PREF_GROUP_VTKVIEWER"
+msgstr "VTK Viewer 3d"
+
+msgid "SalomeApp_Application::PREF_VIEWER_BACKGROUND"
+msgstr "Background color"
+
+msgid "SalomeApp_Application::PREF_TRIHEDRON_SIZE"
+msgstr "Trihedron size"
+
+msgid "SalomeApp_Application::PREF_ISOS_U"
+msgstr "Number of isolines along U"
+
+msgid "SalomeApp_Application::PREF_ISOS_V"
+msgstr "Number of isolines along V"
+
+msgid "SalomeApp_Application::PREF_TRIHEDRON_SHOW"
+msgstr "Show trihedron"
+
+msgid "SalomeApp_Application::PREF_GROUP_PLOT2DVIEWER"
+msgstr "Plot2d Viewer"
+
+msgid "SalomeApp_Application::PREF_SHOW_LEGEND"
+msgstr "Show legend"
+
+msgid "SalomeApp_Application::PREF_LEGEND_POSITION"
+msgstr "Legend position:"
+
+msgid "SalomeApp_Application::PREF_LEFT"
+msgstr "Left"
+
+msgid "SalomeApp_Application::PREF_RIGHT"
+msgstr "Right"
+
+msgid "SalomeApp_Application::PREF_TOP"
+msgstr "Top"
+
+msgid "SalomeApp_Application::PREF_BOTTOM"
+msgstr "Bottom"
+
+msgid "SalomeApp_Application::PREF_CURVE_TYPE"
+msgstr "Curve type:"
+
+msgid "SalomeApp_Application::PREF_POINTS"
+msgstr "Points"
+
+msgid "SalomeApp_Application::PREF_LINES"
+msgstr "Lines"
+
+msgid "SalomeApp_Application::PREF_SPLINE"
+msgstr "Spline"
+
+msgid "SalomeApp_Application::PREF_MARKER_SIZE"
+msgstr "Marker size:"
+
+msgid "SalomeApp_Application::PREF_LINEAR"
+msgstr "Linear"
+
+msgid "SalomeApp_Application::PREF_LOGARITHMIC"
+msgstr "Logarithmic"
+
+msgid "SalomeApp_Application::PREF_HOR_AXIS_SCALE"
+msgstr "Horizontal axis scale:"
+
+msgid "SalomeApp_Application::PREF_VERT_AXIS_SCALE"
+msgstr "Vertical axis scale:"
+
+msgid "SalomeApp_Application::PREF_TAB_DIRECTORIES"
+msgstr "Directories"
+
+msgid "SalomeApp_Application::PREF_GROUP_DIRECTORIES"
+msgstr "Quick directory list"
+
//=======================================================================================
msgid "SalomeApp_Application::OBJ_BROWSER_NAME"
//=======================================================================================
+msgid "SalomeApp_ModuleDlg::CAPTION"
+msgstr "Activate module"
+
+msgid "SalomeApp_ModuleDlg::NEW"
+msgstr "&New"
+
+msgid "SalomeApp_ModuleDlg::OPEN"
+msgstr "&Open"
+
+msgid "SalomeApp_ModuleDlg::LOAD"
+msgstr "&Load"
+
+msgid "SalomeApp_ModuleDlg::CANCEL"
+msgstr "&Cancel"
+
+msgid "SalomeApp_ModuleDlg::ActivateComponent_DESCRIPTION"
+msgstr "Create, open or load study."
+
+//=======================================================================================
+
+msgid "SalomeApp_PreferencesDlg::CAPTION"
+msgstr "Preferences"
+
+//=======================================================================================
+
msgid "SalomeApp_StudyPropertiesDlg::PRP_MODE_FROM_SCRATCH"
msgstr "from scratch"
msgid "SalomeApp_Application::PUBLISH_IN_STUDY"
msgstr "Publish in study"
+msgid "SalomeApp_Application::ACTIVATING_MODULE"
+msgstr "Trying to activate module \"%1\""
+
using namespace std;
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
/*
static int GetEdgeId(vtkPicker *thePicker, SALOME_Actor *theActor, int theObjId){
int anEdgeId = -1;
/*!Destructor.*/
VTKViewer_InteractorStyle::~VTKViewer_InteractorStyle()
{
+// if(MYDEBUG) INFOS("VTKViewer_InteractorStyle::~VTKViewer_InteractorStyle()");
m_ViewWnd->RemoveActor(myPreSelectionActor);
}
Handle(SALOME_InteractiveObject) IO = SActor->getIO();
if(aSelectionMode != EdgeOfCellSelection) {
if(CheckDimensionId(aSelectionMode,SActor,anObjId)){
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId);
if (IsSelected(IO,aSel)) {
// This IO is already in the selection
aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
}
int anEdgeId = GetEdgeId(picker,SActor,anObjId);
if (anEdgeId >= 0) {
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId<<"; EdgeId : "<<anEdgeId);
aSel->AddOrRemoveIndex( IO, anObjId, true, false);
aSel->AddOrRemoveIndex( IO, -anEdgeId-1, true, true );
aSel->AddIObject( IO, false );
this->HighlightProp( NULL );
aSel->ClearIObjects();
}
+ if(MYDEBUG) INFOS(" PointId : "<<anObjId);
aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
aSel->AddIObject( IO, false );
}
continue;
VTKViewer_CellDataSet cellList = picker->GetCellData(aActor);
if ( !cellList.empty() ) {
+ if(MYDEBUG) INFOS ( " NAME Actor : " << aSActor->getName() );
SALOME_Selection::TContainerOfId anIndexes;
VTKViewer_CellDataSet::iterator it;
for ( it = cellList.begin(); it != cellList.end(); ++it ) {
if(aResult){
mySelectedActor = SActor;
myElemId = anObjId;
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId);
m_Interactor->setCellData(anObjId,SActor,myPreSelectionActor);
}
}
mySelectedActor = SActor;
myEdgeId = anEdgeId;
myElemId = anObjId;
+ if(MYDEBUG) INFOS(" CellId : "<<anObjId<<"; EdgeId : "<<anEdgeId);
m_Interactor->setEdgeData(anObjId,SActor,-anEdgeId-1,myPreSelectionActor);
}
}
if(!anIsSameObjId) {
mySelectedActor = SActor;
myNodeId = anObjId;
+ if(MYDEBUG) INFOS(" PointId : "<<anObjId);
m_Interactor->setPointData(anObjId,SActor,myPreSelectionActor);
}
myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
}
}
}
+ //if(MYDEBUG) INFOS ( " NAME PREVIEW " << SActor->getName() );
}
}
}
#include <vtkPointData.h>
#include <vtkUnstructuredGrid.h>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+
vtkCxxRevisionMacro(VTKViewer_ShrinkFilter, "$Revision$");
vtkStandardNewMacro(VTKViewer_ShrinkFilter);