Salome HOME
Merge branch 'pre/V8_2_BR' of https://git.salome-platform.org/git/modules/gui into...
authorPaul RASCLE <paul.rascle@edf.fr>
Fri, 3 Mar 2017 09:27:59 +0000 (10:27 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Fri, 3 Mar 2017 09:27:59 +0000 (10:27 +0100)
78 files changed:
CMakeLists.txt
doc/salome/gui/images/icon_about.png
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_BaseObjects.cxx
src/GLViewer/GLViewer_Context.h
src/GLViewer/GLViewer_Drawer.cxx
src/GLViewer/GLViewer_Drawer.h
src/GLViewer/GLViewer_Grid.h
src/GLViewer/GLViewer_MimeData.cxx
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.xml
src/LightApp/resources/LightApp_msg_en.ts
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_ViewPort3d.cxx
src/OCCViewer/OCCViewer_ViewPort3d.h
src/OCCViewer/OCCViewer_ViewSketcher.cxx
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OpenGLUtils/OpenGLUtils_FrameBuffer.cxx
src/OpenGLUtils/OpenGLUtils_FrameBuffer.h
src/PVViewer/PVViewer_GUIElements.cxx
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/Qtx/QtxWebBrowser.cxx
src/SALOME_PY/SalomePy.cxx
src/SALOME_PYQT/SalomePyQt/CMakeLists.txt
src/STD/STD_Application.cxx
src/STD/STD_Application.h
src/SUIT/SUIT_FileValidator.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/SalomeApp/SalomeApp_PyInterp.cxx
src/SalomeApp/SalomeApp_Study.cxx
src/Session/SALOME_Session_Server.cxx
src/Session/Session_ServerLauncher.cxx
src/VTKViewer/VTKViewer_GeometryFilter.cxx
src/VTKViewer/VTKViewer_PolyDataMapper.cxx
src/VTKViewer/VTKViewer_PolyDataMapper.h
src/VTKViewer/VTKViewer_RenderWindow.cxx
tools/PyConsole/src/PyConsole_Editor.cxx
tools/PyConsole/src/PyConsole_Editor.h
tools/PyConsole/src/PyConsole_Interp.h
tools/PyConsole/src/python/CMakeLists.txt
tools/PyEditor/src/PyEditor_Settings.h
tools/PyInterp/src/CMakeLists.txt
tools/PyInterp/src/PyInterp_Interp.h
tools/PyInterp/src/PyInterp_RefCounterObj.h [new file with mode: 0644]

index 903049a7ee3877962043fa3c9a673c8111fa9e51..6690cb677b5b3294212795e44cac8bcc20f415e6 100755 (executable)
@@ -37,7 +37,7 @@ SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
-SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
+SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
 
 # Common CMake macros
 # ===================
@@ -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 dfdc7e618906cfabcfa9ce8b4ab44b4ab688ec31..61b9676d6fa51e0717d4f67b73f6034c1cb625cd 100755 (executable)
Binary files a/doc/salome/gui/images/icon_about.png and b/doc/salome/gui/images/icon_about.png differ
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 0a45bb38a9a07905640c1a984f86fa822abe6425..cf12ae7ba5d29b1c5520cba1e17c03af4f09be15 100644 (file)
@@ -1096,7 +1096,7 @@ GLboolean GLViewer_Polyline::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer
     GLfloat xa, xb, ya, yb, l;
     GLfloat rsin, rcos, r, ra, rb;
     // GLboolean update;
-    GLboolean selected = myIsSel;
+    // GLboolean selected = myIsSel;
 
     myIsSel = GL_FALSE;
 
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 73fee04129e7699bf2650c334eb88a6534927b45..2b54084672420b70ebd198df14efbc798d8b96e3 100644 (file)
@@ -235,8 +235,8 @@ const char* GLViewer_MimeData::format( int theIndex ) const
 */
 QByteArray GLViewer_MimeData::encodedData( const char* theObjectType ) const
 {
-    if( theObjectType == "GLViewer_Objects" )
-        return myByteArray;
-    
-    return QByteArray();
+  if ( theObjectType && strcmp( theObjectType, "GLViewer_Objects" ) == 0 )
+    return myByteArray;
+
+  return QByteArray();
 }
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 18532ce0e8d1260e39e6df59a8dd25c2314cc78a..626bbc6b3559b1de3df12a529218f8e836a494f5 100644 (file)
@@ -1849,12 +1849,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)";
 }
 
@@ -4471,8 +4469,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 4796a3ed265d1f1d7f1b3124f6f0c3db673a95cf..ace4c880f822f02be8c06593a352322910866a24 100644 (file)
     <!-- External HELP browser settings -->
     <parameter name="winapplication"       value="C:\Program Files\Internet Explorer\iexplore.exe" />
     <parameter name="use_external_browser" value="false" />
-    <parameter name="application"          value="/usr/bin/mozilla" />
+    <parameter name="application"          value="/usr/bin/firefox" />
     <parameter name="parameters"           value="" />
   </section>
   <section name="add_help">
index 53f076da35a9ba9817bd7f583ffd1201a155dc41..63fc8258bffca77cb055797600c87d3a9745002e 100644 (file)
@@ -5,7 +5,7 @@
     <name>@default</name>
     <message>
         <source>EXTERNAL_BROWSER_CANNOT_SHOW_PAGE</source>
-        <translation>External browser &quot;%1&quot; can not show help page &quot;%2&quot;. Do you want to change it in preferences?</translation>
+        <translation>External browser &quot;%1&quot; can not show help page &quot;%2&quot;. Do you want to change the browser's settings in preferences?</translation>
     </message>
     <message>
         <source>ABOUT_COPYRIGHT</source>
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 ee51e0b4e8af49ac216edf4e16373390b7c9d596..e42313e63ca0c8447004da69e05d5544cc7323c4 100755 (executable)
@@ -245,10 +245,13 @@ bool OCCViewer_ViewPort3d::syncronize( const OCCViewer_ViewPort3d* ref )
   /* update */
   tgtView->Update();
   tgtView->SetImmediateUpdate( Standard_True );
+#if OCC_VERSION_LARGE <= 0x07000000
   tgtView->ZFitAll();
+#endif
   return true;
 }
 
+#if OCC_VERSION_LARGE <= 0x07000000
 /*!
   Returns Z-size of this view. [ public ]
 */
@@ -270,6 +273,7 @@ void OCCViewer_ViewPort3d::setZSize( double zsize )
         if ( !myPerspView.IsNull() )
         myPerspView->SetZSize( zsize );*/
 }
+#endif
 
 /*!
   Get axial scale to the view
@@ -574,8 +578,8 @@ void OCCViewer_ViewPort3d::rotate( int x, int y,
 void OCCViewer_ViewPort3d::endRotation()
 {
   if ( !activeView().IsNull() ) {
+#if OCC_VERSION_LARGE <= 0x07000000
     activeView()->ZFitAll( 1.0 );
-#if OCC_VERSION_LARGE <= 0x06070100
     activeView()->SetZSize( 0.0 );
 #endif
     activeView()->Update();
@@ -651,12 +655,14 @@ void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool withZ, bool upd )
   
 #if OCC_VERSION_LARGE > 0x06070100
   activeView()->FitAll( margin, upd );
+#if OCC_VERSION_LARGE <= 0x07000000
   if(withZ)
     activeView()->ZFitAll();
-#else 
+#endif  
+#else
   activeView()->FitAll( margin, withZ, upd );
-#endif
   activeView()->SetZSize(0.);
+#endif
   emit vpTransformed( this );
 }
 
@@ -770,7 +776,9 @@ bool OCCViewer_ViewPort3d::synchronize( OCCViewer_ViewPort* view )
     aView3d->SetViewMapping( aRefView3d->ViewMapping() );
     aView3d->SetViewOrientation( aRefView3d->ViewOrientation() );
 #endif
+#if OCC_VERSION_LARGE <= 0x07000000
     aView3d->ZFitAll();
+#endif
     aView3d->SetImmediateUpdate( Standard_True );
     aView3d->Update();
     blockSignals( blocked );
index f6f9f55f1680f4115433d8d639acb492c3de76b3..99428489804e23f294917cd1d090782ed98f5f5f 100755 (executable)
@@ -65,8 +65,10 @@ public:
 //   void         setActive( V3d_TypeOfView );
   virtual bool          syncronize( const OCCViewer_ViewPort3d* );
 
+#if OCC_VERSION_LARGE <= 0x07000000
   double                getZSize() const;
   void                  setZSize( double );
+#endif
 
   void                  getAxialScale( double&, double&, double& );
 
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 282daceb7307b6e168d801500c4a1a7b16d9689b..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)
@@ -406,7 +410,9 @@ bool OCCViewer_ViewWindow::eventFilter( QObject* watched, QEvent* e )
           int x1 = (int)( aEvent->x() + width()*delta/100 );
           int y1 = (int)( aEvent->y() + height()*delta/100 );
           myViewPort->zoom( x, y, x1, y1 );
+#if OCC_VERSION_LARGE <= 0x07000000
           myViewPort->getView()->ZFitAll();
+#endif
           emit vpTransformationFinished ( ZOOMVIEW );
         }
       }
@@ -536,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();
@@ -575,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;
@@ -770,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;
@@ -810,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;
@@ -1060,7 +1066,9 @@ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent)
 
   case PANVIEW:
   case ZOOMVIEW:
+#if OCC_VERSION_LARGE <= 0x07000000
     myViewPort->getView()->ZFitAll();
+#endif
     resetState();
     break;
 
@@ -3667,8 +3675,9 @@ void OCCViewer_ViewWindow::synchronize( SUIT_ViewWindow* theView )
 #endif
 
   getViewPort()->setAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] );
-
+#if OCC_VERSION_LARGE <= 0x07000000
   aDestView->ZFitAll();
+#endif
   aDestView->SetImmediateUpdate( Standard_True );
   aDestView->Redraw();
 
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 4421a22e887fc27c1f735f2c68a86d6d4bc7074c..6c21812f2de9901deb9517b970a81ab55c71d3f4 100644 (file)
@@ -219,7 +219,7 @@ void PVViewer_GUIElements::buildPVWidgets()
                                 Q_ARG( pqServerManagerModelItem* , NULL ) );
     }
     
-    publishExistingSources();
+    //publishExistingSources();
     myPVWidgetsFlag = true;
   }
 }
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 48991f6bed956cfed255f41a4c053646e577b039..3141d68be296b4ab861f6c1bb142169a489fa940 100644 (file)
@@ -119,7 +119,9 @@ bool QtxWebBrowser::Searcher::find( const QString& text, QtxSearchTool* st )
   if ( st->isSearchWrapped() ) fl = fl | WebPage::FindWrapsAroundDocument;
   return myView->findText( text, fl );
 #else
-  myView->findText( text, fl, [this](bool found) { return found; });  
+  bool textFound;
+  myView->findText( text, fl, [&](bool found) { textFound = found; });
+  return textFound;
 #endif    
 }
 
@@ -150,7 +152,9 @@ bool QtxWebBrowser::Searcher::findPrevious( const QString& text, QtxSearchTool*
   if ( st->isSearchWrapped() ) fl = fl | WebPage::FindWrapsAroundDocument;
   return myView->findText( text, fl );
 #else
-  myView->findText( text, fl, [this](bool found) { return found; });
+  bool textFound;
+  myView->findText( text, fl, [&](bool found) { textFound = found; });
+  return textFound;
 #endif 
 }
 
@@ -222,10 +226,10 @@ QtxWebBrowser::Downloader::Downloader( const QString& fileName, int action, cons
 
   QGridLayout* l = new QGridLayout( this );
   l->addWidget( new QLabel( QtxWebBrowser::tr( "You are opening the file" ), this ), 
-                           0, 0, 1, 4 );
+                            0, 0, 1, 4 );
   l->addWidget( myFileName, 1, 1, 1, 3 );
   l->addWidget( new QLabel( QtxWebBrowser::tr( "Please choose the action to be done" ), this ), 
-                           3, 0, 1, 4 );
+                            3, 0, 1, 4 );
   l->addWidget( rbOpen,     4, 1, 1, 1 );
   l->addWidget( myBrowse,   4, 2, 1, 1 );
   l->addWidget( rbSave,     5, 1, 1, 3 );
@@ -367,11 +371,11 @@ QtxWebBrowser::QtxWebBrowser( ) : QMainWindow( 0 )
   
   myFindPanel = new QtxSearchTool( frame, myWebView,
 #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
-                                  QtxSearchTool::Basic | QtxSearchTool::Case | QtxSearchTool::Wrap,
+                                   QtxSearchTool::Basic | QtxSearchTool::Case | QtxSearchTool::Wrap,
 #else
-                                  QtxSearchTool::Basic | QtxSearchTool::Case,
-#endif                            
-                                  Qt::Horizontal );
+                                   QtxSearchTool::Basic | QtxSearchTool::Case,
+#endif                             
+                                   Qt::Horizontal );
   myFindPanel->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
   myFindPanel->setActivators( QtxSearchTool::SlashKey );
   myFindPanel->setSearcher( new Searcher( myWebView ) );
@@ -384,29 +388,29 @@ QtxWebBrowser::QtxWebBrowser( ) : QMainWindow( 0 )
 
   QMenu* fileMenu = menuBar()->addMenu( tr( "&File" ) );
   fileMenu->addAction( QPixmap( ":/images/open.png" ), tr( "&Open..." ), 
-                      this, SLOT( open() ),
-                      QKeySequence( QKeySequence::Open ) );
+                       this, SLOT( open() ),
+                       QKeySequence( QKeySequence::Open ) );
   fileMenu->addSeparator();
   fileMenu->addAction( myWebView->pageAction( WebPage::Back ) );
   fileMenu->addAction( myWebView->pageAction( WebPage::Forward ) );
   fileMenu->addAction( myWebView->pageAction( WebPage::Reload ) );
   fileMenu->addSeparator();
   fileMenu->addAction( tr( "&Find in text..." ),
-                      myFindPanel, SLOT( find() ),
-                      QKeySequence( QKeySequence::Find ) );
+                       myFindPanel, SLOT( find() ),
+                       QKeySequence( QKeySequence::Find ) );
   fileMenu->addAction( tr( "&Find next" ),
-                      myFindPanel, SLOT( findNext() ),
-                      QKeySequence( QKeySequence::FindNext ) );
+                       myFindPanel, SLOT( findNext() ),
+                       QKeySequence( QKeySequence::FindNext ) );
   fileMenu->addAction( tr( "&Find previous" ),
-                      myFindPanel, SLOT( findPrevious() ),
-                      QKeySequence( QKeySequence::FindPrevious ) );
+                       myFindPanel, SLOT( findPrevious() ),
+                       QKeySequence( QKeySequence::FindPrevious ) );
   fileMenu->addSeparator();
   fileMenu->addAction( QPixmap( ":/images/close.png" ), tr( "&Close" ),
-                      this, SLOT( close() ) );
+                       this, SLOT( close() ) );
 
   QMenu* helpMenu = menuBar()->addMenu( tr( "&Help" ) );
   helpMenu->addAction( tr( "&About..." ),
-                      this, SLOT( about() ) );
+                       this, SLOT( about() ) );
   
   QVBoxLayout* main = new QVBoxLayout( frame );
   main->addWidget( myWebView );
@@ -418,22 +422,22 @@ QtxWebBrowser::QtxWebBrowser( ) : QMainWindow( 0 )
   connect( myWebView, SIGNAL( loadFinished( bool ) ),    SLOT( finished( bool ) ) );
   
   connect( myWebView->pageAction( WebPage::DownloadLinkToDisk ), SIGNAL( triggered() ),
-          SLOT( linkAction() ) );
+           SLOT( linkAction() ) );
 #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
   //QtWebKit case:
   connect( myWebView, SIGNAL( linkClicked( QUrl ) ),     SLOT( linkClicked( QUrl ) ) );
   connect( myWebView->page(), SIGNAL( linkHovered( QString, QString, QString ) ), 
-          SLOT( linkHovered( QString, QString, QString ) ) ); 
+           SLOT( linkHovered( QString, QString, QString ) ) ); 
   disconnect( myWebView->pageAction( WebPage::OpenLink ), 0, 0, 0 );
   connect( myWebView->pageAction( WebPage::OpenLink ), SIGNAL( triggered() ),
-          SLOT( linkAction() ) );
+           SLOT( linkAction() ) );
 #else
   //QtWebEngine (Qt-5.6.0) case:
   connect( myWebView->page(), SIGNAL( linkHovered( QString ) ), 
-          SLOT( linkHovered( QString ) ) );
+           SLOT( linkHovered( QString ) ) );
   disconnect( myWebView->pageAction( WebPage::OpenLinkInThisWindow ), 0, 0, 0 );
   connect( myWebView->pageAction( WebPage::OpenLinkInThisWindow ), SIGNAL( triggered() ),
-          SLOT( linkAction() ) );
+           SLOT( linkAction() ) );
 #endif  
   setCentralWidget( frame );
   setFocusProxy( myWebView );
@@ -513,7 +517,7 @@ QtxResourceMgr* QtxWebBrowser::resourceMgr() const
 void QtxWebBrowser::about()
 {
   QMessageBox::about( this, tr( "About %1" ).arg( tr( "Help Browser" ) ),
-                     QString( "SALOME %1" ).arg( tr( "Help Browser" ) ) );
+                      QString( "SALOME %1" ).arg( tr( "Help Browser" ) ) );
 }
 
 /*!
@@ -636,7 +640,7 @@ void QtxWebBrowser::openLink( const QString& fileName, bool force )
       myResourceMgr->setValue( resSection, actionParam, defAction );
       myResourceMgr->setValue( resSection, repeatParam, defRepeat );
       if ( defAction == Downloader::mOpen )
-       myResourceMgr->setValue( resSection, programParam, defProgram );
+        myResourceMgr->setValue( resSection, programParam, defProgram );
     }
   }
   switch( defAction ) {
@@ -689,12 +693,13 @@ void QtxWebBrowser::load( const QString& link )
 void QtxWebBrowser::saveLink( const QString& fileName )
 {
   QString newFileName = QFileDialog::getSaveFileName( this, tr( "Save file" ), fileName, 
-                                                     QString( "*.%1" ).arg( QFileInfo( fileName ).suffix() ) );
+                                                      QString( "*.%1" ).arg( QFileInfo( fileName ).suffix() ) );
   if ( !newFileName.isEmpty() && 
        QFileInfo( newFileName ).canonicalFilePath() != QFileInfo( fileName ).canonicalFilePath() ) {
     QFile toFile( newFileName );
     QFile fromFile( fileName );
-    if ( toFile.exists() && !toFile.remove() || !fromFile.copy( newFileName ) )
+    if (( toFile.exists() && !toFile.remove() ) ||
+        ( !fromFile.copy( newFileName ) ))
       QMessageBox::warning( this, tr( "Error"), tr( "Can't save file:\n%1" ).arg( newFileName ) );
   }
 }
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 f8506842d81891b37c24e7fccce02975da4c4f6f..c4ffd66159eb63a5bec52a84f91142710d1d825e 100755 (executable)
@@ -33,9 +33,10 @@ class QString;
 
 class SUIT_EXPORT SUIT_FileValidator
 {
-public:
+ public:
   SUIT_FileValidator( QWidget* = 0 );
-  
+  virtual ~SUIT_FileValidator() {}
+
   virtual bool    canOpen( const QString&, bool = true );
   virtual bool    canSave( const QString&, bool = true );
 
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 fa6c6ab7bfa2ce31eb2229e8ab84f026bebb4700..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 )
 {
@@ -2082,7 +2074,7 @@ bool SalomeApp_Application::checkExistingDoc()
 
 PyConsole_Interp* SalomeApp_Application::createPyInterp()
 {
-  return new SalomeApp_PyInterp();
+  return new SalomeApp_PyInterp;
 }
 
 #endif // DISABLE_PYCONSOLE
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 0ab36f99a65cec79f76a09e3e9f14a0e24f73afb..4db5aff1a717e351f4c332d6114620250fde117d 100755 (executable)
@@ -28,7 +28,7 @@
   \brief Constructor
 */
 SalomeApp_PyInterp::SalomeApp_PyInterp()
-  : PyConsole_Interp(), myFirstRun( true ), myFirstInitStudy( false )
+  : myFirstRun( true ), myFirstInitStudy( false )
 {
 }
 
index a2945767595108f65f89019254bbba9cdb74bfcb..84bb76df6fa8790d8a82b52b78724777a8d557a8 100644 (file)
@@ -196,22 +196,22 @@ public:
           //aFatherDO->insertChild(suit_obj, pos);
           aFatherDO->updateItem();
 
-         /* Define visibility state */
-         bool isComponent = dynamic_cast<SalomeApp_ModuleObject*>( suit_obj ) != 0;
-         if ( suit_obj && !isComponent && myStudy->visibilityState( theID.c_str() ) == Qtx::UnpresentableState ) {
-           QString moduleTitle = ((CAM_Application*)myStudy->application())->moduleTitle(suit_obj->componentDataType());
-           if (!moduleTitle.isEmpty()) {
-             LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(moduleTitle,false);
-             if (aDisplayer) {
-               if(aDisplayer->canBeDisplayed(theID.c_str())) {
-                 myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState ); //hide the just added object
-                 //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
-               }
-               else
-                 MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
-             }
-           }
-         }
+          /* Define visibility state */
+          bool isComponent = dynamic_cast<SalomeApp_ModuleObject*>( suit_obj ) != 0;
+          if ( suit_obj && !isComponent && myStudy->visibilityState( theID.c_str() ) == Qtx::UnpresentableState ) {
+            QString moduleTitle = ((CAM_Application*)myStudy->application())->moduleTitle(suit_obj->componentDataType());
+            if (!moduleTitle.isEmpty()) {
+              LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(moduleTitle,false);
+              if (aDisplayer) {
+                if(aDisplayer->canBeDisplayed(theID.c_str())) {
+                  myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState ); //hide the just added object
+                  //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
+                }
+                //else
+                  //MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
+              }
+            }
+          }
         } // END: work with tree nodes structure
         else { // BEGIN: work with study structure
           EntryMapIter it = entry2SuitObject.find( theID );
@@ -340,8 +340,8 @@ public:
                 myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
                 //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
               }
-              else
-                MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
+              //else
+                //MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
             }
           }
         }
@@ -350,8 +350,8 @@ public:
 #ifndef DISABLE_PYCONSOLE
     case 6: //NoteBook variables were modified
       {
-       myStudy->onNoteBookVarUpdate( QString( theID.c_str() ) );
-       break;
+        myStudy->onNoteBookVarUpdate( QString( theID.c_str() ) );
+        break;
       }
 #endif
     default:MESSAGE("Unknown event: "  << event);break;
index d84b326b903010efb1a68892e4eb4b3b8562d96a..ea144e9a96cb5e33c8361aa04a21094603f751d3 100755 (executable)
@@ -77,6 +77,9 @@
 #include <QWaitCondition>
 #include <QRegExp>
 #include <QTextStream>
+#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+#include <QSurfaceFormat>
+#endif
 
 /*! - read arguments, define list of server to launch with their arguments.
  * - wait for naming service
@@ -213,8 +216,8 @@ protected:
 #endif
       QString fname = QFileInfo( _fname ).fileName();
       if ( exp.exactMatch( fname ) ) {
-       long fid = Qtx::versionToId( exp.cap( 1 ) );
-       if ( fid > 0 ) id = fid;
+        long fid = Qtx::versionToId( exp.cap( 1 ) );
+        if ( fid > 0 ) id = fid;
       }
     }
     return id;
@@ -248,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() ),
@@ -366,6 +369,15 @@ int main( int argc, char **argv )
       QLocale::setDefault( QLocale::system() );
     }
   }
+  
+#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
 
   // Create Qt application instance;
   // this should be done the very first!
@@ -550,8 +562,8 @@ int main( int argc, char **argv )
       SALOME::StatSession stat = session->GetStatSession();
       shutdownSession = stat.state == SALOME::shutdown;
       if ( shutdownSession ) {
-       _SessionMutex.lock(); // lock mutex before leaving loop - it will be unlocked later
-       break;
+        _SessionMutex.lock(); // lock mutex before leaving loop - it will be unlocked later
+        break;
       }
 
       // SUIT_Session creation
index a5ba098220a55aab16fd4843a36fa0efa674b82c..4cfe26c20dedde0fe67b61c1913f79288052c724 100755 (executable)
@@ -111,8 +111,8 @@ void Session_ServerLauncher::CheckArgs()
   _argCopy.reserve(_argc);
   for (int iarg=0; iarg <_argc; iarg++)
     {
-      SCRUTE(iarg);
-      SCRUTE(_argv[iarg]);
+      //SCRUTE(iarg);
+      //SCRUTE(_argv[iarg]);
       _argCopy.push_back(_argv[iarg]);
       switch (argState)
         {
@@ -124,16 +124,16 @@ void Session_ServerLauncher::CheckArgs()
           }
         case 1: // looking for server type
           {
-           // Temporary solution
-           // Issue 21337 - no more SalomeApp_Engine_i activation here
-           // TODO: To be removed as soon as any trace of SalomeAppEngine
-           // has been eliminated from KERNEL scripts
-           if (strcmp(_argv[iarg], "SalomeAppEngine")==0){
-             argState = 0;
-             iarg += 2; // skipping "()" 
-             break;
-           }
-           // Temporary solution
+            // Temporary solution
+            // Issue 21337 - no more SalomeApp_Engine_i activation here
+            // TODO: To be removed as soon as any trace of SalomeAppEngine
+            // has been eliminated from KERNEL scripts
+            if (strcmp(_argv[iarg], "SalomeAppEngine")==0){
+              argState = 0;
+              iarg += 2; // skipping "()" 
+              break;
+            }
+            // Temporary solution
 
             for (int i=0; i<Session_ServerThread::NB_SRV_TYP; i++)
                 if (strcmp(_argv[iarg],Session_ServerThread::_serverTypes[i])==0)
index 237adfb6c4611a18f907a79230ea386ae266b856..a289dc87c2ac60cfe4457e5538e55e3e48d0eca7 100755 (executable)
@@ -1146,9 +1146,9 @@ VTKViewer_GeometryFilter
                         // avoid adding it when treating another face
                         process = midPoints.insert( face->GetPointId(p2) ).second; break;
                       case 1: // the edge is shared by two cells
-                        process = ( cellIdsTmp->GetId(0) == cellId ); break;
+                        process = ( cellIdsTmp->GetId(0) < cellId ); break;
                       default: // the edge is shared by >2 cells
-                        process = ( cellIdsTmp->GetId(0) != cellId ); break;
+                        process = ( cellIdsTmp->GetId(0) < cellId ); break;
                       }
                       if ( process )
                       {
index d34ea33c38032f3679ef0ac48b241b66eb5096e0..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>
@@ -593,6 +613,8 @@ namespace VTK
     virtual
     void
     get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId ) = 0;
+
+    virtual ~TColorFunctorBase() {}
   };
 
   //-----------------------------------------------------------------------------
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 7ec727292b4a936526c2f8e0883212ee54059f88..4c3df75f0225ff9314a2d5c69cbf917f3243f67c 100644 (file)
@@ -155,9 +155,10 @@ void PyConsole_CallbackStderr( void* data, char* c )
 PyConsole_Editor::PyConsole_Editor( QWidget* parent )
   : QTextEdit( parent )
 {
-  PyConsole_Interp* interp = new PyConsole_Interp();
+  PyConsole_Interp *interp(new PyConsole_Interp);
   interp->initialize();
-  init( interp );
+  myInterp=interp;
+  init();
 }
 
 /*!
@@ -171,13 +172,13 @@ PyConsole_Editor::PyConsole_Editor( QWidget*          parent,
                                     PyConsole_Interp* interp )
   : QTextEdit( parent )
 {
-  init( interp );
+  myInterp.takeRef(interp);
+  init();
 }
 
 
-void PyConsole_Editor::init( PyConsole_Interp* interp )
+void PyConsole_Editor::init()
 {
-  myInterp = interp;
   myCmdInHistory = -1;
   myEventLoop = 0;
   myShowBanner = true;
@@ -219,15 +220,14 @@ void PyConsole_Editor::init( PyConsole_Interp* interp )
 */
 PyConsole_Editor::~PyConsole_Editor()
 {
-  myInterp = 0;
 }
 
 /*!
   \brief Get Python interpreter
 */
-PyConsole_InterpPyConsole_Editor::getInterp() const
+PyConsole_Interp *PyConsole_Editor::getInterp() const
 {
-  return myInterp;
+  return myInterp.iAmATrollConstCast();
 }
 
 /*!
index 01c35c92ec1d0a8c3d69757c924cebb6044558a1..cdf7078c79fb3b468fd320093dd44bc687762d31 100644 (file)
@@ -27,6 +27,8 @@
 
 #include "PyConsole.h"
 
+#include "PyInterp_RefCounterObj.h"
+
 #include <QTextEdit>
 #include <QQueue>
 
@@ -96,7 +98,7 @@ protected:
   virtual QString getLogFileName();
 
 private:
-  void           init( PyConsole_Interp* );
+  void           init();
 
   void           multilinePaste( const QString& );
   void           multiLineProcessNextLine();
@@ -115,25 +117,25 @@ private:
   QString        banner() const;
   inline int     promptSize() const { return myPrompt.size(); }
 
-  PyConsole_Interp* myInterp;           //!< python interpreter
-  QString           myCommandBuffer;    //!< python command buffer
-  QString           myCurrentCommand;   //!< currently being printed command
-  QString           myPrompt;           //!< current command line prompt
-  int               myCmdInHistory;     //!< current history command index
-  QString           myLogFile;          //!< current output log
-  QStringList       myHistory;          //!< commands history buffer
-  QEventLoop*       myEventLoop;        //!< internal event loop
-  bool              myShowBanner;       //!< 'show banner' flag
-  QStringList       myQueue;            //!< python commands queue
-  bool              myIsSync;           //!< synchronous mode flag
-  bool              myIsSuppressOutput; //!< suppress output flag
-  bool              myMultiLinePaste;   //!< true when pasting several lines
-  QQueue<QString>   myMultiLineContent; //!< queue of lines being pasted
-  bool              myAutoCompletion;   //!< auto-completion mode flag
-  bool              myTabMode;          //!< flag that is \c true when editor performs completion
-  QString           myComplBeforePoint; //!< string on which the dir() command is executed
-  QString           myComplAfterPoint;  //!< string on which the results of the dir() are matched
-  int               myComplCursorPos;   //!< cursor position when <TAB> is hit
+  PyInterp_Auto<PyConsole_Interp> myInterp;           //!< python interpreter
+  QString                         myCommandBuffer;    //!< python command buffer
+  QString                         myCurrentCommand;   //!< currently being printed command
+  QString                         myPrompt;           //!< current command line prompt
+  int                             myCmdInHistory;     //!< current history command index
+  QString                         myLogFile;          //!< current output log
+  QStringList                     myHistory;          //!< commands history buffer
+  QEventLoop*                     myEventLoop;        //!< internal event loop
+  bool                            myShowBanner;       //!< 'show banner' flag
+  QStringList                     myQueue;            //!< python commands queue
+  bool                            myIsSync;           //!< synchronous mode flag
+  bool                            myIsSuppressOutput; //!< suppress output flag
+  bool                            myMultiLinePaste;   //!< true when pasting several lines
+  QQueue<QString>                 myMultiLineContent; //!< queue of lines being pasted
+  bool                            myAutoCompletion;   //!< auto-completion mode flag
+  bool                            myTabMode;          //!< flag that is \c true when editor performs completion
+  QString                         myComplBeforePoint; //!< string on which the dir() command is executed
+  QString                         myComplAfterPoint;  //!< string on which the results of the dir() are matched
+  int                             myComplCursorPos;   //!< cursor position when <TAB> is hit
 
   friend void PyConsole_CallbackStdout( void*, char* );
   friend void PyConsole_CallbackStderr( void*, char* );
index 4275c350f6aa590fad518deb6551ec4ea5414ba1..434b73cd43ff1b13819320acf23f768f413042f0 100644 (file)
@@ -36,11 +36,14 @@ class PYCONSOLE_EXPORT PyConsole_Interp : public PyInterp_Interp
 
 public:
   PyConsole_Interp();
-  ~PyConsole_Interp();
 
   virtual int afterRun();
   virtual int beforeRun();
 
+protected:
+  
+  ~PyConsole_Interp();
+
 private:
   bool runDirCommand( const QString&, const QString&, QStringList&, QString& );
   bool runDirAndExtract( const QString&, const QString&, QStringList&, bool = true ) const;
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 2f1c9be6c00206b18cc9e09acbe18efc058dd747..aa6de041985d28231a8c35dc462622eb299de966 100644 (file)
@@ -31,21 +31,22 @@ class PYEDITOR_EXPORT PyEditor_Settings
 {
 protected:
   enum Option { snEditor, 
-               snHighlightCurrentLine,
-               snTextWrapping,
-               snCenterCursorOnScroll,
-               snLineNumberArea,
-               snVerticalEdge,
-               snNumberColumns,
-               snTabSpaceVisible,
-               snTabSize,
-               snFont };
+                snHighlightCurrentLine,
+                snTextWrapping,
+                snCenterCursorOnScroll,
+                snLineNumberArea,
+                snVerticalEdge,
+                snNumberColumns,
+                snTabSpaceVisible,
+                snTabSize,
+                snFont };
 
 public:
   static PyEditor_Settings* settings();
   static void setSettings( PyEditor_Settings* );
   
   PyEditor_Settings();
+  virtual ~PyEditor_Settings() {}
 
   void setHighlightCurrentLine( bool );
   bool highlightCurrentLine() const;
index c29e7e5fdbf02788c236ae6c7f2361e5438e3725..392246b87634f70f5fd6d6d103bdad4eeece905d 100755 (executable)
@@ -47,6 +47,7 @@ SET(_other_HEADERS
   PyInterp_Interp.h
   PyInterp_Request.h
   PyInterp_Utils.h
+  PyInterp_RefCounterObj.h
 )
 
 # header files / to install
index 88e5519166450fe10e93ed39061f5a36636343bb..b7855434b3c4284093b2a98ab06b440238e35b74 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "PyInterp.h"   // !!! WARNING !!! THIS INCLUDE MUST BE THE VERY FIRST !!!
 #include "PyInterp_Utils.h"
+#include "PyInterp_RefCounterObj.h"
 
 #include <list>
 #include <string>
@@ -50,20 +51,17 @@ typedef struct {
  * (only there namespace is made available when importing in another context).
  * See also class PyConsole_Interp.
  */
-class PYINTERP_EXPORT PyInterp_Interp
+class PYINTERP_EXPORT PyInterp_Interp : public PyInterp_RefCounterObj
 {
 public:
   static int _argc;
   static char* _argv[];
   
-  PyInterp_Interp();
-  virtual ~PyInterp_Interp();
-  
   void initialize();
   void destroy();
 
   virtual int run(const char *command); 
-  virtual void initStudy() {};
+  virtual void initStudy() {}
 
   std::string getBanner() const;
   void setverrcb(PyOutChanged*, void*);
@@ -72,6 +70,11 @@ public:
   const char* getPrevious();
   const char* getNext();
 
+protected:
+  
+  PyInterp_Interp();
+  virtual ~PyInterp_Interp();
+
 protected:
   /** Redirection of stdout and stderr */
   PyObject* _vout;
diff --git a/tools/PyInterp/src/PyInterp_RefCounterObj.h b/tools/PyInterp/src/PyInterp_RefCounterObj.h
new file mode 100644 (file)
index 0000000..0afd178
--- /dev/null
@@ -0,0 +1,80 @@
+// 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
+//
+//  File   : PyInterp_RefCounterObj.h
+//  Author : Anthony Geay (EDF R&D)
+
+#ifndef PYINTERP_REFCOUNTEROBJ_H
+#define PYINTERP_REFCOUNTEROBJ_H
+
+#include "PyInterp.h"
+
+template<class T>
+class PyInterp_Auto
+{
+public:
+  PyInterp_Auto(const PyInterp_Auto& other):_ptr(0) { referPtr(other._ptr); }
+  PyInterp_Auto(T *ptr=0):_ptr(ptr) { }
+  ~PyInterp_Auto() { destroyPtr(); }
+  bool isNull() const { return _ptr==0; }
+  bool isNotNull() const { return !isNull(); }
+  void nullify() { destroyPtr(); _ptr=0; }
+  bool operator==(const PyInterp_Auto& other) const { return _ptr==other._ptr; }
+  bool operator==(const T *other) const { return _ptr==other; }
+  PyInterp_Auto &operator=(const PyInterp_Auto<T>& other) { if(_ptr!=other._ptr) { destroyPtr(); referPtr(other._ptr); } return *this; }
+  PyInterp_Auto &operator=(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; }
+  void takeRef(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; if(_ptr) _ptr->incrRef(); } }
+  T *operator->() { return _ptr ; }
+  const T *operator->() const { return _ptr; }
+  T& operator*() { return *_ptr; }
+  const T& operator*() const { return *_ptr; }
+  operator T *() { return _ptr; }
+  operator const T *() const { return _ptr; }
+  T *retn() { if(_ptr) _ptr->incrRef(); return _ptr; }
+  T *iAmATrollConstCast() const { return _ptr; }
+ private:
+  void referPtr(T *ptr) { _ptr=ptr; if(_ptr) _ptr->incrRef(); }
+  void destroyPtr() { if(_ptr) _ptr->decrRef(); }
+ private:
+  T *_ptr;
+};
+
+class PYINTERP_EXPORT PyInterp_RefCounterObj
+{
+ protected:
+  PyInterp_RefCounterObj():_cnt(1) { }
+  PyInterp_RefCounterObj(const PyInterp_RefCounterObj& other):_cnt(1) { }
+ public:
+  bool decrRef() const
+  {
+    bool ret=((--_cnt)==0);
+    if(ret)
+      delete this;
+    return ret;
+  }
+  void incrRef() const { _cnt++; }
+  int getRCValue() const { return _cnt; }
+  // copies using operator= should not copy the ref counter of \a other 
+  PyInterp_RefCounterObj& operator=(const PyInterp_RefCounterObj& other) { return *this; }
+ protected:
+  virtual ~PyInterp_RefCounterObj() { }
+ private:
+  mutable int _cnt;
+};
+
+#endif // PYINTERP_REFCOUNTEROBJ_H