Salome HOME
Merge branch 'rnv/23406'
authorrnv <rnv@opencascade.com>
Tue, 14 Feb 2017 11:23:24 +0000 (14:23 +0300)
committerrnv <rnv@opencascade.com>
Tue, 14 Feb 2017 11:32:40 +0000 (14:32 +0300)
58 files changed:
CMakeLists.txt
src/CAF/CAF_Application.cxx
src/CAF/CAF_Application.h
src/CAF/CAF_Study.cxx
src/CAM/CAM_Application.cxx
src/CMakeLists.txt
src/GLViewer/CMakeLists.txt
src/GLViewer/GLViewer_BaseDrawers.cxx
src/GLViewer/GLViewer_Context.h
src/GLViewer/GLViewer_Drawer.cxx
src/GLViewer/GLViewer_Drawer.h
src/GLViewer/GLViewer_Grid.h
src/GLViewer/GLViewer_Object.h
src/GLViewer/GLViewer_Text.h
src/GLViewer/GLViewer_Tools.cxx
src/GLViewer/GLViewer_ViewPort.cxx
src/GLViewer/GLViewer_ViewPort2d.h
src/GLViewer/GLViewer_Viewer2d.h
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/resources/LightApp_msg_fr.ts
src/OCCViewer/OCCViewer_AISSelector.cxx
src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx
src/OCCViewer/OCCViewer_Trihedron.cxx
src/OCCViewer/OCCViewer_VService.cxx
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewPort.cxx
src/OCCViewer/OCCViewer_ViewSketcher.cxx
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OpenGLUtils/OpenGLUtils_FrameBuffer.cxx
src/OpenGLUtils/OpenGLUtils_FrameBuffer.h
src/Qtx/CMakeLists.txt
src/Qtx/Qtx.cxx
src/Qtx/QtxColorButton.cxx
src/Qtx/QtxMenu.cxx
src/Qtx/QtxMenu.h
src/Qtx/QtxToolButton.cxx [new file with mode: 0644]
src/Qtx/QtxToolButton.h [new file with mode: 0644]
src/SALOME_PY/SalomePy.cxx
src/SALOME_PYQT/SalomePyQt/CMakeLists.txt
src/STD/STD_Application.cxx
src/STD/STD_Application.h
src/SUITApp/SUITApp.cxx
src/SUITApp/SUITApp_Application.cxx
src/SVTK/SVTK_RenderWindowInteractor.cxx
src/SVTK/SVTK_RenderWindowInteractor.h
src/SVTK/SVTK_SpaceMouse.cxx
src/SVTK/SVTK_SpaceMouse.h
src/SVTK/SVTK_ViewWindow.cxx
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h
src/Session/SALOME_Session_Server.cxx
src/VTKViewer/VTKViewer_PolyDataMapper.cxx
src/VTKViewer/VTKViewer_PolyDataMapper.h
src/VTKViewer/VTKViewer_RenderWindow.cxx
tools/PyConsole/src/python/CMakeLists.txt
tools/PyInterp/src/PyInterp_RefCounterObj.h

index 326b619861585ac0bcdfb922e061acb4f5899fc5..6690cb677b5b3294212795e44cac8bcc20f415e6 100755 (executable)
@@ -342,12 +342,6 @@ SET(_${PROJECT_NAME}_exposed_targets
     ImageComposer
 )
 
-# CAF package (not compilable while TDocStd_Application::Formats is removed)
-IF(CAS_VERSION_STR VERSION_LESS "7.0.1")
-  LIST(APPEND _${PROJECT_NAME}_exposed_targets 
-       caf)
-ENDIF()
-
 IF(SALOME_USE_OCCVIEWER OR SALOME_USE_VTKVIEWER OR SALOME_USE_GLVIEWER)
   LIST(APPEND _${PROJECT_NAME}_exposed_targets 
        OpenGLUtils)
index 477dca391ea2bd257067c9cdd2309852c244d18a..ef3e2fec0f12d40cd65d76c722a9e5ac40eed2a6 100755 (executable)
@@ -36,7 +36,7 @@
 #include <QStringList>
 
 #include <Resource_Manager.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
+#include <TColStd_SequenceOfAsciiString.hxx>
 
 /*!
   \brief Create new instance of CAF_Application.
@@ -106,13 +106,16 @@ Handle( TDocStd_Application ) CAF_Application::stdApp() const
 
   \return file filters for open/save document dialog box
 */
-QString CAF_Application::getFileFilter() const
+QString CAF_Application::getFileFilter( bool open ) const
 {
   if ( stdApp().IsNull() )
     return QString();
 
-  TColStd_SequenceOfExtendedString formats;
-  stdApp()->Formats( formats );
+  TColStd_SequenceOfAsciiString formats;
+  if ( open )
+    stdApp()->ReadingFormats( formats );
+  else
+    stdApp()->WritingFormats( formats );
 
   QStringList allWC;
   QMap<QString, QStringList> wildCards;
index 5ee1b60be0f01b32e52086343b756feae495a862..1ec1aa90e4d842c979077dd6d6577b123e86ab54 100755 (executable)
@@ -48,7 +48,7 @@ public:
 
   Handle(TDocStd_Application) stdApp() const;
 
-  virtual QString             getFileFilter() const;
+  virtual QString             getFileFilter( bool ) const;
 
 public slots:  
   virtual void                onHelpAbout();
index 15f6185ee63414402ff7caec02748c71877ea981..f4f4cf957be6cb5960581e41bf45a828a33acdcb 100755 (executable)
@@ -33,7 +33,7 @@
 
 #include <TDF_Delta.hxx>
 #include <TDF_ListIteratorOfDeltaList.hxx>
-
+#include <TColStd_SequenceOfAsciiString.hxx>
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx>
 
@@ -106,8 +106,10 @@ bool CAF_Study::createDocument( const QString& doc )
   {
     try {
       OCC_CATCH_SIGNALS;
-      TColStd_SequenceOfExtendedString formats;
-      app->stdApp()->Formats( formats );
+      TColStd_SequenceOfAsciiString formats;
+      app->stdApp()->WritingFormats( formats );
+      if ( formats.IsEmpty() )
+        app->stdApp()->ReadingFormats( formats );
       if ( !formats.IsEmpty() )
         app->stdApp()->NewDocument( formats.First(), myStdDoc );
     }
index a8603ec1f358f72eab8f0669b0ef0addac5700b5..59a7f7ed82a5886bc30d9bbfcc00abb42cb586af 100755 (executable)
@@ -771,8 +771,10 @@ void CAM_Application::readModuleList()
     if ( !modLibrary.isEmpty() )
     {
       modLibrary = SUIT_Tools::file( modLibrary.trimmed() );
-#ifdef WIN32
+#if defined(WIN32)
       QString libExt = QString( "dll" );
+#elif defined(__APPLE__)
+      QString libExt = QString( "dylib" );
 #else
       QString libExt = QString( "so" );
 #endif
index f4b1b7fed130e67ebe5aae262c256c816fc0635e..907798d2e1ba60eb7f2789784c024ab4ca75cd28 100755 (executable)
@@ -32,10 +32,7 @@ ADD_SUBDIRECTORY(ObjBrowser)
 ADD_SUBDIRECTORY(SUIT)
 ADD_SUBDIRECTORY(SUITApp)
 ADD_SUBDIRECTORY(STD)
-# CAF package (not compilable while TDocStd_Application::Formats is removed)
-IF(CAS_VERSION_STR VERSION_LESS "7.0.1")
-  ADD_SUBDIRECTORY(CAF)
-ENDIF()
+ADD_SUBDIRECTORY(CAF)
 ADD_SUBDIRECTORY(CAM)
 ADD_SUBDIRECTORY(LogWindow)
 ADD_SUBDIRECTORY(Prs)
index 2198d7eb45e4e3593c9dca30063452f161d95a54..9d0e36c57c3044fd629632512d2a27f053b287f7 100755 (executable)
@@ -33,7 +33,7 @@ ADD_DEFINITIONS(${CAS_DEFINITIONS} ${QT_DEFINITIONS})
 
 # libraries to link to
 SET(_link_LIBRARIES ${QT_LIBRARIES} ${CAS_KERNEL} ${OPENGL_LIBRARIES} qtx suit)
-IF(NOT WIN32)
+IF(NOT (WIN32 OR APPLE))
   LIST(APPEND _link_LIBRARIES Xmu)
 ENDIF()
 
index cd27c7f04fc98f36600177f8be7903d09f719680..f675e769ef2a40f26e61f415396ca9a4db0d8bfb 100644 (file)
@@ -34,8 +34,7 @@
 // Qt includes
 #include <QColor>
 
-
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
 #include <GL/glx.h>
 #endif
 
index 498ef3f22f16d6bc5406fd61ac91f39c41b273ec..aa31fd70960ad0a828e6f66692dd8f1ca6f45238 100644 (file)
@@ -39,7 +39,11 @@ class QRect;
 #include <Quantity_NameOfColor.hxx>
 #include <Quantity_Color.hxx>
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 class GLViewer_Viewer2d;
 
index 089d8a8109c809a48852c99747aa7a12feb2b5c7..13d5e8acbef14f0b6bbaffb3abc2e4e93ceba5ec 100644 (file)
@@ -36,7 +36,9 @@
 #include <QPainter>
 #include <QFile>
 
-#ifndef WIN32
+#if defined(__APPLE__)
+#include <OpenGL/CGLCurrent.h>
+#elif !defined(WIN32)
 #include <GL/glx.h>
 #endif
 
@@ -377,7 +379,7 @@ static GLuint displayListBase( QFont* theFont )
   aFindFont.myIsUndl = theFont->underline();
   aFindFont.myPointSize = theFont->pointSize();
 
-#ifdef WIN32
+#if defined(WIN32)
   HGLRC ctx = ::wglGetCurrentContext();
   if ( !ctx )
     return aList;  
@@ -406,6 +408,33 @@ static GLuint displayListBase( QFont* theFont )
     aList = listBase;
     GLViewer_TexFont::BitmapFontCache[aFindFont] = aList;
   }
+#elif defined(__APPLE__)
+  CGLContextObj ctx = ::CGLGetCurrentContext();
+  if ( !ctx )
+    return aList;
+
+  aFindFont.myViewPortId = (long)ctx;
+
+  if ( GLViewer_TexFont::BitmapFontCache.contains( aFindFont ) )
+    aList = GLViewer_TexFont::BitmapFontCache[aFindFont];
+  else
+  {
+    GLuint listBase = 0;
+    QMap<GLViewer_TexFindId, GLuint>::iterator it = GLViewer_TexFont::BitmapFontCache.begin();
+    for ( ; it != GLViewer_TexFont::BitmapFontCache.end(); ++it )
+    {
+      if ( it.key().myViewPortId == (long)ctx && it.value() > listBase )
+        listBase = it.value();
+    }
+    listBase += 256;
+
+    //HDC glHdc = ::wglGetCurrentDC();
+    //::SelectObject( glHdc, theFont->handle() );
+    //if ( !::wglUseFontBitmaps( glHdc, 0, 256, listBase ) )
+    //  listBase = 0;
+    aList = listBase;
+    GLViewer_TexFont::BitmapFontCache[aFindFont] = aList;
+  }
 #else //X Window
   Display* aDisp = glXGetCurrentDisplay();
   if( !aDisp )
index e454081a59d4673ffd990f07da880a361d04c059..f936da990d91b8e0f573060db9b0ab5d3f288767 100644 (file)
 
 class QFile;
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 #include "GLViewer.h"
 #include "GLViewer_Defs.h"
@@ -79,8 +83,8 @@ struct GLVIEWER_API GLViewer_TexFindId
   bool        myIsUndl;
   //! Font Size
   int         myPointSize;
-  //! View POrt ID
-  int         myViewPortId;
+  //! View Port ID
+  long        myViewPortId;
   //! Overloaded operator for using struct as MAP key
   bool operator < (const GLViewer_TexFindId theStruct) const 
   { 
index 1a867b2e4c8a84cffb5c829418a778101287b6af..f487a0e7ed4fd8b8a2135b4c53fd71e8cca4ba49 100644 (file)
 
 #include "GLViewer.h"
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
 #include <GL/gl.h>
 #include <GL/glu.h>
+#endif
 
 #ifdef WIN32
 #pragma warning( disable:4251 )
index 10b181ab157940dffb2c1aaffebbeec5818ce5f1..bbf4df0e16ec182b0d2fd3907c1201183c9a8897 100644 (file)
 #include "GLViewer.h"
 #include "GLViewer_Geom.h"
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 #include <QString>
 
index cc15d89079b0c41c6daee654484ab2f2177ae9b0..01adfd250f93d4e2bdbee6d0e41a183821a48d74 100644 (file)
 #include "GLViewer.h"
 #include "GLViewer_Defs.h"
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 #include <QFont>
 #include <QString>
index 7079142f8751826c4e6946d1bca8735a981b9f6b..e1df5e0ead637df43db6ce64d4b4c56de5ec925b 100644 (file)
 //
 #include "GLViewer_Tools.h"
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 #include <iostream>
 #include <string.h>
index 733b1a392bde11c55bf7088ad24e50df4f144e8c..75187e971d20c891434b6a878891ce3ebb49a25f 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <stdlib.h>
 
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
 #include <QX11Info>
 #include <GL/glx.h>
 #include <X11/Xlib.h>
@@ -353,7 +353,7 @@ void GLViewer_ViewPort::cleanup()
 */
 void GLViewer_ViewPort::selectVisualId( ViewType type )
 {
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
     XVisualInfo* pVisualInfo;
     if ( QX11Info::display() )
     {
index c673b169b65b3a6d70c105eac49b95851651982e..465c2f8d77466e394944e7a383322884ec978122 100644 (file)
 #include <windows.h>
 #endif
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
 #include <GL/gl.h>
 #include <GL/glu.h>
+#endif
 
 #include "GLViewer_ViewPort.h"
 #include "GLViewer_Widget.h"
index 875baa0b8ebdf84b75a37659c002be19866cc1ec..9cafb3bdca1209b2881c9364d73703e93fce3e36 100644 (file)
@@ -38,7 +38,11 @@ class QFile;
 
 #include <TColStd_SequenceOfInteger.hxx>
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 class GLViewer_Object;
 class GLViewer_ViewFrame;
index 37ca6fd0f769c8d0acde36547ff6f8d4556b7233..1824defd3442e2fba42f0a73abaf3e4ae173342c 100644 (file)
@@ -1836,12 +1836,10 @@ void LightApp_Application::studyCreated( SUIT_Study* s )
 }
 
 /*!Gets file filter.
- *\retval QString "(*.bin)"
+ *\retval QString "(*.hdf)"
  */
-QString LightApp_Application::getFileFilter() const
+QString LightApp_Application::getFileFilter( bool /*open*/) const
 {
-  //return "(*.bin)";
-  // HDF persistence
   return "(*.hdf)";
 }
 
@@ -4458,8 +4456,10 @@ bool LightApp_Application::isLibExists( const QString& moduleTitle ) const
   bool isPythonLightModule = lib.contains("SalomePyQtGUILight");
 
   QStringList paths;
-#ifdef WIN32
+#if defined(WIN32)
   paths = QString(::getenv( "PATH" )).split( ";", QString::SkipEmptyParts );
+#elif defined(__APPLE__)
+  paths = QString(::getenv( "DYLD_LIBRARY_PATH" )).split( ":", QString::SkipEmptyParts );
 #else
   paths = QString(::getenv( "LD_LIBRARY_PATH" )).split( ":", QString::SkipEmptyParts );
 #endif
index 92654622873d8cb04626f4c85317dbe4d863fd89..5f98a8794e378ca63ffad2add20e228cf3c9c1d4 100644 (file)
@@ -118,7 +118,7 @@ public:
 
   LightApp_Preferences*               preferences() const;
 
-  virtual QString                     getFileFilter() const;
+  virtual QString                     getFileFilter( bool ) const;
 
   virtual QString                     getFileName( bool open, const QString& initial, const QString& filters,
                                                    const QString& caption, QWidget* parent );
index 1646f5b82ce61e31c0586814351d0c6c41b6e15c..88a208a03a216cbdb593050ae27206c0860dfb10 100755 (executable)
@@ -5,7 +5,7 @@
     <name>@default</name>
     <message>
         <source>EXTERNAL_BROWSER_CANNOT_SHOW_PAGE</source>
-        <translation>Le navigateur externe &quot;%1&quot; ne peut pas trouver la page d&apos;aide &quot;%2&quot;. Voulez-vous le modifierdans les préférences ?</translation>
+        <translation>Le navigateur externe &quot;%1&quot; ne peut pas trouver la page d&apos;aide &quot;%2&quot;. Voulez-vous modifier les settings du navigateur externe dans les préférences ?</translation>
     </message>
     <message>
         <source>ABOUT_COPYRIGHT</source>
index c15c45e4ed7faf811692b16fa2f33a876accfa28..03b001be77f3d132b58c0722ebf9c89001c210f5 100755 (executable)
@@ -157,8 +157,7 @@ bool OCCViewer_AISSelector::moveTo ( int x, int y, const Handle (V3d_View)& view
     return false;
   
   AIS_StatusOfDetection status = AIS_SOD_Error;
-  status = myAISContext->MoveTo (x, y, view);
-  
+  status = myAISContext->MoveTo ( x, y, view, Standard_True );
   return ( status != AIS_SOD_Error && status != AIS_SOD_AllBad );
 }
 
@@ -177,7 +176,7 @@ bool OCCViewer_AISSelector::select ()
   bool hadSelection = ( myNumSelected > 0 );
   
   /* select and send notifications */
-  return checkSelection ( myAISContext->Select(), hadSelection, false );
+  return checkSelection ( myAISContext->Select( Standard_True ), hadSelection, false );
 }
 
 /*!
@@ -197,8 +196,8 @@ bool OCCViewer_AISSelector::select ( int left, int top, int right, int bottom,
   bool hadSelection = ( myNumSelected > 0 );
   
   /* select and send notifications */
-  return checkSelection ( myAISContext->Select(left, top, right, bottom, view),
-                          hadSelection, false );
+  return checkSelection ( myAISContext->Select( left, top, right, bottom, view, Standard_True ),
+                         hadSelection, false );
 }
 
 /*!
@@ -219,7 +218,7 @@ bool OCCViewer_AISSelector::shiftSelect ()
     return false;
   
   /* select and send notifications */
-  return checkSelection ( myAISContext->ShiftSelect(), hadSelection, true );
+  return checkSelection ( myAISContext->ShiftSelect( Standard_True ), hadSelection, true );
 }
 
 /*!
@@ -243,6 +242,6 @@ bool OCCViewer_AISSelector::shiftSelect ( int left, int top, int right, int bott
     return false;
   
   /* select and send notifications */
-  return checkSelection ( myAISContext->ShiftSelect(left,top,right,bottom, view),
-    hadSelection, true );
+  return checkSelection ( myAISContext->ShiftSelect( left, top, right, bottom, view, Standard_True ),
+                         hadSelection, true );
 }
index 45e6693969ae598dffef7eabad6d349efe5390c7..a187df5378cc6a47bfe60f566dbef457c2303b66 100644 (file)
@@ -406,7 +406,7 @@ void OCCViewer_ClipPlaneInteractor::performDragging( const QPoint& theDragPos,
       thePlane->SetToUpdate();
       thePlane->UpdateSelection();
 
-      myViewer->getAISContext()->Update( thePlane );
+      myViewer->getAISContext()->Update( thePlane , Standard_True );
     }
     break;
 
@@ -447,7 +447,7 @@ void OCCViewer_ClipPlaneInteractor::performDragging( const QPoint& theDragPos,
       thePlane->SetToUpdate();
       thePlane->UpdateSelection();
 
-      myViewer->getAISContext()->Update( thePlane );
+      myViewer->getAISContext()->Update( thePlane , Standard_True );
     }
     break;
   }
@@ -495,7 +495,7 @@ bool OCCViewer_ClipPlaneInteractor::mousePress( QMouseEvent* theEvent,
   Handle(AIS_InteractiveContext) anAISContext = myViewer->getAISContext();
 
   // check detection of plane
-  anAISContext->MoveTo( theEvent->x(), theEvent->y(), aView3D );
+  anAISContext->MoveTo( theEvent->x(), theEvent->y(), aView3D , Standard_True );
 
   if ( !anAISContext->HasDetected() )
   {
@@ -522,7 +522,7 @@ bool OCCViewer_ClipPlaneInteractor::mousePress( QMouseEvent* theEvent,
   // process mouse click on the object
   if ( myIsClickable )
   {
-    myViewer->getAISContext()->SetSelected( Handle(AIS_InteractiveObject)::DownCast(aPlane) );
+    myViewer->getAISContext()->SetSelected( Handle(AIS_InteractiveObject)::DownCast(aPlane) , Standard_True );
     emit planeClicked( aPlane );
   }
 
index 4682ce950340f2c49a33dbb4ac605b6a720256ca..d13af530ef417aa3f9362f5dc791fa6722dec3ab 100644 (file)
 #include <windows.h>
 #endif
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 #include "OCCViewer_Trihedron.h"
 
@@ -37,7 +41,7 @@
 #include <PrsMgr_PresentationManager3d.hxx>
 
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 # include <GL/glx.h>
 #endif
 
@@ -122,7 +126,7 @@ GLuint generateTextList()
   bool ok = false;
   GLuint aList = glGenLists( 256 );
 
-#ifdef WIN32
+#if defined(WIN32)
   HGLRC hglrc = wglGetCurrentContext();
   if( hglrc )
   {
@@ -142,7 +146,7 @@ GLuint generateTextList()
     SelectObject( hdc, oldFont );
     DeleteObject( font );
   }
-#else // X Window
+#elif !defined(__APPLE__) // X Window
   Display* dpy = glXGetCurrentDisplay();
   if( dpy )
   {
index ec09bc0a965243ab161adb5a9c778be75d9a3baa..1102899a50545a10ae050ba17f254b9cf6c75cc5 100644 (file)
 #endif
 #include <Aspect_DisplayConnection.hxx>
 
-#ifdef WIN32
+#if defined(WIN32)
 #include <WNT_Window.hxx>
+#elif defined(__APPLE__)
+#include <Cocoa_Window.hxx>
 #else
 #include <Xw_Window.hxx>
 #endif
@@ -47,8 +49,10 @@ Handle(Aspect_Window) OCCViewer_VService::CreateWindow( const Handle(V3d_View)&
                                                        WId winId )
 {
   Aspect_Handle aWindowHandle = (Aspect_Handle)winId;
-#ifdef WIN32
+#if defined(WIN32)
   Handle(WNT_Window) viewWindow = new WNT_Window( aWindowHandle );
+#elif defined(__APPLE__)
+  Handle(Cocoa_Window) viewWindow = new Cocoa_Window( (NSView*)winId );
 #else
   Handle(Aspect_DisplayConnection) aDispConnection = view->Viewer()->Driver()->GetDisplayConnection();
   Handle(Xw_Window) viewWindow = new Xw_Window( aDispConnection, aWindowHandle );
@@ -75,7 +79,7 @@ Handle(V3d_Viewer) OCCViewer_VService::CreateViewer( const Standard_ExtString na
   if (aGraphicDriver.IsNull())
   {
     Handle(Aspect_DisplayConnection) aDisplayConnection;
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
     aDisplayConnection = new Aspect_DisplayConnection( displayName );
 #else
     aDisplayConnection = new Aspect_DisplayConnection();
@@ -87,10 +91,15 @@ Handle(V3d_Viewer) OCCViewer_VService::CreateViewer( const Standard_ExtString na
 #endif
   }
 
-#if OCC_VERSION_LARGE > 0x07000000
+#if OCC_VERSION_LARGE > 0x07010000
   return new V3d_Viewer( aGraphicDriver, name, domain, viewSize, viewProjection,
-                        Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
+                        Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD,
                         computedMode, defaultComputedMode );
+  
+#elif OCC_VERSION_LARGE > 0x07000000
+  return new V3d_Viewer( aGraphicDriver, name, domain, viewSize, viewProjection,
+                        Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
+                        computedMode, defaultComputedMode );  
 #else
   return new V3d_Viewer( aGraphicDriver, name, domain, viewSize, viewProjection,
                         Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
index a8e64751da371adab958897579a1df09748ab8bd..f2c3169ce0d324aa504bd99ecc408d8e43f2d72a 100644 (file)
@@ -129,13 +129,15 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
 
   // init selector
   myAISContext = new AIS_InteractiveContext( myV3dViewer );
-#if OCC_VERSION_LARGE > 0x07000000
-    
+#if OCC_VERSION_LARGE > 0x07010000
+  myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected)->SetColor( Quantity_NOC_WHITE );
+  myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_Selected)->SetColor( Quantity_NOC_WHITE );
+#elif OCC_VERSION_LARGE > 0x07000000
   const Handle(Graphic3d_HighlightStyle)& sStyle = myAISContext->SelectionStyle();
-  sStyle->SetColor( Quantity_NOC_WHITE ); 
-#else  
+  sStyle->SetColor( Quantity_NOC_WHITE );
+#else
   myAISContext->SelectionColor( Quantity_NOC_WHITE );
-#endif  
+#endif
   
   // display isoline on planar faces (box for ex.)
   myAISContext->IsoOnPlane( true );
@@ -347,7 +349,7 @@ void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theE
     }
     Handle(V3d_View) aView3d = aView->getViewPort()->getView();
     if ( !aView3d.IsNull() ) {
-      myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d);
+      myAISContext->MoveTo( theEvent->x(), theEvent->y(), aView3d, Standard_True );
     }
   }
 }
@@ -379,14 +381,14 @@ void OCCViewer_Viewer::onMouseRelease(SUIT_ViewWindow* theWindow, QMouseEvent* t
     if ( !isPreselectionEnabled() ) {
       Handle(V3d_View) aView3d = aView->getViewPort()->getView();
       if ( !aView3d.IsNull() ) {
-       myAISContext->MoveTo(myEndPnt.x(), myEndPnt.y(), aView3d);
+       myAISContext->MoveTo( myEndPnt.x(), myEndPnt.y(), aView3d, Standard_True );
       }
     }
 
     if (aHasShift && myMultiSelectionEnabled)
-      myAISContext->ShiftSelect();
-    else
-      myAISContext->Select();
+      myAISContext->ShiftSelect( Standard_True );
+    else 
+      myAISContext->Select( Standard_True );
   }
   else
   {
@@ -438,14 +440,14 @@ void OCCViewer_Viewer::onKeyPress(SUIT_ViewWindow* theWindow, QKeyEvent* theEven
     if ( !isPreselectionEnabled() ) {
       Handle(V3d_View) aView3d = aView->getViewPort()->getView();
       if ( !aView3d.IsNull() ) {
-       myAISContext->MoveTo(myCurPnt.x(), myCurPnt.y(), aView3d);
+       myAISContext->MoveTo(myCurPnt.x(), myCurPnt.y(), aView3d, Standard_True );
       }
     }
 
     if (aHasShift && myMultiSelectionEnabled)
-      myAISContext->ShiftSelect();
+      myAISContext->ShiftSelect( Standard_True );
     else
-      myAISContext->Select();
+      myAISContext->Select( Standard_True );
 
     emit selectionChanged();
 
@@ -1287,7 +1289,7 @@ void OCCViewer_Viewer::setTrihedronShown( const bool on )
     myAISContext->Deactivate( myTrihedron );
   }
   else {
-    myAISContext->Erase( myTrihedron );
+    myAISContext->Erase( myTrihedron , Standard_True );
   }
 }
 
index 41079ea3c9711b7a4815c2e0414d2d62a6144655..63db7700b2b4dec9694189bbdc6a2f121da08fd1 100755 (executable)
@@ -94,7 +94,7 @@ public:
   
   void                            getSelectedObjects(AIS_ListOfInteractive& theList);
   void                            setObjectsSelected(const AIS_ListOfInteractive& theList);
-  void                            setSelected(const Handle(AIS_InteractiveObject)& theIO) { myAISContext->SetSelected(theIO);}
+  void                            setSelected(const Handle(AIS_InteractiveObject)& theIO) { myAISContext->SetSelected(theIO,Standard_True);}
 
   void                            performSelectionChanged();
   // emit signal selectionChanged
index d6cca3173e96a9785872ea5ebda943e1e7ad5f2a..d0d2ce19d94539ccd0747b8e3d6b41c027cf1920 100755 (executable)
@@ -40,7 +40,7 @@
 
 #include <stdlib.h>
 
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
 #include <QX11Info>
 #include <GL/glx.h>
 #include <X11/Xlib.h>
@@ -236,7 +236,7 @@ void OCCViewer_ViewPort::cleanup()
 */
 void OCCViewer_ViewPort::selectVisualId()
 {
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
   XVisualInfo* pVisualInfo;
   if ( QX11Info::display() )
   {
index 103880d525d32046e562446532140f8b50ccf95e..16d028f1d787bfbdf1ae8cb0b3eb4e5ef95218c2 100755 (executable)
@@ -492,35 +492,30 @@ void OCCViewer_PolygonSketcher::onSketch( SketchState state )
     if ( state != Fin )
       p.drawPolyline( *mypPoints );
       }*/
-  if ( mypPolyRB )
-    {
+  if ( mypPolyRB ) {
+    if ( state == Fin ) {
+      mypPolyRB->clearGeometry();
+      mypPolyRB->hide();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+      QApplication::syncX();
+#endif
+      mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching );
+    } else {
       mypPolyRB->setUpdatesEnabled ( false );
       if ( !mypPolyRB->isVisible() )
-        mypPolyRB->show();
+       mypPolyRB->show();
       //if ( state != Debut )
       //  mypPolyRB->repaint();
-
+      
       if ( state != Fin && points->count() )
-        mypPolyRB->initGeometry( QPolygon(*points) << myCurr );
+       mypPolyRB->initGeometry( QPolygon(*points) << myCurr );
       //mypPolyRB->addNode( myCurr );
-
+      
       //if ( state != Fin )
       //  mypPolyRB->repaint();
       mypPolyRB->setUpdatesEnabled ( true );
       //mypPolyRB->repaint();
     }
-      
-  if ( state == Fin )
-  {
-    if ( mypPolyRB )
-      {
-        mypPolyRB->clearGeometry();
-        mypPolyRB->hide();
-      }
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-    QApplication::syncX();
-#endif
-    mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching );
   }
 }
 
index 8959f5961f7aa48f83caaa1471571401571767f3..a4bce4220b4e3d0040794c9f2ae7b8446b4b8331 100644 (file)
@@ -115,7 +115,11 @@ static QEvent* l_mbPressEvent = 0;
 //# include <QWindowsStyle>
 //#endif
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 // To avoid conflict between KeyPress from the X.h (define KeyPress 2)
 // and QEvent::KeyPress (qevent.h)
@@ -538,7 +542,7 @@ void OCCViewer_ViewWindow::vpMousePressEvent( QMouseEvent* theEvent )
         if ( theEvent->button() == Qt::LeftButton )
         {
           Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
-          ic->Select();
+          ic->Select( Standard_True );
           for ( ic->InitSelected(); ic->MoreSelected(); ic->NextSelected() )
           {
             TopoDS_Shape aShape = ic->SelectedShape();
@@ -577,7 +581,7 @@ void OCCViewer_ViewWindow::vpMousePressEvent( QMouseEvent* theEvent )
           }
           if ( ic->NbSelected() == 0 ) myCurrPointType = myPrevPointType;
           if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange();
-          ic->CloseAllContexts();
+          ic->CloseAllContexts( Standard_True );
           myOperation = NOTHING;
           myViewPort->setCursor( myCursor );
           myCursorIsHand = false;
@@ -772,7 +776,7 @@ void OCCViewer_ViewWindow::activateSetRotationGravity()
   if ( myRotationPointSelection )
   {
     Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
-    ic->CloseAllContexts();
+    ic->CloseAllContexts( Standard_True );
     myOperation = NOTHING;
     myViewPort->setCursor( myCursor );
     myCursorIsHand = false;
@@ -812,7 +816,7 @@ void OCCViewer_ViewWindow::activateSetRotationSelected( double theX, double theY
   if ( myRotationPointSelection )
   {
     Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
-    ic->CloseAllContexts();
+    ic->CloseAllContexts( Standard_True );
     myOperation = NOTHING;
     myViewPort->setCursor( myCursor );
     myCursorIsHand = false;
index d0f822174e4680f80afa7096117bb1796cafc0db..891ae65117c4994ceca864a97cdfb8bdd8a6f4cb 100755 (executable)
 # ifndef GLX_GLXEXT_LEGACY
 #  define GLX_GLXEXT_LEGACY
 # endif
+#ifdef __APPLE__
+#import <mach-o/dyld.h>
+#import <stdlib.h>
+#import <string.h>
+void * glXGetProcAddressARB (const GLubyte *name)
+
+{
+    NSSymbol symbol;
+    char *symbolName;
+    symbolName = (char *)malloc (strlen ((const char *)name) + 2); // 1
+    strcpy(symbolName + 1, (const char *)name); // 2
+    symbolName[0] = '_'; // 3
+    symbol = NULL;
+    if (NSIsSymbolNameDefined (symbolName)) // 4
+        symbol = NSLookupAndBindSymbol (symbolName);
+    free (symbolName); // 5
+    return symbol ? NSAddressOfSymbol (symbol) : NULL; // 6
+}
+#else
 # include <GL/glx.h>
+#endif
 # include <dlfcn.h>
 #else
 # include <wingdi.h>
index 8e7efeb570ed8233edef5a037dd970cf8b4cf3eb..feb10037f875de7653bf205921095d413fed6328 100755 (executable)
 #include <windows.h>
 #endif
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 class OPENGLUTILS_EXPORT OpenGLUtils_FrameBuffer
 {
index f25866f091e732b8a9b106879e7c66ae64c8f83f..ad1337ffc18e4aa47753c5d305fe0bf4e354330e 100755 (executable)
@@ -72,6 +72,7 @@ SET(_moc_HEADERS
   QtxSlider.h
   QtxSplash.h
   QtxToolBar.h
+  QtxToolButton.h
   QtxToolTip.h
   QtxTreeView.h
   QtxValidator.h
@@ -164,6 +165,7 @@ SET(_other_SOURCES
   QtxSlider.cxx
   QtxSplash.cxx
   QtxToolBar.cxx
+  QtxToolButton.cxx
   QtxToolTip.cxx
   QtxTranslator.cxx
   QtxTreeView.cxx
index 0bacef045c4ffef344561205859e81e5296d9330..d596874ce2988a8647757aed20e31913fb0f7b8e 100755 (executable)
@@ -429,13 +429,15 @@ QString Qtx::library( const QString& str )
     name = QString( "lib" ) + name;
 #endif
 
-#ifdef WIN32
+#if defined(WIN32)
   QString libExt( "dll" );
+#elif defined(__APPLE__)
+  QString libExt( "dylib" );
 #else
   QString libExt( "so" );
 #endif
 
-  if ( ext.toLower() != QString( "so" ) && ext.toLower() != QString( "dll" ) )
+  if ( ext.toLower() != QString( "so" ) && ext.toLower() != QString( "dll" ) && ext.toLower() != QString( "dylib" ) )
   {
     if ( !name.isEmpty() && !ext.isEmpty() )
       name += QString( "." );
@@ -2104,7 +2106,7 @@ QFont Qtx::stringToFont( const QString& fontDescription )
   return font;
 }
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__ 
 
 #include <X11/Xlib.h>
 #include <GL/glx.h>
index c164440619cc9158657dd7bfb22058ba642ff2aa..5ba0316403e7c35d025affadf9f72bcb39bc981e 100644 (file)
@@ -54,7 +54,7 @@ QtxColorButton::QtxColorButton( QWidget* parent )
 : QToolButton( parent )
 {
   setCheckable( false );
-  setPopupMode( MenuButtonPopup ); // VSR 11/10/2010 temporarily roolback from InstantPopup (regressions)
+  setPopupMode( InstantPopup );
 
   QMenu* pm = new QMenu( this );
   QGridLayout* grid = new QGridLayout( pm );
index 526965bcf9c4c2b26357b2340dd411640a171c25..a70f1f392f3fa9b8d5c046332441c2b0d3cbfdcd 100644 (file)
@@ -359,13 +359,30 @@ void QtxMenu::setTitleAlignment( const Qt::Alignment a )
 }
 
 /*!
- * \brief Append a title to the and of the menu
- *  \param [in] text - title text
- */
-void QtxMenu::appendGroupTitle( const QString& text )
+  \brief Append group title to the end of the menu.
+  \param text group title's text
+*/
+void QtxMenu::addGroup( const QString& text )
+{
+  Title* aTitle = new Title( this );
+  aTitle->setText( text );
+
+  QWidgetAction* anAction = new QWidgetAction( this );
+  anAction->setDefaultWidget( aTitle );
+
+  addAction( anAction );
+}
+
+/*!
+  \brief Append group title to the end of the menu.
+  \param icon group title's icon
+  \param text group title's text
+*/
+void QtxMenu::addGroup( const QIcon& icon, const QString& text )
 {
   Title* aTitle = new Title( this );
   aTitle->setText( text );
+  aTitle->setIcon( icon );
 
   QWidgetAction* anAction = new QWidgetAction( this );
   anAction->setDefaultWidget( aTitle );
index 5ed17ed859a42c3ecada0d986a0857a5c173a279..493a348e4bb58981be64a40718785d6587b8ff7d 100644 (file)
@@ -59,7 +59,8 @@ public:
   virtual void           setTitleMode( const TitleMode );
   virtual void           setTitleAlignment( const Qt::Alignment );
 
-  virtual void           appendGroupTitle( const QString& );
+  virtual void           addGroup( const QString& );
+  virtual void           addGroup( const QIcon&, const QString& );
 
 public slots:
   virtual void           setVisible( bool );
diff --git a/src/Qtx/QtxToolButton.cxx b/src/Qtx/QtxToolButton.cxx
new file mode 100644 (file)
index 0000000..d245051
--- /dev/null
@@ -0,0 +1,529 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "QtxToolButton.h"
+#include "QtxMenu.h"
+
+#include <QKeyEvent>
+#include <QWheelEvent>
+
+namespace
+{
+  bool isSeparator( QAction* a )
+  {
+    return a->property( "separator" ).toBool();
+  }
+  void setSeparator( QAction* a )
+  {
+    a->setProperty( "separator", true );
+  }
+}
+
+/*!
+  \class QtxToolButton
+  \brief Drop-down tool button that behaves like a drop-down combo-box.
+
+  In contrast to the standard combo box, QtxToolButton can show drop-down
+  menu containing groups of items where each group has a separate title.
+*/
+
+/*!
+  \brief Constructor.
+  \param parent Parent widget.
+*/
+QtxToolButton::QtxToolButton( QWidget* parent )
+  : QToolButton( parent )
+{
+  setMenu( new QtxMenu( this ) );
+  setPopupMode( InstantPopup );
+  setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+  connect( this, SIGNAL( triggered( QAction* ) ), this, SLOT( actionTriggered( QAction* ) ) );
+}
+
+/*!
+  \brief Destructor.
+*/
+QtxToolButton::~QtxToolButton()
+{
+}
+
+/*!
+  \brief Add an item with the given \a text, and containing the specified \a userData.
+  The item is appended to the list of existing items.
+  \param text Item's text.
+  \param userData Item's data.
+  \return Index of just added item.
+*/
+int QtxToolButton::addItem( const QString& text, const QVariant& userData )
+{
+  QAction* action = menu()->addAction( text );
+  action->setData( userData );
+  bool currentChanged = false;
+  if ( !menu()->defaultAction() ) {
+    menu()->setDefaultAction( action );
+    currentChanged = true;
+  }
+  internalUpdate();
+  if ( currentChanged ) emitCurrentChanged( false, true );
+  return count()-1;
+}
+
+/*!
+  \brief Add an item with the given \a icon and \a text, and containing the specified
+  \a userData. The item is appended to the list of existing items.
+  \param text Item's text.
+  \param icon Item's icon.
+  \param userData Item's data.
+  \return Index of just added item.
+*/
+int QtxToolButton::addItem( const QIcon& icon, const QString& text, const QVariant& userData )
+{
+  QAction* action = menu()->addAction( icon, text );
+  action->setData( userData );
+  bool currentChanged = false;
+  if ( !menu()->defaultAction() ) {
+    menu()->setDefaultAction( action );
+    currentChanged = true;
+  }
+  internalUpdate();
+  if ( currentChanged ) emitCurrentChanged( false, true );
+  return count()-1;
+}
+
+/*!
+  \brief Add items with given \a texts. Each item is appended to the list of existing
+  items in turn.
+  \param texts Items being added.
+*/
+void QtxToolButton::addItems( const QStringList& texts )
+{
+  Q_FOREACH( QString text, texts )
+    menu()->addAction( text );
+  bool currentChanged = false;
+  if ( !menu()->defaultAction() && menu()->actions().count() > 0 ) {
+    menu()->setDefaultAction( menu()->actions()[0] );
+    currentChanged = true;
+  }
+  if ( currentChanged ) emitCurrentChanged( false, true );
+  internalUpdate();
+}
+
+/*!
+  \brief Add separator to the end of the items list.
+  \param text Separator's text.
+  \return Index of just added item.
+*/
+int QtxToolButton::addSeparator( const QString& text )
+{
+  (qobject_cast<QtxMenu*>(menu()))->addGroup( text );
+  setSeparator( actionAt( count()-1 ) );
+  return count()-1;
+}
+
+/*!
+  \brief Add separator to the end of the items list.
+  \param icon Separator's icon.
+  \param text Separator's text.
+  \return Index of just added item.
+*/
+int QtxToolButton::addSeparator( const QIcon& icon, const QString& text )
+{
+  (qobject_cast<QtxMenu*>(menu()))->addGroup( icon, text );
+  setSeparator( actionAt( count()-1 ) );
+  return count()-1;
+}
+
+/*!
+  \brief Remove item with given \a index.
+  \param index Index of item to be removed.
+*/
+void QtxToolButton::removeItem( int index )
+{
+  QAction* action = actionAt( index );
+  if ( !action ) return;
+  QAction* current = menu()->defaultAction();
+  menu()->removeAction( action );
+  bool currentChanged = false;
+  if ( action == current ) {
+    for ( int i = index; i < count(); i++ ) {
+      QAction* a = actionAt( i );
+      if ( a && !isSeparator( a ) ) {
+        menu()->setDefaultAction( a );
+        currentChanged = true;
+        break;
+      }
+    }
+    for ( int i = index-1; i >= 0; i-- ) {
+      QAction* a = actionAt( i );
+      if ( a && !isSeparator( a ) ) {
+        menu()->setDefaultAction( a );
+        currentChanged = true;
+        break;
+      }
+    }
+  }
+  internalUpdate();
+  if ( currentChanged ) emitCurrentChanged( false, true );
+}
+
+/*!
+  \brief Get the number of items.
+  \return Number of items.
+*/
+int QtxToolButton::count() const
+{
+  return menu()->actions().count();
+}
+
+/*!
+  \brief Get data of the current item.
+  \return Current item's data (invalid QVariant if list of items is empty
+  or current item doesn't have data).
+*/
+QVariant QtxToolButton::currentData() const
+{
+  QAction* action = menu()->defaultAction();
+  return action == 0 ? QVariant() : action->data();
+}
+
+/*!
+  \brief Get index of current item.
+  \return Current item's index; -1 if list of items is empty or if there's no
+  current item.
+*/
+int QtxToolButton::currentIndex() const
+{
+  QAction* action = menu()->defaultAction();
+  return action == 0 ? -1 : menu()->actions().indexOf( action );
+}
+
+/*!
+  \brief Get text of current item.
+  \return Current item's text; null sting if list of items is empty or
+  if there's no current item.
+*/
+QString QtxToolButton::currentText() const
+{
+  QAction* action = menu()->defaultAction();
+  return action == 0 ? QString() : action->text();
+}
+
+/*!
+  \brief Get custom data of the item at given \a index.
+  \param index Item's index.
+  \return Item's data (invalid QVariant if index is out of range).
+*/
+QVariant QtxToolButton::itemData( int index ) const
+{
+  QAction* action = actionAt( index );
+  return action == 0 ? QVariant() : action->data();
+}
+
+/*!
+  \brief Get icon of the item at given \a index.
+  \param index Item's index.
+  \return Item's icon.
+*/
+QIcon QtxToolButton::itemIcon( int index ) const
+{
+  QAction* action = actionAt( index );
+  return action == 0 ? QIcon() : action->icon();
+}
+
+/*!
+  \brief Get text of the item at given \a index.
+  \param index Item's index.
+  \return Item's text.
+*/
+QString QtxToolButton::itemText( int index ) const
+{
+  QAction* action = actionAt( index );
+  return action == 0 ? QString() : action->text();
+}
+
+/*!
+  \brief Set custom data of the item at given \a index.
+  \param index Item's index.
+  \param value Item's data.
+*/
+void QtxToolButton::setItemData( int index, const QVariant& value )
+{
+  QAction* action = actionAt( index );
+  if ( action ) action->setData( value );
+}
+
+/*!
+  \brief Set icon of the item at given \a index.
+  \param index Item's index.
+  \param icon Item's icon.
+*/
+void QtxToolButton::setItemIcon( int index, const QIcon& icon )
+{
+  QAction* action = actionAt( index );
+  if ( action ) action->setIcon( icon );
+  internalUpdate();
+}
+
+/*!
+  \brief Set text of the item at given \a index.
+  \param index Item's index.
+  \param text Item's text.
+*/
+void QtxToolButton::setItemText( int index, const QString& text )
+{
+  QAction* action = actionAt( index );
+  bool currentChanged = false;
+  if ( action ) {
+    currentChanged = menu()->defaultAction() == action && action->text() != text;
+    action->setText( text );
+  }
+  internalUpdate();
+  if ( currentChanged )
+    emit currentTextChanged( text );
+}
+
+/*!
+  \brief Search item with given \a text.
+  \param Item's text.
+  \return Item's index; -1 if item is not found.
+*/
+int QtxToolButton::findText( const QString& text )
+{
+  int index = -1;
+  for ( int i = 0; i < count() && index == -1; i++ ) {
+    QAction* action = actionAt( i );
+    if ( isSeparator( action ) ) continue;
+    if ( action->text() == text ) index = i;
+  }
+  return index;
+}
+
+/*!
+  \brief Clear widget.
+*/
+void QtxToolButton::clear()
+{
+  QAction* action = menu()->defaultAction();
+  menu()->clear();
+  internalUpdate();
+  if ( action ) emitCurrentChanged( false, true );
+}
+
+/*!
+  \brief Set current item by given \a index.
+  \param index Item's index.
+*/
+void QtxToolButton::setCurrentIndex( int index )
+{
+  bool currentChanged = false;
+  if ( index == -1 ) {
+    currentChanged = currentIndex() != -1;
+    menu()->setDefaultAction( 0 );
+  }
+  else if ( index >= count() )
+    return;
+  else {
+    QAction* action = actionAt( index );
+    if ( !isSeparator( action ) ) {
+      currentChanged = currentIndex() != index;
+      menu()->setDefaultAction( action );
+    }
+  }
+  internalUpdate();
+  if ( currentChanged ) emitCurrentChanged( false, true );
+}
+
+/*!
+  \brief Set current item by given \a text.
+  \param index Item's index.
+*/
+void QtxToolButton::setCurrentText( const QString& text )
+{
+  int index = findText( text );
+  if ( index != -1 )
+    setCurrentIndex( index );
+}
+
+/*!
+  \brief Reimplemented from QToolButton::keyPressEvent().
+  Process key press event.
+  \param e Key press event.
+*/
+void QtxToolButton::keyPressEvent( QKeyEvent* e )
+{
+  Move move = NoMove;
+  switch ( e->key() ) {
+  case Qt::Key_Up:
+  case Qt::Key_PageUp:
+    move = ( e->modifiers() & Qt::ControlModifier ) ? MoveFirst : MoveUp;
+    break;
+  case Qt::Key_Down:
+    if ( e->modifiers() & Qt::AltModifier ) {
+      showMenu();
+      return;
+    }
+  case Qt::Key_PageDown:
+    move = ( e->modifiers() & Qt::ControlModifier ) ? MoveLast : MoveDown;
+    break;
+  case Qt::Key_Home:
+    move = MoveFirst;
+    break;
+  case Qt::Key_End:
+    move = MoveLast;
+    break;
+  case Qt::Key_F4:
+    if ( !e->modifiers() ) {
+      showMenu();
+      return;
+    }
+    break;
+  case Qt::Key_Space:
+    showMenu();
+    return;
+  case Qt::Key_Enter:
+  case Qt::Key_Return:
+  case Qt::Key_Escape:
+    e->ignore();
+    break;
+  case Qt::Key_Select:
+    showMenu();
+    return;
+  case Qt::Key_Left:
+    move = ( e->modifiers() & Qt::ControlModifier ) ? MoveFirst : MoveUp;
+    break;
+  case Qt::Key_Right:
+    move = ( e->modifiers() & Qt::ControlModifier ) ? MoveLast : MoveDown;
+    break;
+  default:
+    e->ignore();
+    break;
+  }
+  moveIndex( move );
+}
+
+/*!
+  \brief Reimplemented from QToolButton::wheelEvent().
+  Process mouse wheel event.
+  \param e Mouse wheel event.
+*/
+void QtxToolButton::wheelEvent( QWheelEvent* e )
+{
+  Move move = NoMove;
+  if ( e->delta() > 0 )
+    move = ( e->modifiers() & Qt::ControlModifier ) ? MoveFirst : MoveUp;
+  else if ( e->delta() < 0 )
+    move = ( e->modifiers() & Qt::ControlModifier ) ? MoveLast : MoveDown;
+  moveIndex( move );
+}
+
+/*!
+  \brief Called when menu action is triggered.
+  \internal
+*/
+void QtxToolButton::actionTriggered( QAction* action )
+{
+  if ( action && !isSeparator( action ) ) {
+    int index = currentIndex();
+    menu()->setDefaultAction( action );
+    internalUpdate();
+    int newIndex = currentIndex();
+    emitCurrentChanged( true, index != newIndex );
+  }
+}
+
+/*!
+  \brief Update content of the widget.
+  \internal
+*/
+void QtxToolButton::internalUpdate()
+{
+  QAction* action = menu()->defaultAction();
+  setText( action == 0 ? "" : action->text() );
+  setIcon( action == 0 ? QIcon() : action->icon() );
+}
+
+/*!
+  \brief Get menu action at given index.
+  \internal
+*/
+QAction* QtxToolButton::actionAt( int index ) const
+{
+  return ( index >=0 && index < count() ) ? menu()->actions()[index] : 0;
+}
+
+/*!
+  \brief Move current index.
+  \internal
+*/
+void QtxToolButton::moveIndex( Move move )
+{
+  int index = currentIndex();
+  int newIndex = index;
+  switch ( move ) {
+  case MoveUp:
+  case MoveFirst:
+    for ( int i = index-1; i >= 0; i-- ) {
+      QAction* a = actionAt( i );
+      if ( a && !isSeparator( a ) ) {
+        newIndex = i;
+        if ( move == MoveUp )
+          break;
+      }
+    }
+    break;
+  case MoveDown:
+  case MoveLast:
+    for ( int i = index+1; i < count(); i++ ) {
+      QAction* a = actionAt( i );
+      if ( a && !isSeparator( a ) ) {
+        newIndex = i;
+        if ( move == MoveDown )
+          break;
+      }
+    }
+    break;
+  default:
+    break;
+  }
+  if ( newIndex != index ) {
+    menu()->setDefaultAction( actionAt( newIndex ) );
+    internalUpdate();
+    emitCurrentChanged( true, true );
+  }
+}
+
+/*!
+  \brief Emit `currentChanged()` signal.
+  \internal
+*/
+void QtxToolButton::emitCurrentChanged( bool activate, bool changed )
+{
+  QAction* action = menu()->defaultAction();
+  int index = action == 0 ? -1 : menu()->actions().indexOf( action );
+  QString text = action == 0 ? QString() : action->text();
+  if ( activate ) {
+    emit activated( index );
+    emit activated( text );
+  }
+  if ( changed ) {
+    emit currentIndexChanged( index );
+    emit currentIndexChanged( text );
+    emit currentTextChanged( text );
+  }
+}
diff --git a/src/Qtx/QtxToolButton.h b/src/Qtx/QtxToolButton.h
new file mode 100644 (file)
index 0000000..04a7195
--- /dev/null
@@ -0,0 +1,91 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef QTXTOOLBUTTON_H
+#define QTXTOOLBUTTON_H
+
+#include "Qtx.h"
+
+#include <QStringList>
+#include <QToolButton>
+#include <QVariant>
+
+class QTX_EXPORT QtxToolButton : public QToolButton
+{
+  Q_OBJECT
+
+  enum Move { NoMove=0, MoveUp, MoveDown, MoveFirst, MoveLast };
+
+public:
+  QtxToolButton( QWidget* = 0 );
+  virtual ~QtxToolButton();
+
+  int addItem( const QString&, const QVariant& = QVariant() );
+  int addItem( const QIcon&, const QString&, const QVariant& = QVariant() );
+  void addItems( const QStringList& );
+
+  int addSeparator( const QString& = QString() );
+  int addSeparator( const QIcon&, const QString& );
+
+  void removeItem( int );
+
+  int count() const;
+
+  QVariant currentData() const;
+  int currentIndex() const;
+  QString currentText() const;
+
+  QVariant itemData( int ) const;
+  QIcon itemIcon( int ) const;
+  QString itemText( int ) const;
+
+  void setItemData( int, const QVariant& );
+  void setItemIcon( int, const QIcon& );
+  void setItemText( int, const QString& );
+
+  int findText( const QString& );
+
+public slots:
+  void clear();
+
+  void setCurrentIndex( int );
+  void setCurrentText( const QString& );
+
+protected:
+  void keyPressEvent( QKeyEvent* );
+  void wheelEvent( QWheelEvent* );
+
+signals:
+  void activated( int );
+  void activated( const QString& );
+  void currentIndexChanged( int );
+  void currentIndexChanged( const QString& );
+  void currentTextChanged( const QString& );
+
+private slots:
+  void actionTriggered( QAction* );
+
+private:
+  void internalUpdate();
+  QAction* actionAt( int ) const;
+  void moveIndex( Move );
+  void emitCurrentChanged( bool, bool );
+};
+
+#endif // QTXTOOLBUTTON_H
index 65cf4ffe864f16434605f8c8c76c004267e10ce5..d099217b9fbd9616c526886a76074e9febff9210 100755 (executable)
@@ -449,7 +449,7 @@ extern "C" SALOMEPY_EXPORT PyObject* libSalomePy_setView( PyObject* self, PyObje
         case ViewLeft:
           aVTKViewWindow->onLeftView();   break;
         default:
-          PyErr_Format(PyExc_ValueError,"setView%: wrong parameter value; must be between %d and %d", ViewFront, ViewLeft );
+          PyErr_Format(PyExc_ValueError,"setView: wrong parameter value; must be between %d and %d", ViewFront, ViewLeft );
           break;
         }
       }
index 9760dd47a2a11c1ad2135f33a32e5677004c7bff..e5c68a0f60c63a1fd263824ec300fd056e991f9a 100755 (executable)
@@ -118,7 +118,7 @@ SET(SalomePyQt_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_sip_SOURCES})
 
 # --- rules ---
 
-ADD_LIBRARY(SalomePyQt ${SalomePyQt_SOURCES})
+ADD_LIBRARY(SalomePyQt MODULE ${SalomePyQt_SOURCES})
 TARGET_LINK_LIBRARIES(SalomePyQt ${_link_LIBRARIES})
 INSTALL(TARGETS SalomePyQt DESTINATION ${SALOME_INSTALL_LIBS})
 
index ff308b7d78cb620f6f5186a717cef3b1fe4d3fc2..d252e149199e4b51c1f7d1fcbe4bab3f99aed980 100755 (executable)
@@ -314,7 +314,7 @@ bool STD_Application::onNewDoc( const QString& name )
 void STD_Application::onOpenDoc()
 {
   // It is preferrable to use OS-specific file dialog box here !!!
-  QString aName = getFileName( true, QString(), getFileFilter(), QString(), 0 );
+  QString aName = getFileName( true, QString(), getFileFilter( true ), QString(), 0 );
   if ( aName.isNull() )
     return;
 
@@ -611,7 +611,7 @@ bool STD_Application::onSaveAsDoc()
   bool isOk = false;
   while ( !isOk )
   {
-    QString aName = getFileName( false, study->studyName(), getFileFilter(), QString(), 0 );
+    QString aName = getFileName( false, study->studyName(), getFileFilter( false ), QString(), 0 );
     if ( aName.isNull() )
       return false;
 
@@ -884,6 +884,12 @@ void STD_Application::onConnectPopupRequest( SUIT_PopupClient* client, QContextM
   delete popup;
 }
 
+/*!\retval QString - return file extension(s).*/
+QString STD_Application::getFileFilter( bool /*open*/ ) const
+{
+  return QString();
+}
+
 /*!\retval QString - return file name from dialog.*/
 QString STD_Application::getFileName( bool open, const QString& initial, const QString& filters,
                                       const QString& caption, QWidget* parent )
index 06ad40df96b1b01ed08ecb1276d3b2b5907242db..c709c95cdba23b748a499eb0a262c1fa2f349633 100755 (executable)
@@ -60,7 +60,7 @@ public:
          UserID
   };
 
- public:
+public:
   STD_Application();
   virtual ~STD_Application();
 
@@ -88,9 +88,9 @@ public:
   void                  viewManagers( const QString&, ViewManagerList& ) const;
   virtual int           viewManagerId (const SUIT_ViewManager* ) const;
 
-  virtual QString       getFileFilter() const { return QString(); }
+  virtual QString       getFileFilter( bool open ) const;
   virtual QString       getFileName( bool open, const QString& initial, const QString& filters,
-                                                             const QString& caption, QWidget* parent );
+                                    const QString& caption, QWidget* parent );
   QString               getDirectory( const QString& initial, const QString& caption, QWidget* parent );
 
   virtual void          start();
index 979783334852ad305733f82479eb07a5278fa09e..8c1fd4b6c84d9916e7f3dd0a8a0cff4ec81d726c 100644 (file)
@@ -57,6 +57,9 @@
 #include <QRegExp>
 #include <QString>
 #include <QStringList>
+#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+#include <QSurfaceFormat>
+#endif
 
 #include <stdlib.h>
 
@@ -179,6 +182,15 @@ int main( int argc, char* argv[] )
     }
   }
 
+#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+  // initialization of the X11 visual on Linux
+  QSurfaceFormat format;
+  format.setDepthBufferSize(16);
+  format.setStencilBufferSize(1);
+  format.setProfile(QSurfaceFormat::CompatibilityProfile);
+  QSurfaceFormat::setDefaultFormat(format);
+#endif
+
   // add <qtdir>/plugins directory to the pluins search path for image plugins
   QString qtdir = Qtx::qtDir( "plugins" );
   if ( !qtdir.isEmpty() )
index ad1fcf01c1ea8d5a24b437cab4fcf73cecea80a2..f1590699562b1e2bd2c6740e517b1aeacc903116 100644 (file)
@@ -41,7 +41,7 @@
 */
 SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* hand )
 // TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
-#if !defined(WIN32) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+#if !defined(WIN32) && !defined(__APPLE__) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
   // san: Opening an X display and choosing a visual most suitable for 3D visualization
   // in order to make SALOME viewers work with non-native X servers
   : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ),
index c82c2515667ea93ea6e842fc92c1599f17802add..c6278f7c2665cbe197a689dd12bafa7907d2a69f 100644 (file)
@@ -34,7 +34,7 @@
 // QT Includes
 // Put Qt includes before the X11 includes which #define the symbol None
 // (see SVTK_SpaceMouse.h) to avoid the compilation error.
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 #include <xcb/xcb.h>
 #endif
@@ -84,7 +84,7 @@ QVTK_RenderWindowInteractor
   myRenderWindow->Delete();
   myRenderWindow->DoubleBufferOn();
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
   myRenderWindow->SetDisplayId((void*)QX11Info::display());
 #endif
   myRenderWindow->SetWindowId((void*)winId());
@@ -112,7 +112,7 @@ QVTK_RenderWindowInteractor
 QVTK_RenderWindowInteractor
 ::~QVTK_RenderWindowInteractor() 
 {
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance();
   if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() )
@@ -415,7 +415,7 @@ QVTK_RenderWindowInteractor
 {
   QWidget::focusInEvent( event );
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
   // register set space mouse events receiver
 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance();
@@ -451,7 +451,7 @@ QVTK_RenderWindowInteractor
 {
   QWidget::focusOutEvent( event );
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   // unregister set space mouse events receiver
   SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance();
@@ -467,7 +467,7 @@ QVTK_RenderWindowInteractor
 
 // TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-#ifdef WIN32
+#if defined(WIN32)
 
 /*!
   To handle native Win32 events (from such devices as SpaceMouse)
@@ -478,8 +478,7 @@ bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result )
   return QWidget::winEvent( msg, result);
 }
 
-#else
-
+#elif !defined(__APPLE__)
 /*!
   To handle native X11 events (from such devices as SpaceMouse)
 */
@@ -519,9 +518,9 @@ QVTK_RenderWindowInteractor
 bool QVTK_RenderWindowInteractor
 ::nativeEvent(const QByteArray& eventType, void* message, long* result)
 {
-#ifdef WIN32
+#if defined(WIN32)
   // TODO: WIN32-related implementation
-#else
+#elif !defined(__APPLE__)
   if ( eventType == "xcb_generic_event_t" )
   {
     xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
index 521794f67f0a40a2fc4bd820269057240f509d8b..e04a2edbfd9d48bd08df692566afbf527d79a27e 100644 (file)
@@ -124,9 +124,9 @@ class SVTK_EXPORT QVTK_RenderWindowInteractor: public QWidget
   //! To handle native events (from such devices as SpaceMouse)
 // TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-#ifdef WIN32
+#if defined(WIN32)
   virtual bool winEvent( MSG*, long* );
-#else
+#elif !defined(__APPLE__)
   virtual bool x11Event( XEvent *e );
 #endif
 #else
index 5db6b427da0c2f3e92882e2e5e0505c372e1111b..7e8e6abf89caaf9b71dda9e6c399bb206a2f4e04 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <QtGlobal>
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 #include <X11/X.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
@@ -64,7 +64,7 @@ SVTK_SpaceMouse::SVTK_SpaceMouse()
 SVTK_SpaceMouseX::SVTK_SpaceMouseX()
 : SVTK_SpaceMouse()
 {
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
   win = InputFocus;
 #endif
 }
@@ -79,7 +79,7 @@ SVTK_SpaceMouseX* SVTK_SpaceMouseX::getInstance()
   return myInstance;
 }
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 
 static int errorCallback( Display *display, XErrorEvent *Error )
 {
@@ -232,7 +232,7 @@ int SVTK_SpaceMouseX::translateEvent( Display* display, XEvent* xEvent, MoveEven
 SVTK_SpaceMouseXCB::SVTK_SpaceMouseXCB()
 : SVTK_SpaceMouse()
 {
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
   win = InputFocus;
 #endif
 }
@@ -249,7 +249,7 @@ SVTK_SpaceMouseXCB* SVTK_SpaceMouseXCB::getInstance()
 /*!
   Initialization
 */
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 int SVTK_SpaceMouseXCB::initialize( xcb_connection_t *connection, xcb_window_t window )
 {
   // make request
index ab140cd0d9810d1c48199d77a21026ceccc7ba6b..af04575a559689fc6313f75154ff4bdf96710db1 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <QtGlobal>
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 extern "C"
 {
 #include <X11/X.h>
@@ -39,7 +39,6 @@ extern "C"
 #include <xcb/xcb.h>
 #endif
 }
-
 #endif
 
 class SVTK_SpaceMouse 
@@ -76,7 +75,7 @@ public:
   // access to SpaceMouse utility class
   static SVTK_SpaceMouseX* getInstance();
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
   int initialize     ( Display*, Window );
   int setWindow      ( Display*, Window );
   int translateEvent ( Display*, XEvent*, MoveEvent*, double, double );
@@ -93,7 +92,9 @@ private:
   static SVTK_SpaceMouseX* myInstance;
 
 };
+
 #else
+
 class SVTK_SpaceMouseXCB: public SVTK_SpaceMouse
 {
 
@@ -103,7 +104,7 @@ public:
   // access to SpaceMouse utility class
   static SVTK_SpaceMouseXCB* getInstance();
 
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
   int initialize     ( xcb_connection_t*, xcb_window_t );
   int setWindow      ( xcb_connection_t*, xcb_window_t );
   int translateEvent ( xcb_connection_t*, xcb_client_message_event_t*, MoveEvent*, double, double );
@@ -119,5 +120,6 @@ private:
   static SVTK_SpaceMouseXCB* myInstance;
 
 };
+
 #endif
 #endif
index 16578ddbf74b53db8cffe25d00778da375f5338a..d13911d460eea075006e46f335365169f52bdb1a 100755 (executable)
 
 #include <OpenGLUtils_FrameBuffer.h>
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 namespace SVTK
 {
index e16d11d53ecb608ba01690486babb94ca3d60b3d..12a733584f9f9a98abad23a815311544ccee5f4e 100644 (file)
@@ -969,14 +969,6 @@ void SalomeApp_Application::onDockWindowVisibilityChanged( bool theIsVisible )
     objectBrowserColumnsVisibility();
 }
 
-/*!Gets file filter.
- *\retval QString "(*.hdf)"
- */
-QString SalomeApp_Application::getFileFilter() const
-{
-  return "(*.hdf)";
-}
-
 /*!Create window.*/
 QWidget* SalomeApp_Application::createWindow( const int flag )
 {
index c2b62929da0c4e3ab85403d91621293f2b44ed3a..ae6775ea7962fb721b733ceb93e062aa98736f70 100644 (file)
@@ -87,8 +87,6 @@ public:
 
   virtual void                        updateObjectBrowser( const bool = true );
 
-  virtual QString                     getFileFilter() const;
-
   virtual void                        start();
 
   virtual void                        contextMenuPopup( const QString&, QMenu*, QString& );
index 61a1fe9e70ff84fec65ecdb4b8387b99ae02631d..ea144e9a96cb5e33c8361aa04a21094603f751d3 100755 (executable)
@@ -251,7 +251,7 @@ class SALOME_QApplication : public QApplication
 public:
   SALOME_QApplication( int& argc, char** argv )
 // TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
-#if !defined WIN32 && QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#if !defined(WIN32) && !defined(__APPLE__) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
   // san: Opening an X display and choosing a visual most suitable for 3D visualization
   // in order to make SALOME viewers work with non-native X servers
   : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ),
index 7dca2f88de49c9843f216c941c9a914af6c4801e..8071540037eae583e63a350f81af3887cded6407 100644 (file)
 # ifndef GLX_GLXEXT_LEGACY
 #  define GLX_GLXEXT_LEGACY
 # endif
+#ifdef __APPLE__
+#import <mach-o/dyld.h>
+#import <stdlib.h>
+#import <string.h>
+void * glXGetProcAddressARB (const GLubyte *name)
+
+{
+    NSSymbol symbol;
+    char *symbolName;
+    symbolName = (char *)malloc (strlen ((const char *)name) + 2); // 1
+    strcpy(symbolName + 1, (const char *)name); // 2
+    symbolName[0] = '_'; // 3
+    symbol = NULL;
+    if (NSIsSymbolNameDefined (symbolName)) // 4
+        symbol = NSLookupAndBindSymbol (symbolName);
+    free (symbolName); // 5
+    return symbol ? NSAddressOfSymbol (symbol) : NULL; // 6
+}
+#else
 # include <GL/glx.h>
+#endif
 # include <dlfcn.h>
 #else
 # include <wingdi.h>
index 8fa5725b0dba170f77aeb95185a8df205de84f87..14418801a163c50146aee4304fb3f4b621409cad 100644 (file)
 
 #include <map>
 
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 #include <vtkSmartPointer.h>
 
index 2395f8c965d0adbd0076d334312222973ec77041..16aafdbc3dcfec3803e1b4a361761d37bbc2a371 100755 (executable)
@@ -31,7 +31,7 @@
 #include <vtkRenderWindowInteractor.h>
 #include <vtkRendererCollection.h>
 #include <vtkCamera.h>
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
 #include <QX11Info>
 #include <vtkXOpenGLRenderWindow.h>
 #endif
@@ -47,7 +47,7 @@ QWidget(parent, Qt::FramelessWindowHint )
   setAttribute( Qt::WA_DeleteOnClose );
 
   myRW = vtkRenderWindow::New();
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
   myRW->SetDisplayId((void*)(QX11Info::display()));
 #endif
   myRW->SetWindowId((void*)winId());
index 1d2ee2106c5cb68ec2218bfeee39b505551dda7a..ab5ccd929dc97c6f26ef1ad9b7ce3fc4a80203c4 100644 (file)
@@ -49,7 +49,6 @@ PYQT_WRAP_SIP(_sip_SOURCES ${_sip_files})
 
 # sources / to compile
 SET(PyConsolePy_SOURCES ${_sip_SOURCES})
-message("PyConsolePy_SOURCES = ${PyConsolePy_SOURCES}")
 
 # --- rules ---
 
index b251b090c294cbb02d134a93dd0c06e83ffdf995..0afd178dec6e487e6922e8c39f78d27b5f6b9357 100644 (file)
@@ -25,7 +25,7 @@
 #include "PyInterp.h"
 
 template<class T>
-class PYINTERP_EXPORT PyInterp_Auto
+class PyInterp_Auto
 {
 public:
   PyInterp_Auto(const PyInterp_Auto& other):_ptr(0) { referPtr(other._ptr); }