From 4b7bd5bad8435d6d2e6307f31edd89da815a57a7 Mon Sep 17 00:00:00 2001 From: ouv Date: Tue, 12 Oct 2010 14:56:26 +0000 Subject: [PATCH] Additional fix for issue 0020938: EDF 1450 GEOM: center of zoom --- src/LightApp/LightApp_Application.cxx | 24 +++++++++++++++++++----- src/OCCViewer/OCCViewer_ViewPort3d.cxx | 10 ++++++++++ src/OCCViewer/OCCViewer_ViewWindow.cxx | 2 ++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index f6c5c1752..8ad007ba5 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -177,6 +177,14 @@ #include #endif +#include + +#ifdef OCC_VERSION_SERVICEPACK +#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK) +#else +#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8) +#endif + #define ToolBarMarker 0 #define DockWidgetMarker 1 @@ -1970,14 +1978,16 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) pref->setItemProperty( "strings", aStyleModeList, occStyleMode ); pref->setItemProperty( "indexes", aModeIndexesList, occStyleMode ); +#if OCC_VERSION_LARGE > 0x06030010 // available only with OCC-6.3-sp11 and higher version int occZoomingStyleMode = pref->addPreference( tr( "PREF_ZOOMING" ), occGroup, LightApp_Preferences::Selector, "OCCViewer", "zooming_mode" ); - QStringList aZoomingStyleModeList; - aZoomingStyleModeList.append( tr("PREF_ZOOMING_AT_CENTER") ); - aZoomingStyleModeList.append( tr("PREF_ZOOMING_AT_CURSOR") ); + QStringList anOCCZoomingStyleModeList; + anOCCZoomingStyleModeList.append( tr("PREF_ZOOMING_AT_CENTER") ); + anOCCZoomingStyleModeList.append( tr("PREF_ZOOMING_AT_CURSOR") ); - pref->setItemProperty( "strings", aZoomingStyleModeList, occZoomingStyleMode ); + pref->setItemProperty( "strings", anOCCZoomingStyleModeList, occZoomingStyleMode ); pref->setItemProperty( "indexes", aModeIndexesList, occZoomingStyleMode ); +#endif // VTK Viewer int vtkGen = pref->addPreference( "", vtkGroup, LightApp_Preferences::Frame ); @@ -2012,7 +2022,11 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) int vtkZoomingStyleMode = pref->addPreference( tr( "PREF_ZOOMING" ), vtkGen, LightApp_Preferences::Selector, "VTKViewer", "zooming_mode" ); - pref->setItemProperty( "strings", aZoomingStyleModeList, vtkZoomingStyleMode ); + QStringList aVTKZoomingStyleModeList; + aVTKZoomingStyleModeList.append( tr("PREF_ZOOMING_AT_CENTER") ); + aVTKZoomingStyleModeList.append( tr("PREF_ZOOMING_AT_CURSOR") ); + + pref->setItemProperty( "strings", aVTKZoomingStyleModeList, vtkZoomingStyleMode ); pref->setItemProperty( "indexes", aModeIndexesList, vtkZoomingStyleMode ); int vtkSpeed = pref->addPreference( tr( "PREF_INCREMENTAL_SPEED" ), vtkGen, diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index e49b93b51..ef78fa84c 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -51,6 +51,14 @@ static int sx = 0; static int sy = 0; static Standard_Boolean zRotation = Standard_False; +#include + +#ifdef OCC_VERSION_SERVICEPACK +#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK) +#else +#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8) +#endif + /*! Constructor */ @@ -314,8 +322,10 @@ void OCCViewer_ViewPort3d::fitRect( const QRect& rect ) */ void OCCViewer_ViewPort3d::startZoomAtPoint( int x, int y ) { +#if OCC_VERSION_LARGE > 0x06030010 // available only with OCC-6.3-sp11 and higher version if ( !activeView().IsNull() && isAdvancedZoomingEnabled() ) activeView()->StartZoomAtPoint( x, y ); +#endif } /*! diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index c52efe0ca..a1200fd76 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -1192,7 +1192,9 @@ void OCCViewer_ViewWindow::createToolBar() toolMgr()->append( DumpId, tid ); toolMgr()->append( SwitchInteractionStyleId, tid ); +#if OCC_VERSION_LARGE > 0x06030010 // available only with OCC-6.3-sp11 and higher version toolMgr()->append( SwitchZoomingStyleId, tid ); +#endif if( myModel->trihedronActivated() ) toolMgr()->append( TrihedronShowId, tid ); -- 2.39.2