svgtopt/SVGTPlugin/src/SvgtPluginControl.cpp
branchRCL_3
changeset 39 1902ade171ab
equal deleted inserted replaced
38:db5c883ad1c5 39:1902ade171ab
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  SVGT Plugin Implementation source file
       
    15  *
       
    16 */
       
    17 
       
    18 #include <featmgr.h>
       
    19 #include <eikenv.h>
       
    20 #include <w32std.h>
       
    21 #include <e32base.h>
       
    22 #include <barsread.h>
       
    23 #include <SVGEngineInterfaceImpl.h>
       
    24 //#include <Svgengineinterface.h>
       
    25 #include <f32file.h>
       
    26 
       
    27 #include "Svgtplugin.h"
       
    28 
       
    29 #define SVGT_PLUGIN_DEVICE_KEY_0 48
       
    30 #define SVGT_PLUGIN_DEVICE_KEY_1 49
       
    31 #define SVGT_PLUGIN_DEVICE_KEY_2 50
       
    32 #define SVGT_PLUGIN_DEVICE_KEY_3 51
       
    33 #define SVGT_PLUGIN_DEVICE_KEY_4 52
       
    34 #define SVGT_PLUGIN_DEVICE_KEY_5 53
       
    35 #define SVGT_PLUGIN_DEVICE_KEY_6 54
       
    36 #define SVGT_PLUGIN_DEVICE_KEY_7 55
       
    37 #define SVGT_PLUGIN_DEVICE_KEY_8 56
       
    38 #define SVGT_PLUGIN_DEVICE_KEY_9 57
       
    39 #define SVGT_PLUGIN_DEVICE_KEY_ASTERIX 42
       
    40 
       
    41 
       
    42 void CSvgtPluginControl::ConstructL(CSvgtPlugin* aPlugin, const CCoeControl* aParentControl)
       
    43     {
       
    44     iAsFileCalled = EFalse;
       
    45     iShowCursor = EFalse;
       
    46     iPointerX = 5;
       
    47     iPointerY = 5;
       
    48     iPlugin=aPlugin;
       
    49     this->CreateWindowL(aParentControl);
       
    50     ActivateL();
       
    51     EnableDragEvents();
       
    52     iLightObserver = CHWRMLight::NewL(this);
       
    53     }
       
    54 
       
    55 CSvgtPluginControl::~CSvgtPluginControl()
       
    56     {
       
    57 	delete iLightObserver;
       
    58     }
       
    59 
       
    60 void CSvgtPluginControl::Draw(const TRect& aRect) const
       
    61     {
       
    62     CWindowGc &gc = SystemGc();
       
    63     if (iPlugin && iPlugin->iRenderBuffer !=NULL)
       
    64         {
       
    65         
       
    66         // Fix for the iframe scrolling.
       
    67     	TRect lCliprect;
       
    68     	
       
    69     	lCliprect.iTl.iY = iPlugin->iCurrentWindow.clipRect.top;
       
    70     	lCliprect.iTl.iX = iPlugin->iCurrentWindow.clipRect.left;
       
    71     	lCliprect.iBr.iY = iPlugin->iCurrentWindow.clipRect.bottom;
       
    72     	lCliprect.iBr.iX = iPlugin->iCurrentWindow.clipRect.right;
       
    73 		
       
    74 		TSize lWindowSize(iPlugin->iCurrentWindow.width,iPlugin->iCurrentWindow.height);
       
    75 		
       
    76 		if(lWindowSize!=(lCliprect.Size()))
       
    77 			{
       
    78 			// Get the Abs(x,y) of the window and render with the size of the cliprect 
       
    79 			TPoint lpt(Abs(iPlugin->iCurrentWindow.x),Abs(iPlugin->iCurrentWindow.y ));
       
    80 			TRect lrect(lpt,lCliprect.Size());
       
    81 			gc.BitBlt( aRect.iTl,  (iPlugin->iRenderBuffer), lrect );
       
    82 			}
       
    83         else
       
    84         	{
       
    85         	gc.BitBlt( aRect.iTl,  (iPlugin->iRenderBuffer), aRect );
       
    86         	}
       
    87         
       
    88 
       
    89 		if ( iShowCursor )
       
    90 			{
       
    91 	        TInt lX = iPointerX + aRect.iTl.iX;
       
    92 	        TInt lY = iPointerY + aRect.iTl.iY;
       
    93 	        TRect   csrh    ( lX - 2,
       
    94 	                          lY - 5,
       
    95 	                          lX + 2,
       
    96 	                          lY + 5 );
       
    97 	        TRect   csrv    ( lX - 5,
       
    98 	                          lY - 2,
       
    99 	                          lX + 5,
       
   100 	                          lY + 2 );
       
   101 	        gc.SetPenSize( TSize( 1, 1 ) );
       
   102 	        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   103 	        gc.SetBrushColor( TRgb( 0, 0, 0 ) );
       
   104 	        gc.SetPenColor( TRgb( 0, 0, 0 ) );
       
   105 	        gc.DrawRect( csrh );
       
   106 	        gc.DrawRect( csrv );
       
   107 	        csrh.Shrink( 1, 1 );
       
   108 	        csrv.Shrink( 1, 1 );
       
   109 	        gc.SetBrushColor( TRgb( 255, 225, 225 ) );
       
   110 	        gc.SetPenColor( TRgb( 255, 225, 225 ) );
       
   111 	        gc.DrawRect( csrh );
       
   112 	        gc.DrawRect( csrv );
       
   113 			}
       
   114         }
       
   115     }
       
   116 
       
   117 TInt CSvgtPluginControl::CountComponentControls() const
       
   118     {
       
   119     return 0;
       
   120     }
       
   121 
       
   122 CCoeControl* CSvgtPluginControl::ComponentControl(TInt /*aIndex*/) const
       
   123     {
       
   124     return NULL;
       
   125     }
       
   126 
       
   127 void CSvgtPluginControl::SizeChanged()
       
   128     {
       
   129     }
       
   130 
       
   131 #ifndef ER5
       
   132 TCoeInputCapabilities CSvgtPluginControl::InputCapabilities() const
       
   133     {
       
   134     return TCoeInputCapabilities(TCoeInputCapabilities::ENavigation);
       
   135     }
       
   136 #endif
       
   137 
       
   138 void CSvgtPluginControl::HandleControlEventL(CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/)
       
   139     {
       
   140     }
       
   141 
       
   142 void CSvgtPluginControl::FocusChanged(TDrawNow /*aDrawNow*/)
       
   143     {
       
   144     }
       
   145 
       
   146 TKeyResponse CSvgtPluginControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
   147     {
       
   148     TKeyResponse    retVal  = EKeyWasNotConsumed;
       
   149     if( iPlugin->iSvgModule && iPlugin->iSvgModule->SvgDocument() )
       
   150         {
       
   151         if ( aType == EEventKeyUp )
       
   152             {
       
   153               iPointerDx = 0;
       
   154               iPointerDy = 0;
       
   155             if ( aKeyEvent.iScanCode == EStdKeyDevice3 ) // Center button of rocker key
       
   156                	{
       
   157                	iPlugin->iSvgModule->MouseUp( iPointerX, iPointerY );
       
   158                 retVal = EKeyWasConsumed;
       
   159                	} 
       
   160 			if(iPreviousScanCode.iScanCode == SVGT_PLUGIN_DEVICE_KEY_0)
       
   161 				{
       
   162 				   if(!iPreviousScanCode.iRepeats) /*Short Key Press of 'Zero' Do Zoom Out*/
       
   163 					{
       
   164 					iPlugin->iSvgModule->Zoom(0.5f);
       
   165                     iPlugin->iSvgModule->Redraw();
       
   166 					}
       
   167 				   else /*Long Key Press of 'Zero' Reset to Original View*/
       
   168 					{
       
   169                     iPlugin->iSvgModule->OriginalView();
       
   170                     iPlugin->iSvgModule->Redraw();
       
   171 					}
       
   172 					retVal = EKeyWasConsumed;
       
   173 
       
   174 				}
       
   175 			iPreviousScanCode.iRepeats	= 0;
       
   176 			iPreviousScanCode.iCode		= 0;
       
   177 			iPreviousScanCode.iScanCode	= 0;
       
   178             }
       
   179         else if ( aType == EEventKey )
       
   180             {
       
   181             retVal = EKeyWasConsumed;
       
   182             // aKeyEvent.iScanCode does not recognize EStdKeyNkpAsterisk
       
   183                 switch ( aKeyEvent.iScanCode )
       
   184                     {
       
   185                 case EStdKeyLeftArrow:
       
   186                     iPointerDx -= 5;
       
   187                     iPointerDy = 0;
       
   188                     break;
       
   189                 case EStdKeyRightArrow:
       
   190                     iPointerDx += 5;
       
   191                     iPointerDy = 0;
       
   192                     break;
       
   193                 case EStdKeyUpArrow:
       
   194                     iPointerDx = 0;
       
   195                     iPointerDy -= 5;
       
   196                     break;
       
   197                 case EStdKeyDownArrow:
       
   198                     iPointerDx = 0;
       
   199                     iPointerDy += 5;
       
   200                     break;
       
   201                 case EStdKeyDevice3:
       
   202                     // Center button of rocker key
       
   203                     iPlugin->iSvgModule->MouseDown( iPointerX, iPointerY );
       
   204                     break;
       
   205 		       case EStdKeyHash: // Pause/Resume
       
   206                     if(iPlugin->iSvgModule->CurrentState() == 0)
       
   207                         iPlugin->iSvgModule->Stop();
       
   208                     else if(iPlugin->iSvgModule->CurrentState() == 1)
       
   209                         iPlugin->iSvgModule->Resume();
       
   210                     break;
       
   211 
       
   212                 case SVGT_PLUGIN_DEVICE_KEY_5: //Zoom In
       
   213                     iPlugin->iSvgModule->Zoom(2.0f);
       
   214                     iPlugin->iSvgModule->Redraw();
       
   215                     break;
       
   216 
       
   217                 case SVGT_PLUGIN_DEVICE_KEY_1: //Rotate ClockWise  90
       
   218                     iPlugin->iSvgModule->Rotate( (float) (3.1415926/2), iContentDimension.iWidth/2, iContentDimension.iHeight/2);
       
   219                     iPlugin->iSvgModule->Redraw();
       
   220                     break;
       
   221 
       
   222                 case SVGT_PLUGIN_DEVICE_KEY_3: //Rotate Counter ClockWise  90
       
   223                     iPlugin->iSvgModule->Rotate( (float) (-3.1415926/2), iContentDimension.iWidth/2, iContentDimension.iHeight/2);
       
   224                     iPlugin->iSvgModule->Redraw();
       
   225                     break;
       
   226                 case SVGT_PLUGIN_DEVICE_KEY_7: //Rotate ClockWise 45
       
   227                     iPlugin->iSvgModule->Rotate( (float) (3.1415926/4), iContentDimension.iWidth/2, iContentDimension.iHeight/2);
       
   228                     iPlugin->iSvgModule->Redraw();
       
   229                     break;
       
   230                 case SVGT_PLUGIN_DEVICE_KEY_9: //Rotate Counter ClockWise  45
       
   231                     iPlugin->iSvgModule->Rotate( (float) (-3.1415926/4), iContentDimension.iWidth/2, iContentDimension.iHeight/2);
       
   232                     iPlugin->iSvgModule->Redraw();
       
   233                     break;
       
   234 				case SVGT_PLUGIN_DEVICE_KEY_0:
       
   235 					iPreviousScanCode = aKeyEvent;
       
   236 					break;
       
   237                 default:
       
   238                 retVal = EKeyWasNotConsumed;
       
   239                     }
       
   240                 }
       
   241          
       
   242          else if ( aType == EEventKeyDown)
       
   243          	{
       
   244             // Send the mousedown event for triggering any animation
       
   245             // Since the EEventKey is not recieved when MSK is pressed,
       
   246             // the mousedown doesn't occur on engine. Hence EEventKey 
       
   247             // handled here
       
   248             if ( aKeyEvent.iScanCode == EStdKeyDevice3 ) // Center button of rocker key
       
   249             	{
       
   250             	iPlugin->iSvgModule->MouseDown( iPointerX, iPointerY );
       
   251             	retVal=EKeyWasConsumed;
       
   252             	}
       
   253            	}
       
   254 
       
   255         if ( (iPointerDx != 0) || (iPointerDy != 0) )
       
   256            {
       
   257             UpdatePointer(iPointerDx,iPointerDy);
       
   258            }
       
   259         }
       
   260     return retVal;
       
   261     }
       
   262 
       
   263 
       
   264 void CSvgtPluginControl::AsFile(const TDesC& fname,NPStream* stream)
       
   265     {
       
   266     // -----------------------------------
       
   267 	// Check for image was requested
       
   268     // -----------------------------------
       
   269     if( iPlugin && iFilename.Length() > 0 )
       
   270 	{
       
   271 		TInt lFileSize = 0;
       
   272         RFile lSvgFile;
       
   273         CEikonEnv* iEikEnv = CEikonEnv::Static(); 
       
   274         
       
   275         // Attempt to open the file in read mode
       
   276         User::LeaveIfError( lSvgFile.Open(iEikEnv->FsSession(),fname,EFileRead ) );
       
   277         
       
   278         // Save on cleanup stack
       
   279         CleanupClosePushL( lSvgFile );
       
   280         
       
   281         // Get the size of the data to create read buffer
       
   282         User::LeaveIfError( lSvgFile.Size(lFileSize) );
       
   283         
       
   284         // Create buffer that will contain the file data
       
   285         HBufC8* lFileData = HBufC8::NewLC(lFileSize);
       
   286         TPtr8 lFileDataPtr(lFileData->Des());
       
   287         
       
   288         // Read from the file
       
   289         User::LeaveIfError( lSvgFile.Read(lFileDataPtr) );
       
   290         
       
   291         TInt index = reinterpret_cast<TInt>((stream->notifyData));       
       
   292         
       
   293         iPlugin->iSvgModule->AssignImageData(*(iPlugin->iImageUrlInfoList[index]), lFileData );
       
   294 		iPlugin->iSvgModule->Redraw();
       
   295 		
       
   296 		// The ownership of lFileData is with the respective Image Element.
       
   297 		CleanupStack::Pop(1);
       
   298 		CleanupStack::PopAndDestroy(&lSvgFile); // lSvgFile.Close()
       
   299 				
       
   300 		return;
       
   301 	}
       
   302 		
       
   303 	// Svg file
       
   304     iFilename.Zero();
       
   305     iFilename.Copy(fname);
       
   306 
       
   307 	if ( ( iPlugin && iPlugin->iSvgModule ) )
       
   308         {
       
   309         iPlugin->iSvgModule->Stop();
       
   310         iPlugin->LoadSvgFile( iFilename );
       
   311         // After loading the content, the width & height will be visible to plugin.
       
   312         // It is time to adjust the size if needed.
       
   313 	    TBool widthInPercentage = EFalse;
       
   314 	    TBool heightInPercentage = EFalse;
       
   315 	    iContentDimension = iPlugin->iSvgModule->ContentDimensionsInPercentage();
       
   316 	    
       
   317 	    if(iContentDimension.iWidth == -1)
       
   318 	    {
       
   319 	        widthInPercentage = EFalse;
       
   320 	        if(iPlugin->iSvgModule->SvgDocument())
       
   321 	        {
       
   322 	            iContentDimension.iWidth = iPlugin->iSvgModule->GetViewportWidth(iPlugin->iSvgModule->SvgDocument());    
       
   323 	        }
       
   324 	        else
       
   325 	        {
       
   326 	            return;
       
   327 	        }
       
   328 	    }
       
   329 	    else
       
   330 	    {
       
   331 	        widthInPercentage = ETrue;
       
   332 	    }
       
   333 	    
       
   334 	    if(iContentDimension.iHeight == -1)
       
   335 	    {
       
   336 	        heightInPercentage = EFalse;
       
   337             if(iPlugin->iSvgModule->SvgDocument())
       
   338             {
       
   339                 iContentDimension.iHeight = iPlugin->iSvgModule->GetViewportHeight(iPlugin->iSvgModule->SvgDocument());    
       
   340             }
       
   341             else
       
   342             {
       
   343                 return;
       
   344             }
       
   345 	        
       
   346 	    }
       
   347 	    else
       
   348 	    {
       
   349 	        heightInPercentage = ETrue;
       
   350 	    }
       
   351 	    if(iPlugin->AdjustDimention(widthInPercentage, heightInPercentage))
       
   352             {
       
   353             // dimention change is needed so return and notify Browser.
       
   354 	        iAsFileCalled = ETrue;
       
   355             return;
       
   356             }
       
   357 
       
   358 	       	iPlugin->iSvgModule->Start();
       
   359         }        
       
   360         iAsFileCalled = ETrue;
       
   361     }
       
   362 
       
   363 
       
   364 TBool CSvgtPluginControl::IsAsFileCalled()
       
   365     {
       
   366     return iAsFileCalled;
       
   367     }
       
   368 
       
   369 TDesC& CSvgtPluginControl::GetFilename()
       
   370     {
       
   371     return iFilename;
       
   372     }
       
   373 
       
   374 
       
   375 void CSvgtPluginControl::LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus)
       
   376 {
       
   377      //TInt lState = iPlugin->iSvgModule->CurrentState();
       
   378 	if((aTarget == CHWRMLight::EPrimaryDisplay) || (aTarget == CHWRMLight::EPrimaryDisplayAndKeyboard))
       
   379 	{
       
   380 		if(aStatus == CHWRMLight::ELightOff)
       
   381 		{
       
   382 
       
   383 			if (iPlugin && iPlugin->iSvgModule)
       
   384 			{
       
   385 		    #ifdef _DEBUG
       
   386 		    RDebug::Printf("Backlight Off");
       
   387             #endif //_DEBUG
       
   388 
       
   389 		    iPlugin->iSvgModule->Pause();
       
   390 		    }
       
   391 
       
   392 		}
       
   393 		else if(aStatus == CHWRMLight::ELightOn)
       
   394 		{
       
   395 
       
   396 			if (iPlugin && iPlugin->iSvgModule)
       
   397 		    {
       
   398 		    #ifdef _DEBUG
       
   399 		    RDebug::Printf("Backlight On");
       
   400 	        #endif //_DEBUG
       
   401 
       
   402 	        iPlugin->iSvgModule->Resume();
       
   403 			}
       
   404 	    }
       
   405 	}
       
   406 
       
   407 }
       
   408 /**
       
   409 * MOperaPluginNotifier methods
       
   410 * - Handle notifications browser
       
   411 */
       
   412 TInt CSvgtPluginControl::NotifyL(TNotificationType aCallType, void* aParam)
       
   413     {
       
   414     if ( (iPlugin == NULL ) ||  ( iPlugin->iSvgModule == NULL ) )
       
   415 		{
       
   416 		return KErrNone;
       
   417 		}
       
   418 
       
   419     if(aCallType == EApplicationFocusChanged)
       
   420         {
       
   421         TInt lState = iPlugin->iSvgModule->CurrentState();
       
   422         TBool lInFocus =  (TBool) aParam;
       
   423 
       
   424 		if ( lInFocus )
       
   425 	    	{
       
   426             // iShowCursor = ETrue;
       
   427             if ( lState == 1 )
       
   428             	{
       
   429 		        iPlugin->iSvgModule->Resume();
       
   430             	}
       
   431 			DrawNow();
       
   432 	    	}
       
   433 	    else if ( !lInFocus )
       
   434 	    	{
       
   435             //ShowCursor = EFalse;
       
   436             if ( lState == 0 )
       
   437             	{
       
   438 		        iPlugin->iSvgModule->Pause();
       
   439             	}
       
   440 			DrawNow();
       
   441 	    	}
       
   442         }
       
   443     else if(aCallType == EPluginActivated)
       
   444         {
       
   445         iShowCursor = ETrue;
       
   446         DrawNow();
       
   447         }
       
   448     else if(aCallType == EPluginDeactivated)
       
   449         {
       
   450         iShowCursor = EFalse;
       
   451         DrawNow();
       
   452         }
       
   453     else if(aCallType == EPluginInvisible )
       
   454         {
       
   455         }
       
   456     return KErrNone;
       
   457     }
       
   458 
       
   459 
       
   460 void CSvgtPluginControl::ApplicationFocusChanged(TBool /*aInFocus*/)
       
   461     {
       
   462     }
       
   463 
       
   464 void CSvgtPluginControl::SystemNotification()
       
   465     {
       
   466     }
       
   467 
       
   468 void CSvgtPluginControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   469     {
       
   470     
       
   471     
       
   472     if ( iPlugin->iSvgModule && iPlugin->iSvgModule->SvgDocument() )
       
   473         {
       
   474         iPointerDx = 0;
       
   475         iPointerDy = 0;
       
   476         
       
   477         if(aPointerEvent.iType == TPointerEvent::EButton1Down)
       
   478             {
       
   479             if(aPointerEvent.iPosition.iX <=iPlugin->iRenderWidth && aPointerEvent.iPosition.iY <=iPlugin->iRenderHeight)
       
   480                 {
       
   481                 iPointerX = aPointerEvent.iPosition.iX;
       
   482                 iPointerY = aPointerEvent.iPosition.iY;
       
   483 
       
   484 				iXPosAtMouseDown = iPointerX;
       
   485 				iYPosAtMouseDown = iPointerY;
       
   486 				
       
   487                 iPlugin->iSvgModule->MouseDown( iPointerX, iPointerY );
       
   488                 UpdatePointer();
       
   489                 }
       
   490             }
       
   491         else if(aPointerEvent.iType == TPointerEvent::EButton1Up)
       
   492             {
       
   493             iPlugin->iSvgModule->MouseUp( iPointerX, iPointerY );
       
   494             DrawDeferred();
       
   495             }
       
   496          else if (aPointerEvent.iType == TPointerEvent::EDrag)
       
   497             {
       
   498             if((iPointerX != aPointerEvent.iPosition.iX || iPointerY != aPointerEvent.iPosition.iY) && 
       
   499             (aPointerEvent.iPosition.iX <=iPlugin->iRenderWidth && aPointerEvent.iPosition.iY <=iPlugin->iRenderHeight))
       
   500                 {
       
   501                 iPointerX = aPointerEvent.iPosition.iX;
       
   502                 iPointerY = aPointerEvent.iPosition.iY;
       
   503 
       
   504                 iPlugin->iSvgModule->MouseMove( iPointerX, iPointerY );
       
   505                 
       
   506                 UpdatePointer((iXPosAtMouseDown-iPointerX),(iYPosAtMouseDown-iPointerY));
       
   507                 }
       
   508             }
       
   509         }
       
   510     }
       
   511 
       
   512 void CSvgtPluginControl::UpdatePointer(
       
   513 #ifdef __PEN_SUPPORT
       
   514         TInt aShiftX , TInt aShiftY
       
   515 #else
       
   516         TInt , TInt
       
   517 #endif        
       
   518     )
       
   519     {
       
   520     #ifdef __PEN_SUPPORT
       
   521      if(FeatureManager::FeatureSupported(KFeatureIdPenSupport))
       
   522          {
       
   523     if(aShiftX != 0 || aShiftY != 0 )
       
   524     {
       
   525     	iPlugin->iSvgModule->Pan(-aShiftX,-aShiftY);  
       
   526     	iPlugin->iSvgModule->Redraw();  
       
   527     	iXPosAtMouseDown = iPointerX;
       
   528 		iYPosAtMouseDown = iPointerY;	
       
   529     	iPlugin->iSvgModule->MouseMove( iPointerX, iPointerY );
       
   530     	User::After(10);
       
   531         DrawNow();
       
   532     }
       
   533          }
       
   534     #else//_PEN_SUPPORT
       
   535      {
       
   536      if (iPlugin->iRenderBuffer !=NULL)
       
   537         {
       
   538         // Due to the iframe scrolling the pointer will run out 
       
   539         // of the iframe window when tried to pan inside the plugin. 
       
   540         // So the control rect for the pointer is now the cliprect.
       
   541         
       
   542 	//	TRect lControlRect(TSize(iPlugin->iViewPortWidth, iPlugin->iViewPortHeight));
       
   543 		TRect lControlRect;
       
   544     	
       
   545     	lControlRect.iTl.iY = iPlugin->iCurrentWindow.clipRect.top;
       
   546     	lControlRect.iTl.iX = iPlugin->iCurrentWindow.clipRect.left;
       
   547     	lControlRect.iBr.iY = iPlugin->iCurrentWindow.clipRect.bottom;
       
   548     	lControlRect.iBr.iX = iPlugin->iCurrentWindow.clipRect.right;
       
   549 	
       
   550         //X value
       
   551         iPointerX += iPointerDx;
       
   552         if ( iPointerX < 5 )
       
   553             {
       
   554             iPointerX = 5;
       
   555             iPlugin->iSvgModule->Pan( 30, 0 );
       
   556             //iPlugin->iSvgModule->Pan( -30, 0 );
       
   557             iPlugin->iSvgModule->Redraw();
       
   558             }
       
   559       else if ( lControlRect.Width() - 5 < iPointerX )
       
   560             {
       
   561             iPointerX = lControlRect.Width() - 5;
       
   562             iPlugin->iSvgModule->Pan( -30, 0 );
       
   563             //iPlugin->iSvgModule->Pan( 30, 0 );
       
   564             iPlugin->iSvgModule->Redraw();
       
   565             }
       
   566         //Y value
       
   567         iPointerY += iPointerDy;
       
   568         if ( iPointerY < 5 )
       
   569             {
       
   570             iPointerY = 5;
       
   571             iPlugin->iSvgModule->Pan( 0, 30 );
       
   572             //iPlugin->iSvgModule->Pan( 0, -30 );
       
   573             iPlugin->iSvgModule->Redraw();
       
   574             }
       
   575       else if ( lControlRect.Height() - 5 < iPointerY )
       
   576             {
       
   577             iPointerY = lControlRect.Height() - 5;
       
   578             iPlugin->iSvgModule->Pan( 0,-30 );
       
   579             //iPlugin->iSvgModule->Pan( 0,30 );
       
   580             iPlugin->iSvgModule->Redraw();
       
   581             }
       
   582         iPlugin->iSvgModule->MouseMove( iPointerX, iPointerY );
       
   583         DrawNow();
       
   584         }
       
   585      }
       
   586     #endif //_PEN_SUPPORT
       
   587         
       
   588     }
       
   589