From bfbed632ffc28dac9ce3fca6c643025ec7218369 Mon Sep 17 00:00:00 2001 From: abd Date: Mon, 28 Apr 2008 06:18:56 +0000 Subject: [PATCH] Correct compilation on Linux --- adm_local/unix/config_files/check_opengl.m4 | 35 +++++++++++++++++ src/OCCViewer/OCCViewer_ViewWindow.h | 2 +- src/PythonConsole/PythonConsole_PyInterp.cxx | 10 +++++ src/QxGraph/QxGraph_CanvasView.cxx | 41 +++++++++++++++++++- src/QxGraph/QxGraph_CanvasView.h | 4 ++ src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip | 6 +-- src/SVTK/SVTK_InteractorStyle.cxx | 10 +---- src/SalomeApp/SalomeApp_Application.cxx | 23 ++++++++++- src/SalomeApp/resources/SalomeApp_msg_en.po | 3 ++ src/Session/SALOME_Session_Server.cxx | 19 +++++---- src/VTKViewer/VTKViewer_ViewWindow.cxx | 4 +- 11 files changed, 132 insertions(+), 25 deletions(-) diff --git a/adm_local/unix/config_files/check_opengl.m4 b/adm_local/unix/config_files/check_opengl.m4 index 8a56e0f54..a1eb48ee2 100644 --- a/adm_local/unix/config_files/check_opengl.m4 +++ b/adm_local/unix/config_files/check_opengl.m4 @@ -162,6 +162,40 @@ if test "x${OpenGL_libs_ok}" = "xyes" ; then break fi done + + # workaround a problem with libGL library location + for idir in $dirs; do + if test -r "${idir}/libGLU.la"; then + GLU_LA_PATH="${idir}/libGLU.la" + GL_LA_PATH_TO_CHECK=`cat ${GLU_LA_PATH} | awk '{ for(i=1;i0) print $i } }'` + if test -z ${GL_LA_PATH_TO_CHECK} || test -r ${GL_LA_PATH_TO_CHECK}; then + # nothing to do + break + fi + for jdir in $dirs; do + if test -r "${jdir}/libGL.la"; then + GL_LA_PATH="${jdir}/libGL.la" + # copy the libGLU.la file and set correct libGL.la path in it + NEW_GLU_LA_PATH=${ROOT_BUILDDIR} + NEW_GLU_LA_FILE="${NEW_GLU_LA_PATH}/libGLU.la" + sed -e "s%${GL_LA_PATH_TO_CHECK}%${GL_LA_PATH}%" ${GLU_LA_PATH} > "${NEW_GLU_LA_FILE}" + chmod -f --reference=${GLU_LA_PATH} "${NEW_GLU_LA_FILE}" + # set a new libGLU.la path + GLU_LIB_PATH="-L${NEW_GLU_LA_PATH}" + # create a simbolic link to libGLU.so + for kdir in $dirs; do + if test -r "${kdir}/libGLU.so"; then + cp -fs "${kdir}/libGLU.so" "${NEW_GLU_LA_PATH}/libGLU.so" + break + fi + done + break + fi + done + break + fi + done + LDFLAGS_old="${LDFLAGS}" LDFLAGS="${LDFLAGS} ${OGL_LIBS} ${GLU_LIB_PATH}" AC_CHECK_LIB([GLU], @@ -193,3 +227,4 @@ AC_SUBST(OGL_LIBS) AC_LANG_RESTORE ])dnl + diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index 698a9f095..c3e7ca9f4 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -20,6 +20,7 @@ #define OCCVIEWER_VIEWWINDOW_H #include "OCCViewer_ViewModel.h" +#include "OCCViewer_ViewSketcher.h" #include "SUIT_ViewWindow.h" @@ -30,7 +31,6 @@ class SUIT_Desktop; class OCCViewer_ViewPort3d; -class OCCViewer_ViewSketcher; class OCCViewer_ClippingDlg; class OCCViewer_SetRotationPointDlg; diff --git a/src/PythonConsole/PythonConsole_PyInterp.cxx b/src/PythonConsole/PythonConsole_PyInterp.cxx index 0046f02e3..e54023779 100755 --- a/src/PythonConsole/PythonConsole_PyInterp.cxx +++ b/src/PythonConsole/PythonConsole_PyInterp.cxx @@ -108,6 +108,16 @@ bool PythonConsole_PyInterp::initState() * will have the same __builtin__ module */ + if(!builtinmodule) // PAL18041: deepcopy function don't work in Salome + { + //builtinmodule is static member of PyInterp class + //If it is not NULL (initialized to the builtin module of the main interpreter + //all the sub interpreters will have the same builtin + //_interp is a static member and is the main interpreter + //The first time we initialized it to the builtin of main interpreter + builtinmodule=PyDict_GetItemString(_interp->modules, "__builtin__"); + } + if(builtinmodule) { PyObject *m = PyImport_GetModuleDict(); diff --git a/src/QxGraph/QxGraph_CanvasView.cxx b/src/QxGraph/QxGraph_CanvasView.cxx index be0d7dcbf..e7f726b13 100644 --- a/src/QxGraph/QxGraph_CanvasView.cxx +++ b/src/QxGraph/QxGraph_CanvasView.cxx @@ -113,7 +113,8 @@ QxGraph_CanvasView::QxGraph_CanvasView(QxGraph_Canvas* theCanvas, QxGraph_ViewWi myCurrentItem(0), myHilightedItem(0), mySelectedItem(0), - myMovingDone(false) + myMovingDone(false), + myCenter(0,0) { printf("Construct QxGraph_CanvasView\n"); setName("QxGraph_CanvasView"); @@ -174,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; } @@ -213,6 +219,7 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) scrollBy(myGlobalPoint.x() - aGlobalPoint.x(), myGlobalPoint.y() - aGlobalPoint.y()); myGlobalPoint = aGlobalPoint; + myMovingDone = true; return; } @@ -243,23 +250,41 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) 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; } @@ -429,6 +454,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) myOperation = NOTHING; viewport()->setMouseTracking(true); setCursor(myCursor); + + emit viewOperationDone(); } if ( myOperation == PANGLOBAL ) @@ -436,6 +463,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) myOperation = NOTHING; center( theEvent->x(), theEvent->y() ); setCursor(myCursor); + + emit viewOperationDone(); } if ( myOperation == WINDOWFIT ) @@ -477,6 +506,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) viewport()->setMouseTracking(true); setCursor(myCursor); + + emit viewOperationDone(); } if ( myOperation == ZOOMVIEW ) @@ -484,6 +515,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) myOperation = NOTHING; viewport()->setMouseTracking(true); setCursor(myCursor); + + emit viewOperationDone(); } if ( theEvent->button() == RightButton ) @@ -618,6 +651,8 @@ void QxGraph_CanvasView::activateFitAll() canvas()->update(); //myOperation = NOTHING; + + emit viewOperationDone(); } void QxGraph_CanvasView::activateFitRect() @@ -672,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 f14e1277e..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(); @@ -76,6 +79,7 @@ class QXGRAPH_EXPORT QxGraph_CanvasView : public QCanvasView { QPoint myPoint; QPoint myGlobalPoint; bool myMovingDone; + QPoint myCenter; // for control toolbar actions OperationType myOperation; diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip index ba6700477..1239326a3 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip @@ -10,9 +10,9 @@ %Import qtmod.sip -//%ExportedHeaderCode -//#include -//%End +%ExportedHeaderCode +#include +%End class SALOME_Selection : QObject { diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index 37756f98d..1f662ca7b 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -1207,7 +1207,7 @@ SVTK_InteractorStyle ::onCursorMove(QPoint mousePos) { // processing highlighting - SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY(); + SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY(); this->FindPokedRenderer(aSelectionEvent->myX,aSelectionEvent->myY); bool anIsChanged = false; @@ -1218,13 +1218,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 771c0d7de..802d7d7b0 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -702,8 +702,27 @@ 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()) { + if ( (aFileName.find('-', 0) == -1) && (aFileName.find('!', 0) == -1) && (aFileName.find('?', 0) == -1) && + (aFileName.find('#', 0) == -1) && (aFileName.find('*', 0) == -1) && (aFileName.find('&', 0) == -1)) { + break; + } + else { + SUIT_MessageBox::warn1 ( desktop(), + QObject::tr("WRN_WARNING"), + tr("WRN_FILE_NAME_BAD"), + QObject::tr("BUT_OK") ); + } + } + else { + break; + } + } bool toPublish = fd->myPublishChk->isChecked(); bool toSaveGUI = fd->mySaveGUIChk->isChecked(); delete fd; diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.po b/src/SalomeApp/resources/SalomeApp_msg_en.po index 40f7e95f1..d6a6d6d90 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_en.po +++ b/src/SalomeApp/resources/SalomeApp_msg_en.po @@ -221,6 +221,9 @@ msgstr "Publish in study" msgid "SalomeApp_Application::WRN_DUMP_STUDY_FAILED" msgstr "Dump study failed" +msgid "SalomeApp_Application::WRN_FILE_NAME_BAD" +msgstr "Please enter correct file name" + msgid "SAVE_POINT_OBJECT_TOOLTIP" msgstr "Saved GUI state: %1" diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 37823d43a..daa2dbb18 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -348,7 +348,8 @@ void killOmniNames() 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); + cmd += QString("os.remove(filedict); "); + cmd = QString("python -c \"%1\" > /dev/null").arg(cmd); system( cmd.latin1() ); } @@ -687,10 +688,8 @@ int main( int argc, char **argv ) // unlock Session mutex _SessionMutex.unlock(); - if ( shutdown ) { + if ( shutdown ) shutdownServers( _NS ); - killOmniNames(); - } if ( myServerLauncher ) myServerLauncher->KillAll(); // kill embedded servers @@ -709,11 +708,17 @@ int main( int argc, char **argv ) } catch(...) { - std::cerr << "Caught unexpected exception on destroy : ignored !!" << std::endl; + ////////////////////////////////////////////////////////////// + // VSR: silently skip exception: + // CORBA.BAD_INV_ORDER.BAD_INV_ORDER_ORBHasShutdown + // exception is raised when orb->destroy() is called and + // cpp continer is launched in the embedded mode + ////////////////////////////////////////////////////////////// + // std::cerr << "Caught unexpected exception on destroy : ignored !!" << std::endl; } - // if ( shutdown ) - // killOmniNames(); + if ( shutdown ) + killOmniNames(); return result; } diff --git a/src/VTKViewer/VTKViewer_ViewWindow.cxx b/src/VTKViewer/VTKViewer_ViewWindow.cxx index f28c446b1..e885ed8cc 100755 --- a/src/VTKViewer/VTKViewer_ViewWindow.cxx +++ b/src/VTKViewer/VTKViewer_ViewWindow.cxx @@ -455,8 +455,8 @@ void VTKViewer_ViewWindow::onAdjustTrihedron(){ (bnd[5]-bnd[4])*(bnd[5]-bnd[4])); }else{ aLength = bnd[1]-bnd[0]; - aLength = QMAX((bnd[3]-bnd[2]),aLength); - aLength = QMAX((bnd[5]-bnd[4]),aLength); + aLength = std::max((bnd[3]-bnd[2]),aLength); + aLength = std::max((bnd[5]-bnd[4]),aLength); } static vtkFloatingPointType aSizeInPercents = 105; -- 2.39.2