photosgallery/slideshow/engine/effectsrc/shwzoomandpanlayout.cpp
branchRCL_3
changeset 12 ce1c7ad1f18b
parent 0 4e91876724a2
child 13 bcb43dc84c44
equal deleted inserted replaced
11:71da52165949 12:ce1c7ad1f18b
    96 // ResetSizeToMinimum
    96 // ResetSizeToMinimum
    97 // -----------------------------------------------------------------------------
    97 // -----------------------------------------------------------------------------
    98 void TShwZoomAndPanLayout::ResetSizeToMinimum()
    98 void TShwZoomAndPanLayout::ResetSizeToMinimum()
    99 	{
    99 	{
   100 	GLX_LOG_INFO( "TShwZoomAndPanLayout::ResetSizeToMinimum" );
   100 	GLX_LOG_INFO( "TShwZoomAndPanLayout::ResetSizeToMinimum" );
   101 	// set initial size to minimum size
       
   102 //	iZoomedSize.Set( iMinimumSize );
       
   103 	}
   101 	}
   104 
   102 
   105 // -----------------------------------------------------------------------------
   103 // -----------------------------------------------------------------------------
   106 // StartZoom
   104 // StartZoom
   107 // -----------------------------------------------------------------------------
   105 // -----------------------------------------------------------------------------
   135 			"TShwZoomAndPanLayout:: Zooming out start(%.1f,%.1f)", 
   133 			"TShwZoomAndPanLayout:: Zooming out start(%.1f,%.1f)", 
   136 			iMaximumSize.iWidth, iMaximumSize.iHeight );
   134 			iMaximumSize.iWidth, iMaximumSize.iHeight );
   137 		GLX_LOG_INFO2( 
   135 		GLX_LOG_INFO2( 
   138 			"TShwZoomAndPanLayout:: Zooming out target(%.1f,%.1f)", 
   136 			"TShwZoomAndPanLayout:: Zooming out target(%.1f,%.1f)", 
   139 			iMinimumSize.iWidth, iMinimumSize.iHeight );
   137 			iMinimumSize.iWidth, iMinimumSize.iHeight );
   140 		// zooming out so we start from maximum size
   138 
   141 		//iZoomedSize.Set( iMaximumSize );
       
   142 		// target is the minimum size
       
   143 	//	iZoomedSize.Set( iMinimumSize, aDuration );
       
   144 		// run the latter half of the curve
   139 		// run the latter half of the curve
   145 		curveStart = curveLength / 2;
   140 		curveStart = curveLength / 2;
   146 		curveEnd = curveLength;
   141 		curveEnd = curveLength;
   147 		}
   142 		}
   148 	else // default case is EZoomIn
   143 	else // default case is EZoomIn
   151 			"TShwZoomAndPanLayout:: Zooming in start(%.1f,%.1f)", 
   146 			"TShwZoomAndPanLayout:: Zooming in start(%.1f,%.1f)", 
   152 			iMinimumSize.iWidth, iMinimumSize.iHeight );
   147 			iMinimumSize.iWidth, iMinimumSize.iHeight );
   153 		GLX_LOG_INFO2( 
   148 		GLX_LOG_INFO2( 
   154 			"TShwZoomAndPanLayout:: Zooming in target(%.1f,%.1f)", 
   149 			"TShwZoomAndPanLayout:: Zooming in target(%.1f,%.1f)", 
   155 			iMaximumSize.iWidth, iMaximumSize.iHeight );
   150 			iMaximumSize.iWidth, iMaximumSize.iHeight );
   156 		// zooming in so we start from minimum size
       
   157 //		iZoomedSize.Set( iMinimumSize );
       
   158 		// target is maximum size
       
   159 //		iZoomedSize.Set( iMaximumSize, aDuration );
       
   160 		}
   151 		}
   161 
   152 
   162 	// set position, if we have curve its either from start to half 
   153 	// set position, if we have curve its either from start to half 
   163 	// or half to end and if we dont then its always 0
   154 	// or half to end and if we dont then its always 0
   164 	iCurvePosition.Set( curveStart );
   155 	iCurvePosition.Set( curveStart );
   218 	TReal32 y_size = iZoomedSize.iHeight.Now();
   209 	TReal32 y_size = iZoomedSize.iHeight.Now();
   219 
   210 
   220 	// ensure x is inside  maximum size and minimum size
   211 	// ensure x is inside  maximum size and minimum size
   221     x_size = Min( x_size, iMaximumSize.iWidth );
   212     x_size = Min( x_size, iMaximumSize.iWidth );
   222     x_size = Max( x_size, iMinimumSize.iWidth );
   213     x_size = Max( x_size, iMinimumSize.iWidth );
   223 	// set x size, it is now inside the minimum and maximum
       
   224 	//aInfo.iSize.iX = x_size;
       
   225 
   214 
   226     // ensure y is inside  maximum size and minimum size
   215     // ensure y is inside  maximum size and minimum size
   227     y_size = Min( y_size, iMaximumSize.iHeight );
   216     y_size = Min( y_size, iMaximumSize.iHeight );
   228     y_size = Max( y_size, iMinimumSize.iHeight );
   217     y_size = Max( y_size, iMinimumSize.iHeight );
   229 	// set y size, it is now inside the minimum and maximum
       
   230 //	aInfo.iSize.iY = y_size;
       
   231 
   218 
   232 	// set position only if we have a panning curve, this enables the use of this
   219 	// set position only if we have a panning curve, this enables the use of this
   233     // layout as only a zooming layout and then some other layout can define 
   220     // layout as only a zooming layout and then some other layout can define 
   234     // the position (as we dont overwrite 0,0 there...)
   221     // the position (as we dont overwrite 0,0 there...)
   235 	if( iPanningCurve )
   222 	if( iPanningCurve )
   250 		//         current.y - minimum.y
   237 		//         current.y - minimum.y
   251 		// scale = ---------------------
   238 		// scale = ---------------------
   252 		//         maximum.y - minimum.y
   239 		//         maximum.y - minimum.y
   253 		// and need to ensure maximum.y > minimum.y, otherwise scale becomes
   240 		// and need to ensure maximum.y > minimum.y, otherwise scale becomes
   254 		// infinite
   241 		// infinite
   255 		if( iMaximumSize.iHeight > iMinimumSize.iHeight )
       
   256 			{
       
   257 /*			TReal32 scale = ( aInfo.iSize.iY - iMinimumSize.iHeight ) /
       
   258 							( iMaximumSize.iHeight - iMinimumSize.iHeight );
       
   259 			// multiply the curve with scale
       
   260 			// set x position
       
   261 			aInfo.iPosition.iX = 
       
   262 				scale * iPanningCurve->MapValue( iCurvePosition.Now(), 0 );
       
   263 			// set y position
       
   264 			aInfo.iPosition.iY =
       
   265 				scale * iPanningCurve->MapValue( iCurvePosition.Now(), 1 );*/
       
   266 			}
       
   267 		else
       
   268 	        {
       
   269 	        // Panning curve defined but we either zoomed to screen size or
       
   270 	        // the image was smaller than or equal to screen size so
       
   271 	        // just set position to origo to see image centered on the screen
       
   272 		//	aInfo.iPosition.iX = 0;
       
   273 		//	aInfo.iPosition.iY = 0;
       
   274 	        }
       
   275 		}
   242 		}
   276 	}
   243 	}
   277 
   244 
   278 // -----------------------------------------------------------------------------
   245 // -----------------------------------------------------------------------------
   279 // DoChanged
   246 // DoChanged
   280 // -----------------------------------------------------------------------------
   247 // -----------------------------------------------------------------------------
   281 TBool TShwZoomAndPanLayout::DoChanged() const
   248 TBool TShwZoomAndPanLayout::DoChanged() const
   282 	{
   249 	{
   283 	TBool ret = EFalse;
   250 	TBool ret = EFalse;
   284 	if( iPanningCurve )
       
   285 		{
       
   286 //		ret = iPanningCurve->MappingFunctionChanged();
       
   287 		}
       
   288 	return iZoomedSize.Changed() || ret;
   251 	return iZoomedSize.Changed() || ret;
   289 	}
   252 	}
   290 
   253 
   291 // -----------------------------------------------------------------------------
   254 // -----------------------------------------------------------------------------
   292 // DoClearChanged
   255 // DoClearChanged
   293 // -----------------------------------------------------------------------------
   256 // -----------------------------------------------------------------------------
   294 void TShwZoomAndPanLayout::DoClearChanged() 
   257 void TShwZoomAndPanLayout::DoClearChanged() 
   295 	{
   258 	{
   296 	iZoomedSize.ClearChanged();
   259 	iZoomedSize.ClearChanged();
   297 	if( iPanningCurve )
       
   298 		{
       
   299 //		iPanningCurve->MappingFunctionClearChanged();
       
   300 		}
       
   301 	}
   260 	}
   302 
   261 
   303 // -----------------------------------------------------------------------------
   262 // -----------------------------------------------------------------------------
   304 // CalculateMinAndMaxSize
   263 // CalculateMinAndMaxSize
   305 // -----------------------------------------------------------------------------
   264 // -----------------------------------------------------------------------------