From: vsr Date: Tue, 12 Feb 2008 14:56:13 +0000 (+0000) Subject: Merge from branch BR_Dev_For_4_0 (from tag mergeto_BR_QT4_Dev_12Feb08) X-Git-Tag: V5_0_0a1~44 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=51bc870cd7a33fd32427bcacb002d54cccaa062f;p=modules%2Fgui.git Merge from branch BR_Dev_For_4_0 (from tag mergeto_BR_QT4_Dev_12Feb08) --- diff --git a/doc/salome/gui/GUI/images/icon_about.png b/doc/salome/gui/GUI/images/icon_about.png index 5ecbe6624..bbbc7a931 100755 Binary files a/doc/salome/gui/GUI/images/icon_about.png and b/doc/salome/gui/GUI/images/icon_about.png differ diff --git a/doc/salome/gui/GUI/pics/icon_about.png b/doc/salome/gui/GUI/pics/icon_about.png index 5ecbe6624..bbbc7a931 100755 Binary files a/doc/salome/gui/GUI/pics/icon_about.png and b/doc/salome/gui/GUI/pics/icon_about.png differ diff --git a/src/GLViewer/Makefile.am b/src/GLViewer/Makefile.am index 1171672da..a92dafe09 100644 --- a/src/GLViewer/Makefile.am +++ b/src/GLViewer/Makefile.am @@ -112,4 +112,4 @@ nodist_salomeres_DATA= \ 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 diff --git a/src/QxGraph/QxGraph_CanvasView.cxx b/src/QxGraph/QxGraph_CanvasView.cxx index d3873b8fb..e7f726b13 100644 --- a/src/QxGraph/QxGraph_CanvasView.cxx +++ b/src/QxGraph/QxGraph_CanvasView.cxx @@ -112,7 +112,9 @@ QxGraph_CanvasView::QxGraph_CanvasView(QxGraph_Canvas* theCanvas, QxGraph_ViewWi 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"); @@ -158,6 +160,11 @@ void QxGraph_CanvasView::contentsMousePressEvent(QMouseEvent* theEvent) return; } + if ( myOperation == WINDOWFIT ) + { // Fit area + return; + } + if ( theEvent->button() == Qt::LeftButton && theEvent->state() == Qt::ControlButton || myOperation == ZOOMVIEW ) @@ -168,6 +175,11 @@ void QxGraph_CanvasView::contentsMousePressEvent(QMouseEvent* theEvent) 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; } @@ -207,6 +219,7 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) scrollBy(myGlobalPoint.x() - aGlobalPoint.x(), myGlobalPoint.y() - aGlobalPoint.y()); myGlobalPoint = aGlobalPoint; + myMovingDone = true; return; } @@ -226,32 +239,52 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) //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( *it ); if ( anActItem ) anActItem->setTMatrix(m); + (*it)->show(); } myGlobalPoint = aGlobalPoint; + myMovingDone = true; + return; } @@ -261,6 +294,7 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) if ( anActItem && anActItem->isResizing() ) { // to resize items on canvas view anActItem->resize(aPoint); + myMovingDone = true; return; } @@ -274,9 +308,10 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) } 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())) { @@ -419,6 +454,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) myOperation = NOTHING; viewport()->setMouseTracking(true); setCursor(myCursor); + + emit viewOperationDone(); } if ( myOperation == PANGLOBAL ) @@ -426,6 +463,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) myOperation = NOTHING; center( theEvent->x(), theEvent->y() ); setCursor(myCursor); + + emit viewOperationDone(); } if ( myOperation == WINDOWFIT ) @@ -467,6 +506,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) viewport()->setMouseTracking(true); setCursor(myCursor); + + emit viewOperationDone(); } if ( myOperation == ZOOMVIEW ) @@ -474,6 +515,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) myOperation = NOTHING; viewport()->setMouseTracking(true); setCursor(myCursor); + + emit viewOperationDone(); } if ( theEvent->button() == RightButton ) @@ -525,7 +568,7 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) } } - if ( theEvent->button() == LeftButton ) + if ( theEvent->button() == LeftButton && !myMovingDone ) { // Selection mechanism QCanvasItemList aList = canvas()->collisions(aPoint); @@ -553,6 +596,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) } } } + + myMovingDone = false; } void QxGraph_CanvasView::contentsMouseDoubleClickEvent(QMouseEvent* theEvent) @@ -606,6 +651,8 @@ void QxGraph_CanvasView::activateFitAll() canvas()->update(); //myOperation = NOTHING; + + emit viewOperationDone(); } void QxGraph_CanvasView::activateFitRect() @@ -660,6 +707,8 @@ void QxGraph_CanvasView::activateReset() } //myOperation = NOTHING; + + emit viewOperationDone(); } void QxGraph_CanvasView::onTimeout() diff --git a/src/QxGraph/QxGraph_CanvasView.h b/src/QxGraph/QxGraph_CanvasView.h index 36cac2201..6aa5c3b79 100644 --- a/src/QxGraph/QxGraph_CanvasView.h +++ b/src/QxGraph/QxGraph_CanvasView.h @@ -58,6 +58,9 @@ class QXGRAPH_EXPORT QxGraph_CanvasView : public QCanvasView { void setSelectedItem( QxGraph_ActiveItem* theItem ); QxGraph_ActiveItem* getSelectedItem() const; + signals: + void viewOperationDone(); + public slots: void onTimeout(); //void changeBackground(); @@ -75,6 +78,8 @@ class QXGRAPH_EXPORT QxGraph_CanvasView : public QCanvasView { QCanvasItem* myCurrentItem; QPoint myPoint; QPoint myGlobalPoint; + bool myMovingDone; + QPoint myCenter; // for control toolbar actions OperationType myOperation; diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index fdfc6fec9..6c8d32111 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -1207,13 +1207,7 @@ SVTK_InteractorStyle { 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(); diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index e857a65af..383ba5135 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -742,8 +742,19 @@ void SalomeApp_Application::onDumpStudy( ) 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; diff --git a/src/SalomeApp/SalomeApp_VisualState.cxx b/src/SalomeApp/SalomeApp_VisualState.cxx index a5af64fdd..a3f14ddb6 100644 --- a/src/SalomeApp/SalomeApp_VisualState.cxx +++ b/src/SalomeApp/SalomeApp_VisualState.cxx @@ -232,13 +232,13 @@ void SalomeApp_VisualState::restoreState(int savePoint) //Resize the views, set their captions and apply visual parameters. QVector views = vm->getViews(); - for (int i = 0, j = 0; iisVisible() ) + while ( !vm->isVisible() ) qApp->processEvents(); viewWin->setWindowTitle(ip->getValue(viewerEntry, j).c_str()); diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 1ae7b2c3f..69ff886a4 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -63,10 +63,12 @@ + +
- +
diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.ts b/src/SalomeApp/resources/SalomeApp_msg_en.ts index b8cd23a0d..37f3e3d9b 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_en.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_en.ts @@ -269,6 +269,10 @@ Do you want to reload it ? ACTIVATE_MODULE_OP_LOAD &Load... + + WRN_FILE_NAME_BAD + Please enter correct file name + SalomeApp_StudyPropertiesDlg diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index abb121c15..6d93c5098 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -303,6 +303,50 @@ bool isFound( const char* str, int argc, char** argv ) 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 ) { @@ -360,41 +404,22 @@ 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(); } } @@ -562,6 +587,7 @@ int main( int argc, char **argv ) _GUIMutex.unlock(); } + bool shutdown = false; if ( !result ) { // Launch GUI activator if ( isGUI ) { @@ -614,8 +640,7 @@ int main( int argc, char **argv ) splash = 0; if ( result == SUIT_Session::NORMAL ) { // desktop is closed by user from GUI - if ( aGUISession->exitFlags() ) - shutdownServers( _NS ); + shutdown = aGUISession->exitFlags(); break; } } @@ -631,6 +656,11 @@ int main( int argc, char **argv ) // unlock Session mutex _SessionMutex.unlock(); + if ( shutdown ) { + shutdownServers( _NS ); + killOmniNames(); + } + if ( myServerLauncher ) myServerLauncher->KillAll(); // kill embedded servers @@ -639,8 +669,18 @@ int main( int argc, char **argv ) 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; } diff --git a/src/Session/Session_ServerLauncher.cxx b/src/Session/Session_ServerLauncher.cxx index bdf10d747..cee92e943 100755 --- a/src/Session/Session_ServerLauncher.cxx +++ b/src/Session/Session_ServerLauncher.cxx @@ -101,7 +101,7 @@ void Session_ServerLauncher::run() _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. } /*! diff --git a/src/Session/Session_ServerThread.cxx b/src/Session/Session_ServerThread.cxx index 93f094944..45bba979c 100755 --- a/src/Session/Session_ServerThread.cxx +++ b/src/Session/Session_ServerThread.cxx @@ -193,9 +193,10 @@ void Session_ServerThread::ActivateModuleCatalog(int argc, // 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&) { @@ -396,10 +397,11 @@ void Session_ServerThread::ActivateEngine(int /*argc*/, char ** /*argv*/) 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&) { @@ -454,6 +456,7 @@ void Session_SessionThread::ActivateSession(int argc, CORBA::Object_var obj = mySALOME_Session->_this(); CORBA::String_var sior(_orb->object_to_string(obj)); + mySALOME_Session->_remove_ref(); mySALOME_Session->NSregister(); } diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx index 92ba94c40..88d2b3fad 100755 --- a/src/Session/Session_Session_i.cxx +++ b/src/Session/Session_Session_i.cxx @@ -66,6 +66,7 @@ SALOME_Session_i::SALOME_Session_i(int argc, _poa = PortableServer::POA::_duplicate(poa) ; _GUIMutex = GUIMutex; _GUILauncher = GUILauncher; + _NS = new SALOME_NamingService(_orb); //MESSAGE("constructor end"); } @@ -89,6 +90,7 @@ Engines::Component_ptr SALOME_Session_i::GetComponent(const char* theLibraryName */ SALOME_Session_i::~SALOME_Session_i() { + delete _NS; //MESSAGE("destructor end"); } @@ -98,10 +100,10 @@ SALOME_Session_i::~SALOME_Session_i() */ 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&)