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