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)
#include <QStringList>
#include <Resource_Manager.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
+#include <TColStd_SequenceOfAsciiString.hxx>
/*!
\brief Create new instance of CAF_Application.
\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;
Handle(TDocStd_Application) stdApp() const;
- virtual QString getFileFilter() const;
+ virtual QString getFileFilter( bool ) const;
public slots:
virtual void onHelpAbout();
#include <TDF_Delta.hxx>
#include <TDF_ListIteratorOfDeltaList.hxx>
-
+#include <TColStd_SequenceOfAsciiString.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>
{
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 );
}
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
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)
# 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()
// Qt includes
#include <QColor>
-
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
#include <GL/glx.h>
#endif
#include <Quantity_NameOfColor.hxx>
#include <Quantity_Color.hxx>
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
class GLViewer_Viewer2d;
#include <QPainter>
#include <QFile>
-#ifndef WIN32
+#if defined(__APPLE__)
+#include <OpenGL/CGLCurrent.h>
+#elif !defined(WIN32)
#include <GL/glx.h>
#endif
aFindFont.myIsUndl = theFont->underline();
aFindFont.myPointSize = theFont->pointSize();
-#ifdef WIN32
+#if defined(WIN32)
HGLRC ctx = ::wglGetCurrentContext();
if ( !ctx )
return aList;
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 )
class QFile;
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
#include "GLViewer.h"
#include "GLViewer_Defs.h"
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
{
#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 )
#include "GLViewer.h"
#include "GLViewer_Geom.h"
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
#include <QString>
#include "GLViewer.h"
#include "GLViewer_Defs.h"
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
#include <QFont>
#include <QString>
//
#include "GLViewer_Tools.h"
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
#include <iostream>
#include <string.h>
#include <stdlib.h>
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
#include <QX11Info>
#include <GL/glx.h>
#include <X11/Xlib.h>
*/
void GLViewer_ViewPort::selectVisualId( ViewType type )
{
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
XVisualInfo* pVisualInfo;
if ( QX11Info::display() )
{
#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"
#include <TColStd_SequenceOfInteger.hxx>
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
class GLViewer_Object;
class GLViewer_ViewFrame;
}
/*!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)";
}
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
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 );
<name>@default</name>
<message>
<source>EXTERNAL_BROWSER_CANNOT_SHOW_PAGE</source>
- <translation>Le navigateur externe "%1" ne peut pas trouver la page d'aide "%2". Voulez-vous le modifierdans les préférences ?</translation>
+ <translation>Le navigateur externe "%1" ne peut pas trouver la page d'aide "%2". Voulez-vous modifier les settings du navigateur externe dans les préférences ?</translation>
</message>
<message>
<source>ABOUT_COPYRIGHT</source>
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 );
}
bool hadSelection = ( myNumSelected > 0 );
/* select and send notifications */
- return checkSelection ( myAISContext->Select(), hadSelection, false );
+ return checkSelection ( myAISContext->Select( Standard_True ), hadSelection, false );
}
/*!
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 );
}
/*!
return false;
/* select and send notifications */
- return checkSelection ( myAISContext->ShiftSelect(), hadSelection, true );
+ return checkSelection ( myAISContext->ShiftSelect( Standard_True ), hadSelection, true );
}
/*!
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 );
}
thePlane->SetToUpdate();
thePlane->UpdateSelection();
- myViewer->getAISContext()->Update( thePlane );
+ myViewer->getAISContext()->Update( thePlane , Standard_True );
}
break;
thePlane->SetToUpdate();
thePlane->UpdateSelection();
- myViewer->getAISContext()->Update( thePlane );
+ myViewer->getAISContext()->Update( thePlane , Standard_True );
}
break;
}
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() )
{
// 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 );
}
#include <windows.h>
#endif
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
#include "OCCViewer_Trihedron.h"
#include <PrsMgr_PresentationManager3d.hxx>
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
# include <GL/glx.h>
#endif
bool ok = false;
GLuint aList = glGenLists( 256 );
-#ifdef WIN32
+#if defined(WIN32)
HGLRC hglrc = wglGetCurrentContext();
if( hglrc )
{
SelectObject( hdc, oldFont );
DeleteObject( font );
}
-#else // X Window
+#elif !defined(__APPLE__) // X Window
Display* dpy = glXGetCurrentDisplay();
if( dpy )
{
#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
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 );
if (aGraphicDriver.IsNull())
{
Handle(Aspect_DisplayConnection) aDisplayConnection;
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
aDisplayConnection = new Aspect_DisplayConnection( displayName );
#else
aDisplayConnection = new Aspect_DisplayConnection();
#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,
// 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 );
}
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 );
}
}
}
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
{
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();
myAISContext->Deactivate( myTrihedron );
}
else {
- myAISContext->Erase( myTrihedron );
+ myAISContext->Erase( myTrihedron , Standard_True );
}
}
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
#include <stdlib.h>
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
#include <QX11Info>
#include <GL/glx.h>
#include <X11/Xlib.h>
*/
void OCCViewer_ViewPort::selectVisualId()
{
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
XVisualInfo* pVisualInfo;
if ( QX11Info::display() )
{
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 );
}
}
//# 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)
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();
}
if ( ic->NbSelected() == 0 ) myCurrPointType = myPrevPointType;
if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange();
- ic->CloseAllContexts();
+ ic->CloseAllContexts( Standard_True );
myOperation = NOTHING;
myViewPort->setCursor( myCursor );
myCursorIsHand = false;
if ( myRotationPointSelection )
{
Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
- ic->CloseAllContexts();
+ ic->CloseAllContexts( Standard_True );
myOperation = NOTHING;
myViewPort->setCursor( myCursor );
myCursorIsHand = false;
if ( myRotationPointSelection )
{
Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
- ic->CloseAllContexts();
+ ic->CloseAllContexts( Standard_True );
myOperation = NOTHING;
myViewPort->setCursor( myCursor );
myCursorIsHand = false;
# 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>
#include <windows.h>
#endif
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
class OPENGLUTILS_EXPORT OpenGLUtils_FrameBuffer
{
QtxSlider.h
QtxSplash.h
QtxToolBar.h
+ QtxToolButton.h
QtxToolTip.h
QtxTreeView.h
QtxValidator.h
QtxSlider.cxx
QtxSplash.cxx
QtxToolBar.cxx
+ QtxToolButton.cxx
QtxToolTip.cxx
QtxTranslator.cxx
QtxTreeView.cxx
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( "." );
return font;
}
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
#include <X11/Xlib.h>
#include <GL/glx.h>
: 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 );
}
/*!
- * \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 );
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 );
--- /dev/null
+// 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 );
+ }
+}
--- /dev/null
+// 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
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;
}
}
# --- 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})
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;
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;
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 )
UserID
};
- public:
+public:
STD_Application();
virtual ~STD_Application();
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();
#include <QRegExp>
#include <QString>
#include <QStringList>
+#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+#include <QSurfaceFormat>
+#endif
#include <stdlib.h>
}
}
+#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() )
*/
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() ),
// 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
myRenderWindow->Delete();
myRenderWindow->DoubleBufferOn();
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
myRenderWindow->SetDisplayId((void*)QX11Info::display());
#endif
myRenderWindow->SetWindowId((void*)winId());
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() )
{
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();
{
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();
// 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)
return QWidget::winEvent( msg, result);
}
-#else
-
+#elif !defined(__APPLE__)
/*!
To handle native X11 events (from such devices as SpaceMouse)
*/
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);
//! 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
#include <QtGlobal>
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
#include <X11/X.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
SVTK_SpaceMouseX::SVTK_SpaceMouseX()
: SVTK_SpaceMouse()
{
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
win = InputFocus;
#endif
}
return myInstance;
}
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
static int errorCallback( Display *display, XErrorEvent *Error )
{
SVTK_SpaceMouseXCB::SVTK_SpaceMouseXCB()
: SVTK_SpaceMouse()
{
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
win = InputFocus;
#endif
}
/*!
Initialization
*/
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
int SVTK_SpaceMouseXCB::initialize( xcb_connection_t *connection, xcb_window_t window )
{
// make request
#include <QtGlobal>
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
extern "C"
{
#include <X11/X.h>
#include <xcb/xcb.h>
#endif
}
-
#endif
class SVTK_SpaceMouse
// 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 );
static SVTK_SpaceMouseX* myInstance;
};
+
#else
+
class SVTK_SpaceMouseXCB: public SVTK_SpaceMouse
{
// 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 );
static SVTK_SpaceMouseXCB* myInstance;
};
+
#endif
#endif
#include <OpenGLUtils_FrameBuffer.h>
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
namespace SVTK
{
objectBrowserColumnsVisibility();
}
-/*!Gets file filter.
- *\retval QString "(*.hdf)"
- */
-QString SalomeApp_Application::getFileFilter() const
-{
- return "(*.hdf)";
-}
-
/*!Create window.*/
QWidget* SalomeApp_Application::createWindow( const int flag )
{
virtual void updateObjectBrowser( const bool = true );
- virtual QString getFileFilter() const;
-
virtual void start();
virtual void contextMenuPopup( const QString&, QMenu*, QString& );
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() ),
# 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>
#include <map>
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
#include <vtkSmartPointer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRendererCollection.h>
#include <vtkCamera.h>
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
#include <QX11Info>
#include <vtkXOpenGLRenderWindow.h>
#endif
setAttribute( Qt::WA_DeleteOnClose );
myRW = vtkRenderWindow::New();
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
myRW->SetDisplayId((void*)(QX11Info::display()));
#endif
myRW->SetWindowId((void*)winId());
# sources / to compile
SET(PyConsolePy_SOURCES ${_sip_SOURCES})
-message("PyConsolePy_SOURCES = ${PyConsolePy_SOURCES}")
# --- rules ---
#include "PyInterp.h"
template<class T>
-class PYINTERP_EXPORT PyInterp_Auto
+class PyInterp_Auto
{
public:
PyInterp_Auto(const PyInterp_Auto& other):_ptr(0) { referPtr(other._ptr); }