From: sln Date: Fri, 9 Feb 2007 18:46:22 +0000 (+0000) Subject: XZoom changed on Zoom for compability with old applications X-Git-Tag: CTH_V12~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=00117fc1e8c7c7315931fd3eeb0bfde3e76b5ec1;p=modules%2Fgui.git XZoom changed on Zoom for compability with old applications --- diff --git a/src/GLViewer/GLViewer_Group.cxx b/src/GLViewer/GLViewer_Group.cxx index 8b13a3615..af707c2df 100644 --- a/src/GLViewer/GLViewer_Group.cxx +++ b/src/GLViewer/GLViewer_Group.cxx @@ -146,7 +146,7 @@ void GLViewer_Group::dragingObjects( float x, float y, bool once ) \param sender - object to be updated \param zoom - zoom coefficient */ -void GLViewer_Group::updateXZoom( GLViewer_Object* sender, float zoom ) +void GLViewer_Group::updateZoom( GLViewer_Object* sender, float zoom ) { OGIterator it = myList.begin(); OGIterator end_it = myList.end(); @@ -154,7 +154,7 @@ void GLViewer_Group::updateXZoom( GLViewer_Object* sender, float zoom ) { GLViewer_Object* anObject = *it; if( anObject != sender ) - anObject->setXZoom( zoom, true, true ); + anObject->setZoom( zoom, true, true ); } } diff --git a/src/GLViewer/GLViewer_Group.h b/src/GLViewer/GLViewer_Group.h index 0731ca415..94678837a 100644 --- a/src/GLViewer/GLViewer_Group.h +++ b/src/GLViewer/GLViewer_Group.h @@ -64,7 +64,7 @@ public: /*! Once = true, if this operation calls only one time for all object*/ void dragingObjects( float x, float y, bool once = false ); //!\warning it is for ouv - void updateXZoom( GLViewer_Object* sender, float zoom ); + void updateZoom( GLViewer_Object* sender, float zoom ); //!\warning it is for ouv void updateYZoom( GLViewer_Object* sender, float zoom ); diff --git a/src/GLViewer/GLViewer_Object.cxx b/src/GLViewer/GLViewer_Object.cxx index eb6b48ff0..22140de12 100644 --- a/src/GLViewer/GLViewer_Object.cxx +++ b/src/GLViewer/GLViewer_Object.cxx @@ -39,7 +39,7 @@ GLViewer_Object::GLViewer_Object() myYScale = 1.0; myXGap = 0; myYGap = 0; - myXZoom = 1.0; + myZoom = 1.0; myYZoom = 1.0; myIsHigh = GL_FALSE; @@ -101,12 +101,12 @@ GLboolean GLViewer_Object::isInside( GLViewer_Rect theRect ) Sets horizontal zoom factor \param zoom - zoom factor */ -GLboolean GLViewer_Object::setXZoom( GLfloat zoom, bool, bool ) +GLboolean GLViewer_Object::setZoom( GLfloat zoom, bool, bool ) { - if( myXZoom == zoom ) + if( myZoom == zoom ) return GL_FALSE; - myXZoom = zoom; + myZoom = zoom; return GL_TRUE; } @@ -114,23 +114,23 @@ GLboolean GLViewer_Object::setXZoom( GLfloat zoom, bool, bool ) Performs horizontal zoom change by step \param zoomIn - to increase to decrease zoom */ -GLboolean GLViewer_Object::updateXZoom( bool zoomIn ) +GLboolean GLViewer_Object::updateZoom( bool zoomIn ) { float newZoom; float step = zoomIn ? 1 : -1; double epsilon = 0.001; - if( myXZoom - 1 > epsilon ) - newZoom = ( myXZoom * 2 + step ) / 2; - else if( 1 - myXZoom > epsilon ) - newZoom = 2 / ( 2 / myXZoom - step ); + if( myZoom - 1 > epsilon ) + newZoom = ( myZoom * 2 + step ) / 2; + else if( 1 - myZoom > epsilon ) + newZoom = 2 / ( 2 / myZoom - step ); else newZoom = zoomIn ? 3./2. : 2./3.; if( newZoom < 0.01 || newZoom > 100.0 ) return GL_FALSE; - return setXZoom( newZoom, true ); + return setZoom( newZoom, true ); } /*! diff --git a/src/GLViewer/GLViewer_Object.h b/src/GLViewer/GLViewer_Object.h index 7bc1dfc68..b75ba3946 100644 --- a/src/GLViewer/GLViewer_Object.h +++ b/src/GLViewer/GLViewer_Object.h @@ -139,11 +139,11 @@ public: virtual void getScale( GLfloat& xScale, GLfloat& yScale ) const { xScale = myXScale; yScale = myYScale;} //!\warning It is for ouv - virtual GLboolean setXZoom( GLfloat zoom, bool recompute, bool fromGroup = false ); + virtual GLboolean setZoom( GLfloat zoom, bool recompute, bool fromGroup = false ); //!\warning It is for ouv - virtual GLfloat getXZoom() const { return myXZoom; } + virtual GLfloat getZoom() const { return myZoom; } //!\warning It is for ouv - virtual GLboolean updateXZoom( bool zoomIn ); + virtual GLboolean updateZoom( bool zoomIn ); //!\warning It is for ouv virtual GLboolean setYZoom( GLfloat yoom, bool recompute, bool fromGroup = false ); @@ -280,7 +280,7 @@ protected: GLfloat myYGap; //!\warning It is for ouv - GLfloat myXZoom; + GLfloat myZoom; //!\warning It is for ouv GLfloat myYZoom; diff --git a/src/GLViewer/GLViewer_Viewer2d.cxx b/src/GLViewer/GLViewer_Viewer2d.cxx index 5884d07a4..b7f169efc 100644 --- a/src/GLViewer/GLViewer_Viewer2d.cxx +++ b/src/GLViewer/GLViewer_Viewer2d.cxx @@ -1008,7 +1008,7 @@ void GLViewer_Viewer2d::startOperations( QWheelEvent* e ) { GLViewer_Object* anObject = myGLContext->SelectedObject(); if( e->state() & ControlButton ) - update = anObject->updateXZoom( zoomIn ) || update; + update = anObject->updateZoom( zoomIn ) || update; else update = anObject->updateYZoom( zoomIn ) || update; }