libGLViewer_la_CPPFLAGS=$(QT_INCLUDES) $(CAS_CPPFLAGS) -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx
libGLViewer_la_LDFLAGS=$(QT_MT_LIBS) $(CAS_KERNEL)
-libGLViewer_la_LIBADD= ../SUIT/libsuit.la -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lGLU
+libGLViewer_la_LIBADD= ../SUIT/libsuit.la
QCanvasView(theCanvas, theViewWindow, 0, Qt::WRepaintNoErase),
myCurrentItem(0),
myHilightedItem(0),
- mySelectedItem(0)
+ mySelectedItem(0),
+ myMovingDone(false),
+ myCenter(0,0)
{
printf("Construct QxGraph_CanvasView\n");
setName("QxGraph_CanvasView");
return;
}
+ if ( myOperation == WINDOWFIT )
+ { // Fit area
+ return;
+ }
+
if ( theEvent->button() == Qt::LeftButton && theEvent->state() == Qt::ControlButton
||
myOperation == ZOOMVIEW )
QPixmap zoomPixmap (imageZoomCursor);
QCursor zoomCursor (zoomPixmap);
setCursor(zoomCursor);
+
+ // the center of the view before zooming
+ int aXVCenter = viewport()->width()/2;
+ int aYVCenter = viewport()->height()/2;
+ myCenter = viewportToContents(QPoint(aXVCenter,aYVCenter));
}
return;
}
scrollBy(myGlobalPoint.x() - aGlobalPoint.x(),
myGlobalPoint.y() - aGlobalPoint.y());
myGlobalPoint = aGlobalPoint;
+ myMovingDone = true;
return;
}
//draw new selected rectangle
QPen pen(Qt::black,1,Qt::SolidLine);
aRect1->setPen(pen);
- aRect1->setZ(3);
+ aRect1->setZ(1E+6);
aRect1->show();
mySelectedRect = aRect1;
canvas()->update();
+
+ return;
}
if ( myOperation == ZOOMVIEW )
{ // Zoom
+ QCanvasItemList aList = canvas()->allItems();
+ for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it)
+ (*it)->hide();
+
+ int aXContCenter = myCenter.x();
+ int aYContCenter = myCenter.y();
+
QWMatrix m = worldMatrix();
double dx = aGlobalPoint.x() - myGlobalPoint.x();
double s = 1. + fabs(dx)*( (m.m11() < 1) ? m.m11() : 1. )/70.;
if (dx < 0) s = 1./s;
+ int aXContCenterScaled = aXContCenter*s;
+ int aYContCenterScaled = aYContCenter*s;
+
m.scale(s, s);
setWorldMatrix(m);
+ center(aXContCenterScaled,aYContCenterScaled);
+
+ myCenter.setX(aXContCenterScaled);
+ myCenter.setY(aYContCenterScaled);
+
// remember the canvas view's current transformation matrix in all canvas items
- QCanvasItemList aList = canvas()->allItems();
+ aList = canvas()->allItems();
for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) {
QxGraph_ActiveItem* anActItem = dynamic_cast<QxGraph_ActiveItem*>( *it );
if ( anActItem ) anActItem->setTMatrix(m);
+ (*it)->show();
}
myGlobalPoint = aGlobalPoint;
+ myMovingDone = true;
+
return;
}
if ( anActItem && anActItem->isResizing() )
{ // to resize items on canvas view
anActItem->resize(aPoint);
+ myMovingDone = true;
return;
}
}
myCurrentItem->moveBy(aPoint.x() - myPoint.x(),
aPoint.y() - myPoint.y());
+ myMovingDone = true;
myPoint = aPoint;
canvas()->update();
-
+
// scroll contents if mouse is outside
QRect r(contentsX(), contentsY(), visibleWidth(), visibleHeight());
if (!r.contains(theEvent->pos())) {
myOperation = NOTHING;
viewport()->setMouseTracking(true);
setCursor(myCursor);
+
+ emit viewOperationDone();
}
if ( myOperation == PANGLOBAL )
myOperation = NOTHING;
center( theEvent->x(), theEvent->y() );
setCursor(myCursor);
+
+ emit viewOperationDone();
}
if ( myOperation == WINDOWFIT )
viewport()->setMouseTracking(true);
setCursor(myCursor);
+
+ emit viewOperationDone();
}
if ( myOperation == ZOOMVIEW )
myOperation = NOTHING;
viewport()->setMouseTracking(true);
setCursor(myCursor);
+
+ emit viewOperationDone();
}
if ( theEvent->button() == RightButton )
}
}
- if ( theEvent->button() == LeftButton )
+ if ( theEvent->button() == LeftButton && !myMovingDone )
{
// Selection mechanism
QCanvasItemList aList = canvas()->collisions(aPoint);
}
}
}
+
+ myMovingDone = false;
}
void QxGraph_CanvasView::contentsMouseDoubleClickEvent(QMouseEvent* theEvent)
canvas()->update();
//myOperation = NOTHING;
+
+ emit viewOperationDone();
}
void QxGraph_CanvasView::activateFitRect()
}
//myOperation = NOTHING;
+
+ emit viewOperationDone();
}
void QxGraph_CanvasView::onTimeout()
void setSelectedItem( QxGraph_ActiveItem* theItem );
QxGraph_ActiveItem* getSelectedItem() const;
+ signals:
+ void viewOperationDone();
+
public slots:
void onTimeout();
//void changeBackground();
QCanvasItem* myCurrentItem;
QPoint myPoint;
QPoint myGlobalPoint;
+ bool myMovingDone;
+ QPoint myCenter;
// for control toolbar actions
OperationType myOperation;
{
myHighlightRotationPointActor->SetVisibility( false );
- SALOME_Actor *anCurrActor;
- if ( anActor ) anCurrActor = anActor;
- else if ( myLastPreHighlitedActor.GetPointer()
- &&
- myLastPreHighlitedActor.GetPointer() != anActor )
- anCurrActor = myLastPreHighlitedActor.GetPointer();
- if ( anCurrActor )
+ if ( anActor )
{
myPointPicker->Pick( aSelectionEvent->myX, aSelectionEvent->myY, 0.0, GetCurrentRenderer() );
int aVtkId = myPointPicker->GetPointId();
fd->setFilters( aFilters );
fd->myPublishChk->setChecked( true );
fd->mySaveGUIChk->setChecked( true );
- fd->exec();
- QString aFileName = fd->selectedFile();
+ QString aFileName;
+ while (1) {
+ fd->exec();
+ fd->raise();
+ aFileName = fd->selectedFile();
+ if ( aFileName.isEmpty() )
+ break;
+ if ( aFileName.indexOf( QRegExp("[-!?#*&]") ) == -1 )
+ break;
+ SUIT_MessageBox::warning( desktop(),
+ tr( "WRN_WARNING" ),
+ tr( "WRN_FILE_NAME_BAD" ) );
+ }
bool toPublish = fd->myPublishChk->isChecked();
bool toSaveGUI = fd->mySaveGUIChk->isChecked();
delete fd;
//Resize the views, set their captions and apply visual parameters.
QVector<SUIT_ViewWindow*> views = vm->getViews();
- for (int i = 0, j = 0; i<viewCount; i++, j++) {
+ for (int i = 0, j = 0; i<viewCount; i++, j+=2) {
viewWin = views[i];
if ( !viewWin )
continue;
// wait untill the window is really shown. This step fixes MANY bugs..
- while ( !viewWin->isVisible() )
+ while ( !vm->isVisible() )
qApp->processEvents();
viewWin->setWindowTitle(ip->getValue(viewerEntry, j).c_str());
<!-- As a result, both variants are acceptable. -->
<parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources/netgenplugin"/>
<parameter name="GHS3DPlugin" value="${GHS3DPLUGIN_ROOT_DIR}/share/salome/resources/ghs3dplugin"/>
+ <parameter name="BLSURFPlugin" value="${BLSURFPLUGIN_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="HexoticPLUGIN" value="${HexoticPLUGIN_ROOT_DIR}/share/salome/resources"/>
</section>
<section name="SMESH">
<!-- Default SMESH module plugins -->
- <parameter name="plugins" value="NETGENPlugin,GHS3DPlugin"/>
+ <parameter name="plugins" value="NETGENPlugin,GHS3DPlugin,BLSURFPlugin,HexoticPLUGIN"/>
</section>
<section name="desktop" >
<!-- Default GUI desktop state, position, size -->
<source>ACTIVATE_MODULE_OP_LOAD</source>
<translation>&Load...</translation>
</message>
+ <message>
+ <source>WRN_FILE_NAME_BAD</source>
+ <translation>Please enter correct file name</translation>
+ </message>
</context>
<context>
<name>SalomeApp_StudyPropertiesDlg</name>
return false;
}
+void killOmniNames()
+{
+ QString fileName( ::getenv ("OMNIORB_CONFIG") );
+ QString portNumber;
+ if ( !fileName.isEmpty() )
+ {
+ QFile aFile( fileName );
+ if ( aFile.open(QIODevice::ReadOnly) ) {
+ QRegExp re("InitRef = .*:([0-9]+)$");
+ QTextStream stream ( &aFile );
+ while ( !stream.atEnd() ) {
+ QString textLine = stream.readLine();
+ if ( re.indexIn( textLine ) > -1 )
+ portNumber = re.cap(1);
+ }
+ aFile.close();
+ }
+ }
+
+ if ( !portNumber.isEmpty() )
+ {
+ QString cmd ;
+ cmd = QString( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*%1\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" ).arg( portNumber );
+ system ( cmd.toLatin1().data() );
+ }
+
+ /////////////////// NPAL 18309 (Kill Notifd) ////////////////////////////
+ if ( !portNumber.isEmpty() )
+ {
+ QString cmd = QString("import pickle, os; ");
+ cmd += QString("from killSalomeWithPort import getPiDict; ");
+ cmd += QString("filedict=getPiDict(%1); ").arg(portNumber);
+ cmd += QString("f=open(filedict, 'r'); ");
+ cmd += QString("pids=pickle.load(f); ");
+ cmd += QString("m={}; ");
+ cmd += QString("[ m.update(i) for i in pids ]; ");
+ cmd += QString("pids=filter(lambda a: 'notifd' in m[a], m.keys()); ");
+ cmd += QString("[ os.kill(pid, 9) for pid in pids ]; ");
+ cmd = QString("python -c \"%1\"").arg(cmd);
+ system( cmd.toLatin1().data() );
+ }
+
+}
+
// shutdown standalone servers
void shutdownServers( SALOME_NamingService* theNS )
{
CORBA::Object_var objSDS = theNS->Resolve("/myStudyManager");
SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow(objSDS) ;
if ( !CORBA::is_nil(studyManager) && ( session->getPID() != studyManager->getPID() ) )
- studyManager->ShutdownWithExit();
+ studyManager->Shutdown();
// 7) ModuleCatalog
CORBA::Object_var objMC=theNS->Resolve("/Kernel/ModulCatalog");
SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objMC);
if ( !CORBA::is_nil(catalog) && ( session->getPID() != catalog->getPID() ) )
- catalog->ShutdownWithExit();
+ catalog->shutdown();
// 8) Registry
CORBA::Object_var objR = theNS->Resolve("/Registry");
Registry::Components_var registry = Registry::Components::_narrow(objR);
if ( !CORBA::is_nil(registry) && ( session->getPID() != registry->getPID() ) )
- registry->end();
+ registry->Shutdown();
// 9) Kill OmniNames
- QString fileName( ::getenv ("OMNIORB_CONFIG") );
- QString portNumber;
- if ( !fileName.isEmpty() ) {
- QFile aFile( fileName );
- if ( aFile.open(QIODevice::ReadOnly) ) {
- QRegExp re("InitRef = .*:([0-9]+)$");
- QTextStream stream ( &aFile );
- while ( !stream.atEnd() ) {
- QString textLine = stream.readLine();
- if ( re.indexIn( textLine ) > -1 )
- portNumber = re.cap(1);
- }
- aFile.close();
- }
- }
- if ( !portNumber.isEmpty() ) {
- QString cmd = QString( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*%1\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" ).arg( portNumber );
- system ( cmd.toLatin1().data() );
- }
-
+ //killOmniNames();
}
}
_GUIMutex.unlock();
}
+ bool shutdown = false;
if ( !result ) {
// Launch GUI activator
if ( isGUI ) {
splash = 0;
if ( result == SUIT_Session::NORMAL ) { // desktop is closed by user from GUI
- if ( aGUISession->exitFlags() )
- shutdownServers( _NS );
+ shutdown = aGUISession->exitFlags();
break;
}
}
// unlock Session mutex
_SessionMutex.unlock();
+ if ( shutdown ) {
+ shutdownServers( _NS );
+ killOmniNames();
+ }
+
if ( myServerLauncher )
myServerLauncher->KillAll(); // kill embedded servers
delete myServerLauncher;
delete _NS;
- LocalTraceBufferPool *bp1 = LocalTraceBufferPool::instance();
- LocalTraceBufferPool::deleteInstance(bp1);
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ Py_Finalize();
+
+ try {
+ orb->destroy();
+ }
+ catch (...) {
+ std::cerr << "Caught unexpected exception on destroy : ignored !!" << std::endl;
+ }
+
+ // if ( shutdown )
+ // killOmniNames();
return result;
}
_ServerLaunch->wakeAll();
// run ORB
- _orb->run(); // this thread waits, during omniORB process events
+ //_orb->run(); // No need to call orb->run() : it waits on a lock. Qt is already waiting in the mainloop.
}
/*!
// Tell the POA that the objects are ready to accept requests.
- _root_poa->activate_object (Catalogue_i);
+ PortableServer::ObjectId_var id = _root_poa->activate_object (Catalogue_i);
+ Catalogue_i->_remove_ref();
- CORBA::Object_ptr myCata = Catalogue_i->_this();
+ CORBA::Object_var myCata = Catalogue_i->_this();
_NS->Register(myCata ,"/Kernel/ModulCatalog");
}
catch(CORBA::SystemException&) {
try {
MESSAGE("SalomeApp_Engine thread started");
SalomeApp_Engine_i* anEngine = new SalomeApp_Engine_i();
- /*PortableServer::ObjectId_var id = */_root_poa->activate_object( anEngine );
+ PortableServer::ObjectId_var id =_root_poa->activate_object( anEngine );
MESSAGE("poa->activate_object( SalomeApp_Engine )");
CORBA::Object_var obj = anEngine->_this();
+ anEngine->_remove_ref();
_NS->Register( obj ,"/SalomeAppEngine");
}
catch (CORBA::SystemException&) {
CORBA::Object_var obj = mySALOME_Session->_this();
CORBA::String_var sior(_orb->object_to_string(obj));
+ mySALOME_Session->_remove_ref();
mySALOME_Session->NSregister();
}
_poa = PortableServer::POA::_duplicate(poa) ;
_GUIMutex = GUIMutex;
_GUILauncher = GUILauncher;
+ _NS = new SALOME_NamingService(_orb);
//MESSAGE("constructor end");
}
*/
SALOME_Session_i::~SALOME_Session_i()
{
+ delete _NS;
//MESSAGE("destructor end");
}
*/
void SALOME_Session_i::NSregister()
{
- SALOME::Session_ptr pSession = SALOME::Session::_narrow(_this());
+ CORBA::Object_var obref=_this();
+ SALOME::Session_var pSession = SALOME::Session::_narrow(obref);
try
{
- _NS = new SALOME_NamingService(_orb);
_NS->Register(pSession, "/Kernel/Session");
}
catch (ServiceUnreachable&)