imageeditor/ImageEditorUI/src/ImageEditorUIView.cpp
changeset 8 18b321db4884
parent 1 edfc90759b9f
equal deleted inserted replaced
1:edfc90759b9f 8:18b321db4884
     1 /*
     1 /*
     2 * Copyright (c) 2010 Ixonos Plc.
     2  * Copyright (c) 2010 Ixonos Plc.
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of the "Eclipse Public License v1.0"
     5  * under the terms of the "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - Initial contribution
    10  * Nokia Corporation - Initial contribution
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 * Ixonos Plc
    13  * Ixonos Plc
    14 *
    14  *
    15 * Description: 
    15  * Description: 
    16 * Image Editor's view class that handles all view related issues.
    16  * Image Editor's view class that handles all view related issues.
    17 *
    17  *
    18 */
    18  */
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
    19 // INCLUDE FILES
    23 #include <eikmenub.h>
    20 #include <eikmenub.h>
    24 #include <eikbtgpc.h>
    21 #include <eikbtgpc.h>
    25 #include <bautils.h>
    22 #include <bautils.h>
    26 
       
    27 #include <avkon.hrh>
    23 #include <avkon.hrh>
    28 #include <aknviewappui.h>
    24 #include <aknviewappui.h>
    29 #include <aknconsts.h>
    25 #include <aknconsts.h>
    30 #include <akntitle.h> 
    26 #include <akntitle.h> 
    31 #include <aknnavi.h>
    27 #include <aknnavi.h>
    34 #include <sendui.h>
    30 #include <sendui.h>
    35 #include <aknpopup.h> 
    31 #include <aknpopup.h> 
    36 #include <CMessageData.h>
    32 #include <CMessageData.h>
    37 #include <AknInfoPopupNoteController.h>
    33 #include <AknInfoPopupNoteController.h>
    38 #include <Avkon.rsg>
    34 #include <Avkon.rsg>
    39 
       
    40 #include <apgcli.h>
    35 #include <apgcli.h>
    41 #include <apadef.h>
    36 #include <apadef.h>
    42 #include <apaid.h>
    37 #include <apaid.h>
    43 #include <StringLoader.h>
    38 #include <StringLoader.h>
    44 #include <pathinfo.h> 
    39 #include <pathinfo.h> 
    45 
       
    46 #include <ImageEditorUI.rsg>
    40 #include <ImageEditorUI.rsg>
    47 #include "ImageEditorUI.hrh"
    41 #include "ImageEditorUI.hrh"
    48 #include "ImageEditorUIPanics.h"
    42 #include "ImageEditorUIPanics.h"
    49 #include "ImageEditorUIView.h"
    43 #include "ImageEditorUIView.h"
    50 #include "ImageEditorUIContainer.h" 
    44 #include "ImageEditorUIContainer.h" 
    51 #include "ImageEditorUtils.h"
    45 #include "ImageEditorUtils.h"
    52 
       
    53 #include "DrawUtils.h" 
    46 #include "DrawUtils.h" 
    54 #include "PluginInfo.h" 
    47 #include "PluginInfo.h" 
    55 #include "ResolutionUtil.h"
    48 #include "ResolutionUtil.h"
    56 
       
    57 #include "ImageEditorControlBase.h" 
    49 #include "ImageEditorControlBase.h" 
    58 #include "SingleParamControl.h" 
    50 #include "SingleParamControl.h" 
    59 #include "imageeditordebugutils.h"
    51 #include "imageeditordebugutils.h"
    60 #include "plugingrid.h"	
    52 #include "plugingrid.h"	
    61 //#include "platform_security_literals.hrh"
    53 #include "text.rsg"
    62 
       
    63 #ifdef AIW_PRINT_PROVIDER_USED
    54 #ifdef AIW_PRINT_PROVIDER_USED
    64 #include <AiwServiceHandler.h>
    55 #include <AiwServiceHandler.h>
    65 #include <AiwMenu.h>
    56 #include <AiwMenu.h>
    66 #include <AiwCommon.hrh>
    57 #include <AiwCommon.hrh>
    67 #endif
    58 #endif
    68 
       
    69 // CONSTANTS
    59 // CONSTANTS
    70 _LIT (KResourceDir, "\\resource\\apps\\");
    60 _LIT (KResourceDir, "\\resource\\apps\\");
    71 _LIT (KResourceFile, "imageeditorui.rsc");
    61 _LIT (KResourceFile, "imageeditorui.rsc");
    72 _LIT (KComponentName, "ImageEditorUI");
    62 _LIT (KComponentName, "ImageEditorUI");
    73 
    63 
    78 #define LANDSCAPE_ARG(x) x
    68 #define LANDSCAPE_ARG(x) x
    79 #else
    69 #else
    80 #define LANDSCAPE_ARG(x)
    70 #define LANDSCAPE_ARG(x)
    81 #endif
    71 #endif
    82 
    72 
    83 
       
    84 //=============================================================================
    73 //=============================================================================
    85 EXPORT_C void CImageEditorUIView::ConstructL()
    74 EXPORT_C void CImageEditorUIView::ConstructL()
    86 {
    75 	{
    87     LOG(KImageEditorLogFile, "CImageEditorUIView::ConstructL()");
    76 	LOG(KImageEditorLogFile, "CImageEditorUIView::ConstructL()");
    88 
    77 
    89     //	Read resource	
    78 	//	Read resource	
    90 	TFileName resourcefile;
    79 	TFileName resourcefile;
    91 	resourcefile.Append(KResourceDir);
    80 	resourcefile.Append(KResourceDir);
    92 	resourcefile.Append(KResourceFile);
    81 	resourcefile.Append(KResourceFile);
    93 
    82 
    94     User::LeaveIfError( CompleteWithAppPath( resourcefile ) );
    83 	User::LeaveIfError(CompleteWithAppPath(resourcefile));
    95     // Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile 
    84 	// Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile 
    96     // to search for a localised resource in proper search order
    85 	// to search for a localised resource in proper search order
    97     iResLoader.OpenL ( resourcefile );
    86 	iResLoader.OpenL(resourcefile);
    98     
    87 
    99     //	Construct base view
    88 	//	Construct base view
   100     BaseConstructL (R_IMAGEEDITORUI_VIEW);
    89 	BaseConstructL(R_IMAGEEDITORUI_VIEW);
   101 
    90 
   102     //  Get reference to status pane 
    91 	//  Get reference to status pane 
   103     CEikStatusPane * sp = AppUi()->StatusPane();
    92 	CEikStatusPane * sp = AppUi()->StatusPane();
   104 
    93 
   105     //  Get reference to navi pane
    94 	//  Get reference to navi pane
   106     iNaviPane = 
    95 	iNaviPane = (CAknNavigationControlContainer *) sp->ControlL(TUid::Uid(
   107         (CAknNavigationControlContainer *) sp->ControlL (TUid::Uid (EEikStatusPaneUidNavi));
    96 			EEikStatusPaneUidNavi));
   108 
    97 
   109     //  Get reference to title pane
    98 	//  Get reference to title pane
   110     iTitlePane = 
    99 	iTitlePane = (CAknTitlePane *) sp->ControlL(TUid::Uid(
   111         (CAknTitlePane *) sp->ControlL (TUid::Uid (EEikStatusPaneUidTitle));
   100 			EEikStatusPaneUidTitle));
   112 
   101 
   113 	// Initialize soft key ID:s (needs to be changed if cba resource in 
   102 	// Initialize soft key ID:s (needs to be changed if cba resource in 
   114 	// R_IMAGEEDITORUI_VIEW changes)
   103 	// R_IMAGEEDITORUI_VIEW changes)
   115 	iSoftkey1 = EAknSoftkeyEmpty;
   104 	iSoftkey1 = EAknSoftkeyEmpty;
   116 	iSoftkey2 = EAknSoftkeyEmpty;
   105 	iSoftkey2 = EAknSoftkeyEmpty;
   117 	iMSK = EAknSoftkeyEmpty;
   106 	iMSK = EAknSoftkeyEmpty;
   118 	
   107 
   119     iInPlugin = EFalse;
   108 	iInPlugin = EFalse;
   120         
   109 
   121     iPopupController = CAknInfoPopupNoteController::NewL();
   110 	iPopupController = CAknInfoPopupNoteController::NewL();
   122     
   111 
   123 	// Read strings needed for zoom popup
   112 	// Read strings needed for zoom popup
   124     HBufC8 * res8 = CEikonEnv::Static()->AllocReadResourceAsDes8LC ( R_ZOOM_TEXTS );
   113 	HBufC8 * res8 =	CEikonEnv::Static()->AllocReadResourceAsDes8LC(R_ZOOM_TEXTS);
   125     TResourceReader resource;
   114 	TResourceReader resource;
   126     //Set resource reader buffer
   115 	//Set resource reader buffer
   127     resource.SetBuffer( res8 );
   116 	resource.SetBuffer(res8);
   128 
   117 
   129     //Read zoom text count
   118 	//Read zoom text count
   130     TInt16 arraycount = ( TInt16 )resource.ReadInt16();
   119 	TInt16 arraycount = (TInt16) resource.ReadInt16();
   131     
   120 
   132     // There have to be as many zoom texts as there are zoom states
   121 	// There have to be as many zoom texts as there are zoom states
   133     __ASSERT_ALWAYS( arraycount == ENumOfZooms, User::Panic(KComponentName, 
   122 	__ASSERT_ALWAYS( arraycount == ENumOfZooms, User::Panic(KComponentName,
   134                                     EImageEditorPanicZoomTextCountDoesntMatch) );
   123 					EImageEditorPanicZoomTextCountDoesntMatch) );
   135     
   124 
   136     if ( arraycount > 0 )
   125 	if (arraycount > 0)
   137         {
   126 		{
   138         //Construct a new descriptor array
   127 		//Construct a new descriptor array
   139         if ( !iZoomTexts )
   128 		if (!iZoomTexts)
   140             {
   129 			{
   141             iZoomTexts = new ( ELeave ) CDesCArraySeg( 16 );
   130 			iZoomTexts = new (ELeave) CDesCArraySeg(16);
   142             }
   131 			}
   143 
   132 
   144         //Read text to array
   133 		//Read text to array
   145         for ( TInt i = 0; i < arraycount; ++i )
   134 		for (TInt i = 0; i < arraycount; ++i)
   146             {
   135 			{
   147             //Construct a flat descriptor array and read all the texts
   136 			//Construct a flat descriptor array and read all the texts
   148             HBufC * parameter = resource.ReadHBufCL();
   137 			HBufC * parameter = resource.ReadHBufCL();
   149             CleanupStack::PushL( parameter );
   138 			CleanupStack::PushL(parameter);
   150             TPtrC ptr = parameter->Des();
   139 			TPtrC ptr = parameter->Des();
   151             iZoomTexts->AppendL ( ptr );
   140 			iZoomTexts->AppendL(ptr);
   152             CleanupStack::PopAndDestroy(); // parameter
   141 			CleanupStack::PopAndDestroy(); // parameter
   153             }
   142 			}
   154         }
   143 		}
   155     CleanupStack::PopAndDestroy (); // res8
   144 	CleanupStack::PopAndDestroy(); // res8
   156 
   145 
   157 
   146 
   158 #ifdef AIW_PRINT_PROVIDER_USED
   147 #ifdef AIW_PRINT_PROVIDER_USED
   159     iServiceHandler = CAiwServiceHandler::NewL();
   148 	iServiceHandler = CAiwServiceHandler::NewL();
   160 	// Attach menu services.
   149 	// Attach menu services.
   161 	iServiceHandler->AttachMenuL(R_IMAGEEDITORUI_MENUPANE, R_IMAGE_EDITOR_INTEREST);
   150 	iServiceHandler->AttachMenuL(R_IMAGEEDITORUI_MENUPANE,
       
   151 			R_IMAGE_EDITOR_INTEREST);
   162 #endif   
   152 #endif   
   163     LOG(KImageEditorLogFile, "CImageEditorUIView: Constructred succesfully");
   153 	LOG(KImageEditorLogFile, "CImageEditorUIView: Constructred succesfully");
   164 }
   154 	}
   165 
   155 
   166 //=============================================================================
   156 //=============================================================================
   167 EXPORT_C CImageEditorUIView::CImageEditorUIView() :
   157 EXPORT_C CImageEditorUIView::CImageEditorUIView() :
   168 CAknView (),
   158 	CAknView(), iResLoader(*iEikonEnv), iBusy(ETrue), iContainerInStack(EFalse)
   169 iResLoader ( *iEikonEnv ), 
   159 	{
   170 iBusy(ETrue),
   160 	}
   171 iContainerInStack(EFalse)
       
   172 {
       
   173 
       
   174 }
       
   175 
   161 
   176 //=============================================================================
   162 //=============================================================================
   177 EXPORT_C CImageEditorUIView::~CImageEditorUIView()
   163 EXPORT_C CImageEditorUIView::~CImageEditorUIView()
   178 {
   164 	{
   179 	LOG(KImageEditorLogFile, "CImageEditorUIView::~CImageEditorUIView()");
   165 	LOG(KImageEditorLogFile, "CImageEditorUIView::~CImageEditorUIView()");
   180 
   166 
   181 	iResLoader.Close();
   167 	iResLoader.Close();
   182 
   168 
   183 #ifdef AIW_PRINT_PROVIDER_USED
   169 #ifdef AIW_PRINT_PROVIDER_USED
   184     delete iServiceHandler;
   170 	delete iServiceHandler;
   185 #endif
   171 #endif
   186 
   172 
   187     if (iNaviPane && iNaviDecorator)
   173 	if (iNaviPane && iNaviDecorator)
   188     {
   174 		{
   189         iNaviPane->Pop (iNaviDecorator);
   175 		iNaviPane->Pop(iNaviDecorator);
   190         delete iNaviDecorator;
   176 		delete iNaviDecorator;
   191         iNaviDecorator = 0;
   177 		iNaviDecorator = 0;
   192     }
   178 		}
   193     iNaviDecorator = 0;
   179 	iNaviDecorator = 0;
   194 	
   180 
   195 	if ( iNaviPane && iPreviousNaviDecorator )
   181 	if (iNaviPane && iPreviousNaviDecorator)
   196     {
   182 		{
   197         iNaviPane->Pop ( iPreviousNaviDecorator );
   183 		iNaviPane->Pop(iPreviousNaviDecorator);
   198         delete iPreviousNaviDecorator;
   184 		delete iPreviousNaviDecorator;
   199         iPreviousNaviDecorator = 0;
   185 		iPreviousNaviDecorator = 0;
   200     }
   186 		}
   201     iPreviousNaviDecorator = 0;
   187 	iPreviousNaviDecorator = 0;
   202     
   188 
   203 	RemoveContainerFromStack();
   189 	RemoveContainerFromStack();
   204     if ( iContainer )
   190 	if (iContainer)
   205 	{
   191 		{
   206         delete iContainer;
   192 		delete iContainer;
   207         iContainer = 0;
   193 		iContainer = 0;
   208     }
   194 		}
   209      
   195 
   210     iArray.Reset();
   196 	iArray.Reset();
   211 
   197 
   212     iNaviPane = NULL;
   198 	iNaviPane = NULL;
   213     iTitlePane = NULL;
   199 	iTitlePane = NULL;
   214     iControl = NULL;
   200 	iControl = NULL;
   215     iPreview = NULL;
   201 	iPreview = NULL;
   216     iSendAppUi = NULL;
   202 	iSendAppUi = NULL;
   217     
   203 
   218     if ( iPopupController )
   204 	if (iPopupController)
   219         {
   205 		{
   220         delete iPopupController;    
   206 		delete iPopupController;
   221         }
   207 		}
   222         
   208 
   223     if ( iZoomTexts )
   209 	if (iZoomTexts)
   224         {
   210 		{
   225         iZoomTexts->Reset();  
   211 		iZoomTexts->Reset();
   226         delete iZoomTexts;
   212 		delete iZoomTexts;
   227         }
   213 		}
   228 	
   214 
   229 	LOG(KImageEditorLogFile, "CImageEditorUIView: View deleted");
   215 	LOG(KImageEditorLogFile, "CImageEditorUIView: View deleted");
   230 }
   216 	}
   231 
   217 
   232 //=============================================================================
   218 //=============================================================================
   233 EXPORT_C TUid CImageEditorUIView::Id() const
   219 EXPORT_C TUid CImageEditorUIView::Id() const
   234 {
   220 	{
   235     return KViewId;
   221 	return KViewId;
   236 }
   222 	}
   237 
   223 
   238 //=============================================================================
   224 //=============================================================================
   239 EXPORT_C void CImageEditorUIView::UpdateLayoutL ( TInt LANDSCAPE_ARG(aScreenMode) ) const
   225 EXPORT_C void CImageEditorUIView::UpdateLayoutL(TInt LANDSCAPE_ARG(aScreenMode)) const
   240     {
   226 	{
   241     CEikStatusPane* sp = StatusPane();
   227 	CEikStatusPane* sp = StatusPane();
   242     __ASSERT_ALWAYS( sp, User::Panic(KComponentName, EImageEditorPanicStatusPaneNotAccessible) );
   228 	__ASSERT_ALWAYS( sp, User::Panic(KComponentName, EImageEditorPanicStatusPaneNotAccessible) );
   243 
   229 
   244 #ifdef LANDSCAPE_SUPPORT
   230 #ifdef LANDSCAPE_SUPPORT
   245 
   231 
   246     TPixelsAndRotation rotation;
   232 	TPixelsAndRotation rotation;
   247     iEikonEnv->ScreenDevice()->GetScreenModeSizeAndRotation(aScreenMode, rotation);
   233 	iEikonEnv->ScreenDevice()->GetScreenModeSizeAndRotation(aScreenMode,rotation);
   248 
   234 
   249 	LOGFMT2(KImageEditorLogFile, "CImageEditorUIView: View mode: ScreenMode: %d, Rotation: %d", aScreenMode, rotation.iRotation);
   235 	LOGFMT2(KImageEditorLogFile, "CImageEditorUIView: View mode: ScreenMode: %d, Rotation: %d", aScreenMode, rotation.iRotation);
   250 
   236 
   251     switch (rotation.iRotation)
   237 	switch (rotation.iRotation)
   252     {
   238 		{
   253     case CFbsBitGc::EGraphicsOrientationRotated270: // view mode
   239 		case CFbsBitGc::EGraphicsOrientationRotated270: // view mode
   254         {
   240 			{
   255 		LOG(KImageEditorLogFile, "CImageEditorUIView: EGraphicsOrientationRotated270");
   241 			LOG(KImageEditorLogFile, "CImageEditorUIView: EGraphicsOrientationRotated270");
   256 
   242 
   257 #ifndef SWAP_SOFTKEY_POSITIONS		
   243 #ifndef SWAP_SOFTKEY_POSITIONS		
   258 		sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT);
   244 			sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT);
   259 #else								
   245 #else								
   260 		sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT);
   246 			sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT);
   261 #endif
   247 #endif
   262         break;
   248 			break;
   263         }
   249 			}
   264 
   250 
   265     case CFbsBitGc::EGraphicsOrientationRotated90: // camcorder mode
   251 		case CFbsBitGc::EGraphicsOrientationRotated90: // camcorder mode
   266         {
   252 			{
   267 		LOG(KImageEditorLogFile, "CImageEditorUIView: EGraphicsOrientationRotated90");
   253 			LOG(KImageEditorLogFile, "CImageEditorUIView: EGraphicsOrientationRotated90");
   268 
   254 
   269 #ifndef SWAP_SOFTKEY_POSITIONS		
   255 #ifndef SWAP_SOFTKEY_POSITIONS		
   270 		sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT);
   256 			sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT);
   271 #else						
   257 #else						
   272 		sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT);
   258 			sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT);
   273 #endif
   259 #endif
   274         break;
   260 			break;
   275         }
   261 			}
   276 
   262 
   277     case CFbsBitGc::EGraphicsOrientationNormal:
   263 		case CFbsBitGc::EGraphicsOrientationNormal:
   278     default:
   264 		default:
   279         {
   265 			{
   280         if( CResolutionUtil::Self()->GetLandscape() )
   266 			if (CResolutionUtil::Self()->GetLandscape())
   281             {
   267 				{
   282             sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL /*R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT*/ );
   268 				sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL /*R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT*/);
   283             }
   269 				}
   284         else
   270 			else
   285             {
   271 				{
   286             sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL );
   272 				sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
   287             }            
   273 				}
   288         break;
   274 			break;
   289         }
   275 			}
   290     }
   276 		}
   291 
   277 
   292 #endif  
   278 #endif  
   293 
   279 
   294     if (iFullScreen)
   280 	if (iFullScreen)
   295         {
   281 		{
   296         //  Hide status pane
   282 		//  Hide status pane
   297         sp->MakeVisible (EFalse);
   283 		sp->MakeVisible(EFalse);
   298         }
   284 		}
   299     else
   285 	else
   300         {
   286 		{
   301         //  Make status pane visible
   287 		//  Make status pane visible
   302         sp->MakeVisible (ETrue);
   288 		sp->MakeVisible(ETrue);
   303 
   289 
   304 #ifdef LANDSCAPE_SUPPORT
   290 #ifdef LANDSCAPE_SUPPORT
   305 
   291 
   306         // And now the CBA...
   292 		// And now the CBA...
   307 	    TRect rect = ClientRect();
   293 		TRect rect = ClientRect();
   308 
   294 
   309         CEikButtonGroupContainer* cba = Cba();
   295 		CEikButtonGroupContainer* cba = Cba();
   310         __ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) );
   296 		__ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) );
   311 
   297 
   312 	    MEikButtonGroup* bgrp = cba->ButtonGroup();
   298 		MEikButtonGroup* bgrp = cba->ButtonGroup();
   313 	    STATIC_CAST( CEikCba*, bgrp)->SetBoundingRect(rect);
   299 		STATIC_CAST( CEikCba*, bgrp)->SetBoundingRect(rect);
   314 	    cba->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
   300 		cba->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
   315 
   301 
   316 #endif
   302 #endif
   317         }
   303 		}
   318 
   304 	}
   319     }
       
   320 
   305 
   321 //=============================================================================
   306 //=============================================================================
   322 EXPORT_C TBool CImageEditorUIView::ViewScreenModeCompatible(TInt /*aScreenMode*/)
   307 EXPORT_C TBool CImageEditorUIView::ViewScreenModeCompatible(TInt /*aScreenMode*/)
   323     {
   308 	{
   324     // Supports any screen size
   309 	// Supports any screen size
   325     return ETrue;
   310 	return ETrue;
   326     }
   311 	}
   327 
   312 
   328 
   313 //=============================================================================
   329 //=============================================================================
   314 EXPORT_C void CImageEditorUIView::HandleCommandL(TInt aCommand)
   330 EXPORT_C void CImageEditorUIView::HandleCommandL (TInt aCommand)
   315 	{
   331 {   
   316 
   332 
   317 	// If focus is gained or lost
   333     // If focus is gained or lost
   318 	if ((aCommand == EImageEditorFocusGained) || (aCommand
   334     if ( (aCommand == EImageEditorFocusGained) || (aCommand == EImageEditorFocusLost) )
   319 			== EImageEditorFocusLost))
   335     {
   320 		{
   336     	if (iContainer && iControl)
   321 		if (iContainer && iControl)
   337     	{
   322 			{
   338           	((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand);
   323 			((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand);
   339 		}
   324 			}
   340     }
   325 		}
   341   	//  If soft key 1 pressed
   326 	//  If soft key 1 pressed
   342    	else if ( iInPlugin &&  (aCommand == iSoftkey1) && (aCommand != EAknSoftkeyOptions) )
   327 	else if (iInPlugin && (aCommand == iSoftkey1) && (aCommand
   343    	{
   328 			!= EAknSoftkeyOptions))
   344     	if ( iContainer && iContainer->Busy() )
   329 		{
   345     	{
   330 		if (iContainer && iContainer->Busy())
       
   331 			{
   346 			return;
   332 			return;
   347 		}
   333 			}
   348         else
   334 		else
   349     	{
   335 			{
   350        	((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand);
   336 			((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand);
   351 		}
   337 			}
   352    	}
   338 		}
   353 
   339 
   354    	//  If soft key 2 pressed
   340 	//  If soft key 2 pressed
   355    	else if ( iInPlugin && (aCommand == iSoftkey2)  )
   341 	else if (iInPlugin && (aCommand == iSoftkey2))
   356    	{
   342 		{
   357     	if ( iContainer && iContainer->Busy() )
   343 		if (iContainer && iContainer->Busy())
   358     	{
   344 			{
   359 			return;
   345 			return;
   360 		}
   346 			}
   361         else
   347 		else
   362     	{
   348 			{
   363             ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand);
   349 			((CImageEditorControlBase *) iControl)->HandlePluginCommandL(
   364 		}
   350 					aCommand);
   365    	}
   351 			}
   366    	
   352 		}
   367    	//  If msk pressed
   353 
   368    	else if ( iInPlugin && (aCommand == iMSK)  )
   354 	//  If msk pressed
   369    	{
   355 	else if (iInPlugin && (aCommand == iMSK))
   370     	if ( iContainer && iContainer->Busy() )
   356 		{
   371     	{
   357 		if (iContainer && iContainer->Busy())
       
   358 			{
   372 			return;
   359 			return;
   373 		}
   360 			}
   374         else
   361 		else
   375     	{
   362 			{
   376             ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand);
   363 			((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand);
   377 		}
   364 			}
   378    	}
   365 		}
   379    	
   366 
   380     //  Menu plug-in item selected
   367 	//  Menu plug-in item selected
   381     else if ( iInPlugin && MenuItemPressedL(aCommand) )
   368 	else if (iInPlugin && MenuItemPressedL(aCommand))
   382     {
   369 		{
   383         ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand);
   370 		((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand);
   384     }
   371 		}
   385 
   372 
   386     else
   373 	else
   387     {
   374 		{
   388         switch (aCommand)
   375 		switch (aCommand)
   389         {
   376 			{
   390             case EImageEditorPreGlobalZoomChange:
   377 			case EImageEditorPreGlobalZoomChange:
   391             case EImageEditorGlobalZoomChanged:
   378 			case EImageEditorGlobalZoomChanged:
   392             case EImageEditorGlobalCropChanged:
   379 			case EImageEditorGlobalCropChanged:
   393             case EImageEditorPreGlobalPanChange:
   380 			case EImageEditorPreGlobalPanChange:
   394             case EImageEditorGlobalPanChanged:
   381 			case EImageEditorGlobalPanChanged:
   395             case EImageEditorGlobalRotationChanged:
   382 			case EImageEditorGlobalRotationChanged:
   396 			case EImageEditorPreScreenModeChange:
   383 			case EImageEditorPreScreenModeChange:
   397 			case EImageEditorPostScreenModeChange:
   384 			case EImageEditorPostScreenModeChange:
   398 			{
   385 				{
   399                 if (iInPlugin)
   386 				if (iInPlugin)
   400                 {
   387 					{
   401 					((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand);
   388 					((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand);
   402 				}
   389 					}
   403 				return;
   390 				return;
   404 			}
   391 				}
   405 
   392 			case EAknSoftkeyBack:
   406             case EAknSoftkeyBack:
   393 				{
   407             {
   394 				if (iContainer && iContainer->Busy())
   408    			if ( iContainer && iContainer->Busy() )
   395 					{
   409     			{
   396 					return;
   410 				return;
   397 					}
   411 				}
   398 				else
   412         	else
   399 					{
   413     			{
   400 					AppUi()->HandleCommandL(EImageEditorSoftkeyCmdBack);
   414                 AppUi()->HandleCommandL (EImageEditorSoftkeyCmdBack);
   401 					break;
   415                 break;
   402 					}
   416 				}				
   403 				}
   417             }
   404 			case EImageEditorUpdateSoftkeys:
   418             case EImageEditorUpdateSoftkeys:
   405 				{
   419             {
   406 				if (iInPlugin)
   420                 if (iInPlugin)
   407 					{
   421                 {
   408 					UpdateSoftkeysL();
   422                     UpdateSoftkeysL();
   409 					}
   423                 }
   410 				break;
   424                 break;
   411 				}
   425             }
   412 			case EImageEditorUpdateNavipane:
   426             case EImageEditorUpdateNavipane:
   413 				{
   427             {
   414 				if (iInPlugin)
   428                 if (iInPlugin)
   415 					{
   429                 {
   416 					UpdateNaviPaneL();
   430                     UpdateNaviPaneL();
   417 					}
   431                 }
   418 				break;
   432                 break;
   419 				}
   433             }
   420 			case EImageEditorTryDisplayMenuBar:
   434             case EImageEditorTryDisplayMenuBar:
   421 				{
   435             {
   422 				CEikMenuBar* menu = MenuBar();
   436                 CEikMenuBar* menu = MenuBar();
   423 				__ASSERT_ALWAYS( menu, User::Panic(KComponentName, EImageEditorPanicMenuNotAccessible) );
   437                 __ASSERT_ALWAYS( menu, User::Panic(KComponentName, EImageEditorPanicMenuNotAccessible) );
   424 				menu->TryDisplayMenuBarL();
   438                 menu->TryDisplayMenuBarL();
   425 				break;
   439                 break;
   426 				}
   440             }
   427 			case EImageEditorDoPrint:
   441             case EImageEditorDoPrint:
   428 				{
   442             {
       
   443 #ifdef AIW_PRINT_PROVIDER_USED
   429 #ifdef AIW_PRINT_PROVIDER_USED
   444 
   430 
   445                 CAiwGenericParamList& in = iServiceHandler->InParamListL();
   431 				CAiwGenericParamList& in = iServiceHandler->InParamListL();
   446 
   432 
   447 		        TFileName filename(iImageFileName);
   433 				TFileName filename(iImageFileName);
   448 		        TAiwVariant variant(filename);
   434 				TAiwVariant variant(filename);
   449 		        TAiwGenericParam param(EGenericParamFile, variant);
   435 				TAiwGenericParam param(EGenericParamFile, variant);
   450             
   436 
   451 		        in.AppendL(param);	
   437 				in.AppendL(param);
   452 
   438 
   453                 iServiceHandler->ExecuteMenuCmdL(
   439 				iServiceHandler->ExecuteMenuCmdL(iSelectedPrintMenuCmd, in,
   454                     iSelectedPrintMenuCmd, 
   440 						iServiceHandler->OutParamListL());
   455                     in, 
       
   456                     iServiceHandler->OutParamListL()
       
   457                     );
       
   458 #endif       
   441 #endif       
   459                 break;
   442 				break;
   460             }
   443 				}
   461             default:
   444 			default:
   462             {
   445 				{
   463                 // Print and save
   446 				// Print and save
   464                 if (aCommand >= EImageEditorMenuAiwPrintBase &&
   447 				if (aCommand >= EImageEditorMenuAiwPrintBase && aCommand
   465                     aCommand <= EImageEditorMenuAiwPrintLast)
   448 						<= EImageEditorMenuAiwPrintLast)
   466                     {
   449 					{
   467                     iSelectedPrintMenuCmd = aCommand;
   450 					iSelectedPrintMenuCmd = aCommand;
   468                     AppUi()->HandleCommandL (EImageEditorSaveAndPrint);
   451 					AppUi()->HandleCommandL(EImageEditorSaveAndPrint);
   469                     }
   452 					}
   470                 else
   453 				else
   471                     {
   454 					{
   472                     AppUi()->HandleCommandL (aCommand);
   455 					AppUi()->HandleCommandL(aCommand);
   473                     }
   456 					}
   474                 break;
   457 				break;
   475             }
   458 				}
   476         }
   459 			}
   477     }
   460 		}
   478 }
   461 	}
   479 
   462 
   480 //=============================================================================
   463 //=============================================================================
   481 EXPORT_C void CImageEditorUIView::HandleClientRectChange()
   464 EXPORT_C void CImageEditorUIView::HandleClientRectChange()
   482 {
   465 	{
   483     LOG(KImageEditorLogFile, "CImageEditorUIView: Client rect changed");
   466 	LOG(KImageEditorLogFile, "CImageEditorUIView: Client rect changed");
   484 
   467 
   485     if (iContainer)
   468 	if (iContainer)
   486     {
   469 		{
   487         iContainer->SetRect ( ClientRect() );
   470 		iContainer->SetRect(ClientRect());
   488     }
   471 		}
   489 }
   472 	}
   490 
   473 
   491 //=============================================================================
   474 //=============================================================================
   492 EXPORT_C void CImageEditorUIView::SetImageL (CFbsBitmap * aBitmap)
   475 EXPORT_C void CImageEditorUIView::SetImageL(CFbsBitmap * aBitmap)
   493 {
   476 	{
   494     iPreview = aBitmap;
   477 	iPreview = aBitmap;
   495     if (iContainer)
   478 	if (iContainer)
   496     {
   479 		{
   497 	    iContainer->SetImageL (aBitmap);
   480 		iContainer->SetImageL(aBitmap);
   498     }
   481 		}
   499 }
   482 	}
   500 
   483 
   501 //=============================================================================
   484 //=============================================================================
   502 EXPORT_C void CImageEditorUIView::SetImageFileName (const TDesC& aFileName)
   485 EXPORT_C void CImageEditorUIView::SetImageFileName(const TDesC& aFileName)
   503 {
   486 	{
   504     iImageFileName.Copy(aFileName);
   487 	iImageFileName.Copy(aFileName);
   505 }
   488 	}
   506 
   489 
   507 
   490 //=============================================================================
   508 
   491 EXPORT_C CCoeControl * CImageEditorUIView::GetContainer() const
   509 //=============================================================================
   492 	{
   510 EXPORT_C CCoeControl * CImageEditorUIView::GetContainer () const
       
   511 {
       
   512 	return iContainer;
   493 	return iContainer;
   513 }
   494 	}
   514 
   495 
   515 //=============================================================================
   496 //=============================================================================
   516 EXPORT_C void CImageEditorUIView::ActivatePluginL (CCoeControl * aControl)
   497 EXPORT_C void CImageEditorUIView::ActivatePluginL(CCoeControl * aControl)
   517 {
   498 	{
   518     LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin");
   499 	LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin");
   519 
   500 
   520     // Activate the plugin based on UI type
   501 	// Activate the plugin based on UI type
   521     switch ( iArray[iIndex]->PluginUiType() ) 
   502 	switch (iArray[iIndex]->PluginUiType())
   522     {
   503 		{
   523     case 1: // EPluginUiTypeNone
   504 		case 1: // EPluginUiTypeNone
   524         {
   505 			{
   525             // For non-UI plug-ins active main view and render
   506 			// For non-UI plug-ins active main view and render
   526             iInPlugin = EFalse;
   507 			iInPlugin = EFalse;
   527             ActivateMainViewL();
   508 			ActivateMainViewL();
   528             HandleCommandL (EImageEditorCmdRender);
   509 			HandleCommandL(EImageEditorCmdRender);
   529             break;
   510 			break;
   530 
   511 
   531 
   512 			}
   532         }
   513 		case 2: // EPluginUiTypeSingleParam
   533     case 2: // EPluginUiTypeSingleParam
   514 		case 3: // EPluginUiTypeMultiParam
   534     case 3: // EPluginUiTypeMultiParam
   515 		case 4: // EPluginUiTypeCustomized
   535     case 4: // EPluginUiTypeCustomized
   516 			{
   536         {
   517 			iInPlugin = ETrue;
   537             iInPlugin = ETrue;
   518 
   538 
   519 			//  Set control
   539             //  Set control
   520 			iControl = aControl;
   540             iControl = aControl;
   521 			if (iContainer)
   541             if (iContainer)
   522 				{
   542             {
   523 				iContainer->SetControl(iControl);
   543                 iContainer->SetControl (iControl);
   524 				}
   544             }
   525 
   545 
   526 			//  Set plug-in item
   546             //  Set plug-in item
   527 			if (iControl)
   547             if (iControl)
   528 				{
   548             {
   529 				LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling SetSelectedUiItemL");
   549                 LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling SetSelectedUiItemL");
   530 
   550 
   531 				((CImageEditorControlBase *) iControl)->SetSelectedUiItemL(	iArray[iIndex]);
   551                 ((CImageEditorControlBase *)iControl)->SetSelectedUiItemL (iArray[iIndex]);
   532 				}
   552             }
   533 
   553 
   534 			//  Prepare the plug-in item
   554             //  Prepare the plug-in item
   535 			if (iControl)
   555             if (iControl)
   536 				{
   556             {
   537 				LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling ");
   557                 LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling PrepareL");
   538 
   558 
   539 				((CImageEditorControlBase *) iControl)->PrepareL();
   559                 ((CImageEditorControlBase *)iControl)->PrepareL ();
   540 				}
   560             }
   541 
   561 
   542 			//  Update soft keys
   562             //  Update soft keys
   543 			UpdateSoftkeysL();
   563             UpdateSoftkeysL();
   544 
   564 
   545 			//  Update navigation pane
   565             //  Update navigation pane
   546 			UpdateNaviPaneL();
   566             UpdateNaviPaneL();
   547 
   567 			
   548 			break;
   568             break;
   549 			}
   569         }
   550 		default:
   570     default:
   551 			{
   571         {
   552 			iInPlugin = ETrue;
   572             iInPlugin = ETrue;
   553 
   573 
   554 			//  Set control
   574             //  Set control
   555 			iControl = aControl;
   575             iControl = aControl;
   556 			if (iContainer)
   576             if (iContainer)
   557 				{
   577             {
   558 				iContainer->SetControl(iControl);
   578                 iContainer->SetControl (iControl);
   559 				}
   579             }
   560 			break;
   580     	    break;
   561 			}
   581         }
   562 		}
   582     }
   563 	}
   583 }
       
   584 
   564 
   585 //=============================================================================
   565 //=============================================================================
   586 EXPORT_C void CImageEditorUIView::ActivateMainViewL()
   566 EXPORT_C void CImageEditorUIView::ActivateMainViewL()
   587 {
   567 	{
   588 
   568 
   589     LOG(KImageEditorLogFile, "CImageEditorUIView: Activating main view");
   569 	LOG(KImageEditorLogFile, "CImageEditorUIView: Activating main view");
   590 
   570 
   591     iInPlugin = EFalse;
   571 	iInPlugin = EFalse;
   592 
   572 
   593     //  Reset buttons
   573 	//  Reset buttons
   594 	iSoftkey1 = EAknSoftkeyOptions;
   574 	iSoftkey1 = EAknSoftkeyOptions;
   595 	iSoftkey2 = EAknSoftkeyBack;
   575 	iSoftkey2 = EAknSoftkeyBack;
   596 	iMSK = EImageEditorMenuCmdApplyEffect;
   576 	iMSK = EImageEditorMenuCmdApplyEffect;
   597 	
   577 
   598     if ( InZoomingState() )
   578 	if (InZoomingState())
   599         {
   579 		{
   600         if ( iZoomMode == ( ENumOfZooms - 1 ) )
   580 		if (iZoomMode == (ENumOfZooms - 1))
   601             {
   581 			{
   602             SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL );
   582 			SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL);
   603             }
   583 			}
   604         else
   584 		else
   605             {
   585 			{
   606             SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN );
   586 			SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN);
   607             }        
   587 			}
   608         }
   588 		}
   609      else
   589 	else
   610         {
   590 		{
   611         SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY );
   591 		SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY);
   612         }
   592 		}
   613 
   593 
   614     //  Reset navi pane
   594 	//  Reset navi pane
   615     ClearNaviPaneTextL();
   595 	ClearNaviPaneTextL();
   616 
   596 
   617     //  Set control in container to NULL
   597 	//  Set control in container to NULL
   618     iControl = 0;
   598 	iControl = 0;
   619     if (iContainer)
   599 	if (iContainer)
   620     {
   600 		{
   621         iContainer->SetControl (iControl);
   601 		iContainer->SetControl(iControl);
   622     }
   602 		}
   623     
   603 
   624 }
   604 	}
   625 
   605 
   626 //=============================================================================
   606 //=============================================================================
   627 EXPORT_C CPluginInfo * CImageEditorUIView::GetSelectedPluginInfoL ()
   607 EXPORT_C CPluginInfo * CImageEditorUIView::GetSelectedPluginInfoL()
   628 {
   608 	{
   629     TInt selectedItem;
   609 	TInt selectedItem;
   630     TInt dialog_ok = CPluginSelectionDialog::RunDlgLD(&iPreview, selectedItem, &iArray, ClientRect());
   610 	TInt dialog_ok = CPluginSelectionDialog::RunDlgLD(&iPreview, selectedItem,
   631 
   611 			&iArray, ClientRect());
   632     if (dialog_ok && selectedItem != KErrCancel)
   612 
   633     {
   613 	if (dialog_ok && selectedItem != KErrCancel)
   634         iIndex = selectedItem;
   614 		{
   635         return iArray[selectedItem];
   615 		iIndex = selectedItem;
   636     }
   616 		return iArray[selectedItem];
   637     else
   617 		}
   638     {
   618 	else
   639      if ( InZoomingState() )
   619 		{
   640         {
   620 		if (InZoomingState())
   641         if ( iZoomMode == ( ENumOfZooms - 1 ) )
   621 			{
   642             {
   622 			if (iZoomMode == (ENumOfZooms - 1))
   643             SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL );
   623 				{
   644             }
   624 				SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL);
   645         else
   625 				}
   646             {
   626 			else
   647             SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN );
   627 				{
   648             }        
   628 				SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN);
   649         }
   629 				}
   650      else
   630 			}
   651         {
   631 		else
   652         SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY );
   632 			{
   653         }           
   633 			SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY);
   654         return NULL;
   634 			}
   655     }
   635 		return NULL;
   656 }
   636 		}
   657 
   637 	}
   658 //=============================================================================
   638 
   659 EXPORT_C void CImageEditorUIView::AddPluginUiItemL (const CPluginInfo * aPluginInfo)
   639 //=============================================================================
   660 {
   640 EXPORT_C void CImageEditorUIView::AddPluginUiItemL(
   661     TLinearOrder<CPluginInfo> order (CPluginInfo::ComparePluginOrder);
   641 		const CPluginInfo * aPluginInfo)
   662     iArray.InsertInOrder (aPluginInfo, order);
   642 	{
   663 }
   643 	TLinearOrder<CPluginInfo> order(CPluginInfo::ComparePluginOrder);
   664 
   644 	iArray.InsertInOrder(aPluginInfo, order);
   665 //=============================================================================
   645 	}
   666 EXPORT_C void CImageEditorUIView::SetCustomButtonsL (TInt aResourceID) const
   646 
   667 {
   647 //=============================================================================
   668     LOG(KImageEditorLogFile, "CImageEditorUIView: Setting buttons");
   648 EXPORT_C void CImageEditorUIView::SetCustomButtonsL(TInt aResourceID) const
   669 
   649 	{
   670     CEikButtonGroupContainer* cba = Cba();
   650 	LOG(KImageEditorLogFile, "CImageEditorUIView: Setting buttons");
   671     __ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) );
   651 
   672 
   652 	CEikButtonGroupContainer* cba = Cba();
   673     cba->SetCommandSetL (aResourceID);
   653 	__ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) );
   674     cba->DrawDeferred();
   654 
   675 }
   655 	cba->SetCommandSetL(aResourceID);
   676 
   656 	cba->DrawDeferred();
   677 //=============================================================================
   657 	}
   678 EXPORT_C TInt CImageEditorUIView::LaunchSaveChangesQueryL () const
   658 
   679 {
   659 //=============================================================================
       
   660 EXPORT_C TInt CImageEditorUIView::LaunchSaveChangesQueryL() const
       
   661 	{
   680 	//	Create dialog prompt
   662 	//	Create dialog prompt
   681     HBufC * prompt = iEikonEnv->AllocReadResourceLC (R_LIST_QUERY_SAVE_CONFIRMATION);
   663 	HBufC * prompt = iEikonEnv->AllocReadResourceLC(
   682     
   664 			R_LIST_QUERY_SAVE_CONFIRMATION);
       
   665 
   683 	//	Execute query dialog
   666 	//	Execute query dialog
   684 	TInt ret = SDrawUtils::LaunchQueryDialogL (*prompt);
   667 	TInt ret = SDrawUtils::LaunchQueryDialogL(*prompt);
   685 
   668 
   686 	CleanupStack::PopAndDestroy(); // prompt
   669 	CleanupStack::PopAndDestroy(); // prompt
   687 
   670 
   688 	return ret;
   671 	return ret;
   689 }
   672 	}
   690 
   673 
   691 //=============================================================================
   674 //=============================================================================
   692 EXPORT_C TInt CImageEditorUIView::LaunchExitWithoutSavingQueryL () const
   675 EXPORT_C TInt CImageEditorUIView::LaunchExitWithoutSavingQueryL() const
   693 {
   676 	{
   694 	//	Create dialog prompt
   677 	//	Create dialog prompt
   695     HBufC * prompt = iEikonEnv->AllocReadResourceLC (R_LIST_QUERY_EXIT_WITHOUT_SAVING_CONFIRMATION);
   678 	HBufC * prompt = iEikonEnv->AllocReadResourceLC(
   696     
   679 			R_LIST_QUERY_EXIT_WITHOUT_SAVING_CONFIRMATION);
       
   680 
   697 	//	Execute query dialog
   681 	//	Execute query dialog
   698 	TInt ret = SDrawUtils::LaunchQueryDialogL (*prompt);
   682 	TInt ret = SDrawUtils::LaunchQueryDialogL(*prompt);
   699 
   683 
   700 	CleanupStack::PopAndDestroy(); // prompt
   684 	CleanupStack::PopAndDestroy(); // prompt
   701 
   685 
   702 	return ret;
   686 	return ret;
   703 }
   687 	}
   704 
   688 
   705 //=============================================================================
   689 //=============================================================================
   706 EXPORT_C TInt CImageEditorUIView::LaunchCancelTextInputQueryL () const
   690 EXPORT_C TInt CImageEditorUIView::LaunchCancelTextInputQueryL() const
   707 {
   691 	{
   708    
   692 
   709 	// Create dialog prompt
   693 	// Create dialog prompt
   710 	// At the moment query is not in use and corresponding string is removed
   694 	// At the moment query is not in use and corresponding string is removed
   711 	// from the loc file. To enable this, a new string has to be defined. 
   695 	// from the loc file. To enable this, a new string has to be defined. 
   712     HBufC * prompt = iEikonEnv->AllocReadResourceLC(R_LIST_QUERY_CANCEL_TEXT_INPUT);
   696 	HBufC * prompt = iEikonEnv->AllocReadResourceLC(
   713     
   697 			R_LIST_QUERY_CANCEL_TEXT_INPUT);
       
   698 
   714 	//	Execute query dialog
   699 	//	Execute query dialog
   715 	TInt ret = SDrawUtils::LaunchQueryDialogOkOnlyL (*prompt);
   700 	TInt ret = SDrawUtils::LaunchQueryDialogOkOnlyL(*prompt);
   716 
   701 
   717 	CleanupStack::PopAndDestroy(); // save_conf, prompt
   702 	CleanupStack::PopAndDestroy(); // save_conf, prompt
   718 
   703 
   719 	return ret;
   704 	return ret;
   720 }
   705 	}
   721 
   706 
   722 //=============================================================================
   707 //=============================================================================
   723 EXPORT_C void CImageEditorUIView::LaunchSendQueryL (
   708 EXPORT_C void CImageEditorUIView::LaunchSendQueryL(
   724     const TSendingCapabilities& aCaps,
   709 		const TSendingCapabilities& aCaps, TFileName& aFileName) const
   725     TFileName& aFileName
   710 	{
   726     ) const
   711 	if (iSendAppUi)
   727 {
   712 		{
   728     if (iSendAppUi)
   713 		CMessageData* msgData = CMessageData::NewLC();
   729     {
   714 		msgData->AppendAttachmentL(aFileName);
   730         CMessageData* msgData = CMessageData::NewLC();        
   715 
   731         msgData->AppendAttachmentL(aFileName);       	
   716 		iSendAppUi->ShowQueryAndSendL(msgData, aCaps);
   732 
       
   733         iSendAppUi->ShowQueryAndSendL (msgData, aCaps);
       
   734 
   717 
   735 		CleanupStack::PopAndDestroy(msgData);
   718 		CleanupStack::PopAndDestroy(msgData);
   736     }
   719 		}
   737 }
   720 	}
   738 
   721 
   739 //=============================================================================
   722 //=============================================================================
   740 EXPORT_C void CImageEditorUIView::LaunchSendQueryL (
   723 EXPORT_C void CImageEditorUIView::LaunchSendQueryL(
   741     const TSendingCapabilities& aCaps,
   724 		const TSendingCapabilities& aCaps, RFile& aFileHandle) const
   742     RFile& aFileHandle
   725 	{
   743     ) const
   726 	if (iSendAppUi)
   744 {
   727 		{
   745     if (iSendAppUi)
   728 		CMessageData* msgData = CMessageData::NewLC();
   746     {
   729 		msgData->AppendAttachmentHandleL(aFileHandle);
   747         CMessageData* msgData = CMessageData::NewLC();        
   730 
   748         msgData->AppendAttachmentHandleL(aFileHandle);       	
   731 		iSendAppUi->ShowQueryAndSendL(msgData, aCaps);
   749 
       
   750         iSendAppUi->ShowQueryAndSendL (msgData, aCaps);
       
   751 
   732 
   752 		CleanupStack::PopAndDestroy(msgData);
   733 		CleanupStack::PopAndDestroy(msgData);
   753     }
   734 		}
   754 }
   735 	}
   755 
       
   756 
   736 
   757 //=============================================================================
   737 //=============================================================================
   758 EXPORT_C void CImageEditorUIView::LaunchSaveWaitDialogL(
   738 EXPORT_C void CImageEditorUIView::LaunchSaveWaitDialogL(
   759     CAknProgressDialog** 			aSelfPtr,
   739 		CAknProgressDialog** aSelfPtr, TInt aFinalValue,
   760 	TInt							aFinalValue,
   740 		MProgressDialogCallback* aCallback) const
   761     MProgressDialogCallback*		aCallback
   741 	{
   762     ) const
       
   763 {
       
   764 	//	Create dialog prompt
   742 	//	Create dialog prompt
   765 	HBufC * prompt;
   743 	HBufC * prompt;
   766 		    
   744 
   767     TApaAppCaption caption;
   745 	TApaAppCaption caption;
   768     TRAPD( err, ResolveCaptionNameL( caption ) );
   746 	TRAPD( err, ResolveCaptionNameL( caption ) );
   769     
   747 
   770     // If something goes wrong, show basic "Saving" note
   748 	// If something goes wrong, show basic "Saving" note
   771     if ( err )
   749 	if (err)
   772         {
   750 		{
   773         prompt = iEikonEnv->AllocReadResourceLC( R_WAIT_NOTE_SAVING );
   751 		prompt = iEikonEnv->AllocReadResourceLC(R_WAIT_NOTE_SAVING);
   774         }
   752 		}
   775     else
   753 	else
   776         {
   754 		{
   777         prompt =  StringLoader::LoadLC( R_WAIT_NOTE_SAVING_TO, caption );
   755 		prompt = StringLoader::LoadLC(R_WAIT_NOTE_SAVING_TO, caption);
   778         }        
   756 		}
   779         
   757 
   780 	//	Launch wait dialog with Cancel softkey
   758 	//	Launch wait dialog with Cancel softkey
   781 	SDrawUtils::LaunchProgressNoteL (
   759 	SDrawUtils::LaunchProgressNoteL(aSelfPtr, R_PROGRESS_DIALOG, *prompt,
   782         aSelfPtr, 
   760 			aFinalValue, aCallback);
   783         R_PROGRESS_DIALOG, 
       
   784         *prompt, 
       
   785         aFinalValue, 
       
   786         aCallback
       
   787         );
       
   788 
   761 
   789 	CleanupStack::PopAndDestroy(); // prompt
   762 	CleanupStack::PopAndDestroy(); // prompt
   790 }
   763 	}
   791 
   764 
   792 //=============================================================================
   765 //=============================================================================
   793 void CImageEditorUIView::ResolveCaptionNameL( TApaAppCaption& aCaption ) const
   766 void CImageEditorUIView::ResolveCaptionNameL(TApaAppCaption& aCaption) const
   794     {   
   767 	{
   795     RApaLsSession appArcSession;
   768 	RApaLsSession appArcSession;
   796     CleanupClosePushL( appArcSession );
   769 	CleanupClosePushL(appArcSession);
   797     User::LeaveIfError( appArcSession.Connect() );       	    
   770 	User::LeaveIfError(appArcSession.Connect());
   798     
   771 
   799     // Get Media Gallery caption
   772 	// Get Media Gallery caption
   800     TApaAppInfo appInfo;
   773 	TApaAppInfo appInfo;
   801     User::LeaveIfError( appArcSession.GetAppInfo( appInfo, TUid::Uid( KMediaGalleryUID3 ) ) );
   774 	User::LeaveIfError(appArcSession.GetAppInfo(appInfo, TUid::Uid(
   802     
   775 			KMediaGalleryUID3)));
   803     aCaption = appInfo.iCaption;
   776 
   804     
   777 	aCaption = appInfo.iCaption;
   805     CleanupStack::PopAndDestroy( &appArcSession );  
   778 
   806     }
   779 	CleanupStack::PopAndDestroy(&appArcSession);
   807     
   780 	}
       
   781 
   808 //=============================================================================
   782 //=============================================================================
   809 EXPORT_C void CImageEditorUIView::LaunchLoadWaitDialogL(
   783 EXPORT_C void CImageEditorUIView::LaunchLoadWaitDialogL(
   810     CAknWaitDialog** 				aSelfPtr,
   784 		CAknWaitDialog** aSelfPtr, MProgressDialogCallback* aCallback) const
   811     MProgressDialogCallback*		aCallback
   785 	{
   812     ) const
       
   813 {
       
   814 	//	Create dialog prompt
   786 	//	Create dialog prompt
   815 	HBufC * prompt = iEikonEnv->AllocReadResourceLC (R_WAIT_NOTE_LOADING);
   787 	HBufC * prompt = iEikonEnv->AllocReadResourceLC(R_WAIT_NOTE_LOADING);
   816 
   788 
   817 	//	Launch wait dialog with empty softkeys
   789 	//	Launch wait dialog with empty softkeys
   818 	SDrawUtils::LaunchWaitNoteL (
   790 	SDrawUtils::LaunchWaitNoteL(aSelfPtr, R_WAIT_DIALOG, *prompt, aCallback);
   819         aSelfPtr, 
       
   820         R_WAIT_DIALOG, 
       
   821         *prompt, 
       
   822         aCallback
       
   823         );
       
   824 
   791 
   825 	CleanupStack::PopAndDestroy(); // prompt
   792 	CleanupStack::PopAndDestroy(); // prompt
   826 }
   793 	}
   827 
   794 
   828 //=============================================================================
   795 //=============================================================================
   829 EXPORT_C void CImageEditorUIView::LaunchWaitDialog() const
   796 EXPORT_C void CImageEditorUIView::LaunchWaitDialog() const
   830 {   
   797 	{
   831     // Show empty set of cba buttons while animation on the screen
   798 	// Show empty set of cba buttons while animation on the screen
   832     SetCustomButtonsL ( R_AVKON_SOFTKEYS_EMPTY );
   799 	SetCustomButtonsL(R_AVKON_SOFTKEYS_EMPTY);
   833 	iContainer->ShowWaitNote();
   800 	iContainer->ShowWaitNote();
   834 }
   801 	}
   835 
   802 
   836 //=============================================================================
   803 //=============================================================================
   837 EXPORT_C void CImageEditorUIView::HideWaitDialog() const
   804 EXPORT_C void CImageEditorUIView::HideWaitDialog() const
   838 {
   805 	{
   839 	iContainer->HideWaitNote();
   806 	iContainer->HideWaitNote();
   840 }
   807 	}
   841 
   808 
   842 //=============================================================================
   809 //=============================================================================
   843 EXPORT_C void CImageEditorUIView::ShowInformationNoteL (const TDesC& aNoteText) const
   810 EXPORT_C void CImageEditorUIView::ShowInformationNoteL(const TDesC& aNoteText) const
   844 {
   811 	{
   845 
   812 
   846     CAknGlobalNote * globalnote = CAknGlobalNote::NewLC();
   813 	CAknGlobalNote * globalnote = CAknGlobalNote::NewLC();
   847     globalnote->ShowNoteL (EAknGlobalInformationNote, aNoteText); 
   814 	globalnote->ShowNoteL(EAknGlobalInformationNote, aNoteText);
   848 
   815 
   849     CleanupStack::PopAndDestroy(); // globalnote
   816 	CleanupStack::PopAndDestroy(); // globalnote
   850 
   817 
   851 }
   818 	}
   852 
   819 
   853 //=============================================================================
   820 //=============================================================================
   854 EXPORT_C void CImageEditorUIView::ShowConfirmationNoteL (const TDesC& aNoteText) const
   821 EXPORT_C void CImageEditorUIView::ShowConfirmationNoteL(const TDesC& aNoteText) const
   855 {
   822 	{
   856 
   823 
   857     CAknGlobalNote * globalnote = CAknGlobalNote::NewLC();
   824 	CAknGlobalNote * globalnote = CAknGlobalNote::NewLC();
   858     globalnote->ShowNoteL (EAknGlobalConfirmationNote, aNoteText); 
   825 	globalnote->ShowNoteL(EAknGlobalConfirmationNote, aNoteText);
   859 
   826 
   860     CleanupStack::PopAndDestroy(); // globalnote
   827 	CleanupStack::PopAndDestroy(); // globalnote
   861 
   828 
   862 }
   829 	}
   863 
   830 
   864 //=============================================================================
   831 //=============================================================================
   865 EXPORT_C void CImageEditorUIView::SetNaviPaneTextL (
   832 EXPORT_C void CImageEditorUIView::SetNaviPaneTextL(const TDesC & aText,
   866     const TDesC & aText,
   833 		TBool aLeftNaviPaneScrollButtonVisibile,
   867 	TBool aLeftNaviPaneScrollButtonVisibile, 
   834 		TBool aRightNaviPaneScrollButtonVisible)
   868 	TBool aRightNaviPaneScrollButtonVisible )
   835 	{
   869     {
   836 	LOG(KImageEditorLogFile, "CImageEditorUIView: Setting navi pane text");
   870     LOG(KImageEditorLogFile, "CImageEditorUIView: Setting navi pane text");
   837 
   871 
   838 	if (iNaviPane)
   872     if (iNaviPane )
   839 		{
   873         {
   840 		//  Create a new decorator
   874         //  Create a new decorator
   841 		CAknNavigationDecorator* newNaviDecorator =
   875         CAknNavigationDecorator* newNaviDecorator = 
   842 				iNaviPane->CreateNavigationLabelL(aText);
   876                                     iNaviPane->CreateNavigationLabelL (aText);
   843 		CleanupStack::PushL(newNaviDecorator);
   877         CleanupStack::PushL (newNaviDecorator);
   844 
   878   
   845 		// Set the navi scroll indicators for the new decorator
   879         // Set the navi scroll indicators for the new decorator
   846 		newNaviDecorator->SetScrollButtonDimmed(
   880         newNaviDecorator->SetScrollButtonDimmed( 
   847 				CAknNavigationDecorator::ELeftButton,
   881                             CAknNavigationDecorator::ELeftButton, 
   848 				!aLeftNaviPaneScrollButtonVisibile);
   882                             !aLeftNaviPaneScrollButtonVisibile );
   849 		newNaviDecorator->SetScrollButtonDimmed(
   883         newNaviDecorator->SetScrollButtonDimmed( 
   850 				CAknNavigationDecorator::ERightButton,
   884                             CAknNavigationDecorator::ERightButton, 
   851 				!aRightNaviPaneScrollButtonVisible);
   885                             !aRightNaviPaneScrollButtonVisible );        
   852 		if (aLeftNaviPaneScrollButtonVisibile
   886         if ( aLeftNaviPaneScrollButtonVisibile || aRightNaviPaneScrollButtonVisible )
   853 				|| aRightNaviPaneScrollButtonVisible)
   887             {
   854 			{
   888             newNaviDecorator->MakeScrollButtonVisible( ETrue );
   855 			newNaviDecorator->MakeScrollButtonVisible(ETrue);
   889             }
   856 			}
   890         
   857 
   891         // Set new decorator on top of Navi Pane's decorator stack 
   858 		// Set new decorator on top of Navi Pane's decorator stack 
   892         // (topmost decorator is the one to show)
   859 		// (topmost decorator is the one to show)
   893         iNaviPane->PushL (*newNaviDecorator);
   860 		iNaviPane->PushL(*newNaviDecorator);
   894 
   861 
   895         // remove old "previous decorator" from decorator stack and delete it
   862 		// remove old "previous decorator" from decorator stack and delete it
   896         if ( iPreviousNaviDecorator )
   863 		if (iPreviousNaviDecorator)
   897             {   
   864 			{
   898             iNaviPane->Pop( iPreviousNaviDecorator );
   865 			iNaviPane->Pop(iPreviousNaviDecorator);
   899             delete iPreviousNaviDecorator;
   866 			delete iPreviousNaviDecorator;
   900             iPreviousNaviDecorator = NULL;               
   867 			iPreviousNaviDecorator = NULL;
   901             }
   868 			}
   902         
   869 
   903         // update decorator pointers to new ones    
   870 		// update decorator pointers to new ones    
   904         iPreviousNaviDecorator = iNaviDecorator;
   871 		iPreviousNaviDecorator = iNaviDecorator;
   905         iNaviDecorator = newNaviDecorator;
   872 		iNaviDecorator = newNaviDecorator;
   906         
   873 
   907         // set observer for the currently shown decorator
   874 		// set observer for the currently shown decorator
   908         (iNaviPane->Top())->SetNaviDecoratorObserver( iContainer );
   875 		(iNaviPane->Top())->SetNaviDecoratorObserver(iContainer);
   909 
   876 
   910         CleanupStack::Pop (newNaviDecorator);  
   877 		CleanupStack::Pop(newNaviDecorator);
   911         }
   878 		}
   912 
   879 
   913     }
   880 	}
   914 
   881 
   915 //=============================================================================
   882 //=============================================================================
   916 EXPORT_C void CImageEditorUIView::ClearNaviPaneTextL()
   883 EXPORT_C void CImageEditorUIView::ClearNaviPaneTextL()
   917 {
   884 	{
   918     LOG(KImageEditorLogFile, "CImageEditorUIView: Clearing navi pane text");
   885 	LOG(KImageEditorLogFile, "CImageEditorUIView: Clearing navi pane text");
   919     if (iNaviPane)
   886 	if (iNaviPane)
   920     {
   887 		{
   921         if (iNaviDecorator)
   888 		if (iNaviDecorator)
   922         {
   889 			{
   923             iNaviPane->Pop (iNaviDecorator);
   890 			iNaviPane->Pop(iNaviDecorator);
   924             delete iNaviDecorator;
   891 			delete iNaviDecorator;
   925             iNaviDecorator = 0;
   892 			iNaviDecorator = 0;
   926         }
   893 			}
   927         
   894 
   928         if (iPreviousNaviDecorator)
   895 		if (iPreviousNaviDecorator)
   929         {
   896 			{
   930             iNaviPane->Pop (iPreviousNaviDecorator);
   897 			iNaviPane->Pop(iPreviousNaviDecorator);
   931             delete iPreviousNaviDecorator;
   898 			delete iPreviousNaviDecorator;
   932             iPreviousNaviDecorator = 0;
   899 			iPreviousNaviDecorator = 0;
   933         }
   900 			}
   934 	    HBufC * title = iEikonEnv->AllocReadResourceLC (R_MAIN_VIEW_TITLE);
   901 		HBufC * title = iEikonEnv->AllocReadResourceLC(R_MAIN_VIEW_TITLE);
   935         iNaviDecorator = iNaviPane->CreateNavigationLabelL ( title->Des() );
   902 		iNaviDecorator = iNaviPane->CreateNavigationLabelL(title->Des());
   936         iPreviousNaviDecorator = iNaviPane->CreateNavigationLabelL ( title->Des() );
   903 		iPreviousNaviDecorator
   937                 
   904 				= iNaviPane->CreateNavigationLabelL(title->Des());
   938         iNaviPane->PushL (*iPreviousNaviDecorator); 
   905 
   939         iNaviPane->PushL (*iNaviDecorator);
   906 		iNaviPane->PushL(*iPreviousNaviDecorator);
   940         iNaviPane->DrawDeferred();
   907 		iNaviPane->PushL(*iNaviDecorator);
   941         iNaviDecorator->DrawDeferred();
   908 		iNaviPane->DrawDeferred();
   942         CleanupStack::PopAndDestroy(); // title
   909 		iNaviDecorator->DrawDeferred();
   943     }
   910 		CleanupStack::PopAndDestroy(); // title
   944 }
   911 		}
   945 
   912 	}
   946 //=============================================================================
   913 
   947 EXPORT_C void CImageEditorUIView::SetTitlePaneTextL (const TDesC & aText)
   914 //=============================================================================
   948 {
   915 EXPORT_C void CImageEditorUIView::SetTitlePaneTextL(const TDesC & aText)
   949     iTitlePane->SetTextL (aText);
   916 	{
   950 }
   917 	iTitlePane->SetTextL(aText);
       
   918 	}
   951 
   919 
   952 //=============================================================================
   920 //=============================================================================
   953 EXPORT_C void CImageEditorUIView::ClearTitlePaneTextL()
   921 EXPORT_C void CImageEditorUIView::ClearTitlePaneTextL()
   954 {
   922 	{
   955     iTitlePane->SetTextL ( KNullDesC );
   923 	iTitlePane->SetTextL(KNullDesC);
   956 }
   924 	}
   957 
   925 
   958 //=============================================================================
   926 //=============================================================================
   959 EXPORT_C void CImageEditorUIView::SetSoftKey1L (
   927 EXPORT_C void CImageEditorUIView::SetSoftKey1L(const TDesC & aText,
   960 	const TDesC &	aText,
   928 		const TInt aCommand)
   961 	const TInt		aCommand
   929 	{
   962 	)
   930 	CEikButtonGroupContainer * cba = Cba();
   963 {
   931 	// TInt replace_position = cba->PositionById (iSoftkey1);
   964     CEikButtonGroupContainer * cba = Cba();
   932 	TInt replace_position(CEikButtonGroupContainer::ELeftSoftkeyPosition);
   965    // TInt replace_position = cba->PositionById (iSoftkey1);
   933 	cba->SetCommandL(replace_position, aCommand, aText);
   966     TInt replace_position( CEikButtonGroupContainer::ELeftSoftkeyPosition );
   934 	cba->DrawDeferred();
   967     cba->SetCommandL (replace_position, aCommand, aText);
   935 	iSoftkey1 = aCommand;
   968     cba->DrawDeferred();
   936 	}
   969     iSoftkey1 = aCommand;
   937 
   970 }
   938 //=============================================================================
   971 
   939 EXPORT_C void CImageEditorUIView::SetSoftKey2L(const TDesC & aText,
   972 //=============================================================================
   940 		const TInt aCommand)
   973 EXPORT_C void CImageEditorUIView::SetSoftKey2L (
   941 	{
   974 	const TDesC &	aText,
   942 	CEikButtonGroupContainer * cba = Cba();
   975 	const TInt		aCommand
   943 	//TInt replace_position = cba->PositionById (iSoftkey2); 
   976 	)
   944 	TInt replace_position(CEikButtonGroupContainer::ERightSoftkeyPosition);
   977 {
   945 	cba->SetCommandL(replace_position, aCommand, aText);
   978     CEikButtonGroupContainer * cba = Cba();
   946 	cba->DrawDeferred();
   979     //TInt replace_position = cba->PositionById (iSoftkey2); 
   947 	iSoftkey2 = aCommand;
   980     TInt replace_position( CEikButtonGroupContainer::ERightSoftkeyPosition );
   948 	}
   981     cba->SetCommandL (replace_position, aCommand, aText);
   949 
   982     cba->DrawDeferred();
   950 //=============================================================================
   983     iSoftkey2 = aCommand;
   951 EXPORT_C void CImageEditorUIView::SetMiddleSoftKeyL(const TDesC & aText,
   984 }
   952 		const TInt aCommand)
   985 
   953 	{
   986 //=============================================================================
   954 	CEikButtonGroupContainer * cba = Cba();
   987 EXPORT_C void CImageEditorUIView::SetMiddleSoftKeyL (
   955 
   988 	const TDesC &	aText,
   956 	if (aCommand == EAknSoftkeyContextOptions)
   989 	const TInt		aCommand
   957 		{
   990 	)
   958 		TInt
   991 {
   959 				contextMenuId =
   992     CEikButtonGroupContainer * cba = Cba();
   960 						((CImageEditorControlBase *) iControl)->GetContextMenuResourceId();
   993     
   961 		if (contextMenuId)
   994     if ( aCommand == EAknSoftkeyContextOptions )
   962 			{
   995         {
   963 		//if in doodle don't show select dialog.
   996         TInt contextMenuId = 
   964 			if (contextMenuId != R_TEXT_CONTEXT_MENUBAR)
   997             ((CImageEditorControlBase *)iControl)->GetContextMenuResourceId();  
   965 				{
   998         if ( contextMenuId )
   966 				MenuBar()->SetContextMenuTitleResourceId(contextMenuId);
   999             {
   967 				}
  1000             MenuBar()->SetContextMenuTitleResourceId( contextMenuId );
   968 			}
  1001             }
   969 		}
  1002         }
   970 
  1003         
   971 	TInt replace_position(CEikButtonGroupContainer::EMiddleSoftkeyPosition);
  1004     TInt replace_position( CEikButtonGroupContainer::EMiddleSoftkeyPosition );
   972 	cba->SetCommandL(replace_position, aCommand, aText);
  1005     cba->SetCommandL ( replace_position, aCommand, aText );
   973 	cba->DrawDeferred();
  1006     cba->DrawDeferred();
   974 	iMSK = aCommand;
  1007     iMSK = aCommand;
   975 	}
  1008 }
       
  1009 
   976 
  1010 //=============================================================================
   977 //=============================================================================
  1011 EXPORT_C void CImageEditorUIView::SetBusy()
   978 EXPORT_C void CImageEditorUIView::SetBusy()
  1012 {
   979 	{
  1013     
   980 
  1014 	if (iContainer)
   981 	if (iContainer)
  1015 	{
   982 		{
  1016 		iContainer->SetBusy();
   983 		iContainer->SetBusy();
  1017 	}
   984 		}
  1018 	
   985 
  1019 	iBusy = ETrue;
   986 	iBusy = ETrue;
  1020 	RemoveContainerFromStack();	
   987 	RemoveContainerFromStack();
  1021 
   988 
  1022 }
   989 	}
  1023 
   990 
  1024 //=============================================================================
   991 //=============================================================================
  1025 EXPORT_C void CImageEditorUIView::ResetBusy()
   992 EXPORT_C void CImageEditorUIView::ResetBusy()
  1026 {
   993 	{
  1027 
   994 
  1028 	AddContainerToStack();
   995 	AddContainerToStack();
  1029 	iBusy = EFalse;
   996 	iBusy = EFalse;
  1030     
   997 
  1031     if (iContainer)
   998 	if (iContainer)
  1032 	{
   999 		{
  1033 		iContainer->ResetBusy();
  1000 		iContainer->ResetBusy();
  1034 	}
  1001 		}
  1035 }
  1002 	}
  1036 
  1003 
  1037 //=============================================================================
  1004 //=============================================================================
  1038 EXPORT_C void CImageEditorUIView::SetUndoFlag (const TBool aUndo)
  1005 EXPORT_C void CImageEditorUIView::SetUndoFlag(const TBool aUndo)
  1039 {
  1006 	{
  1040     iCanUndo = aUndo;
  1007 	iCanUndo = aUndo;
  1041 }
  1008 	}
  1042 
  1009 
  1043 //=============================================================================
  1010 //=============================================================================
  1044 EXPORT_C void CImageEditorUIView::SetSaveFlag (const TBool aSave)
  1011 EXPORT_C void CImageEditorUIView::SetSaveFlag(const TBool aSave)
  1045 {
  1012 	{
  1046     iCanSave = aSave;
  1013 	iCanSave = aSave;
  1047 }
  1014 	}
  1048 
  1015 
  1049 //=============================================================================
  1016 //=============================================================================
  1050 EXPORT_C void CImageEditorUIView::SetFullScreen()
  1017 EXPORT_C void CImageEditorUIView::SetFullScreen()
  1051 {
  1018 	{
  1052     if (iContainer)
  1019 	if (iContainer)
  1053     {
  1020 		{
  1054         iContainer->SetFullScreen();
  1021 		iContainer->SetFullScreen();
  1055     }
  1022 		}
  1056     iFullScreen = ETrue;
  1023 	iFullScreen = ETrue;
  1057 }
  1024 	}
  1058 
  1025 
  1059 //=============================================================================
  1026 //=============================================================================
  1060 EXPORT_C void CImageEditorUIView::ResetFullScreen()
  1027 EXPORT_C void CImageEditorUIView::ResetFullScreen()
  1061 {
  1028 	{
  1062     if (iContainer)
  1029 	if (iContainer)
  1063     {
  1030 		{
  1064         iContainer->ResetFullScreen();
  1031 		iContainer->ResetFullScreen();
  1065     }
  1032 		}
  1066     iFullScreen = EFalse;
  1033 	iFullScreen = EFalse;
  1067 }
  1034 	}
  1068 
  1035 
  1069 //=============================================================================
  1036 //=============================================================================
  1070 EXPORT_C void CImageEditorUIView::SetZoomModeL ( const TZoomMode& aMode )
  1037 EXPORT_C void CImageEditorUIView::SetZoomModeL(const TZoomMode& aMode)
  1071 {
  1038 	{
  1072 	iZoomMode = aMode;
  1039 	iZoomMode = aMode;
  1073 	
  1040 
  1074 	HandleZoomModeChangeL();
  1041 	HandleZoomModeChangeL();
  1075 	
  1042 	}
  1076 }
       
  1077 
  1043 
  1078 //=============================================================================
  1044 //=============================================================================
  1079 void CImageEditorUIView::HandleZoomModeChangeL()
  1045 void CImageEditorUIView::HandleZoomModeChangeL()
  1080     {
  1046 	{
  1081     
  1047 
  1082     if ( !iInPlugin && iZoomMode != EZoomNormal )
  1048 	if (!iInPlugin && iZoomMode != EZoomNormal)
  1083 	    {
  1049 		{
  1084 	    if ( iZoomMode != ( ENumOfZooms - 1 ) )
  1050 		if (iZoomMode != (ENumOfZooms - 1))
  1085 	        {
  1051 			{
  1086 	        SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN );
  1052 			SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN);
  1087 	        }
  1053 			}
  1088 	    else
  1054 		else
  1089 	        {
  1055 			{
  1090 	        SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL );
  1056 			SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL);
  1091 	        }	    
  1057 			}
  1092 	    }
  1058 		}
  1093 	else if ( !iInPlugin && iZoomMode == EZoomNormal )
  1059 	else if (!iInPlugin && iZoomMode == EZoomNormal)
  1094 	    {
  1060 		{
  1095 
  1061 
  1096 	    SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY );
  1062 		SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY);
  1097 	    }
  1063 		}
  1098 	
  1064 
  1099 	// hide previous tooltip
  1065 	// hide previous tooltip
  1100 	iPopupController->HideInfoPopupNote();
  1066 	iPopupController->HideInfoPopupNote();
  1101     
  1067 
  1102     // show tooltip (also if in plugin)
  1068 	// show tooltip (also if in plugin)
  1103     if ( iZoomMode != EZoomNormal )
  1069 	if (iZoomMode != EZoomNormal)
  1104         {
  1070 		{
  1105                 
  1071 
  1106         SDrawUtils::ShowToolTip ( iPopupController,
  1072 		SDrawUtils::ShowToolTip(iPopupController, (CCoeControl*) iContainer,
  1107                                   ( CCoeControl* )iContainer, 
  1073 				TPoint(iContainer->Rect().iTl.iX, iContainer->Rect().iTl.iY),
  1108                                   TPoint( iContainer->Rect().iTl.iX,
  1074 				EHRightVTop, iZoomTexts->MdcaPoint(iZoomMode));
  1109                                           iContainer->Rect().iTl.iY ),
  1075 		}
  1110                                   EHRightVTop,
  1076 
  1111                                   iZoomTexts->MdcaPoint( iZoomMode ) ); 
  1077 	}
  1112         }
  1078 
  1113     
  1079 //=============================================================================
  1114     }
  1080 EXPORT_C void CImageEditorUIView::DynInitMenuPaneL(TInt aResourceId,
  1115 
  1081 		CEikMenuPane * aMenuPane)
  1116 //=============================================================================
  1082 	{
  1117 EXPORT_C void CImageEditorUIView::DynInitMenuPaneL (
  1083 	// This is called by the framework, aMenuPane should never be null pointer...
  1118 	TInt			aResourceId,
  1084 	__ASSERT_ALWAYS( aMenuPane, User::Panic(KComponentName, EImageEditorPanicMenuNotAccessible) );
  1119 	CEikMenuPane *	aMenuPane
       
  1120 	)
       
  1121     {
       
  1122     // This is called by the framework, aMenuPane should never be null pointer...
       
  1123     __ASSERT_ALWAYS( aMenuPane, User::Panic(KComponentName, EImageEditorPanicMenuNotAccessible) );
       
  1124 
  1085 
  1125 #ifdef AIW_PRINT_PROVIDER_USED
  1086 #ifdef AIW_PRINT_PROVIDER_USED
  1126     if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) )
  1087 	if (iServiceHandler->HandleSubmenuL(*aMenuPane))
  1127         {
  1088 		{
  1128         // Return if AIW submenu 
  1089 		// Return if AIW submenu 
  1129         return;    
  1090 		return;
  1130         }
  1091 		}
  1131 #endif    
  1092 #endif    
  1132         
  1093 
  1133 	if ( aResourceId != R_IMAGEEDITORUI_MENUPANE )
  1094 	if (aResourceId != R_IMAGEEDITORUI_MENUPANE)
  1134 	    {
  1095 		{
  1135         return;
  1096 		return;
  1136         }    
  1097 		}
  1137 
  1098 
  1138     // In busy mode
  1099 	// In busy mode
  1139     if ( iBusy )  
  1100 	if (iBusy)
  1140         {
  1101 		{
  1141         DimAllL ( aResourceId, *aMenuPane );
  1102 		DimAllL(aResourceId, *aMenuPane);
  1142         }
  1103 		}
  1143     // In idle mode
  1104 	// In idle mode
  1144     else
  1105 	else
  1145         {
  1106 		{
  1146         //  In plug-in mode
  1107 		//  In plug-in mode
  1147         if ( iInPlugin )
  1108 		if (iInPlugin)
  1148             {
  1109 			{
  1149             DimAllL ( aResourceId, *aMenuPane );
  1110 			DimAllL(aResourceId, *aMenuPane);
  1150             InsertPluginItemsL ( *aMenuPane );
  1111 			InsertPluginItemsL(*aMenuPane);
  1151             
  1112 
  1152 #ifdef FULLSCREEN_AVAILABLE            
  1113 #ifdef FULLSCREEN_AVAILABLE            
  1153             // After plugin specific items, add menu commands that are common
  1114 			// After plugin specific items, add menu commands that are common
  1154             // for all plugins' options menus
  1115 			// for all plugins' options menus
  1155             // In normal screen mode
  1116 			// In normal screen mode
  1156             if ( !iFullScreen )
  1117 			if ( !iFullScreen )
  1157                 {
  1118 				{
  1158                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, EFalse );
  1119 				aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, EFalse );
  1159                 }
  1120 				}
  1160 
  1121 
  1161             // In full screen mode
  1122 			// In full screen mode
  1162             else
  1123 
  1163                 {
  1124 			else
  1164                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, EFalse );
  1125 				{
  1165                 }
  1126 				aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, EFalse );
       
  1127 				}
  1166 #endif // FULLSCREEN_AVAILABLE        
  1128 #endif // FULLSCREEN_AVAILABLE        
  1167    
  1129 			aMenuPane->SetItemDimmed(EImageEditorMenuCmdHelp, EFalse);
  1168             aMenuPane->SetItemDimmed ( EImageEditorMenuCmdHelp, EFalse );
  1130 			aMenuPane->SetItemDimmed(EImageEditorMenuCmdExit, EFalse);
  1169             aMenuPane->SetItemDimmed ( EImageEditorMenuCmdExit, EFalse );    
  1131 			}
  1170             }
  1132 		else if (InZoomingState())
  1171         else if ( InZoomingState() )
  1133 			{
  1172             {
  1134 			aMenuPane->SetItemDimmed(EImageEditorMenuCmdUndo, ETrue);
  1173             aMenuPane->SetItemDimmed( EImageEditorMenuCmdUndo, ETrue );
       
  1174 #ifdef FULLSCREEN_AVAILABLE
  1135 #ifdef FULLSCREEN_AVAILABLE
  1175             aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, ETrue );
  1136 			aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, ETrue );
  1176             aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, ETrue );
  1137 			aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, ETrue );
  1177 #endif // FULLSCREEN_AVAILABLE  
  1138 #endif // FULLSCREEN_AVAILABLE  
  1178             
  1139 			if (!iCanSave || IsMemoryInCriticalLevel())
  1179             if ( !iCanSave || IsMemoryInCriticalLevel() )
  1140 				{
  1180                 {
  1141 				aMenuPane->SetItemDimmed(EImageEditorMenuCmdSave, ETrue);
  1181                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdSave, ETrue );
  1142 				}
  1182                 }      
  1143 
  1183             
  1144 			TInt position;
  1184             TInt position;
  1145 			if (aMenuPane->MenuItemExists(EImageEditorMenuCmdSend, position))
  1185             if ( aMenuPane->MenuItemExists( EImageEditorMenuCmdSend, 
  1146 				{
  1186                                             position ) )
  1147 				aMenuPane->SetItemDimmed(EImageEditorMenuCmdSend, ETrue);
  1187                 {
  1148 				}
  1188                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdSend, ETrue );
  1149 			if (aMenuPane->MenuItemExists(EImageEditorAiwCriteriaPrint,position))
  1189                 }                           
  1150 				{
  1190             if ( aMenuPane->MenuItemExists( EImageEditorAiwCriteriaPrint, 
  1151 				aMenuPane->SetItemDimmed(EImageEditorAiwCriteriaPrint, ETrue);
  1191                                             position ) )
  1152 				}
  1192                 {
  1153 
  1193                 aMenuPane->SetItemDimmed( EImageEditorAiwCriteriaPrint, ETrue );
  1154 			if (iZoomMode == EZoomIn3)
  1194                 }    
  1155 				{
  1195             
  1156 				aMenuPane->SetItemDimmed(EImageEditorMenuCmdZoomIn, ETrue);
  1196             if ( iZoomMode == EZoomIn3 )
  1157 				}
  1197                 {
  1158 			// Set "Apply Effect" item to be after "Zoom Out" in zooming 
  1198                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdZoomIn, ETrue );
  1159 			// state's options menu
  1199                 }
  1160 			if (aMenuPane->MenuItemExists(EImageEditorMenuCmdApplyEffect,position))
  1200             // Set "Apply Effect" item to be after "Zoom Out" in zooming 
  1161 				{
  1201             // state's options menu
  1162 				CEikMenuPaneItem::SData data = aMenuPane->ItemData(
  1202             if ( aMenuPane->MenuItemExists( EImageEditorMenuCmdApplyEffect, 
  1163 						EImageEditorMenuCmdApplyEffect);
  1203                                             position ) )
  1164 				aMenuPane->DeleteMenuItem(EImageEditorMenuCmdApplyEffect);
  1204                 {
  1165 				aMenuPane->AddMenuItemL(data, EImageEditorMenuCmdZoomOut);
  1205                 CEikMenuPaneItem::SData data = 
  1166 				}
  1206                         aMenuPane->ItemData( EImageEditorMenuCmdApplyEffect );
  1167 			}
  1207                 aMenuPane->DeleteMenuItem( EImageEditorMenuCmdApplyEffect );
  1168 		//  In main view mode
  1208                 aMenuPane->AddMenuItemL( data, EImageEditorMenuCmdZoomOut );
  1169 		else
  1209                 }
  1170 			{
  1210             }
       
  1211         //  In main view mode
       
  1212         else
       
  1213             {
       
  1214 
  1171 
  1215 #ifdef AIW_PRINT_PROVIDER_USED
  1172 #ifdef AIW_PRINT_PROVIDER_USED
  1216     
  1173 
  1217 #else
  1174 #else
  1218             aMenuPane->SetItemDimmed( EImageEditorAiwCriteriaPrint, ETrue );
  1175 			aMenuPane->SetItemDimmed( EImageEditorAiwCriteriaPrint, ETrue );
  1219 #endif   
  1176 #endif   
  1220 
  1177 
  1221             //  Display CSendUi menu item
  1178 			//  Display CSendUi menu item
  1222             if ( iSendAppUi )
  1179 			if (iSendAppUi)
  1223                 {
  1180 				{
  1224          		iSendAppUi->AddSendMenuItemL( 
  1181 				iSendAppUi->AddSendMenuItemL(*aMenuPane,
  1225          			*aMenuPane,
  1182 						SIE_SENDUI_MENU_ITEM_INDEX, EImageEditorMenuCmdSend,
  1226          			SIE_SENDUI_MENU_ITEM_INDEX,
  1183 						TSendingCapabilities(0, 0,
  1227          			EImageEditorMenuCmdSend,
  1184 								TSendingCapabilities::ESupportsAttachments));
  1228          			TSendingCapabilities (0, 0, TSendingCapabilities::ESupportsAttachments) );
  1185 				}
  1229                 }
  1186 
  1230 
  1187 			//  Nothing to undo
  1231             //  Nothing to undo
  1188 			if (!iCanUndo)
  1232             if ( !iCanUndo )
  1189 				{
  1233                 {
  1190 				aMenuPane->SetItemDimmed(EImageEditorMenuCmdUndo, ETrue);
  1234                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdUndo, ETrue );
  1191 				}
  1235                 }
       
  1236 #ifdef FULLSCREEN_AVAILABLE
  1192 #ifdef FULLSCREEN_AVAILABLE
  1237             // In full screen mode
  1193 			// In full screen mode
  1238             if ( iFullScreen )
  1194 			if ( iFullScreen )
  1239                 {
  1195 				{
  1240                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, ETrue );
  1196 				aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, ETrue );
  1241                 }
  1197 				}
  1242 
  1198 
  1243             // In normal screen mode
  1199 			// In normal screen mode
  1244             else
  1200 
  1245                 {
  1201 			else
  1246                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, ETrue );
  1202 				{
  1247                 }
  1203 				aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, ETrue );
       
  1204 				}
  1248 #endif // FULLSCREEN_AVAILABLE
  1205 #endif // FULLSCREEN_AVAILABLE
  1249             if ( !iCanSave || IsMemoryInCriticalLevel() )
  1206 			if (!iCanSave || IsMemoryInCriticalLevel())
  1250                 {
  1207 				{
  1251                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdSave, ETrue );
  1208 				aMenuPane->SetItemDimmed(EImageEditorMenuCmdSave, ETrue);
  1252                 }
  1209 				}
  1253                 
  1210 
  1254             if ( iZoomMode == EZoomNormal )
  1211 			if (iZoomMode == EZoomNormal)
  1255                 {
  1212 				{
  1256                 aMenuPane->SetItemDimmed( EImageEditorMenuCmdZoomOut, ETrue );
  1213 				aMenuPane->SetItemDimmed(EImageEditorMenuCmdZoomOut, ETrue);
  1257 		        aMenuPane->SetItemDimmed( EImageEditorMenuCmdFitToScreen, ETrue );
  1214 				aMenuPane->SetItemDimmed(EImageEditorMenuCmdFitToScreen, ETrue);
  1258                 }
  1215 				}
  1259 			    
  1216 
  1260 #ifdef AIW_PRINT_PROVIDER_USED
  1217 #ifdef AIW_PRINT_PROVIDER_USED
  1261             if ( iServiceHandler->IsAiwMenu( aResourceId ) )
  1218 			if (iServiceHandler->IsAiwMenu(aResourceId))
  1262     		    {
  1219 				{
  1263                 CAiwGenericParamList& in = iServiceHandler->InParamListL();
  1220 				CAiwGenericParamList& in = iServiceHandler->InParamListL();
  1264     	
  1221 
  1265     		    TFileName filename( iImageFileName );
  1222 				TFileName filename(iImageFileName);
  1266     		    TAiwVariant variant( filename );
  1223 				TAiwVariant variant(filename);
  1267     		    TAiwGenericParam param( EGenericParamFile, variant );
  1224 				TAiwGenericParam param(EGenericParamFile, variant);
  1268                 
  1225 
  1269     		    in.AppendL( param );	
  1226 				in.AppendL(param);
  1270 
  1227 
  1271     		    iServiceHandler->InitializeMenuPaneL( *aMenuPane, 
  1228 				iServiceHandler->InitializeMenuPaneL(*aMenuPane, aResourceId,
  1272     		                                          aResourceId, 
  1229 						EImageEditorMenuAiwPrintBase, in);
  1273     		                                          EImageEditorMenuAiwPrintBase, 
  1230 				}
  1274     		                                          in);
       
  1275     		    }  
       
  1276 #endif
  1231 #endif
  1277 
  1232 
  1278             }
  1233 			}
  1279         }
  1234 		}
  1280     }
  1235 	}
  1281 
  1236 
  1282 //=============================================================================
  1237 //=============================================================================
  1283 EXPORT_C void CImageEditorUIView::SetSendAppUi(CSendUi* aSendAppUi)
  1238 EXPORT_C void CImageEditorUIView::SetSendAppUi(CSendUi* aSendAppUi)
  1284     {
  1239 	{
  1285     iSendAppUi = aSendAppUi;
  1240 	iSendAppUi = aSendAppUi;
  1286     }
  1241 	}
  1287 
       
  1288 
  1242 
  1289 //=============================================================================
  1243 //=============================================================================
  1290 EXPORT_C void CImageEditorUIView::HandleStatusPaneSizeChange()
  1244 EXPORT_C void CImageEditorUIView::HandleStatusPaneSizeChange()
  1291 {
  1245 	{
  1292 
  1246 
  1293 }
  1247 	}
  1294 
  1248 
  1295 //=============================================================================
  1249 //=============================================================================
  1296 void CImageEditorUIView::DimAllL (
  1250 void CImageEditorUIView::DimAllL(TInt /*aResourceId*/, CEikMenuPane & aMenuPane) const
  1297 	TInt			/*aResourceId*/,
  1251 	{
  1298 	CEikMenuPane &	aMenuPane
       
  1299 	) const
       
  1300 {
       
  1301 	LOG(KImageEditorLogFile, "CImageEditorUIView::DimAllL");
  1252 	LOG(KImageEditorLogFile, "CImageEditorUIView::DimAllL");
  1302 
  1253 
  1303     aMenuPane.SetItemDimmed (EImageEditorMenuCmdApplyEffect, ETrue);
  1254 	aMenuPane.SetItemDimmed(EImageEditorMenuCmdApplyEffect, ETrue);
  1304     aMenuPane.SetItemDimmed (EImageEditorMenuCmdExit, ETrue);
  1255 	aMenuPane.SetItemDimmed(EImageEditorMenuCmdExit, ETrue);
  1305     aMenuPane.SetItemDimmed (EImageEditorMenuCmdUndo, ETrue);
  1256 	aMenuPane.SetItemDimmed(EImageEditorMenuCmdUndo, ETrue);
  1306 #ifdef FULLSCREEN_AVAILABLE    
  1257 #ifdef FULLSCREEN_AVAILABLE    
  1307     aMenuPane.SetItemDimmed (EImageEditorMenuCmdFullScreen, ETrue);
  1258 	aMenuPane.SetItemDimmed (EImageEditorMenuCmdFullScreen, ETrue);
  1308     aMenuPane.SetItemDimmed (EImageEditorMenuCmdNormalScreen, ETrue);
  1259 	aMenuPane.SetItemDimmed (EImageEditorMenuCmdNormalScreen, ETrue);
  1309 #endif // FULLSCREEN_AVAILABLE    
  1260 #endif // FULLSCREEN_AVAILABLE    
  1310     aMenuPane.SetItemDimmed (EImageEditorMenuCmdZoomIn, ETrue);
  1261 	aMenuPane.SetItemDimmed(EImageEditorMenuCmdZoomIn, ETrue);
  1311     aMenuPane.SetItemDimmed (EImageEditorMenuCmdZoomOut, ETrue);
  1262 	aMenuPane.SetItemDimmed(EImageEditorMenuCmdZoomOut, ETrue);
  1312     aMenuPane.SetItemDimmed (EImageEditorMenuCmdSave, ETrue);
  1263 	aMenuPane.SetItemDimmed(EImageEditorMenuCmdSave, ETrue);
  1313     aMenuPane.SetItemDimmed (EImageEditorAiwCriteriaPrint, ETrue);
  1264 	aMenuPane.SetItemDimmed(EImageEditorAiwCriteriaPrint, ETrue);
  1314     aMenuPane.SetItemDimmed (EImageEditorMenuCmdHelp, ETrue);
  1265 	aMenuPane.SetItemDimmed(EImageEditorMenuCmdHelp, ETrue);
  1315     aMenuPane.SetItemDimmed (EImageEditorMenuCmdFitToScreen, ETrue);    
  1266 	aMenuPane.SetItemDimmed(EImageEditorMenuCmdFitToScreen, ETrue);
  1316 }
  1267 	}
  1317 
  1268 
  1318 //=============================================================================
  1269 //=============================================================================
  1319 void CImageEditorUIView::UpdateSoftkeysL ()
  1270 void CImageEditorUIView::UpdateSoftkeysL()
  1320 {
  1271 	{
  1321     __ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) );
  1272 	__ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) );
  1322 
  1273 
  1323     //  Get plug-in info
  1274 	//  Get plug-in info
  1324     CPluginInfo * pgn_info = iArray[iIndex];
  1275 	CPluginInfo * pgn_info = iArray[iIndex];
  1325 
  1276 
  1326     //  Get soft key pair index 
  1277 	//  Get soft key pair index 
  1327     TInt sk_index = ((CImageEditorControlBase *)iControl)->GetSoftkeyIndexL();
  1278 	TInt sk_index = ((CImageEditorControlBase *) iControl)->GetSoftkeyIndexL();
  1328 
  1279 
  1329     //  Set soft key 1
  1280 	//  Set soft key 1
  1330     SetSoftKey1L ( 
  1281 	SetSoftKey1L(pgn_info->Sk1Texts()[sk_index], pgn_info->Sk1Cmds()[sk_index]);
  1331         pgn_info->Sk1Texts()[sk_index], 
  1282 
  1332         pgn_info->Sk1Cmds()[sk_index] 
  1283 	//  Set soft key 2
  1333         );
  1284 	SetSoftKey2L(pgn_info->Sk2Texts()[sk_index], pgn_info->Sk2Cmds()[sk_index]);
  1334 
  1285 
  1335     //  Set soft key 2
  1286 	//  Set middle soft key
  1336     SetSoftKey2L ( 
  1287 	SetMiddleSoftKeyL(pgn_info->MSKTexts()[sk_index],
  1337         pgn_info->Sk2Texts()[sk_index], 
  1288 			pgn_info->MSKCmds()[sk_index]);
  1338         pgn_info->Sk2Cmds()[sk_index] 
  1289 	}
  1339         );
       
  1340         
       
  1341     //  Set middle soft key
       
  1342     SetMiddleSoftKeyL ( 
       
  1343         pgn_info->MSKTexts()[sk_index], 
       
  1344         pgn_info->MSKCmds()[sk_index] 
       
  1345         );    
       
  1346 }
       
  1347 
  1290 
  1348 //=============================================================================
  1291 //=============================================================================
  1349 void CImageEditorUIView::UpdateNaviPaneL()
  1292 void CImageEditorUIView::UpdateNaviPaneL()
  1350 {
  1293 	{
  1351     __ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) );
  1294 	__ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) );
  1352 
  1295 
  1353     TBool leftNaviPaneScrollButtonVisibile;
  1296 	TBool leftNaviPaneScrollButtonVisibile;
  1354     TBool rightNaviPaneScrollButtonVisible;
  1297 	TBool rightNaviPaneScrollButtonVisible;
  1355     TPtrC naviText =  ((CImageEditorControlBase *)iControl)->GetNaviPaneTextL(
  1298 	TPtrC naviText = ((CImageEditorControlBase *) iControl)->GetNaviPaneTextL(
  1356         leftNaviPaneScrollButtonVisibile,
  1299 			leftNaviPaneScrollButtonVisibile, rightNaviPaneScrollButtonVisible);
  1357         rightNaviPaneScrollButtonVisible );
  1300 
  1358 
  1301 	SetNaviPaneTextL(naviText, leftNaviPaneScrollButtonVisibile,
  1359     SetNaviPaneTextL ( 
  1302 			rightNaviPaneScrollButtonVisible);
  1360         naviText,
  1303 	}
  1361         leftNaviPaneScrollButtonVisibile,
  1304 
  1362         rightNaviPaneScrollButtonVisible );
  1305 //=============================================================================
  1363 }
  1306 void CImageEditorUIView::InsertPluginItemsL(CEikMenuPane & aMenuPane)
  1364 
  1307 	{
  1365 //=============================================================================
  1308 	__ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) );
  1366 void CImageEditorUIView::InsertPluginItemsL (CEikMenuPane &	aMenuPane)
  1309 
  1367 {
  1310 	// Insert the plug-in commands
  1368     __ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) );
  1311 	CMenuItemArray & menu_items = iArray[iIndex]->MenuItems();
  1369 
  1312 	TBitField dimmed =
  1370     // Insert the plug-in commands
  1313 			((CImageEditorControlBase *) iControl)->GetDimmedMenuItems();
  1371     CMenuItemArray & menu_items = iArray[iIndex]->MenuItems();
  1314 	for (TInt i = 0; i < menu_items.Count(); ++i)
  1372     TBitField dimmed = ((CImageEditorControlBase *)iControl)->GetDimmedMenuItems();
  1315 		{
  1373     for (TInt i = 0; i < menu_items.Count(); ++i)
  1316 		// Check the visibility for each menu item.
  1374     {
  1317 		if (!dimmed.GetBit(i))
  1375         // Check the visibility for each menu item.
  1318 			{
  1376         if ( ! dimmed.GetBit(i) )
  1319 			aMenuPane.InsertMenuItemL(menu_items[i], i);
  1377         {
  1320 			}
  1378             aMenuPane.InsertMenuItemL ( menu_items[i], i );
  1321 		}
  1379         }
  1322 	}
  1380     }
  1323 
  1381 }
  1324 //=============================================================================
  1382 
  1325 TBool CImageEditorUIView::MenuItemPressedL(TInt aCommand)
  1383 //=============================================================================
  1326 	{
  1384 TBool CImageEditorUIView::MenuItemPressedL (TInt aCommand)
  1327 	CMenuItemArray & menu_items = iArray[iIndex]->MenuItems();
  1385 { 
  1328 	for (TInt i = 0; i < menu_items.Count(); ++i)
  1386     CMenuItemArray & menu_items = iArray[iIndex]->MenuItems();
  1329 		{
  1387     for (TInt i = 0; i < menu_items.Count(); ++i)
  1330 		if (menu_items[i].iCommandId == aCommand)
  1388     {
  1331 			{
  1389         if ( menu_items[i].iCommandId == aCommand )
  1332 			return ETrue;
  1390         {
  1333 			}
  1391             return ETrue;
  1334 		}
  1392         }
  1335 	return EFalse;
  1393     }
  1336 	}
  1394     return EFalse;
  1337 
  1395 }
  1338 //=============================================================================
  1396 
  1339 EXPORT_C void CImageEditorUIView::DoActivateL(
  1397 //=============================================================================
  1340 		const TVwsViewId & /*aPrevViewId*/, TUid /*aCustomMessageId*/,
  1398 EXPORT_C void CImageEditorUIView::DoActivateL (
  1341 		const TDesC8 & /*aCustomMessage*/
  1399    const TVwsViewId &		/*aPrevViewId*/,
  1342 )
  1400    TUid						/*aCustomMessageId*/,
  1343 	{
  1401    const TDesC8 &			/*aCustomMessage*/
  1344 	LOG(KImageEditorLogFile, "CImageEditorUIView: Activating view");
  1402    )
  1345 	//  Construct container
  1403 {
  1346 	iContainer = new (ELeave) CImageEditorUIContainer;
  1404     LOG(KImageEditorLogFile, "CImageEditorUIView: Activating view");
  1347 	iContainer->SetMopParent(this);
  1405     //  Construct container
  1348 	iContainer->ConstructL(ClientRect());
  1406     iContainer = new (ELeave) CImageEditorUIContainer;
  1349 	iContainer->SetView(this);
  1407     iContainer->SetMopParent (this);
  1350 	HandleCommandL(EImageEditorCmdViewReady);
  1408     iContainer->ConstructL ( ClientRect() );
  1351 
  1409 	iContainer->SetView (this);
  1352 	}
  1410     HandleCommandL (EImageEditorCmdViewReady);
       
  1411   
       
  1412 }
       
  1413 
       
  1414 
  1353 
  1415 //=============================================================================
  1354 //=============================================================================
  1416 EXPORT_C void CImageEditorUIView::DoDeactivate()
  1355 EXPORT_C void CImageEditorUIView::DoDeactivate()
  1417 {
  1356 	{
  1418     LOG(KImageEditorLogFile, "CImageEditorUIView: Deactivating view");
  1357 	LOG(KImageEditorLogFile, "CImageEditorUIView: Deactivating view");
  1419     
  1358 
  1420     RemoveContainerFromStack();
  1359 	RemoveContainerFromStack();
  1421     
  1360 
  1422     if ( iContainer )
  1361 	if (iContainer)
  1423 	{
  1362 		{
  1424 		delete iContainer;
  1363 		delete iContainer;
  1425 		iContainer = 0;
  1364 		iContainer = 0;
  1426     }
  1365 		}
  1427 }
  1366 	}
  1428 
  1367 
  1429 //=============================================================================
  1368 //=============================================================================
  1430 void CImageEditorUIView::AddContainerToStack()
  1369 void CImageEditorUIView::AddContainerToStack()
  1431 {
  1370 	{
  1432 	if (!iContainerInStack && iContainer)
  1371 	if (!iContainerInStack && iContainer)
  1433 	{
  1372 		{
  1434 		TRAPD(err, AppUi()->AddToViewStackL (*this, iContainer); );
  1373 		TRAPD(err, AppUi()->AddToViewStackL (*this, iContainer); );
  1435 		if (err == KErrNone)
  1374 		if (err == KErrNone)
  1436 		{
  1375 			{
  1437 			iContainerInStack = ETrue;		
  1376 			iContainerInStack = ETrue;
  1438 		}
  1377 			}
  1439 	}	
  1378 		}
  1440 }
  1379 	}
  1441 
       
  1442 
       
  1443 
  1380 
  1444 //=============================================================================
  1381 //=============================================================================
  1445 void CImageEditorUIView::RemoveContainerFromStack()
  1382 void CImageEditorUIView::RemoveContainerFromStack()
  1446 {
  1383 	{
  1447 	if (iContainerInStack)
  1384 	if (iContainerInStack)
  1448 	{
  1385 		{
  1449 		AppUi()->RemoveFromViewStack (*this, iContainer);	
  1386 		AppUi()->RemoveFromViewStack(*this, iContainer);
  1450 		iContainerInStack = EFalse;	
  1387 		iContainerInStack = EFalse;
  1451 	}	
  1388 		}
  1452 }
  1389 	}
  1453 
  1390 
  1454 //=============================================================================
  1391 //=============================================================================
  1455 EXPORT_C TBool CImageEditorUIView::InZoomingState()
  1392 EXPORT_C TBool CImageEditorUIView::InZoomingState()
  1456     {
  1393 	{
  1457     if ( iZoomMode == EZoomIn1 || 
  1394 	if (iZoomMode == EZoomIn1 || iZoomMode == EZoomIn2 || iZoomMode == EZoomIn3)
  1458          iZoomMode == EZoomIn2 ||
  1395 		{
  1459          iZoomMode == EZoomIn3 )
  1396 		return ETrue;
  1460         {
  1397 		}
  1461         return ETrue;
  1398 	else
  1462         }
  1399 		{
  1463     else
  1400 		return EFalse;
  1464         {
  1401 		}
  1465         return EFalse;
  1402 	}
  1466         }
  1403 
  1467     }
  1404 //=============================================================================
  1468 
  1405 EXPORT_C TInt CImageEditorUIView::LaunchSaveImageQueryL() const
  1469 //=============================================================================
  1406 	{
  1470 EXPORT_C TInt CImageEditorUIView::LaunchSaveImageQueryL () const
       
  1471 {
       
  1472 
       
  1473 	//	Create dialog heading and options
  1407 	//	Create dialog heading and options
  1474     HBufC * heading = CEikonEnv::Static()->AllocReadResourceLC (R_SIE_LIST_QUERY_HEADING_SAVE);
  1408 	HBufC * heading = CEikonEnv::Static()->AllocReadResourceLC(
  1475     HBufC * option1 = CEikonEnv::Static()->AllocReadResourceLC (R_SIE_LIST_QUERY_SAVE_NEW); 
  1409 			R_SIE_LIST_QUERY_HEADING_SAVE);
  1476     HBufC * option2 = CEikonEnv::Static()->AllocReadResourceLC (R_SIE_LIST_QUERY_SAVE_REPLACE);       
  1410 	HBufC * option1 = CEikonEnv::Static()->AllocReadResourceLC(
  1477                 
  1411 			R_SIE_LIST_QUERY_SAVE_NEW);
       
  1412 	HBufC * option2 = CEikonEnv::Static()->AllocReadResourceLC(
       
  1413 			R_SIE_LIST_QUERY_SAVE_REPLACE);
       
  1414 
  1478 	//	Query dialog texts
  1415 	//	Query dialog texts
  1479 	CDesCArray * options = new (ELeave) CDesCArraySeg (2);
  1416 	CDesCArray * options = new (ELeave) CDesCArraySeg(2);
  1480 	CleanupStack::PushL (options);
  1417 	CleanupStack::PushL(options);
  1481 	options->AppendL( option1->Des() );
  1418 	options->AppendL(option1->Des());
  1482 	options->AppendL( option2->Des() );
  1419 	options->AppendL(option2->Des());
  1483 
  1420 
  1484 	//	Execute query dialog
  1421 	//	Execute query dialog
  1485 	TInt ret = SDrawUtils::LaunchListQueryDialogL (options, *heading);
  1422 	TInt ret = SDrawUtils::LaunchListQueryDialogL(options, *heading);
  1486 
  1423 
  1487 	options->Reset();
  1424 	options->Reset();
  1488 	
  1425 
  1489 	CleanupStack::PopAndDestroy(4); //options, option2, option1, heading
  1426 	CleanupStack::PopAndDestroy(4); //options, option2, option1, heading
  1490 	
  1427 
  1491 	return ret;
  1428 	return ret;
  1492 }
  1429 	}
  1493 
  1430 
  1494 //=============================================================================
  1431 //=============================================================================
  1495 EXPORT_C void CImageEditorUIView::GetTouchPanDirections( TInt& xMovement, 
  1432 EXPORT_C void CImageEditorUIView::GetTouchPanDirections(TInt& xMovement,
  1496                                                          TInt& yMovement )
  1433 		TInt& yMovement)
  1497     {
  1434 	{
  1498 
  1435 
  1499     xMovement = 0;
  1436 	xMovement = 0;
  1500     yMovement = 0;
  1437 	yMovement = 0;
  1501     iContainer->GetDragDirections( xMovement, yMovement );
  1438 	iContainer->GetDragDirections(xMovement, yMovement);
  1502     }
  1439 	}
  1503     
  1440 
  1504 EXPORT_C TBool CImageEditorUIView::IsMemoryInCriticalLevel()
  1441 EXPORT_C TBool CImageEditorUIView::IsMemoryInCriticalLevel()
  1505 	{
  1442 	{
  1506 	TEntry entry;
  1443 	TEntry entry;
  1507 	RFs & fs = iEikonEnv->FsSession(); 
  1444 	RFs & fs = iEikonEnv->FsSession();
  1508 	fs.Entry( iImageFileName, entry );
  1445 	fs.Entry(iImageFileName, entry);
  1509 	TFileName driveAndPath;
  1446 	TFileName driveAndPath;
  1510 	driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() );
  1447 	driveAndPath.Copy(PathInfo::PhoneMemoryRootPath());
  1511 	driveAndPath.Append( PathInfo::ImagesPath() );
  1448 	driveAndPath.Append(PathInfo::ImagesPath());
  1512 	return !ImageEditorUtils::ImageFitsToDriveL( fs, iImageFileName, driveAndPath);
  1449 	return !ImageEditorUtils::ImageFitsToDriveL(fs, iImageFileName,
       
  1450 			driveAndPath);
  1513 	}
  1451 	}
  1514 
  1452 
  1515 // End of File
  1453 // End of File
  1516 
  1454