author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:32:09 +0300 | |
branch | RCL_3 |
changeset 75 | 01504893d9cb |
parent 60 | 5b3385a43d68 |
permissions | -rw-r--r-- |
60 | 1 |
/* |
2 |
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Implementation of CGlxZoomControl |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
||
21 |
#include "glxzoomcontrol.h" |
|
22 |
||
23 |
// INCLUDES |
|
24 |
#include <data_caging_path_literals.hrh> |
|
25 |
#include <eikbtgpc.h> //For CEikButtonGroupContainer |
|
26 |
#include <ExifRead.h> |
|
27 |
||
28 |
//Alf Headers |
|
29 |
#include <alf/alfviewportlayout.h> // For CAlfViewPortLayout |
|
30 |
#include <alf/alfimagevisual.h> // For CAlfImageVisual |
|
31 |
#include <alf/alfcontrolgroup.h> // For CAlfControlGroup |
|
32 |
#include <alf/alfdisplay.h> // For CAlfDisplay |
|
33 |
#include <alf/alfroster.h> // For CAlfRoster |
|
34 |
#include <alf/alfutil.h> // For AlfUtil |
|
35 |
// Antariksh |
|
36 |
#include <mul/imulsliderwidget.h> // For Slider Widget |
|
37 |
#include <mul/mulevent.h> // For Slider events |
|
38 |
||
39 |
#include <gesturehelper.h> |
|
40 |
#include <e32math.h> |
|
41 |
||
42 |
using namespace GestureHelper; |
|
43 |
||
44 |
//Gallery Headers |
|
45 |
#include <glxuiutility.h> |
|
46 |
#include <glxattributecontext.h> |
|
47 |
#include <glxtracer.h> // For Tracer |
|
48 |
#include <glxlog.h> // For Log |
|
49 |
#include <glxtexturemanager.h> // For Creating Texture |
|
50 |
#include <glxuistd.h> // For Fetch Context Priority |
|
51 |
#include <mglxmedialist.h> // For MGlxMediaList |
|
52 |
#include <mglxuicommandhandler.h> // For MGlxUiCommandHandler |
|
53 |
||
54 |
#include "glxtv.h" // for CGlxTv |
|
55 |
// LOCAL CONSTANTS AND MACROS |
|
56 |
const TReal KGlxOpacityOpaque = 1.0; |
|
57 |
const TInt KGlxMaxExifSize = 0x10000; |
|
58 |
const TReal KGlxOpacityTransparent = 0.0; |
|
59 |
//zoom delay for animation while hdmi cable, |
|
60 |
//is connected and zoom is initiated |
|
61 |
const TInt KHDMIZoomDelay = 250000; |
|
62 |
//Zoom level for the animation , assuming the innitial level is 1. |
|
63 |
const TReal KGlxZoomLevel = 1.5; |
|
64 |
||
65 |
const TInt KGlxDecodingThreshold = 3000000; // pixels |
|
66 |
||
67 |
||
68 |
// ============================ MEMBER FUNCTIONS =============================== |
|
69 |
||
70 |
// ----------------------------------------------------------------------------- |
|
71 |
// CGlxZoomControl::CGlxZoomControl |
|
72 |
// C++ default constructor can NOT contain any code, that might leave. |
|
73 |
// ----------------------------------------------------------------------------- |
|
74 |
// |
|
75 |
CGlxZoomControl::CGlxZoomControl(MGlxUiCommandHandler& aCommandHandler, |
|
76 |
MGlxMediaList& aMediaList,CEikButtonGroupContainer& aZoomBackKeys, |
|
77 |
IMulSliderWidget& aSliderWidget, GestureHelper::CGestureHelper* aGestureHelper) : |
|
78 |
iMediaList(aMediaList), iGestureHelper(aGestureHelper), |
|
79 |
iZoomSliderWidget(aSliderWidget), iZoomBackKey(&aZoomBackKeys), |
|
80 |
iCommandHandler(aCommandHandler) |
|
81 |
{ |
|
82 |
TRACER("CGlxZoomControl::CGlxZoomControl"); |
|
83 |
} |
|
84 |
||
85 |
// ----------------------------------------------------------------------------- |
|
86 |
// CGlxZoomControl::ConstructL |
|
87 |
// Symbian 2nd phase constructor can leave. |
|
88 |
// ----------------------------------------------------------------------------- |
|
89 |
// |
|
90 |
void CGlxZoomControl::ConstructL() |
|
91 |
{ |
|
92 |
TRACER("CGlxZoomControl::ConstructL()"); |
|
93 |
iAttributeContext = CGlxDefaultAttributeContext::NewL(); |
|
94 |
iAttributeContext->AddAttributeL(KGlxMediaGeneralDimensions); |
|
95 |
iMediaList.AddContextL( iAttributeContext, KGlxFetchContextPriorityLow ); |
|
96 |
iUiUtility = CGlxUiUtility::UtilityL(); |
|
97 |
iEnv = iUiUtility->Env(); |
|
98 |
iDisplay = iUiUtility->Display(); |
|
99 |
iTextureMgr = &iUiUtility->GlxTextureManager(); |
|
100 |
iScreenSize = ScreenSize(); |
|
101 |
||
102 |
iDisplay->SetVisibleArea(TRect(TPoint(0,0),iScreenSize)); |
|
103 |
CAlfControl::ConstructL(*iEnv); |
|
104 |
||
105 |
//Func creating black background and visual that has to zoomed |
|
106 |
CreateZoomVisualL(); |
|
107 |
||
108 |
iControlGroup = &iEnv->NewControlGroupL(0x119); |
|
109 |
iControlGroup->AppendL(this); |
|
110 |
||
111 |
iDisplay->Roster().ShowL( *iControlGroup); |
|
112 |
||
113 |
// Hide the Zoom at the construction |
|
114 |
ShowZoom(EFalse); |
|
115 |
iZoomActive = EFalse; |
|
116 |
||
117 |
//To know if HDMi cable is connected. |
|
118 |
iGlxTvOut = CGlxTv::NewL(*this); |
|
119 |
iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
120 |
iGPUMemMonitor = CGlxRelaseGPUMemory::NewL(*this); |
|
121 |
} |
|
122 |
||
123 |
// ----------------------------------------------------------------------------- |
|
124 |
// ScreenSize : gets the screensize, Note that , this is not stored in member variable as |
|
125 |
// Screen rect can change based on orientation |
|
126 |
// ----------------------------------------------------------------------------- |
|
127 |
// |
|
128 |
TSize CGlxZoomControl::ScreenSize() |
|
129 |
{ |
|
130 |
TRACER("CGlxZoomControl::ScreenSize()"); |
|
131 |
return AlfUtil::ScreenSize(); |
|
132 |
} |
|
133 |
||
134 |
// ----------------------------------------------------------------------------- |
|
135 |
// ShowZoom |
|
136 |
// ----------------------------------------------------------------------------- |
|
137 |
// |
|
138 |
void CGlxZoomControl::ShowZoom(TBool aShow) |
|
139 |
{ |
|
140 |
TRACER("CGlxZoomControl::ShowZoom()"); |
|
141 |
if (aShow) |
|
142 |
{ |
|
143 |
iViewPort->SetOpacity(KGlxOpacityOpaque); |
|
144 |
iGestureHelper->AddObserver(this); |
|
145 |
} |
|
146 |
else |
|
147 |
{ |
|
148 |
iViewPort->SetOpacity(KGlxOpacityTransparent); |
|
149 |
} |
|
150 |
} |
|
151 |
||
152 |
// ----------------------------------------------------------------------------- |
|
153 |
// CreateZoomVisual |
|
154 |
// ----------------------------------------------------------------------------- |
|
155 |
// |
|
156 |
void CGlxZoomControl::CreateZoomVisualL() |
|
157 |
{ |
|
158 |
TRACER("CGlxZoomControl::CreateZoomVisualL()"); |
|
159 |
||
160 |
CAlfTexture *blackoutTexture = &(iTextureMgr->CreateFlatColourTextureL(KRgbBlack)); |
|
161 |
CleanupStack::PushL(blackoutTexture); |
|
162 |
||
163 |
iViewPort = CAlfViewportLayout::AddNewL(*this); |
|
164 |
//Create the Image visual ,which holds the texture,which is complete black in color |
|
165 |
CAlfImageVisual *blackoutImageVisual = CAlfImageVisual::AddNewL(*this,iViewPort); |
|
166 |
CleanupStack::PushL(blackoutImageVisual); |
|
167 |
||
168 |
// Visual is larger than the screen to deal with control transformations that |
|
169 |
// may show areas usually outside the normal screen coordinates |
|
170 |
TInt16 blackImageSize =(iScreenSize.iWidth > iScreenSize.iHeight) ?iScreenSize.iWidth:iScreenSize.iHeight; |
|
171 |
blackoutImageVisual->SetImage(TAlfImage(*blackoutTexture)); |
|
172 |
blackoutImageVisual->SetFlag(EAlfVisualFlagManualLayout); |
|
173 |
blackoutImageVisual->SetSize(TAlfRealSize(blackImageSize, blackImageSize)); |
|
174 |
blackoutImageVisual->SetPos(TAlfRealPoint(0, 0)); |
|
175 |
CleanupStack::Pop(blackoutImageVisual); |
|
176 |
CleanupStack::Pop(blackoutTexture); |
|
177 |
||
178 |
// VisualLayoutUpdated |
|
179 |
// Enable scrolling of the Viewport. |
|
180 |
// The content area of a layout can be thought to be larger than the real visible size. |
|
181 |
// Scrolling changes which portion of the layout’s content is actually visible at the moment. |
|
182 |
iViewPort->SetFlag(EAlfVisualFlagLayoutUpdateNotification); |
|
183 |
iViewPort->SetVirtualSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); |
|
184 |
iViewPort->SetViewportSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); |
|
185 |
iViewPort->SetViewportPos(TAlfRealPoint(0,0), 0); |
|
186 |
iViewPort->SetClipping(EFalse); |
|
187 |
iViewPort->SetOrigin( EAlfVisualHOriginLeft, EAlfVisualVOriginTop ); |
|
188 |
||
189 |
//Enable scrolling of the Viewport. |
|
190 |
//The content area of a layout can be thought to be larger than the real visible size. |
|
191 |
//Scrolling changes which portion of the layout’s content is actually visible at the moment. |
|
192 |
iViewPort->EnableScrollingL(); |
|
193 |
iViewPort->EnableTransformationL(); |
|
194 |
||
195 |
iImageVisual = CAlfImageVisual::AddNewL(*this,iViewPort); |
|
196 |
iImageVisual->SetScaleMode(CAlfImageVisual::EScaleFitInside); |
|
197 |
||
198 |
iEventHandler = CGlxZoomPanEventHandler::NewL(*this); |
|
199 |
} |
|
200 |
||
201 |
// ----------------------------------------------------------------------------- |
|
202 |
// CGlxZoomControl::NewL |
|
203 |
// Two-phased constructor. |
|
204 |
// ----------------------------------------------------------------------------- |
|
205 |
// |
|
206 |
EXPORT_C CGlxZoomControl* CGlxZoomControl::NewL( |
|
207 |
MGlxUiCommandHandler& aCommandHandler, |
|
208 |
MGlxMediaList& aMediaList,CEikButtonGroupContainer& aZoomKeys, |
|
209 |
IMulSliderWidget& aSliderWidget, GestureHelper::CGestureHelper* aGestureHelper) |
|
210 |
{ |
|
211 |
TRACER("CGlxZoomControl::NewL"); |
|
212 |
CGlxZoomControl* self = new (ELeave) CGlxZoomControl(aCommandHandler, |
|
213 |
aMediaList,aZoomKeys,aSliderWidget,aGestureHelper); |
|
214 |
||
215 |
CleanupStack::PushL(self); |
|
216 |
self->ConstructL(); |
|
217 |
||
218 |
CleanupStack::Pop(self); |
|
219 |
return self; |
|
220 |
} |
|
221 |
||
222 |
// ----------------------------------------------------------------------------- |
|
223 |
// Destructor |
|
224 |
// ----------------------------------------------------------------------------- |
|
225 |
// |
|
226 |
CGlxZoomControl::~CGlxZoomControl() |
|
227 |
{ |
|
228 |
TRACER("CGlxZoomControl::~CGlxZoomControl()"); |
|
229 |
if(iTimer->IsActive()) |
|
230 |
{ |
|
231 |
iTimer->Cancel(); |
|
232 |
} |
|
233 |
delete iTimer; |
|
234 |
||
235 |
if(iGPUMemMonitor) |
|
236 |
{ |
|
237 |
delete iGPUMemMonitor; |
|
238 |
} |
|
239 |
||
240 |
if(iGlxTvOut) |
|
241 |
{ |
|
242 |
delete iGlxTvOut; |
|
243 |
} |
|
244 |
||
245 |
if(iEventHandler) |
|
246 |
{ |
|
247 |
delete iEventHandler; |
|
248 |
iEventHandler = NULL ; |
|
249 |
} |
|
250 |
||
251 |
if(iViewPort) |
|
252 |
{ |
|
253 |
iViewPort->RemoveAndDestroyAllD(); |
|
254 |
iViewPort = NULL; |
|
255 |
} |
|
256 |
iMediaList.RemoveContext(iAttributeContext); |
|
257 |
delete iAttributeContext; |
|
258 |
if(iImageTexture) |
|
259 |
{ |
|
260 |
delete iImageTexture; |
|
261 |
iImageTexture=NULL; |
|
262 |
} |
|
263 |
iDisplay->Roster().Hide(*iControlGroup); |
|
264 |
if ( iControlGroup ) |
|
265 |
{ |
|
266 |
iControlGroup->Remove(this); |
|
267 |
iEnv->DeleteControlGroup(0x119); |
|
268 |
iControlGroup = NULL; |
|
269 |
} |
|
270 |
if ( iUiUtility ) |
|
271 |
{ |
|
272 |
iUiUtility->Close(); |
|
273 |
} |
|
274 |
} |
|
275 |
||
276 |
// ----------------------------------------------------------------------------- |
|
277 |
// ActivateL:Activates the Zoom Control,set the image visual ,do the initial setup |
|
278 |
// ----------------------------------------------------------------------------- |
|
279 |
// |
|
280 |
EXPORT_C void CGlxZoomControl::ActivateL(TInt aInitialZoomRatio, TZoomStartMode aStartMode, |
|
281 |
TInt aFocusIndex, TGlxMedia& aItem, TPoint* aZoomFocus,TBool aViewingMode) |
|
282 |
{ |
|
283 |
TRACER("CGlxZoomControl::ActivateL()"); |
|
284 |
||
285 |
//Request to release GPU mem parallelly |
|
286 |
iGPUMemMonitor->RequestMemory(EFalse); |
|
287 |
||
288 |
if ( !iZoomActive ) |
|
289 |
{ |
|
290 |
//To Retrive the image details |
|
291 |
TMPXAttribute thumbNailAttribute(0,0); |
|
292 |
||
293 |
TGlxIdSpaceId idspace = iMediaList.IdSpaceId( aFocusIndex ); |
|
294 |
//Get the texture Created in fullscreen View. |
|
295 |
iImageTexture = &(iTextureMgr->CreateNewTextureForMediaL( |
|
296 |
ScreenSize(),aItem, idspace, this )); |
|
297 |
iImageVisual->SetImage(*iImageTexture); |
|
298 |
||
299 |
if(iGlxTvOut->IsHDMIConnected()&& !aViewingMode ) |
|
300 |
{ |
|
301 |
StartZoomAnimation(aStartMode); |
|
302 |
} |
|
303 |
else |
|
304 |
{ |
|
305 |
ShowZoom(ETrue); |
|
306 |
iZoomSliderWidget.AddEventHandler(*this); |
|
307 |
iZoomSliderWidget.SetHandleKeyEvent(EFalse); |
|
308 |
iZoomSliderModel = (IMulSliderModel*) iZoomSliderWidget.model(); |
|
309 |
||
310 |
if(iZoomSliderWidget.IsHidden()) |
|
311 |
{ |
|
312 |
iEventHandler->SetZoomUiState(EUiOff); |
|
313 |
} |
|
314 |
else |
|
315 |
{ |
|
316 |
iEventHandler->SetZoomUiState(EUiOn); |
|
317 |
} |
|
318 |
// Get size, return value tells us if it was available |
|
319 |
//We need this Value to calculate the size of the visual/Layout corresponding to the Zoom factor |
|
320 |
TSize imageSize; |
|
321 |
aItem.GetDimensions( imageSize ); |
|
322 |
TSize maxVirtualImageSize = imageSize; |
|
323 |
||
324 |
if (KGlxDecodingThreshold < (imageSize.iWidth * imageSize.iHeight)) |
|
325 |
{ |
|
326 |
TReal areaRatio = TReal(imageSize.iWidth*imageSize.iHeight)/KGlxDecodingThreshold ; |
|
327 |
||
328 |
TReal sideRatio; |
|
329 |
Math::Sqrt(sideRatio, areaRatio); |
|
330 |
||
331 |
maxVirtualImageSize.iHeight = imageSize.iHeight / sideRatio ; |
|
332 |
maxVirtualImageSize.iWidth = imageSize.iWidth / sideRatio ; |
|
333 |
} |
|
334 |
||
335 |
// Now since our maximum size possible is 3 MP. all our zoom percentages will be relative to it. |
|
336 |
// So our initial zoom ratio will be different and cnsequently our minimum slider value too will change. |
|
337 |
||
338 |
||
339 |
GLX_LOG_INFO1("ActivateZoomControlL: Slider MaxRange = %d ", iZoomSliderModel->MaxRange() ); |
|
340 |
GLX_LOG_INFO1("ActivateZoomControlL: Slider MinRange = %d ", iZoomSliderModel->MinRange() ); |
|
341 |
GLX_LOG_INFO1("ActivateZoomControlL: Slider PrimaryValue= %d", iZoomSliderModel->PrimaryValue() ); |
|
342 |
||
343 |
iEventHandler->SetZoomActivated(ETrue); |
|
344 |
if (aStartMode == EZoomStartSlider) |
|
345 |
{ |
|
346 |
iEventHandler->ActivateZoom(aInitialZoomRatio, |
|
347 |
maxVirtualImageSize, |
|
348 |
aStartMode, |
|
349 |
iZoomSliderModel->MinRange(), |
|
350 |
iZoomSliderModel->MaxRange(), |
|
351 |
aZoomFocus); |
|
352 |
} |
|
353 |
else |
|
354 |
{ |
|
355 |
iEventHandler->ActivateZoom(aInitialZoomRatio, |
|
356 |
maxVirtualImageSize, |
|
357 |
aStartMode, |
|
358 |
iZoomSliderModel->MinRange(), |
|
359 |
iZoomSliderModel->MaxRange(), |
|
360 |
aZoomFocus); |
|
361 |
} |
|
362 |
TRAP_IGNORE(iImageTexture = |
|
363 |
&(iTextureMgr->CreateZoomedTextureL(aItem,thumbNailAttribute,idspace,this))); |
|
364 |
||
365 |
//This is for handling the alaram interrupt events,that causes the phone to freeze. |
|
366 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
367 |
if (NULL != cba) |
|
368 |
{ |
|
369 |
if (cba->IsVisible()) |
|
370 |
{ |
|
371 |
cba->ActivateL(); |
|
372 |
} |
|
373 |
} |
|
374 |
} |
|
375 |
// Now the zoom activation process is complete. |
|
376 |
// Now is when truly zoom is active. |
|
377 |
iZoomActive = ETrue; |
|
378 |
} |
|
379 |
} |
|
380 |
// --------------------------------------------------------------------------- |
|
381 |
// StartZoomAnimation |
|
382 |
// --------------------------------------------------------------------------- |
|
383 |
// |
|
384 |
void CGlxZoomControl::StartZoomAnimation(TZoomStartMode aStartMode) |
|
385 |
{ |
|
386 |
TRACER("CGlxZoomControl::StartZoomAnimation()"); |
|
387 |
iZoomIn = ETrue; |
|
388 |
//Set zoom visible but not enable the gesturehelper events |
|
389 |
iViewPort->SetOpacity(KGlxOpacityOpaque); |
|
390 |
TAlfTimedValue timedvalue; |
|
391 |
//using KGlxOpacityOpaque for the value 1 , assuming the initial zoom level as 1. |
|
392 |
timedvalue.SetValueNow(KGlxOpacityOpaque); |
|
393 |
timedvalue.SetTarget(KGlxZoomLevel,KHDMIZoomDelay/1000); |
|
394 |
iImageVisual->SetScale(timedvalue); |
|
395 |
||
396 |
//If zoom is not done using pinch, zoom out with the rubber effect |
|
397 |
//Else wait for the gesture helper event for zooming out. |
|
398 |
if(aStartMode != EZoomStartPinch) |
|
399 |
{ |
|
400 |
iTimer->Cancel(); |
|
401 |
iTimer->Start(KHDMIZoomDelay,KHDMIZoomDelay,TCallBack( TimeOut,this )); |
|
402 |
} |
|
403 |
else |
|
404 |
{ |
|
405 |
iGestureHelper->AddObserver(this); |
|
406 |
} |
|
407 |
} |
|
408 |
// --------------------------------------------------------------------------- |
|
409 |
// TimeOut |
|
410 |
// --------------------------------------------------------------------------- |
|
411 |
// |
|
412 |
TInt CGlxZoomControl::TimeOut(TAny* aSelf) |
|
413 |
{ |
|
414 |
TRACER("CGlxZoomControl::TimeOut"); |
|
415 |
if(aSelf) |
|
416 |
{ |
|
417 |
CGlxZoomControl* self = static_cast <CGlxZoomControl*> (aSelf); |
|
418 |
self->ActivateFullscreen(); |
|
419 |
} |
|
420 |
return KErrNone; |
|
421 |
} |
|
422 |
// --------------------------------------------------------------------------- |
|
423 |
// ActivateZoomAnimation |
|
424 |
// --------------------------------------------------------------------------- |
|
425 |
// |
|
426 |
void CGlxZoomControl::ActivateFullscreen() |
|
427 |
{ |
|
428 |
TRACER("CGlxZoomControl::ActivateFullscreen"); |
|
429 |
if(iZoomIn) |
|
430 |
{ |
|
431 |
iZoomIn = EFalse; |
|
432 |
TAlfTimedValue timedvalue; |
|
433 |
timedvalue.SetValueNow(KGlxZoomLevel); |
|
434 |
timedvalue.SetTarget(KGlxOpacityOpaque,KHDMIZoomDelay/1000); |
|
435 |
iImageVisual->SetScale(timedvalue); |
|
436 |
} |
|
437 |
else |
|
438 |
{ |
|
439 |
if(iTimer->IsActive()) |
|
440 |
{ |
|
441 |
iTimer->Cancel(); |
|
442 |
} |
|
443 |
//once the animation is done come back to fullscreen. |
|
444 |
HandleZoomOutL(KGlxZoomOutCommand); |
|
445 |
} |
|
446 |
} |
|
447 |
||
448 |
// ----------------------------------------------------------------------------------- |
|
449 |
// Deactivate:Remove the screen furniture ,cancel the timers if any |
|
450 |
// ---------------------------------------------------------------------------------- |
|
451 |
// |
|
452 |
EXPORT_C void CGlxZoomControl::Deactivate() |
|
453 |
{ |
|
454 |
TRACER("CGlxZoomControl::Deactivate()"); |
|
455 |
if (iZoomActive) |
|
456 |
{ |
|
457 |
if (iTimer->IsActive()) |
|
458 |
{ |
|
459 |
iTimer->Cancel(); |
|
460 |
} |
|
461 |
iZoomSliderWidget.RemoveEventHandler(*this); |
|
462 |
iZoomBackKey->MakeVisible(EFalse); |
|
463 |
iTextureMgr->RemoveZoomList(); |
|
464 |
||
465 |
iImageVisual->SetImage(*iImageTexture); |
|
466 |
iEventHandler->DeactivateZoom(); |
|
467 |
CleanUpVisual(); |
|
468 |
||
469 |
iZoomActive = EFalse; |
|
470 |
iEventHandler->SetZoomActivated(EFalse); |
|
471 |
} |
|
472 |
// Hide the Zoom View |
|
473 |
ShowZoom(EFalse); |
|
474 |
} |
|
475 |
||
476 |
// ----------------------------------------------------------------------------------- |
|
477 |
// HandleZoomForegroundEventL:Zoom Foreground event handling function |
|
478 |
// ---------------------------------------------------------------------------------- |
|
479 |
// |
|
480 |
EXPORT_C void CGlxZoomControl::HandleZoomForegroundEvent(TBool aForeground) |
|
481 |
{ |
|
482 |
TRACER("CGlxZoomControl::HandleZoomForegroundEventL()"); |
|
483 |
||
484 |
if (!aForeground) |
|
485 |
{ |
|
486 |
ShowUi(EFalse); |
|
487 |
iEventHandler->CancelZoomPanTimer(); |
|
488 |
iEventHandler->CancelUITimer(); |
|
489 |
iEventHandler->CancelAnimationTimer(); |
|
490 |
} |
|
491 |
else |
|
492 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
493 |
TInt focus = iMediaList.FocusIndex(); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
494 |
const TGlxMedia item = iMediaList.Item(focus); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
495 |
TGlxIdSpaceId spaceId = iMediaList.IdSpaceId(focus); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
496 |
GLX_LOG_INFO("CGlxZoomControl::HandleZoomForegroundEvent - Get the FS texture"); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
497 |
// Get the texture created in fullscreen view. |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
498 |
TRAPD(err, iImageTexture = &(iTextureMgr->CreateNewTextureForMediaL( |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
499 |
ScreenSize(), item, spaceId, this))); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
500 |
|
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
501 |
if (iImageTexture && iImageTexture->HasContent() && KErrNone == err) |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
502 |
{ |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
503 |
GLX_LOG_INFO("CGlxZoomControl::HandleZoomForegroundEvent - Show the FS texture"); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
504 |
iImageVisual->SetImage(*iImageTexture); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
505 |
} |
60 | 506 |
iGPUMemMonitor->RequestMemory(); |
507 |
} |
|
508 |
} |
|
509 |
||
510 |
// ----------------------------------------------------------------------------- |
|
511 |
// CleanUpVisual:reset the values of the variables. |
|
512 |
// ----------------------------------------------------------------------------- |
|
513 |
// |
|
514 |
void CGlxZoomControl::CleanUpVisual() |
|
515 |
{ |
|
516 |
TRACER("CGlxZoomControl::CleanUpVisual() "); |
|
517 |
} |
|
518 |
// ----------------------------------------------------------------------------- |
|
519 |
// Activated |
|
520 |
// ----------------------------------------------------------------------------- |
|
521 |
// |
|
522 |
EXPORT_C TBool CGlxZoomControl::Activated() |
|
523 |
{ |
|
524 |
TRACER("CGlxZoomControl::Activated"); |
|
525 |
return iZoomActive; |
|
526 |
} |
|
527 |
||
528 |
// ----------------------------------------------------------------------------- |
|
529 |
// OfferEventL |
|
530 |
// ----------------------------------------------------------------------------- |
|
531 |
// |
|
532 |
TBool CGlxZoomControl::OfferEventL(const TAlfEvent &aEvent) |
|
533 |
{ |
|
534 |
TRACER("CGlxZoomControl::OfferEventL()"); |
|
535 |
||
536 |
GLX_LOG_INFO1("OfferEventL 2: iZoomEnabled = %d ", iZoomActive ); |
|
537 |
// All the events related to the keys and pointers will be coming to this offerevent |
|
538 |
return iEventHandler->HandleEventL(aEvent) ; |
|
539 |
} |
|
540 |
||
541 |
||
542 |
// ----------------------------------------------------------------------------- |
|
543 |
// offerEvent |
|
544 |
// ----------------------------------------------------------------------------- |
|
545 |
// |
|
546 |
AlfEventStatus CGlxZoomControl::offerEvent( CAlfWidgetControl& /*aControl*/, |
|
547 |
const TAlfEvent& aEvent) |
|
548 |
{ |
|
549 |
TRACER("CGlxZoomControl::OfferEvent( CAlfWidgetControl& /*aControl*/)"); |
|
550 |
// All the events which are related to slider widget will be coming |
|
551 |
// to this offerevent. |
|
552 |
AlfEventStatus eventStatus = EEventNotHandled; |
|
553 |
||
554 |
TBool consumed = iEventHandler->HandleEvent(aEvent); |
|
555 |
if ( consumed ) |
|
556 |
{ |
|
557 |
eventStatus = EEventConsumed; |
|
558 |
} |
|
559 |
||
560 |
return eventStatus; |
|
561 |
} |
|
562 |
||
563 |
||
564 |
// ----------------------------------------------------------------------------- |
|
565 |
// TextureContentChangedL |
|
566 |
// ----------------------------------------------------------------------------- |
|
567 |
// |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
568 |
void CGlxZoomControl::TextureContentChangedL(TBool aHasContent, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
569 |
CAlfTexture* aNewTexture) |
60 | 570 |
{ |
571 |
TRACER("CGlxZoomControl::TextureContentChangedL "); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
572 |
GLX_LOG_INFO2("CGlxZoomControl::TextureContentChangedL() aNewTexture=%x, aHasContent=%d", aNewTexture, aHasContent); |
60 | 573 |
//if both the textures are null that means we do not have memory to |
574 |
//decode and show anything. So try and check if the fullscreen texture |
|
575 |
//is created by now if not then go to fullscreen view. |
|
576 |
||
577 |
if(NULL == aNewTexture ) |
|
578 |
{ |
|
579 |
if(NULL == iImageTexture) |
|
580 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
581 |
TSize textureSize = ScreenSize(); |
60 | 582 |
TInt focus = iMediaList.FocusIndex(); |
583 |
TGlxMedia item = iMediaList.Item( focus ); |
|
584 |
TGlxIdSpaceId idspace = iMediaList.IdSpaceId( focus ); |
|
585 |
||
586 |
CAlfTexture* newTexture = NULL; |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
587 |
// Get the texture created in fullscreen view. |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
588 |
TRAPD(err, newTexture = &(iTextureMgr->CreateNewTextureForMediaL( |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
589 |
textureSize,item, idspace, this))); |
60 | 590 |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
591 |
GLX_LOG_INFO2("CGlxZoomControl::TextureContentChangedL(1) newTexture=%x, err=%d", newTexture, err); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
592 |
if(newTexture && newTexture->HasContent() && err == KErrNone) |
60 | 593 |
{ |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
594 |
GLX_LOG_INFO("CGlxZoomControl::TextureContentChangedL:Show FS texture"); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
595 |
// Show the fullscreen texture. |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
596 |
iImageTexture = newTexture; |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
597 |
iImageVisual->SetImage(*iImageTexture); |
60 | 598 |
} |
599 |
else |
|
600 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
601 |
GLX_LOG_INFO("CGlxZoomControl::TextureContentChangedL:CreateNewTextureForMediaL Failed"); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
602 |
// Exit zoom and goto fullscreen |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
603 |
HandleZoomOutL(KGlxZoomOutCommand); |
60 | 604 |
} |
605 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
606 |
else if (iImageTexture->HasContent()) |
60 | 607 |
{ |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
608 |
// Show the existing decoded image texture |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
609 |
GLX_LOG_INFO("CGlxZoomControl::TextureContentChangedL - Show the existing texture"); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
610 |
iImageVisual->SetImage(*iImageTexture); |
60 | 611 |
} |
612 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
613 |
else if (aHasContent && aNewTexture->HasContent()) |
60 | 614 |
{ |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
615 |
GLX_LOG_INFO("CGlxZoomControl::TextureContentChangedL - Show the NEW texture"); |
60 | 616 |
iImageTexture = aNewTexture; |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
617 |
iImageVisual->SetImage(*iImageTexture); |
60 | 618 |
} |
619 |
} |
|
620 |
||
621 |
// ----------------------------------------------------------------------------- |
|
622 |
// VisualLayoutUpdated:updates the co-ordinates when phone is tilted |
|
623 |
// ----------------------------------------------------------------------------- |
|
624 |
// |
|
625 |
void CGlxZoomControl::VisualLayoutUpdated(CAlfVisual& aVisual) |
|
626 |
{ |
|
627 |
TRACER("CGlxZoomControl::VisualLayoutUpdated "); |
|
628 |
// Callback comes to this function when there is a resolution change |
|
629 |
||
630 |
if(iGlxTvOut->IsHDMIConnected()) |
|
631 |
{ |
|
632 |
return; |
|
633 |
} |
|
634 |
||
635 |
TRect rect; |
|
636 |
rect = AlfUtil::ScreenSize(); |
|
637 |
if ( (rect.Width() != iScreenSize.iWidth) && ( rect.Height() != iScreenSize.iHeight)) |
|
638 |
{ |
|
639 |
//notify slider about Orientation Change |
|
640 |
iZoomSliderWidget.ContainerLayout().Owner().VisualLayoutUpdated(aVisual); |
|
641 |
//when the Phone is tilted,Height becomes the width and vice versa. So update with the new dimensions |
|
642 |
iScreenSize.iWidth = rect.Width(); |
|
643 |
iScreenSize.iHeight = rect.Height(); |
|
644 |
iDisplay->SetVisibleArea(TRect(TPoint(0,0),iScreenSize)); |
|
645 |
||
646 |
//[TODO]: Use the Maths engine ro arrive at this figure (virtual and viewport sizes). else there might be problems in fringe conditions |
|
647 |
iViewPort->SetVirtualSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); |
|
648 |
iViewPort->SetViewportSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); |
|
649 |
if(Activated()) |
|
650 |
{ |
|
651 |
iEventHandler->OrientationChanged(rect); |
|
652 |
} |
|
653 |
iCommandHandler.HandleCommandL(KGlxZoomOrientationChange, this); |
|
654 |
} |
|
655 |
} |
|
656 |
||
657 |
// --------------------------------------------------------------------------- |
|
658 |
// ShowUi |
|
659 |
// --------------------------------------------------------------------------- |
|
660 |
// |
|
661 |
void CGlxZoomControl::ShowUi(TBool aShow) |
|
662 |
{ |
|
663 |
TRACER("CGlxZoomControl::ShowUi "); |
|
664 |
||
665 |
if (aShow) |
|
666 |
{ |
|
667 |
iEventHandler->SetZoomUiState(EUiOn); |
|
668 |
} |
|
669 |
else |
|
670 |
{ |
|
671 |
iEventHandler->SetZoomUiState(EUiOff); |
|
672 |
} |
|
673 |
||
674 |
iZoomBackKey->MakeVisible( aShow ); |
|
675 |
iZoomSliderWidget.ShowWidget( aShow, 0 ); |
|
676 |
} |
|
677 |
||
678 |
// --------------------------------------------------------------------------- |
|
679 |
// From IAlfWidgetEventHandler.. |
|
680 |
// --------------------------------------------------------------------------- |
|
681 |
// |
|
682 |
bool CGlxZoomControl::accept( CAlfWidgetControl& /*aControl*/, |
|
683 |
const TAlfEvent& /*aEvent*/) const |
|
684 |
{ |
|
685 |
TRACER("CGlxZoomControl::accept "); |
|
686 |
return ETrue; |
|
687 |
} |
|
688 |
||
689 |
// --------------------------------------------------------------------------- |
|
690 |
// From IAlfWidgetEventHandler.. |
|
691 |
// --------------------------------------------------------------------------- |
|
692 |
// |
|
693 |
void CGlxZoomControl::setEventHandlerData( |
|
694 |
const AlfWidgetEventHandlerInitData& /*aData*/) |
|
695 |
{ |
|
696 |
TRACER("CGlxZoomControl::setEventHandlerData "); |
|
697 |
} |
|
698 |
// --------------------------------------------------------------------------- |
|
699 |
// From IAlfWidgetEventHandler.. |
|
700 |
// --------------------------------------------------------------------------- |
|
701 |
// |
|
702 |
||
703 |
AlfWidgetEventHandlerInitData* CGlxZoomControl::eventHandlerData() |
|
704 |
{ |
|
705 |
TRACER("CGlxZoomControl::eventHandlerData "); |
|
706 |
return NULL; |
|
707 |
} |
|
708 |
// --------------------------------------------------------------------------- |
|
709 |
// From IAlfWidgetEventHandler. |
|
710 |
// --------------------------------------------------------------------------- |
|
711 |
// |
|
712 |
||
713 |
void CGlxZoomControl::setActiveStates( unsigned int /*aStates*/ ) |
|
714 |
{ |
|
715 |
TRACER("CGlxZoomControl::setActiveStates "); |
|
716 |
} |
|
717 |
// --------------------------------------------------------------------------- |
|
718 |
// From IAlfWidgetEventHandler. |
|
719 |
// --------------------------------------------------------------------------- |
|
720 |
// |
|
721 |
||
722 |
IAlfInterfaceBase* CGlxZoomControl::makeInterface( const IfId& /*aType*/ ) |
|
723 |
{ |
|
724 |
TRACER("CGlxZoomControl::makeInterface Enter/Exit"); |
|
725 |
return NULL; |
|
726 |
} |
|
727 |
//---------------------------------------------------------------------------------- |
|
728 |
// eventHandlerType |
|
729 |
//---------------------------------------------------------------------------------- |
|
730 |
// |
|
731 |
IAlfWidgetEventHandler::AlfEventHandlerType CGlxZoomControl::eventHandlerType() |
|
732 |
{ |
|
733 |
TRACER("CGlxZoomControl::eventHandlerType Enter/Exit"); |
|
734 |
return IAlfWidgetEventHandler::ELogicalEventHandler; |
|
735 |
} |
|
736 |
||
737 |
//---------------------------------------------------------------------------------- |
|
738 |
// eventExecutionPhase |
|
739 |
//---------------------------------------------------------------------------------- |
|
740 |
// |
|
741 |
IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase CGlxZoomControl::eventExecutionPhase() |
|
742 |
{ |
|
743 |
TRACER("CGlxZoomControl::eventExecutionPhase Enter/Exit"); |
|
744 |
return EBubblingPhaseEventHandler; |
|
745 |
} |
|
746 |
||
747 |
//---------------------------------------------------------------------------------- |
|
748 |
// GetOrientationL: to retreive orientation from the exif tags in the file |
|
749 |
//---------------------------------------------------------------------------------- |
|
750 |
// |
|
751 |
TUint16 CGlxZoomControl::GetOrientationL(const TDesC& aFileName) |
|
752 |
{ |
|
753 |
TRACER("CGlxZoomControl::GetOrientationL()"); |
|
754 |
//Get Exif Metadata and the orientation tag from the file first |
|
755 |
RFs fs; |
|
756 |
CleanupClosePushL(fs); |
|
757 |
User::LeaveIfError(fs.Connect()); |
|
758 |
||
759 |
RFile file; |
|
760 |
CleanupClosePushL(file); |
|
761 |
User::LeaveIfError(file.Open(fs, |
|
762 |
aFileName, EFileRead)); |
|
763 |
||
764 |
TInt size; |
|
765 |
User::LeaveIfError(file.Size(size)); |
|
766 |
if ( KGlxMaxExifSize < size ) |
|
767 |
{ |
|
768 |
size = KGlxMaxExifSize; |
|
769 |
} |
|
770 |
TUint16 orientation = 0; |
|
771 |
HBufC8* exifData = HBufC8::NewLC(size); |
|
772 |
TPtr8 ptr(exifData->Des()); |
|
773 |
User::LeaveIfError(file.Read(ptr)); |
|
774 |
CExifRead* exifReader = NULL; |
|
775 |
TRAPD(exifErr,exifReader = CExifRead::NewL(*exifData, CExifRead::ENoJpeg)); |
|
776 |
if(exifErr == KErrNone) |
|
777 |
{ |
|
778 |
CleanupStack::PushL(exifReader); |
|
779 |
||
780 |
TInt readErr = exifReader->GetOrientation(orientation); |
|
781 |
if(readErr != KErrNone) |
|
782 |
{ |
|
783 |
orientation = 0; |
|
784 |
} |
|
785 |
CleanupStack::PopAndDestroy(exifReader); |
|
786 |
} |
|
787 |
CleanupStack::PopAndDestroy(exifData); |
|
788 |
//Close and pop file Session |
|
789 |
CleanupStack::PopAndDestroy(&file); |
|
790 |
CleanupStack::PopAndDestroy(&fs); |
|
791 |
return orientation; |
|
792 |
||
793 |
} |
|
794 |
||
795 |
// ----------------------------------------------------------------------------- |
|
796 |
// UpdateViewPort |
|
797 |
// ----------------------------------------------------------------------------- |
|
798 |
// |
|
799 |
void CGlxZoomControl::UpdateViewPort(TPoint& aViewPortTopLeft, |
|
800 |
TInt aTransitionTime, |
|
801 |
TSize *apViewPortDimension, |
|
802 |
TInt aPrimarySliderRatio) |
|
803 |
{ |
|
804 |
TRACER("void CGlxZoomControl::UpdateViewPort"); |
|
805 |
||
806 |
iViewPort->SetViewportPos(aViewPortTopLeft,aTransitionTime); |
|
807 |
||
808 |
if (apViewPortDimension) |
|
809 |
{ |
|
810 |
iViewPort->SetVirtualSize(*apViewPortDimension,0); |
|
811 |
} |
|
812 |
||
813 |
if(aPrimarySliderRatio >= 0) |
|
814 |
{ |
|
815 |
iZoomSliderModel->SetPrimaryValue(aPrimarySliderRatio); |
|
816 |
} |
|
817 |
||
818 |
GLX_LOG_INFO1(" CGlxZoomControl::UpdateViewPort aPrimarySliderRatio = [%d]", aPrimarySliderRatio); |
|
819 |
||
820 |
} |
|
821 |
||
822 |
// ----------------------------------------------------------------------------- |
|
823 |
// HandleShowUi |
|
824 |
// ----------------------------------------------------------------------------- |
|
825 |
// |
|
826 |
void CGlxZoomControl::HandleShowUi( TBool aShow) |
|
827 |
{ |
|
828 |
TRACER("void CGlxZoomControl::HandleShowUi"); |
|
829 |
ShowUi(aShow); |
|
830 |
} |
|
831 |
||
832 |
||
833 |
||
834 |
// ----------------------------------------------------------------------------- |
|
835 |
// HandleSetViewPort |
|
836 |
// ----------------------------------------------------------------------------- |
|
837 |
// |
|
838 |
void CGlxZoomControl::HandleViewPortParametersChanged(TPoint& aViewPortTopLeft , |
|
839 |
TInt aTransitionTime , |
|
840 |
TSize *apViewPortDimension , |
|
841 |
TInt aPrimarySliderLevel ) |
|
842 |
{ |
|
843 |
TRACER("void CGlxZoomControl::HandleSetViewPort"); |
|
844 |
UpdateViewPort(aViewPortTopLeft, aTransitionTime, apViewPortDimension, |
|
845 |
aPrimarySliderLevel); |
|
846 |
} |
|
847 |
||
848 |
// ----------------------------------------------------------------------------- |
|
849 |
// HandleZoomOut |
|
850 |
// ----------------------------------------------------------------------------- |
|
851 |
// |
|
852 |
void CGlxZoomControl::HandleZoomOutL(TInt aCommandId) |
|
853 |
{ |
|
854 |
TRACER("void CGlxZoomControl::HandleZoomOut"); |
|
855 |
iCommandHandler.HandleCommandL(aCommandId, this); |
|
856 |
} |
|
857 |
||
858 |
||
859 |
// ----------------------------------------------------------------------------- |
|
860 |
// HandleHDMIGestureReleased |
|
861 |
// ----------------------------------------------------------------------------- |
|
862 |
// |
|
863 |
void CGlxZoomControl::HandleHDMIGestureReleased() |
|
864 |
{ |
|
865 |
TRACER("void CGlxZoomControl::HandlePinchReleased"); |
|
866 |
if ( iGlxTvOut->IsHDMIConnected() && iZoomActive) |
|
867 |
{ |
|
868 |
//On HDMI pinch release, zoom out to fullscreen |
|
869 |
GLX_LOG_INFO("_PHOTOS_LOG_: void CGlxZoomControl::HandlePinchReleased Start ZoomOut"); |
|
870 |
iTimer->Cancel(); |
|
871 |
iTimer->Start(KHDMIZoomDelay,KHDMIZoomDelay,TCallBack( TimeOut,this )); |
|
872 |
} |
|
873 |
} |
|
874 |
||
875 |
// ----------------------------------------------------------------------------- |
|
876 |
// HandlePointerEventsL |
|
877 |
// ----------------------------------------------------------------------------- |
|
878 |
// |
|
879 |
TBool CGlxZoomControl::HandlePointerEventsL(const TAlfEvent &aEvent) |
|
880 |
{ |
|
881 |
TRACER("void CGlxZoomControl::HandlePointerEventsL"); |
|
882 |
||
883 |
return iGestureHelper->OfferEventL(aEvent); |
|
884 |
||
885 |
} |
|
886 |
||
887 |
// ----------------------------------------------------------------------------- |
|
888 |
// HandleGestureL |
|
889 |
// ----------------------------------------------------------------------------- |
|
890 |
// |
|
891 |
void CGlxZoomControl::HandleGestureL( const GestureHelper::MGestureEvent& aEvent ) |
|
892 |
{ |
|
893 |
TRACER("void CGlxZoomControl::HandleGestureL"); |
|
894 |
||
895 |
TGestureCode code = aEvent.Code(MGestureEvent::EAxisBoth); |
|
896 |
GLX_LOG_INFO1("_PHOTOS_LOG_: void CGlxZoomControl::HandleGestureL Code : %d", code); |
|
897 |
||
898 |
//In HDMI pinch mode we will handle only released gesture |
|
899 |
//to zoom out the image to fullscreeen. |
|
900 |
if( iGlxTvOut->IsHDMIConnected() ) |
|
901 |
{ |
|
902 |
if(code == EGestureReleased) |
|
903 |
{ |
|
904 |
HandleHDMIGestureReleased(); |
|
905 |
} |
|
906 |
} |
|
907 |
else |
|
908 |
{ |
|
909 |
// Todo: This switch should go into the event handler. |
|
910 |
switch (code) |
|
911 |
{ |
|
912 |
case EGestureDrag: |
|
913 |
if (aEvent.Visual() == iImageVisual) |
|
914 |
{ |
|
915 |
iEventHandler->HandleDragEvent(aEvent); |
|
916 |
} |
|
917 |
break; |
|
918 |
case EGestureTap: |
|
919 |
iEventHandler->HandleSingleTap(aEvent); |
|
920 |
break; |
|
921 |
case EGesturePinch: |
|
922 |
iEventHandler->HandlePinchEventL(aEvent); |
|
923 |
break; |
|
924 |
case EGestureDoubleTap: |
|
925 |
if (aEvent.Visual() == iImageVisual) |
|
926 |
{ |
|
927 |
iEventHandler->HandleDoubleTap(aEvent); |
|
928 |
} |
|
929 |
break; |
|
930 |
case EGestureReleased: |
|
931 |
iEventHandler->HandleGestureReleased(aEvent); |
|
932 |
break; |
|
933 |
default : |
|
934 |
break; |
|
935 |
} |
|
936 |
} |
|
937 |
iEventHandler->SetPreviousEventCode(code); |
|
938 |
} |
|
939 |
||
940 |
// ----------------------------------------------------------------------------- |
|
941 |
// HandleTvStatusChangedL |
|
942 |
// ----------------------------------------------------------------------------- |
|
943 |
void CGlxZoomControl::HandleTvStatusChangedL( TTvChangeType aChangeType ) |
|
944 |
{ |
|
945 |
TRACER("CGlxZoomControl::HandleTvStatusChangedL()"); |
|
946 |
if ( aChangeType == ETvConnectionChanged ) |
|
947 |
{ |
|
948 |
if ( iGlxTvOut->IsHDMIConnected() && iZoomActive) |
|
949 |
{ |
|
950 |
//initialise all the zoom values to full-screen when hdmi is connected. |
|
951 |
if(iEventHandler) |
|
952 |
{ |
|
953 |
iEventHandler->ZoomToMinimumL(); |
|
954 |
} |
|
955 |
} |
|
956 |
} |
|
957 |
} |
|
958 |
||
959 |
// --------------------------------------------------------------------------- |
|
960 |
// ZoomUiState |
|
961 |
// --------------------------------------------------------------------------- |
|
962 |
// |
|
963 |
EXPORT_C TUiState CGlxZoomControl::ZoomUiState() |
|
964 |
{ |
|
965 |
TRACER("CGlxZoomControl::ZoomUiState"); |
|
966 |
return iEventHandler->ZoomUiState(); |
|
967 |
} |
|
968 |
||
969 |
// --------------------------------------------------------------------------- |
|
970 |
// HandleGoomMemoryReleased |
|
971 |
// Callback from memMonitor CGlxRelaseGPUMemory |
|
972 |
// --------------------------------------------------------------------------- |
|
973 |
// |
|
974 |
void CGlxZoomControl::HandleGoomMemoryReleased(TInt aStatus) |
|
975 |
{ |
|
976 |
TRACER("CGlxZoomControl::HandleGoomMemoryReleased"); |
|
977 |
if (aStatus == KErrNone) |
|
978 |
{ |
|
979 |
//Refeed the textures if we are coming back to foreground from background |
|
980 |
//To Retrive the image details |
|
981 |
TInt focusIndex = iMediaList.FocusIndex(); |
|
982 |
TGlxIdSpaceId idspace = iMediaList.IdSpaceId(focusIndex); |
|
983 |
//Get the texture Created in fullscreen View. |
|
984 |
TGlxMedia item = iMediaList.Item(focusIndex); |
|
985 |
||
986 |
// if we already have the decoded zoomed image bitmap use the texture corresponding to that. |
|
987 |
// Else make do with the fullscreen texture till that happens. |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
988 |
TRAPD(err, iImageTexture = iTextureMgr->CreateZoomedTextureL()); |
60 | 989 |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
990 |
GLX_LOG_INFO2("CGlxZoomControl::HandleGoomMemoryReleased(1) iImageTexture=%x err=%d", iImageTexture, err); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
991 |
if (!iImageTexture || KErrNone != err) |
60 | 992 |
{ |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
993 |
TRAP(err, iImageTexture = &(iTextureMgr->CreateNewTextureForMediaL( |
60 | 994 |
ScreenSize(), item, idspace, this))) |
995 |
} |
|
996 |
||
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
997 |
GLX_LOG_INFO2("CGlxZoomControl::HandleGoomMemoryReleased(2) iImageTexture=%x err=%d", iImageTexture, err); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
998 |
if (iImageTexture && iImageTexture->HasContent() && KErrNone == err) |
60 | 999 |
{ |
1000 |
iImageVisual->SetImage(*iImageTexture); |
|
1001 |
return; |
|
1002 |
} |
|
1003 |
} |
|
1004 |
||
1005 |
// No GPU Memory, return back to Fullscreenview |
|
1006 |
ActivateFullscreen(); |
|
1007 |
} |
|
1008 |
// End of File |