54
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: Container class for scene settings view*
|
|
15 |
*/
|
|
16 |
|
|
17 |
// INCLUDE FILES
|
|
18 |
#include "CamSceneSettingContainer.h"
|
|
19 |
#include "CamUtility.h"
|
|
20 |
#include "CamPanic.h"
|
|
21 |
|
|
22 |
#include <eikenv.h>
|
|
23 |
#include <eikappui.h> // For CCoeAppUiBase
|
|
24 |
#include <eikapp.h> // For CEikApplication
|
|
25 |
#include <stringloader.h>
|
|
26 |
#include <AknBidiTextUtils.h>
|
|
27 |
#include <AknsUtils.h>
|
|
28 |
#include <AknsDrawUtils.h>
|
|
29 |
#include <cameraapp.mbg>
|
|
30 |
#include <BitmapTransforms.h>
|
|
31 |
#include <AknUtils.h>
|
|
32 |
#include <AknLayoutFont.h>
|
|
33 |
#include <barsRead.h> // resource reader
|
|
34 |
|
|
35 |
#include <cameraapp.rsg>
|
|
36 |
#include <vgacamsettings.rsg>
|
|
37 |
|
|
38 |
|
|
39 |
// CONSTANTS
|
|
40 |
|
|
41 |
const TInt KStepSize = 4; // Pixels the animation moves each timer event
|
|
42 |
|
|
43 |
const TInt KCornerSize = 3;
|
|
44 |
const TInt KBorderSize = 1;
|
|
45 |
|
|
46 |
const TReal KNumIconStages = 7;
|
|
47 |
|
|
48 |
#define KRgbGray4 TRgb(0xEEEEEE)
|
|
49 |
#define KRgbGray3 TRgb(0xDDDDDD)
|
|
50 |
#define KRgbGray2 TRgb(0xCCCCCC)
|
|
51 |
#define KRgbGray1 TRgb(0xBBBBBB)
|
|
52 |
|
|
53 |
|
|
54 |
#ifdef __WINS__
|
|
55 |
static const TInt KTimerPeriod = 10000;
|
|
56 |
#else
|
|
57 |
static const TInt KTimerPeriod = 150000;
|
|
58 |
#endif
|
|
59 |
|
|
60 |
// ================= MEMBER FUNCTIONS =======================
|
|
61 |
|
|
62 |
// -----------------------------------------------------------------------------
|
|
63 |
// TCamAnimationData::Initialise
|
|
64 |
// Sets up the animation data
|
|
65 |
// -----------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
void TCamAnimationData::Initialise( const TRect& aRect )
|
|
68 |
{
|
|
69 |
iDeltaY = KStepSize;
|
|
70 |
// scrolling needs to be faster (2 times?) than the fade in/out
|
|
71 |
iScrollingY = iDeltaY * 2;
|
|
72 |
|
|
73 |
iCurrentRect = aRect;
|
|
74 |
iPreviousRect = iCurrentRect;
|
|
75 |
iCurrentRectOld = iCurrentRect;
|
|
76 |
iPreviousRectOld = iCurrentRect;
|
|
77 |
|
|
78 |
iStep = 0;
|
|
79 |
iPenFadeOut = KRgbBlack;
|
|
80 |
iPenFadeIn = KRgbWhite;
|
|
81 |
iScrolling = EFalse;
|
|
82 |
}
|
|
83 |
|
|
84 |
// ---------------------------------------------------------------------------
|
|
85 |
// CCamSceneSettingItem::NewL
|
|
86 |
// Symbian OS two-phased constructor
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
CCamSceneSettingItem* CCamSceneSettingItem::NewL( TCamSceneId aSceneId,
|
|
90 |
const TSize& aLargeBmpSize,
|
|
91 |
const TSize& aSmallBmpSize )
|
|
92 |
{
|
|
93 |
CCamSceneSettingItem* self = new( ELeave ) CCamSceneSettingItem( aSceneId );
|
|
94 |
CleanupStack::PushL( self );
|
|
95 |
self->ConstructL( aLargeBmpSize, aSmallBmpSize );
|
|
96 |
CleanupStack::Pop( self );
|
|
97 |
return self;
|
|
98 |
}
|
|
99 |
|
|
100 |
// ---------------------------------------------------------------------------
|
|
101 |
// CCamSceneSettingItem::~CCamSceneSettingItem
|
|
102 |
// Destructor
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
CCamSceneSettingItem::~CCamSceneSettingItem()
|
|
106 |
{
|
|
107 |
PRINT( _L("Camera => ~CCamSceneSettingItem") );
|
|
108 |
delete iBitmapSmall;
|
|
109 |
delete iBitmap1;
|
|
110 |
delete iBitmap2;
|
|
111 |
delete iBitmap3;
|
|
112 |
delete iBitmap4;
|
|
113 |
delete iBitmap5;
|
|
114 |
delete iBitmap6;
|
|
115 |
delete iBitmapLarge;
|
|
116 |
delete iTitle;
|
|
117 |
delete iDescription;
|
|
118 |
PRINT( _L("Camera <= ~CCamSceneSettingItem") );
|
|
119 |
}
|
|
120 |
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
// CCamSceneSettingItem::SceneId
|
|
123 |
// Returns the sceneId
|
|
124 |
// ---------------------------------------------------------------------------
|
|
125 |
//
|
|
126 |
TCamSceneId CCamSceneSettingItem::SceneId() const
|
|
127 |
{
|
|
128 |
return iSceneId;
|
|
129 |
}
|
|
130 |
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
// CCamSceneSettingItem::Icon
|
|
133 |
// Returns the bitmap specified by aSize
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
//
|
|
136 |
const CFbsBitmap* CCamSceneSettingItem::Icon( TCamIconSize aSize ) const
|
|
137 |
{
|
|
138 |
if ( aSize == ECamIconSizeLarge )
|
|
139 |
{
|
|
140 |
return iBitmapLarge;
|
|
141 |
}
|
|
142 |
else if ( aSize == ECamIconSizeSmall )
|
|
143 |
{
|
|
144 |
return iBitmapSmall;
|
|
145 |
}
|
|
146 |
else if ( aSize == ECamIconSizeOne )
|
|
147 |
{
|
|
148 |
return iBitmap1;
|
|
149 |
}
|
|
150 |
else if ( aSize == ECamIconSizeTwo )
|
|
151 |
{
|
|
152 |
return iBitmap2;
|
|
153 |
}
|
|
154 |
else if ( aSize == ECamIconSizeThree )
|
|
155 |
{
|
|
156 |
return iBitmap3;
|
|
157 |
}
|
|
158 |
else if ( aSize == ECamIconSizeFour )
|
|
159 |
{
|
|
160 |
return iBitmap4;
|
|
161 |
}
|
|
162 |
else if ( aSize == ECamIconSizeFive )
|
|
163 |
{
|
|
164 |
return iBitmap5;
|
|
165 |
}
|
|
166 |
else if ( aSize == ECamIconSizeSix )
|
|
167 |
{
|
|
168 |
return iBitmap6;
|
|
169 |
}
|
|
170 |
else
|
|
171 |
{
|
|
172 |
return iBitmapLarge;
|
|
173 |
}
|
|
174 |
}
|
|
175 |
|
|
176 |
// ---------------------------------------------------------------------------
|
|
177 |
// CCamSceneSettingItem::Title
|
|
178 |
// returns the title text
|
|
179 |
// ---------------------------------------------------------------------------
|
|
180 |
//
|
|
181 |
const HBufC* CCamSceneSettingItem::Title() const
|
|
182 |
{
|
|
183 |
return iTitle;
|
|
184 |
}
|
|
185 |
|
|
186 |
// ---------------------------------------------------------------------------
|
|
187 |
// CCamSceneSettingItem::Description
|
|
188 |
// returns the title text
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
const HBufC* CCamSceneSettingItem::Description() const
|
|
192 |
{
|
|
193 |
return iDescription;
|
|
194 |
}
|
|
195 |
|
|
196 |
// ---------------------------------------------------------------------------
|
|
197 |
// CCamSceneSettingItem::ConstructL
|
|
198 |
// Symbian OS second phase constructor
|
|
199 |
// ---------------------------------------------------------------------------
|
|
200 |
//
|
|
201 |
void CCamSceneSettingItem::ConstructL( const TSize& aLargeBmpSize,
|
|
202 |
const TSize& aSmallBmpSize )
|
|
203 |
{
|
|
204 |
TInt bmpLarge = 0;
|
|
205 |
TInt bmpSmall = 0;
|
|
206 |
TInt title = 0;
|
|
207 |
TInt description = 0;
|
|
208 |
switch ( iSceneId )
|
|
209 |
{
|
|
210 |
case ECamSceneNight:
|
|
211 |
{
|
|
212 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_night_s;
|
|
213 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_night_l;
|
|
214 |
title = R_CAM_SCENE_TITLE_NIGHT;
|
|
215 |
description = R_CAM_SCENE_DESCRIPTION_NIGHT;
|
|
216 |
}
|
|
217 |
break;
|
|
218 |
case ECamSceneMacro:
|
|
219 |
{
|
|
220 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_macro_s;
|
|
221 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_macro_l;
|
|
222 |
title = R_CAM_SCENE_TITLE_MACRO;
|
|
223 |
description = R_CAM_SCENE_DESCRIPTION_MACRO;
|
|
224 |
}
|
|
225 |
break;
|
|
226 |
case ECamScenePortrait:
|
|
227 |
{
|
|
228 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_port_s;
|
|
229 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_port_l;
|
|
230 |
title = R_CAM_SCENE_TITLE_PORTRAIT;
|
|
231 |
description = R_CAM_SCENE_DESCRIPTION_PORTRAIT;
|
|
232 |
}
|
|
233 |
break;
|
|
234 |
case ECamSceneAuto:
|
|
235 |
{
|
|
236 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_auto_s;
|
|
237 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_auto_l;
|
|
238 |
title = R_CAM_SCENE_TITLE_AUTO;
|
|
239 |
description = R_CAM_SCENE_DESCRIPTION_AUTO;
|
|
240 |
}
|
|
241 |
break;
|
|
242 |
case ECamSceneScenery:
|
|
243 |
{
|
|
244 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_land_s;
|
|
245 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_land_l;
|
|
246 |
title = R_CAM_SCENE_TITLE_LANDSCAPE;
|
|
247 |
description = R_CAM_SCENE_DESCRIPTION_LANDSCAPE;
|
|
248 |
}
|
|
249 |
break;
|
|
250 |
case ECamSceneSports:
|
|
251 |
{
|
|
252 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_sport_s;
|
|
253 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_sport_l;
|
|
254 |
title = R_CAM_SCENE_TITLE_SPORTS;
|
|
255 |
description = R_CAM_SCENE_DESCRIPTION_SPORTS;
|
|
256 |
}
|
|
257 |
break;
|
|
258 |
case ECamSceneUser:
|
|
259 |
{
|
|
260 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_user_s;
|
|
261 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_user_l;
|
|
262 |
title = R_CAM_SCENE_TITLE_USER;
|
|
263 |
description = R_CAM_SCENE_DESCRIPTION_USER;
|
|
264 |
}
|
|
265 |
break;
|
|
266 |
case ECamSceneNormal:
|
|
267 |
{
|
|
268 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_auto_s;
|
|
269 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_auto_l;
|
|
270 |
title = R_CAM_SCENE_TITLE_NORMAL;
|
|
271 |
description = R_CAM_SCENE_DESCRIPTION_NORMAL;
|
|
272 |
}
|
|
273 |
break;
|
|
274 |
case ECamSceneNightScenery:
|
|
275 |
{
|
|
276 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_nightland_s;
|
|
277 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_nightland_l;
|
|
278 |
title = R_CAM_SCENE_TITLE_NIGHT_LANDSCAPE;
|
|
279 |
description = R_CAM_SCENE_DESCRIPTION_NIGHT_LANDSCAPE;
|
|
280 |
}
|
|
281 |
break;
|
|
282 |
case ECamSceneNightPortrait:
|
|
283 |
{
|
|
284 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_nightport_s;
|
|
285 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_nightport_l;
|
|
286 |
title = R_CAM_SCENE_TITLE_NIGHT_PORTRAIT;
|
|
287 |
description = R_CAM_SCENE_DESCRIPTION_NIGHT_PORTRAIT;
|
|
288 |
}
|
|
289 |
break;
|
|
290 |
case ECamSceneCandlelight:
|
|
291 |
{
|
|
292 |
bmpSmall = EMbmCameraappQgn_ico_lcam_sce_candle_s;
|
|
293 |
bmpLarge = EMbmCameraappQgn_ico_lcam_sce_candle_l;
|
|
294 |
title = R_CAM_SCENE_TITLE_CANDLELIGHT;
|
|
295 |
description = R_CAM_SCENE_DESCRIPTION_CANDLELIGHT;
|
|
296 |
}
|
|
297 |
break;
|
|
298 |
default:
|
|
299 |
User::Leave( KErrGeneral );
|
|
300 |
break;
|
|
301 |
}
|
|
302 |
|
|
303 |
// Find the name and path of the MBM file for bitmaps
|
|
304 |
TFileName mbmFileName;
|
|
305 |
CamUtility::ResourceFileName( mbmFileName );
|
|
306 |
|
|
307 |
iBitmapSmall = AknIconUtils::CreateIconL( mbmFileName, bmpSmall );
|
|
308 |
AknIconUtils::SetSize( iBitmapSmall, aSmallBmpSize, EAspectRatioNotPreserved );
|
|
309 |
|
|
310 |
TReal xInc = TReal( aLargeBmpSize.iWidth - aSmallBmpSize.iWidth ) / KNumIconStages;
|
|
311 |
TReal yInc = TReal( aLargeBmpSize.iHeight - aSmallBmpSize.iHeight ) / KNumIconStages;
|
|
312 |
|
|
313 |
TSize size;
|
|
314 |
TReal width = aSmallBmpSize.iWidth;
|
|
315 |
TReal height = aSmallBmpSize.iHeight;
|
|
316 |
|
|
317 |
width += xInc;
|
|
318 |
height += yInc;
|
|
319 |
size.SetSize( ( TInt ) width, ( TInt ) height );
|
|
320 |
|
|
321 |
iBitmap1 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
|
|
322 |
AknIconUtils::SetSize( iBitmap1, size, EAspectRatioNotPreserved);
|
|
323 |
|
|
324 |
width += xInc;
|
|
325 |
height += yInc;
|
|
326 |
size.SetSize( ( TInt ) width, ( TInt ) height );
|
|
327 |
|
|
328 |
iBitmap2 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
|
|
329 |
AknIconUtils::SetSize( iBitmap2, size, EAspectRatioNotPreserved );
|
|
330 |
|
|
331 |
width += xInc;
|
|
332 |
height += yInc;
|
|
333 |
size.SetSize( ( TInt ) width, ( TInt ) height );
|
|
334 |
|
|
335 |
iBitmap3 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
|
|
336 |
AknIconUtils::SetSize( iBitmap3, size, EAspectRatioNotPreserved );
|
|
337 |
|
|
338 |
width += xInc;
|
|
339 |
height += yInc;
|
|
340 |
size.SetSize( ( TInt ) width, ( TInt ) height );
|
|
341 |
|
|
342 |
iBitmap4 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
|
|
343 |
AknIconUtils::SetSize( iBitmap4, size, EAspectRatioNotPreserved );
|
|
344 |
|
|
345 |
width += xInc;
|
|
346 |
height += yInc;
|
|
347 |
size.SetSize( ( TInt ) width, ( TInt ) height );
|
|
348 |
|
|
349 |
iBitmap5 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
|
|
350 |
AknIconUtils::SetSize( iBitmap5, size, EAspectRatioNotPreserved );
|
|
351 |
|
|
352 |
width += xInc;
|
|
353 |
height += yInc;
|
|
354 |
size.SetSize( ( TInt ) width, ( TInt ) height );
|
|
355 |
|
|
356 |
iBitmap6 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
|
|
357 |
AknIconUtils::SetSize( iBitmap6, size, EAspectRatioNotPreserved );
|
|
358 |
|
|
359 |
iBitmapLarge = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
|
|
360 |
AknIconUtils::SetSize( iBitmapLarge, aLargeBmpSize, EAspectRatioNotPreserved );
|
|
361 |
|
|
362 |
iTitle = StringLoader::LoadL( title );
|
|
363 |
iDescription = StringLoader::LoadL( description );
|
|
364 |
}
|
|
365 |
|
|
366 |
// ---------------------------------------------------------------------------
|
|
367 |
// CCamSceneSettingItem::CCamSceneSettingContainer
|
|
368 |
// C++ constructor
|
|
369 |
// ---------------------------------------------------------------------------
|
|
370 |
//
|
|
371 |
CCamSceneSettingItem::CCamSceneSettingItem( TCamSceneId aSceneId ) :
|
|
372 |
iSceneId( aSceneId )
|
|
373 |
{
|
|
374 |
}
|
|
375 |
|
|
376 |
// ---------------------------------------------------------------------------
|
|
377 |
// CCamSceneSettingContainer::NewL
|
|
378 |
// Symbian OS two-phased constructor
|
|
379 |
// ---------------------------------------------------------------------------
|
|
380 |
//
|
|
381 |
CCamSceneSettingContainer*
|
|
382 |
CCamSceneSettingContainer::NewL( const TRect& aRect,
|
|
383 |
CAknView& aView,
|
|
384 |
TCamCameraMode aMode,
|
|
385 |
CCamAppController& aController,
|
|
386 |
TBool aUserBaseScenes )
|
|
387 |
{
|
|
388 |
CCamSceneSettingContainer* self =
|
|
389 |
new( ELeave ) CCamSceneSettingContainer( aMode,
|
|
390 |
aController,
|
|
391 |
aView,
|
|
392 |
aUserBaseScenes );
|
|
393 |
CleanupStack::PushL( self );
|
|
394 |
self->ConstructL( aRect );
|
|
395 |
CleanupStack::Pop( self );
|
|
396 |
return self;
|
|
397 |
}
|
|
398 |
|
|
399 |
// ---------------------------------------------------------------------------
|
|
400 |
// CCamSceneSettingContainer::~CCamSceneSettingContainer
|
|
401 |
// Destructor
|
|
402 |
// ---------------------------------------------------------------------------
|
|
403 |
//
|
|
404 |
CCamSceneSettingContainer::~CCamSceneSettingContainer()
|
|
405 |
{
|
|
406 |
PRINT( _L( "Camera => ~CCamSceneSettingContainer" ) );
|
|
407 |
|
|
408 |
iSettingItemArray.ResetAndDestroy();
|
|
409 |
iSettingItemArray.Close();
|
|
410 |
|
|
411 |
iHighlightIcons.Close();
|
|
412 |
iNormalIcons.Close();
|
|
413 |
iDisplacedIcons.Close();
|
|
414 |
|
|
415 |
iHighlightArray.Close();
|
|
416 |
iHighlightTitles.Close();
|
|
417 |
iHighlightDescriptions.Close();
|
|
418 |
|
|
419 |
iNormalTitles.Close();
|
|
420 |
iDisplacedTitles.Close();
|
|
421 |
|
|
422 |
if (iAnimTimer)
|
|
423 |
{
|
|
424 |
iAnimTimer->Cancel();
|
|
425 |
}
|
|
426 |
delete iAnimTimer;
|
|
427 |
delete iScrollFrame;
|
|
428 |
delete iAnimData.iOffScreenBitmap;
|
|
429 |
|
|
430 |
PRINT( _L( "Camera <= ~CCamSceneSettingContainer" ) );
|
|
431 |
}
|
|
432 |
|
|
433 |
// ---------------------------------------------------------
|
|
434 |
// CCamSceneSettingContainer::ConstructL
|
|
435 |
// Symbian OS 2nd phase constructor
|
|
436 |
// ---------------------------------------------------------
|
|
437 |
//
|
|
438 |
void CCamSceneSettingContainer::ConstructL( const TRect& aRect )
|
|
439 |
{
|
|
440 |
PRINT(_L("Camera => CCamSceneSettingContainer::ConstructL") )
|
|
441 |
|
|
442 |
CCamContainerBase::BaseConstructL( aRect );
|
|
443 |
|
|
444 |
TBool secondCameraOn =
|
|
445 |
static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() )->IsSecondCameraEnabled();
|
|
446 |
|
|
447 |
if( !AknLayoutUtils::LayoutMirrored() )
|
|
448 |
{
|
|
449 |
// get the icon positions from the resource
|
|
450 |
ReadLayoutL( ROID(R_CAM_SCENE_ICON_HIGHLIGHT_ARRAY_ID), iHighlightIcons );
|
|
451 |
ReadLayoutL( ROID(R_CAM_SCENE_ICON_DISPLACED_ARRAY_ID), iDisplacedIcons );
|
|
452 |
ReadLayoutL( ROID(R_CAM_SCENE_ICON_NORMAL_ARRAY_ID), iNormalIcons );
|
|
453 |
|
|
454 |
// get the highlight rects
|
|
455 |
ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_LAYOUT_ARRAY_ID), iHighlightArray );
|
|
456 |
|
|
457 |
// Check if we require APAC layouts
|
|
458 |
if( AknLayoutUtils::Variant() == EApacVariant )
|
|
459 |
{
|
|
460 |
// get the layout texts
|
|
461 |
ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_TITLE_ARRAY_APAC_ID), iHighlightTitles );
|
|
462 |
ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_DESCRIPTION_ARRAY_APAC_ID), iHighlightDescriptions );
|
|
463 |
|
|
464 |
ReadLayoutL( ROID(R_CAM_SCENE_TITLE_NORMAL_ARRAY_APAC_ID), iNormalTitles );
|
|
465 |
ReadLayoutL( ROID(R_CAM_SCENE_TITLE_DISPLACED_ARRAY_APAC_ID), iDisplacedTitles );
|
|
466 |
}
|
|
467 |
else
|
|
468 |
{
|
|
469 |
// get the layout texts
|
|
470 |
ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_TITLE_ARRAY_ID), iHighlightTitles );
|
|
471 |
ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_DESCRIPTION_ARRAY_ID), iHighlightDescriptions );
|
|
472 |
|
|
473 |
ReadLayoutL( ROID(R_CAM_SCENE_TITLE_NORMAL_ARRAY_ID), iNormalTitles );
|
|
474 |
ReadLayoutL( ROID(R_CAM_SCENE_TITLE_DISPLACED_ARRAY_ID), iDisplacedTitles );
|
|
475 |
}
|
|
476 |
}
|
|
477 |
else
|
|
478 |
{
|
|
479 |
// get the icon positions from the resource
|
|
480 |
ReadLayoutL( ROID(R_CAM_SCENE_ICON_HIGHLIGHT_ARRAY_AH_ID), iHighlightIcons );
|
|
481 |
ReadLayoutL( ROID(R_CAM_SCENE_ICON_DISPLACED_ARRAY_AH_ID), iDisplacedIcons );
|
|
482 |
ReadLayoutL( ROID(R_CAM_SCENE_ICON_NORMAL_ARRAY_AH_ID), iNormalIcons );
|
|
483 |
|
|
484 |
// get the highlight rects
|
|
485 |
ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_LAYOUT_ARRAY_AH_ID), iHighlightArray );
|
|
486 |
|
|
487 |
// get the layout texts
|
|
488 |
ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_TITLE_ARRAY_AH_ID), iHighlightTitles );
|
|
489 |
ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_DESCRIPTION_ARRAY_AH_ID), iHighlightDescriptions );
|
|
490 |
|
|
491 |
ReadLayoutL( ROID(R_CAM_SCENE_TITLE_NORMAL_ARRAY_AH_ID), iNormalTitles );
|
|
492 |
ReadLayoutL( ROID(R_CAM_SCENE_TITLE_DISPLACED_ARRAY_AH_ID), iDisplacedTitles );
|
|
493 |
}
|
|
494 |
|
|
495 |
TResourceReader reader;
|
|
496 |
iEikonEnv->CreateResourceReaderLC( reader, ROID(R_CAM_SCENE_MAX_ITEMS_TO_DISPLAY_ID));
|
|
497 |
iNumberOfIconsToDisplay = reader.ReadInt16();
|
|
498 |
CleanupStack::PopAndDestroy(); // reader
|
|
499 |
|
|
500 |
if ( iUserBaseScenes )
|
|
501 |
{
|
|
502 |
CreateSceneArrayL( R_CAM_SCENE_LIST_USER );
|
|
503 |
TCamSceneId currentScene = static_cast<TCamSceneId>(
|
|
504 |
iController.IntegerSettingValue(
|
|
505 |
ECamSettingItemUserSceneBasedOnScene ) );
|
|
506 |
SetCurrentPositionToScene( currentScene );
|
|
507 |
SetupScrollbarL();
|
|
508 |
}
|
|
509 |
else if ( ECamControllerImage == iMode )
|
|
510 |
{
|
|
511 |
if ( secondCameraOn )
|
|
512 |
{
|
|
513 |
CreateSceneArrayL( R_CAM_SCENE_LIST_PHOTO_CAM2 );
|
|
514 |
}
|
|
515 |
else
|
|
516 |
{
|
|
517 |
CreateSceneArrayL( R_CAM_SCENE_LIST_PHOTO);
|
|
518 |
SetupScrollbarL();
|
|
519 |
}
|
|
520 |
|
|
521 |
TCamSceneId currentScene = static_cast<TCamSceneId>(
|
|
522 |
iController.IntegerSettingValue(
|
|
523 |
ECamSettingItemDynamicPhotoScene ) );
|
|
524 |
SetCurrentPositionToScene( currentScene );
|
|
525 |
}
|
|
526 |
else
|
|
527 |
{
|
|
528 |
if ( secondCameraOn )
|
|
529 |
{
|
|
530 |
CreateSceneArrayL( R_CAM_SCENE_LIST_VIDEO_CAM2);
|
|
531 |
}
|
|
532 |
else
|
|
533 |
{
|
|
534 |
CreateSceneArrayL( R_CAM_SCENE_LIST_VIDEO );
|
|
535 |
}
|
|
536 |
|
|
537 |
TCamSceneId currentScene = static_cast<TCamSceneId>(
|
|
538 |
iController.IntegerSettingValue(
|
|
539 |
ECamSettingItemDynamicVideoScene ) );
|
|
540 |
SetCurrentPositionToScene( currentScene );
|
|
541 |
}
|
|
542 |
|
|
543 |
TInt index = iCurrentArrayPosition - iTopDisplayPosition;
|
|
544 |
iAnimData.Initialise( iHighlightArray[index].Rect() );
|
|
545 |
|
|
546 |
// create a bitmap to be used off-screen
|
|
547 |
iAnimData.iOffScreenBitmap = new ( ELeave ) CFbsBitmap();
|
|
548 |
User::LeaveIfError( iAnimData.iOffScreenBitmap->Create( aRect.Size(), EColor256 ) );
|
|
549 |
|
|
550 |
TInt leftMarginDiff = iNormalIcons[0].Rect().iTl.iX -
|
|
551 |
iHighlightIcons[0].Rect().iTl.iX;
|
|
552 |
iAnimData.iIconLeftInc = TReal( leftMarginDiff / KNumIconStages );
|
|
553 |
|
|
554 |
|
|
555 |
// Create the timeout timer
|
|
556 |
iAnimTimer = CPeriodic::NewL( EPriorityHigh );
|
|
557 |
|
|
558 |
PRINT(_L("Camera <= CCamSceneSettingContainer::ConstructL") )
|
|
559 |
}
|
|
560 |
|
|
561 |
// ---------------------------------------------------------------------------
|
|
562 |
// CCamSceneSettingContainer::ReadLayoutL
|
|
563 |
// Read the TAknLayoutRect info from the resource file
|
|
564 |
// ---------------------------------------------------------------------------
|
|
565 |
//
|
|
566 |
void CCamSceneSettingContainer::ReadLayoutL( TInt aResourceId,
|
|
567 |
RArray<TAknLayoutRect>& aArray) const
|
|
568 |
{
|
|
569 |
TResourceReader reader;
|
|
570 |
iEikonEnv->CreateResourceReaderLC( reader, aResourceId );
|
|
571 |
const TInt count = reader.ReadInt16();
|
|
572 |
|
|
573 |
TInt i;
|
|
574 |
// Read all of the layout entries from the resource file
|
|
575 |
for ( i = 0; i < count; i++ )
|
|
576 |
{
|
|
577 |
TAknLayoutRect layoutRect;
|
|
578 |
layoutRect.LayoutRect( Rect(), reader );
|
|
579 |
User::LeaveIfError( aArray.Append( layoutRect ) );
|
|
580 |
}
|
|
581 |
CleanupStack::PopAndDestroy(); // reader
|
|
582 |
}
|
|
583 |
|
|
584 |
// ---------------------------------------------------------------------------
|
|
585 |
// CCamSceneSettingContainer::ReadLayoutL
|
|
586 |
// Read the TAknLayoutText info from the resource file
|
|
587 |
// ---------------------------------------------------------------------------
|
|
588 |
//
|
|
589 |
void CCamSceneSettingContainer::ReadLayoutL( TInt aResourceId,
|
|
590 |
RArray<TAknLayoutText>& aArray) const
|
|
591 |
{
|
|
592 |
TResourceReader reader;
|
|
593 |
iEikonEnv->CreateResourceReaderLC( reader, aResourceId );
|
|
594 |
const TInt count = reader.ReadInt16();
|
|
595 |
|
|
596 |
TInt i;
|
|
597 |
// Read all of the layout entries from the resource file
|
|
598 |
for ( i = 0; i < count; i++ )
|
|
599 |
{
|
|
600 |
TAknLayoutText layoutText;
|
|
601 |
layoutText.LayoutText( Rect(), reader );
|
|
602 |
User::LeaveIfError( aArray.Append( layoutText ) );
|
|
603 |
}
|
|
604 |
CleanupStack::PopAndDestroy(); // reader
|
|
605 |
}
|
|
606 |
|
|
607 |
// ---------------------------------------------------------------------------
|
|
608 |
// CCamSceneSettingContainer::CCamSceneSettingContainer
|
|
609 |
// C++ constructor
|
|
610 |
// ---------------------------------------------------------------------------
|
|
611 |
//
|
|
612 |
CCamSceneSettingContainer::CCamSceneSettingContainer(
|
|
613 |
TCamCameraMode aMode,
|
|
614 |
CCamAppController& aController,
|
|
615 |
CAknView& aView,
|
|
616 |
TBool aUserBaseScenes )
|
|
617 |
: CCamContainerBase( aController, aView ),
|
|
618 |
iMode( aMode ),
|
|
619 |
iUserBaseScenes( aUserBaseScenes )
|
|
620 |
{
|
|
621 |
}
|
|
622 |
|
|
623 |
// ----------------------------------------------------------------
|
|
624 |
// CCamSceneSettingContainer::UserSceneHighlighted
|
|
625 |
// Returns ETrue if the current selected scene is User
|
|
626 |
// ----------------------------------------------------------------
|
|
627 |
//
|
|
628 |
TBool CCamSceneSettingContainer::UserSceneHighlighted()
|
|
629 |
{
|
|
630 |
return ( iSettingItemArray[iCurrentArrayPosition]->SceneId() ==
|
|
631 |
ECamSceneUser );
|
|
632 |
}
|
|
633 |
|
|
634 |
// ----------------------------------------------------------------
|
|
635 |
// CCamSceneSettingContainer::SaveSceneSetting
|
|
636 |
// Stores the currently selected scene in the dynamic settings model
|
|
637 |
// ----------------------------------------------------------------
|
|
638 |
//
|
|
639 |
TBool CCamSceneSettingContainer::SaveSceneSettingL()
|
|
640 |
{
|
|
641 |
TInt scene = 0;
|
|
642 |
if ( iUserBaseScenes )
|
|
643 |
{
|
|
644 |
scene = ECamSettingItemUserSceneBasedOnScene;
|
|
645 |
}
|
|
646 |
else if ( ECamControllerImage == iMode )
|
|
647 |
{
|
|
648 |
scene = ECamSettingItemDynamicPhotoScene;
|
|
649 |
}
|
|
650 |
else
|
|
651 |
{
|
|
652 |
scene = ECamSettingItemDynamicVideoScene;
|
|
653 |
}
|
|
654 |
|
|
655 |
iController.SetIntegerSettingValueL( scene,
|
|
656 |
iSettingItemArray[iCurrentArrayPosition]->SceneId() );
|
|
657 |
|
|
658 |
// If user selected sports scene from list.
|
|
659 |
if ( iSettingItemArray[iCurrentArrayPosition]->SceneId() == ECamSceneSports )
|
|
660 |
{
|
|
661 |
// if the selection was for user scene base scene, and user
|
|
662 |
// scene is active, but request was cancelled, return false.
|
|
663 |
if ( ( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene )
|
|
664 |
== ECamSceneUser ) &&
|
|
665 |
( iController.IntegerSettingValue( ECamSettingItemUserSceneBasedOnScene )
|
|
666 |
!= ECamSceneSports ) )
|
|
667 |
{
|
|
668 |
return EFalse;
|
|
669 |
}
|
|
670 |
// if the selection was for the photo/video scene, but request was
|
|
671 |
// cancelled, return false.
|
|
672 |
if ( ( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene )
|
|
673 |
!= ECamSceneUser ) &&
|
|
674 |
( iController.IntegerSettingValue( scene ) != ECamSceneSports ) )
|
|
675 |
{
|
|
676 |
return EFalse;
|
|
677 |
}
|
|
678 |
}
|
|
679 |
// Otherwise, if the user selected user scene from the list, but request
|
|
680 |
// was cancelled, return false.
|
|
681 |
else if ( ( iSettingItemArray[iCurrentArrayPosition]->SceneId()
|
|
682 |
== ECamSceneUser ) &&
|
|
683 |
( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene )
|
|
684 |
!= ECamSceneUser ) )
|
|
685 |
{
|
|
686 |
return EFalse;
|
|
687 |
}
|
|
688 |
|
|
689 |
// Remove lint warning.
|
|
690 |
else
|
|
691 |
{
|
|
692 |
}
|
|
693 |
|
|
694 |
// In all other cases, return true.
|
|
695 |
return ETrue;
|
|
696 |
}
|
|
697 |
|
|
698 |
|
|
699 |
// ---------------------------------------------------------
|
|
700 |
// CCamSceneSettingContainer::CountComponentControls
|
|
701 |
// Returns the number of controls owned
|
|
702 |
// ---------------------------------------------------------
|
|
703 |
//
|
|
704 |
TInt CCamSceneSettingContainer::CountComponentControls() const
|
|
705 |
{
|
|
706 |
TInt count = CCamContainerBase::CountComponentControls(); // Return the number of controls inside this container
|
|
707 |
if ( iScrollFrame )
|
|
708 |
{
|
|
709 |
count += iScrollFrame->CountComponentControls();
|
|
710 |
}
|
|
711 |
return count;
|
|
712 |
}
|
|
713 |
|
|
714 |
// ---------------------------------------------------------
|
|
715 |
// CCamSceneSettingContainer::ComponentControl
|
|
716 |
// Returns the requested component control
|
|
717 |
// ---------------------------------------------------------
|
|
718 |
//
|
|
719 |
CCoeControl* CCamSceneSettingContainer::ComponentControl( TInt aIndex ) const
|
|
720 |
{
|
|
721 |
CCoeControl* control = NULL;
|
|
722 |
if( aIndex == 0 )
|
|
723 |
control = CCamContainerBase::ComponentControl( aIndex );
|
|
724 |
else
|
|
725 |
{
|
|
726 |
if ( iScrollFrame )
|
|
727 |
{
|
|
728 |
return iScrollFrame->ComponentControl( aIndex - 1 );
|
|
729 |
}
|
|
730 |
}
|
|
731 |
return control;
|
|
732 |
}
|
|
733 |
|
|
734 |
// ---------------------------------------------------------
|
|
735 |
// CCamSceneSettingContainer::Draw
|
|
736 |
// Draw control
|
|
737 |
// ---------------------------------------------------------
|
|
738 |
//
|
|
739 |
void CCamSceneSettingContainer::Draw( const TRect& /*aRect*/ ) const
|
|
740 |
{
|
|
741 |
PRINT(_L("Camera => CCamSceneSettingContainer::Draw") )
|
|
742 |
|
|
743 |
CWindowGc& gc = SystemGc();
|
|
744 |
// Draw the background
|
|
745 |
gc.SetBrushColor( KRgbWhite );
|
|
746 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
|
|
747 |
gc.SetPenStyle( CGraphicsContext::ENullPen );
|
|
748 |
gc.DrawRect( Rect() );
|
|
749 |
gc.SetPenStyle( CGraphicsContext::ESolidPen );
|
|
750 |
|
|
751 |
TBool drawnHighlight = EFalse;
|
|
752 |
TInt index = 0;
|
|
753 |
|
|
754 |
TInt i;
|
|
755 |
for ( i = 0; i < iNumberOfIconsToDisplay; i++ )
|
|
756 |
{
|
|
757 |
TInt position = iTopDisplayPosition + i;
|
|
758 |
CCamSceneSettingItem* item = iSettingItemArray[position];
|
|
759 |
const HBufC* title = item->Title();
|
|
760 |
const HBufC* description = item->Description();
|
|
761 |
|
|
762 |
// Drawing currently selected icon and text
|
|
763 |
if ( position == iCurrentArrayPosition )
|
|
764 |
{
|
|
765 |
// Draw the highlight
|
|
766 |
gc.DrawRoundRect( iHighlightArray[i].Rect(),
|
|
767 |
TSize( KCornerSize, KCornerSize ) );
|
|
768 |
|
|
769 |
// Draw the enlarged icon
|
|
770 |
iHighlightIcons[i].DrawImage( gc,
|
|
771 |
const_cast<CFbsBitmap*>( item->Icon( ECamIconSizeLarge ) ), NULL );
|
|
772 |
|
|
773 |
// Draw the enlarged header text
|
|
774 |
iHighlightTitles[i].DrawText( gc, *title );
|
|
775 |
|
|
776 |
// Draw the description text
|
|
777 |
iHighlightDescriptions[i].DrawText( gc, *description );
|
|
778 |
|
|
779 |
#if 0 // debug drawing code
|
|
780 |
gc.SetPenColor(KRgbRed);
|
|
781 |
gc.DrawRect( iHighlightTitles[i].TextRect() );
|
|
782 |
gc.DrawRect( iHighlightDescriptions[i].TextRect() );
|
|
783 |
#endif
|
|
784 |
drawnHighlight = ETrue;
|
|
785 |
}
|
|
786 |
else // Drawing normal items
|
|
787 |
{
|
|
788 |
// Draw the highlight box
|
|
789 |
TAknLayoutRect layoutRect;
|
|
790 |
TAknLayoutText layoutText;
|
|
791 |
if ( drawnHighlight )
|
|
792 |
{
|
|
793 |
layoutRect = iNormalIcons[index];
|
|
794 |
layoutText = iNormalTitles[index];
|
|
795 |
}
|
|
796 |
else
|
|
797 |
{
|
|
798 |
layoutRect = iDisplacedIcons[index];
|
|
799 |
layoutText = iDisplacedTitles[index];
|
|
800 |
}
|
|
801 |
|
|
802 |
// Draw the standard icon
|
|
803 |
layoutRect.DrawImage( gc,
|
|
804 |
const_cast<CFbsBitmap*>( item->Icon( ECamIconSizeSmall ) ), NULL );
|
|
805 |
// Draw the header text
|
|
806 |
layoutText.DrawText( gc, *title );
|
|
807 |
|
|
808 |
#if 0 // debug drawing code
|
|
809 |
gc.SetPenColor(KRgbRed);
|
|
810 |
gc.DrawRect( layoutText.TextRect() );
|
|
811 |
#endif
|
|
812 |
index++;
|
|
813 |
}
|
|
814 |
}
|
|
815 |
PRINT(_L("Camera <= CCamSceneSettingContainer::Draw") )
|
|
816 |
}
|
|
817 |
|
|
818 |
// ----------------------------------------------------------------
|
|
819 |
// CCamSceneSettingContainer::OfferKeyEventL
|
|
820 |
// Handles this application view's command keys. Forwards other
|
|
821 |
// keys to child control(s).
|
|
822 |
// ----------------------------------------------------------------
|
|
823 |
//
|
|
824 |
TKeyResponse CCamSceneSettingContainer::OfferKeyEventL(
|
|
825 |
const TKeyEvent& aKeyEvent,
|
|
826 |
TEventCode aType )
|
|
827 |
{
|
|
828 |
PRINT( _L( "Camera => CCamSceneSettingContainer::OfferKeyEventL" ) );
|
|
829 |
|
|
830 |
if ( iAnimTimer->IsActive() )
|
|
831 |
{
|
|
832 |
return EKeyWasNotConsumed;
|
|
833 |
}
|
|
834 |
|
|
835 |
// Moving down the list
|
|
836 |
if ( aKeyEvent.iScanCode == EStdKeyDownArrow && aType == EEventKey )
|
|
837 |
{
|
|
838 |
// at the bottom of the list and pressing down key
|
|
839 |
if ( iCurrentArrayPosition == iSettingItemArray.Count() - 1 )
|
|
840 |
{
|
|
841 |
// wrap to the top of the list and redraw
|
|
842 |
iCurrentArrayPosition = 0;
|
|
843 |
iPreviousArrayPosition = 0;
|
|
844 |
iTopDisplayPosition = 0;
|
|
845 |
|
|
846 |
iAnimData.iCurrentRect = iHighlightArray[0].Rect();
|
|
847 |
iAnimData.iPreviousRect = iAnimData.iCurrentRect;
|
|
848 |
|
|
849 |
if ( iScrollFrame )
|
|
850 |
{
|
|
851 |
iScrollFrame->MoveVertThumbTo( 0 );
|
|
852 |
}
|
|
853 |
|
|
854 |
DrawDeferred();
|
|
855 |
return EKeyWasConsumed;
|
|
856 |
}
|
|
857 |
|
|
858 |
iAnimData.iMovingDown = ETrue;
|
|
859 |
iPreviousArrayPosition = iCurrentArrayPosition;
|
|
860 |
iCurrentArrayPosition++;
|
|
861 |
|
|
862 |
// need to scroll the list
|
|
863 |
if( iCurrentArrayPosition > iNumberOfIconsToDisplay - 1 )
|
|
864 |
{
|
|
865 |
iAnimData.iScrolling = ETrue;
|
|
866 |
iScrollFrame->MoveThumbsBy( 0, 1 );
|
|
867 |
iTopDisplayPosition++;
|
|
868 |
DrawListL();
|
|
869 |
|
|
870 |
// blit the bitmap at above the 2nd displaced icon
|
|
871 |
TInt yPos = iDisplacedIcons[1].Rect().iTl.iY;
|
|
872 |
// less the difference between the top of the first icon on
|
|
873 |
// the off-screen bitmap and the top of the off-screen bitmap
|
|
874 |
yPos -= iDisplacedIcons[0].Rect().iTl.iY;
|
|
875 |
// less the scrolling value
|
|
876 |
yPos -= iAnimData.iScrollingY;
|
|
877 |
iAnimData.iOffScreenPos.SetXY( 0, yPos );
|
|
878 |
|
|
879 |
TInt curIndex = iCurrentArrayPosition - iTopDisplayPosition;
|
|
880 |
TInt defaultIndex = curIndex - 1;
|
|
881 |
iAnimData.iTitleFadeIn = iNormalTitles[defaultIndex].TextRect();
|
|
882 |
|
|
883 |
iAnimData.iCurrentRect = iHighlightArray[curIndex].Rect();
|
|
884 |
TRect rect = iNormalIcons[defaultIndex].Rect();
|
|
885 |
iAnimData.iCurrentRect.iTl.iY = rect.iTl.iY;
|
|
886 |
iAnimData.iCurrentRect.iBr.iY = iAnimData.iCurrentRect.iTl.iY + rect.Height();
|
|
887 |
|
|
888 |
// clear the top item from the list
|
|
889 |
ActivateGc();
|
|
890 |
SystemGc().Clear( iHighlightArray[0].Rect() );
|
|
891 |
DeactivateGc();
|
|
892 |
}
|
|
893 |
else // just move to the next position
|
|
894 |
{
|
|
895 |
MoveHighlight();
|
|
896 |
}
|
|
897 |
|
|
898 |
StartAnimation();
|
|
899 |
return EKeyWasConsumed;
|
|
900 |
}
|
|
901 |
else if ( aKeyEvent.iScanCode == EStdKeyUpArrow && aType == EEventKey )
|
|
902 |
{
|
|
903 |
// At the top of list and pressing the up key
|
|
904 |
if ( iCurrentArrayPosition == 0 )
|
|
905 |
{
|
|
906 |
// wrap to the bottom of the list and redraw
|
|
907 |
TInt lastItem = iSettingItemArray.Count() - 1;
|
|
908 |
iCurrentArrayPosition = lastItem;
|
|
909 |
iPreviousArrayPosition = lastItem;
|
|
910 |
iTopDisplayPosition = iSettingItemArray.Count() - iNumberOfIconsToDisplay;
|
|
911 |
|
|
912 |
TInt pos = iCurrentArrayPosition - iTopDisplayPosition;
|
|
913 |
iAnimData.iCurrentRect = iHighlightArray[pos].Rect();
|
|
914 |
iAnimData.iPreviousRect = iAnimData.iCurrentRect;
|
|
915 |
|
|
916 |
if ( iScrollFrame )
|
|
917 |
{
|
|
918 |
iScrollFrame->MoveThumbsBy( 0, iTopDisplayPosition );
|
|
919 |
}
|
|
920 |
|
|
921 |
DrawDeferred();
|
|
922 |
iController.StartIdleTimer();
|
|
923 |
return EKeyWasConsumed;
|
|
924 |
}
|
|
925 |
|
|
926 |
iAnimData.iMovingDown = EFalse;
|
|
927 |
iPreviousArrayPosition = iCurrentArrayPosition;
|
|
928 |
iCurrentArrayPosition--;
|
|
929 |
|
|
930 |
// need to scroll the list
|
|
931 |
if ( iPreviousArrayPosition > iNumberOfIconsToDisplay - 1 )
|
|
932 |
{
|
|
933 |
iAnimData.iScrolling = ETrue;
|
|
934 |
iScrollFrame->MoveThumbsBy( 0, -1 );
|
|
935 |
// draw the list before decrementing top display pos
|
|
936 |
DrawListL();
|
|
937 |
iTopDisplayPosition--;
|
|
938 |
|
|
939 |
iAnimData.iOffScreenPos.SetXY( 0, iAnimData.iScrollingY );
|
|
940 |
|
|
941 |
TInt curIndex = iCurrentArrayPosition - iTopDisplayPosition;
|
|
942 |
TInt defaultIndex = curIndex - 1;
|
|
943 |
iAnimData.iTitleFadeIn = iNormalTitles[defaultIndex].TextRect();
|
|
944 |
|
|
945 |
iAnimData.iCurrentRect = iHighlightArray[curIndex].Rect();
|
|
946 |
TRect rect = iNormalIcons[defaultIndex].Rect();
|
|
947 |
iAnimData.iCurrentRect.iTl.iY = rect.iTl.iY;
|
|
948 |
iAnimData.iCurrentRect.iBr.iY = iAnimData.iCurrentRect.iTl.iY + rect.Height();
|
|
949 |
}
|
|
950 |
else // just move to the next position
|
|
951 |
{
|
|
952 |
MoveHighlight();
|
|
953 |
}
|
|
954 |
|
|
955 |
StartAnimation();
|
|
956 |
iController.StartIdleTimer();
|
|
957 |
return EKeyWasConsumed;
|
|
958 |
}
|
|
959 |
else
|
|
960 |
{
|
|
961 |
return CCamContainerBase::OfferKeyEventL( aKeyEvent, aType );
|
|
962 |
}
|
|
963 |
}
|
|
964 |
|
|
965 |
// ---------------------------------------------------------------------------
|
|
966 |
// CCamSceneSettingContainer::HandleScrollEventL
|
|
967 |
// Called when a scroll event is detected
|
|
968 |
// ---------------------------------------------------------------------------
|
|
969 |
//
|
|
970 |
void CCamSceneSettingContainer::HandleScrollEventL( CEikScrollBar* /*aScrollBar*/,
|
|
971 |
TEikScrollEvent /*aEventType*/ )
|
|
972 |
{
|
|
973 |
}
|
|
974 |
|
|
975 |
// ----------------------------------------------------------------
|
|
976 |
// CCamBurstThumbnailGrid::SetupScrollbarL
|
|
977 |
// Sets up the scrollbar for the list
|
|
978 |
// ----------------------------------------------------------------
|
|
979 |
//
|
|
980 |
void CCamSceneSettingContainer::SetupScrollbarL()
|
|
981 |
{
|
|
982 |
if ( !AknLayoutUtils::LayoutMirrored() )
|
|
983 |
{
|
|
984 |
iScrollLayout.LayoutRect( Rect(), ROID(R_CAM_SCENE_SCROLLBAR_POSITION_ID));
|
|
985 |
}
|
|
986 |
else
|
|
987 |
{
|
|
988 |
iScrollLayout.LayoutRect( Rect(), ROID(R_CAM_SCENE_SCROLLBAR_POSITION_AH_ID));
|
|
989 |
}
|
|
990 |
|
|
991 |
// Create scrollbar frame
|
|
992 |
iScrollFrame = new (ELeave) CEikScrollBarFrame( this, this, ETrue );
|
|
993 |
|
|
994 |
// Set up the model accordingly
|
|
995 |
ivModel.SetScrollSpan( iSettingItemArray.Count() );
|
|
996 |
ivModel.SetFocusPosition( 0 );
|
|
997 |
ivModel.SetWindowSize( iNumberOfIconsToDisplay );
|
|
998 |
|
|
999 |
iScrollFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
|
|
1000 |
CEikScrollBarFrame::EOn );
|
|
1001 |
iScrollFrame->CreateDoubleSpanScrollBarsL( ETrue, EFalse );
|
|
1002 |
|
|
1003 |
TRect rect = iScrollLayout.Rect();
|
|
1004 |
iScrollFrame->Tile( &ivModel, rect );
|
|
1005 |
iScrollFrame->MoveVertThumbTo( iTopDisplayPosition );
|
|
1006 |
}
|
|
1007 |
|
|
1008 |
// ----------------------------------------------------------------
|
|
1009 |
// CCamSceneSettingContainer::CreateSceneArrayL
|
|
1010 |
// Populates the scene array with scenes using a resource
|
|
1011 |
// ----------------------------------------------------------------
|
|
1012 |
//
|
|
1013 |
void CCamSceneSettingContainer::CreateSceneArrayL( TInt aResourceId )
|
|
1014 |
{
|
|
1015 |
// Create a resource reader for the scene array resource id.
|
|
1016 |
TResourceReader reader;
|
|
1017 |
iEikonEnv->CreateResourceReaderLC( reader, aResourceId );
|
|
1018 |
|
|
1019 |
// Create all scene list items from the resource reader.
|
|
1020 |
TInt sceneCount = reader.ReadInt16();
|
|
1021 |
|
|
1022 |
TInt i;
|
|
1023 |
for ( i = 0; i < sceneCount; ++i )
|
|
1024 |
{
|
|
1025 |
TCamSceneId sceneId = static_cast<TCamSceneId> ( reader.ReadInt16() );
|
|
1026 |
if ( iController.IsSceneSupported( sceneId ) )
|
|
1027 |
{
|
|
1028 |
TSize large = iHighlightIcons[0].Rect().Size();
|
|
1029 |
TSize small = iNormalIcons[0].Rect().Size();
|
|
1030 |
CCamSceneSettingItem* settingItem = CCamSceneSettingItem::NewL(
|
|
1031 |
sceneId, large, small );
|
|
1032 |
CleanupStack::PushL( settingItem );
|
|
1033 |
iSettingItemArray.AppendL( settingItem );
|
|
1034 |
CleanupStack::Pop( settingItem );
|
|
1035 |
}
|
|
1036 |
|
|
1037 |
}
|
|
1038 |
|
|
1039 |
CleanupStack::PopAndDestroy(); // reader
|
|
1040 |
|
|
1041 |
// If total number of scenes is less than the current number
|
|
1042 |
// of icons to display on screen then reset the current number of
|
|
1043 |
// icons to display on screen.
|
|
1044 |
if ( sceneCount < iNumberOfIconsToDisplay )
|
|
1045 |
{
|
|
1046 |
iNumberOfIconsToDisplay = sceneCount;
|
|
1047 |
}
|
|
1048 |
}
|
|
1049 |
|
|
1050 |
// ----------------------------------------------------------------
|
|
1051 |
// CCamSceneSettingContainer::SetCurrentPositionToScene
|
|
1052 |
// Sets the current position of the scene array to the element
|
|
1053 |
// associated with a particular scene id.
|
|
1054 |
// ----------------------------------------------------------------
|
|
1055 |
//
|
|
1056 |
void CCamSceneSettingContainer::SetCurrentPositionToScene
|
|
1057 |
( TCamSceneId aSceneId )
|
|
1058 |
{
|
|
1059 |
// Find scene in scene array.
|
|
1060 |
TInt count = iSettingItemArray.Count();
|
|
1061 |
TInt j;
|
|
1062 |
for ( j = 0; j < count; j++ )
|
|
1063 |
{
|
|
1064 |
if ( aSceneId == iSettingItemArray[j]->SceneId() )
|
|
1065 |
{
|
|
1066 |
iCurrentArrayPosition = j;
|
|
1067 |
j = count; // stop loop
|
|
1068 |
}
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
// If scene array position is offscreen, move top display position.
|
|
1072 |
if ( iCurrentArrayPosition >= iNumberOfIconsToDisplay )
|
|
1073 |
{
|
|
1074 |
iTopDisplayPosition = ( iCurrentArrayPosition -
|
|
1075 |
iNumberOfIconsToDisplay ) + 1;
|
|
1076 |
}
|
|
1077 |
}
|
|
1078 |
|
|
1079 |
// ---------------------------------------------------------------------------
|
|
1080 |
// CCamSceneSettingContainer::StartAnimation
|
|
1081 |
// Called to start the animation
|
|
1082 |
// ---------------------------------------------------------------------------
|
|
1083 |
//
|
|
1084 |
void CCamSceneSettingContainer::StartAnimation()
|
|
1085 |
{
|
|
1086 |
#ifndef _ANIMATION_OFF
|
|
1087 |
iAnimTimer->Start( KTimerPeriod, KTimerPeriod, TCallBack( TimerExpired, this ) );
|
|
1088 |
#else
|
|
1089 |
DrawDeferred();
|
|
1090 |
#endif
|
|
1091 |
}
|
|
1092 |
|
|
1093 |
// ---------------------------------------------------------------------------
|
|
1094 |
// CCamSceneSettingContainer::TimerExpired
|
|
1095 |
// Called when the timer expires
|
|
1096 |
// ---------------------------------------------------------------------------
|
|
1097 |
//
|
|
1098 |
TInt CCamSceneSettingContainer::TimerExpired( TAny* aAny )
|
|
1099 |
{
|
|
1100 |
CCamSceneSettingContainer* container =
|
|
1101 |
static_cast<CCamSceneSettingContainer*>( aAny );
|
|
1102 |
__ASSERT_DEBUG( container != NULL, CamPanic( ECamPanicNullPointer ) );
|
|
1103 |
container->Animate();
|
|
1104 |
return KErrNone;
|
|
1105 |
}
|
|
1106 |
|
|
1107 |
// ---------------------------------------------------------------------------
|
|
1108 |
// CCamSceneSettingContainer::Animate
|
|
1109 |
// Called every time the timer expires to update the animation
|
|
1110 |
// The animation works by changing a single line non-highlighted item
|
|
1111 |
// into a double line highlighted item.
|
|
1112 |
// When a highlighted item comes into focus, the title text remains the same
|
|
1113 |
// size, but its position is moved up to indicate moving from a single to
|
|
1114 |
// double line.
|
|
1115 |
// The description text fades in underneath the title text - the title text
|
|
1116 |
// moves up to make way for the description text.
|
|
1117 |
// When a highlighted item looses the focus, the title text remains the same
|
|
1118 |
// size, but its position moves down to indicate moving from a double line
|
|
1119 |
// to a single line.
|
|
1120 |
// The description text fades out and the title text moves down into the
|
|
1121 |
// position occupied by the description text.
|
|
1122 |
// ---------------------------------------------------------------------------
|
|
1123 |
//
|
|
1124 |
void CCamSceneSettingContainer::Animate()
|
|
1125 |
{
|
|
1126 |
iAnimData.iStep++;
|
|
1127 |
|
|
1128 |
// update the pen/bitmaps
|
|
1129 |
UpdateAnimationData();
|
|
1130 |
|
|
1131 |
// font is the same for all titles
|
|
1132 |
const CAknLayoutFont* layoutFont = CAknLayoutFont::AsCAknLayoutFontOrNull(
|
|
1133 |
iHighlightTitles[0].Font() );
|
|
1134 |
__ASSERT_DEBUG( layoutFont != NULL, CamPanic( ECamPanicNullPointer ) );
|
|
1135 |
TInt baseline = layoutFont->TextPaneTopToBaseline();
|
|
1136 |
|
|
1137 |
const CCamSceneSettingItem* previousItem = iSettingItemArray[iPreviousArrayPosition];
|
|
1138 |
const CCamSceneSettingItem* currentItem = iSettingItemArray[iCurrentArrayPosition];
|
|
1139 |
|
|
1140 |
TInt currentPosition = iCurrentArrayPosition - iTopDisplayPosition;
|
|
1141 |
TInt previousPosition = iPreviousArrayPosition - iTopDisplayPosition;
|
|
1142 |
|
|
1143 |
CWindowGc& gc = SystemGc();
|
|
1144 |
ActivateGc();
|
|
1145 |
|
|
1146 |
TBool animScrolled = ETrue;
|
|
1147 |
TBool animCompleted = ETrue;
|
|
1148 |
if ( iAnimData.iScrolling )
|
|
1149 |
{
|
|
1150 |
animScrolled = ScrollList();
|
|
1151 |
|
|
1152 |
// update the highlight rects
|
|
1153 |
animCompleted = UpdateHighlight();
|
|
1154 |
|
|
1155 |
DrawIcon( EFalse );
|
|
1156 |
|
|
1157 |
if ( iAnimData.iMovingDown )
|
|
1158 |
{
|
|
1159 |
// Save the current position, so we can rub it out later
|
|
1160 |
iAnimData.iTitleFadeInOld = iAnimData.iTitleFadeIn;
|
|
1161 |
|
|
1162 |
TRect rectLimit = iHighlightTitles[currentPosition].TextRect();
|
|
1163 |
iAnimData.iTitleFadeIn.Move( 0, -iAnimData.iDeltaY );
|
|
1164 |
if ( iAnimData.iTitleFadeIn.iTl.iY <= rectLimit.iTl.iY )
|
|
1165 |
{
|
|
1166 |
// finish
|
|
1167 |
iAnimData.iTitleFadeIn.iTl.iY = rectLimit.iTl.iY;
|
|
1168 |
iAnimData.iTitleFadeIn.iBr.iY = rectLimit.iBr.iY;
|
|
1169 |
}
|
|
1170 |
DrawText( *currentItem->Title(), layoutFont, baseline, EFalse );
|
|
1171 |
}
|
|
1172 |
|
|
1173 |
// draw the description text
|
|
1174 |
iHighlightDescriptions[currentPosition].DrawText( gc,
|
|
1175 |
*currentItem->Description(), ETrue, iAnimData.iPenFadeIn );
|
|
1176 |
|
|
1177 |
// draw the highlighted border
|
|
1178 |
DrawHighlight();
|
|
1179 |
}
|
|
1180 |
else
|
|
1181 |
{
|
|
1182 |
// update the highlight rects
|
|
1183 |
animCompleted = UpdateHighlight();
|
|
1184 |
|
|
1185 |
// draw the highlighted border
|
|
1186 |
DrawHighlight();
|
|
1187 |
|
|
1188 |
/**** PREVIOUS ITEM - FADE OUT ****/
|
|
1189 |
DrawIcon( ETrue );
|
|
1190 |
|
|
1191 |
// fade description text out
|
|
1192 |
iHighlightDescriptions[previousPosition].DrawText( gc,
|
|
1193 |
*previousItem->Description(), ETrue, iAnimData.iPenFadeOut );
|
|
1194 |
|
|
1195 |
// Save the current position, so we can rub it out later
|
|
1196 |
iAnimData.iTitleFadeOutOld = iAnimData.iTitleFadeOut;
|
|
1197 |
|
|
1198 |
// Draw the title text if moving down the list
|
|
1199 |
TRect rectLimit;
|
|
1200 |
if ( iAnimData.iMovingDown )
|
|
1201 |
{
|
|
1202 |
rectLimit = iDisplacedTitles[previousPosition].TextRect();
|
|
1203 |
}
|
|
1204 |
else // Draw the title text if moving up the list
|
|
1205 |
{
|
|
1206 |
rectLimit = iNormalTitles[previousPosition-1].TextRect();
|
|
1207 |
}
|
|
1208 |
|
|
1209 |
iAnimData.iTitleFadeOut.Move( 0, iAnimData.iDeltaY );
|
|
1210 |
if ( iAnimData.iTitleFadeOut.iTl.iY >= rectLimit.iTl.iY )
|
|
1211 |
{
|
|
1212 |
// finish
|
|
1213 |
iAnimData.iTitleFadeOut.iTl.iY = rectLimit.iTl.iY;
|
|
1214 |
iAnimData.iTitleFadeOut.iBr.iY = rectLimit.iBr.iY;
|
|
1215 |
}
|
|
1216 |
|
|
1217 |
DrawText( *previousItem->Title(), layoutFont, baseline, ETrue );
|
|
1218 |
|
|
1219 |
/**** NEXT ITEM - FADE IN ****/
|
|
1220 |
DrawIcon( EFalse );
|
|
1221 |
|
|
1222 |
if ( iAnimData.iMovingDown )
|
|
1223 |
{
|
|
1224 |
iHighlightDescriptions[currentPosition].DrawText( gc,
|
|
1225 |
*currentItem->Description(), ETrue, iAnimData.iPenFadeIn );
|
|
1226 |
}
|
|
1227 |
else
|
|
1228 |
{
|
|
1229 |
// don't fade in straight away otherwise looks messy
|
|
1230 |
if ( iAnimData.iStep > 3 )
|
|
1231 |
{
|
|
1232 |
iHighlightDescriptions[currentPosition].DrawText( gc,
|
|
1233 |
*currentItem->Description(), ETrue, iAnimData.iPenFadeIn );
|
|
1234 |
}
|
|
1235 |
}
|
|
1236 |
|
|
1237 |
// Save the current position, so we can rub it out later
|
|
1238 |
iAnimData.iTitleFadeInOld = iAnimData.iTitleFadeIn;
|
|
1239 |
|
|
1240 |
rectLimit = iHighlightTitles[currentPosition].TextRect();
|
|
1241 |
iAnimData.iTitleFadeIn.Move( 0, -iAnimData.iDeltaY );
|
|
1242 |
if ( iAnimData.iTitleFadeIn.iTl.iY <= rectLimit.iTl.iY )
|
|
1243 |
{
|
|
1244 |
// finish
|
|
1245 |
iAnimData.iTitleFadeIn.iTl.iY = rectLimit.iTl.iY;
|
|
1246 |
iAnimData.iTitleFadeIn.iBr.iY = rectLimit.iBr.iY;
|
|
1247 |
}
|
|
1248 |
DrawText( *currentItem->Title(), layoutFont, baseline, EFalse );
|
|
1249 |
}
|
|
1250 |
|
|
1251 |
DeactivateGc();
|
|
1252 |
|
|
1253 |
if ( animScrolled && animCompleted )
|
|
1254 |
{
|
|
1255 |
iAnimTimer->Cancel();
|
|
1256 |
iAnimData.iScrolling = EFalse;
|
|
1257 |
iAnimData.iPenFadeOut = KRgbBlack;
|
|
1258 |
iAnimData.iPenFadeIn = KRgbWhite;
|
|
1259 |
iAnimData.iStep = 0;
|
|
1260 |
iAnimData.iIconLeftOffset = 0;
|
|
1261 |
DrawNow();
|
|
1262 |
}
|
|
1263 |
}
|
|
1264 |
|
|
1265 |
// ---------------------------------------------------------------------------
|
|
1266 |
// CCamSceneSettingContainer::UpdateHighlight
|
|
1267 |
// Updates the highlight rect each time Animate() is called
|
|
1268 |
// ---------------------------------------------------------------------------
|
|
1269 |
//
|
|
1270 |
TBool CCamSceneSettingContainer::UpdateHighlight()
|
|
1271 |
{
|
|
1272 |
TInt currentPosition = iCurrentArrayPosition - iTopDisplayPosition;
|
|
1273 |
TInt previousPosition = iPreviousArrayPosition - iTopDisplayPosition;
|
|
1274 |
|
|
1275 |
// Save the current position, so we can rub it out later
|
|
1276 |
iAnimData.iCurrentRectOld = iAnimData.iCurrentRect;
|
|
1277 |
iAnimData.iPreviousRectOld = iAnimData.iPreviousRect;
|
|
1278 |
|
|
1279 |
TBool completedCurrentTop = EFalse;
|
|
1280 |
TBool completedCurrentBottom = EFalse;
|
|
1281 |
TBool completedPreviousTop = EFalse;
|
|
1282 |
TBool completedPreviousBottom = EFalse;
|
|
1283 |
|
|
1284 |
TInt currentRectTopLimit = iHighlightArray[currentPosition].Rect().iTl.iY;
|
|
1285 |
TInt currentRectBottomLimit = iHighlightArray[currentPosition].Rect().iBr.iY;
|
|
1286 |
|
|
1287 |
iAnimData.iCurrentRect.iTl.iY -= iAnimData.iDeltaY;
|
|
1288 |
if ( iAnimData.iCurrentRect.iTl.iY <= currentRectTopLimit )
|
|
1289 |
{
|
|
1290 |
iAnimData.iCurrentRect.iTl.iY = currentRectTopLimit;
|
|
1291 |
completedCurrentTop = ETrue;
|
|
1292 |
}
|
|
1293 |
iAnimData.iCurrentRect.iBr.iY += iAnimData.iDeltaY;
|
|
1294 |
if ( iAnimData.iCurrentRect.iBr.iY >= currentRectBottomLimit )
|
|
1295 |
{
|
|
1296 |
iAnimData.iCurrentRect.iBr.iY = currentRectBottomLimit;
|
|
1297 |
completedCurrentBottom = ETrue;
|
|
1298 |
}
|
|
1299 |
|
|
1300 |
// not scrolling so fade the previous highlight
|
|
1301 |
if ( !iAnimData.iScrolling )
|
|
1302 |
{
|
|
1303 |
TInt previousRectTopLimit;
|
|
1304 |
TInt previousRectBottomLimit;
|
|
1305 |
if ( iAnimData.iMovingDown )
|
|
1306 |
{
|
|
1307 |
previousRectTopLimit = iDisplacedIcons[previousPosition].Rect().iTl.iY;
|
|
1308 |
previousRectBottomLimit = iDisplacedIcons[previousPosition].Rect().iBr.iY;
|
|
1309 |
}
|
|
1310 |
else // moving up
|
|
1311 |
{
|
|
1312 |
previousRectTopLimit = iNormalIcons[previousPosition-1].Rect().iTl.iY;
|
|
1313 |
previousRectBottomLimit = iNormalIcons[previousPosition-1].Rect().iBr.iY;
|
|
1314 |
}
|
|
1315 |
|
|
1316 |
iAnimData.iPreviousRect.iTl.iY += iAnimData.iDeltaY;
|
|
1317 |
if ( iAnimData.iPreviousRect.iTl.iY >= previousRectTopLimit )
|
|
1318 |
{
|
|
1319 |
iAnimData.iPreviousRect.iTl.iY = previousRectTopLimit;
|
|
1320 |
completedPreviousTop = ETrue;
|
|
1321 |
}
|
|
1322 |
|
|
1323 |
iAnimData.iPreviousRect.iBr.iY -= iAnimData.iDeltaY;
|
|
1324 |
if ( iAnimData.iPreviousRect.iBr.iY <= previousRectBottomLimit )
|
|
1325 |
{
|
|
1326 |
iAnimData.iPreviousRect.iBr.iY = previousRectBottomLimit;
|
|
1327 |
completedPreviousBottom = ETrue;
|
|
1328 |
}
|
|
1329 |
}
|
|
1330 |
else // scrolling - don't draw the previous rect
|
|
1331 |
{
|
|
1332 |
completedPreviousTop = ETrue;
|
|
1333 |
completedPreviousBottom = ETrue;
|
|
1334 |
}
|
|
1335 |
|
|
1336 |
return ( completedCurrentTop && completedCurrentBottom &&
|
|
1337 |
completedPreviousTop && completedPreviousBottom );
|
|
1338 |
}
|
|
1339 |
|
|
1340 |
// ---------------------------------------------------------------------------
|
|
1341 |
// CCamSceneSettingContainer::UpdateAnimationData
|
|
1342 |
// Updates the pen/icons each time Animate() is called
|
|
1343 |
// ---------------------------------------------------------------------------
|
|
1344 |
//
|
|
1345 |
void CCamSceneSettingContainer::UpdateAnimationData()
|
|
1346 |
{
|
|
1347 |
const CCamSceneSettingItem* previousItem = iSettingItemArray[iPreviousArrayPosition];
|
|
1348 |
const CCamSceneSettingItem* currentItem = iSettingItemArray[iCurrentArrayPosition];
|
|
1349 |
|
|
1350 |
if ( iAnimData.iStep == 1 )
|
|
1351 |
{
|
|
1352 |
iAnimData.iPenFadeOut = KRgbDarkGray;
|
|
1353 |
iAnimData.iPenFadeIn = KRgbGray4;
|
|
1354 |
iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeSix );
|
|
1355 |
iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeOne );
|
|
1356 |
}
|
|
1357 |
else if ( iAnimData.iStep == 2 )
|
|
1358 |
{
|
|
1359 |
iAnimData.iPenFadeOut = KRgbGray;
|
|
1360 |
iAnimData.iPenFadeIn = KRgbGray3;
|
|
1361 |
iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeFive );
|
|
1362 |
iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeTwo );
|
|
1363 |
}
|
|
1364 |
else if ( iAnimData.iStep == 3 )
|
|
1365 |
{
|
|
1366 |
iAnimData.iPenFadeOut = KRgbGray1;
|
|
1367 |
iAnimData.iPenFadeIn = KRgbGray2;
|
|
1368 |
iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeFour );
|
|
1369 |
iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeThree );
|
|
1370 |
}
|
|
1371 |
else if ( iAnimData.iStep == 4 )
|
|
1372 |
{
|
|
1373 |
iAnimData.iPenFadeOut = KRgbGray2;
|
|
1374 |
iAnimData.iPenFadeIn = KRgbGray1;
|
|
1375 |
iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeThree );
|
|
1376 |
iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeFour );
|
|
1377 |
}
|
|
1378 |
else if ( iAnimData.iStep == 5 )
|
|
1379 |
{
|
|
1380 |
iAnimData.iPenFadeOut = KRgbGray3;
|
|
1381 |
iAnimData.iPenFadeIn = KRgbGray;
|
|
1382 |
iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeTwo );
|
|
1383 |
iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeFive );
|
|
1384 |
}
|
|
1385 |
else if ( iAnimData.iStep == 6 )
|
|
1386 |
{
|
|
1387 |
iAnimData.iPenFadeOut = KRgbGray4;
|
|
1388 |
iAnimData.iPenFadeIn = KRgbDarkGray;
|
|
1389 |
|
|
1390 |
iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeOne );
|
|
1391 |
iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeSix );
|
|
1392 |
}
|
|
1393 |
else if ( iAnimData.iStep == 7 )
|
|
1394 |
{
|
|
1395 |
iAnimData.iPenFadeOut = KRgbWhite;
|
|
1396 |
iAnimData.iPenFadeIn = KRgbBlack;
|
|
1397 |
iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeSmall );
|
|
1398 |
iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeLarge );
|
|
1399 |
}
|
|
1400 |
else
|
|
1401 |
{
|
|
1402 |
|
|
1403 |
}
|
|
1404 |
iAnimData.iIconLeftOffset += iAnimData.iIconLeftInc;
|
|
1405 |
}
|
|
1406 |
|
|
1407 |
// ---------------------------------------------------------------------------
|
|
1408 |
// CCamSceneSettingContainer::DrawText
|
|
1409 |
// Draws the title text each time Animate() is called
|
|
1410 |
// ---------------------------------------------------------------------------
|
|
1411 |
//
|
|
1412 |
void CCamSceneSettingContainer::DrawText( const TDesC& aText,
|
|
1413 |
const CAknLayoutFont* aFont,
|
|
1414 |
TInt aBaseline,
|
|
1415 |
TBool aFadeOut ) const
|
|
1416 |
{
|
|
1417 |
CWindowGc& gc = SystemGc();
|
|
1418 |
|
|
1419 |
TRect oldRect;
|
|
1420 |
TRect rect;
|
|
1421 |
if ( aFadeOut )
|
|
1422 |
{
|
|
1423 |
rect = iAnimData.iTitleFadeOut;
|
|
1424 |
oldRect = iAnimData.iTitleFadeOutOld;
|
|
1425 |
}
|
|
1426 |
else
|
|
1427 |
{
|
|
1428 |
rect = iAnimData.iTitleFadeIn;
|
|
1429 |
oldRect = iAnimData.iTitleFadeInOld;
|
|
1430 |
}
|
|
1431 |
gc.UseFont( aFont );
|
|
1432 |
TLogicalRgb backgroundColour( TLogicalRgb::ESystemBackgroundColor );
|
|
1433 |
gc.SetPenColor( backgroundColour );
|
|
1434 |
// draw test aligned left or right depending on layout
|
|
1435 |
if( !AknLayoutUtils::LayoutMirrored() )
|
|
1436 |
{
|
|
1437 |
gc.DrawText( aText, oldRect, aBaseline, CGraphicsContext::ELeft );
|
|
1438 |
gc.SetPenColor( KRgbBlack );
|
|
1439 |
gc.DrawText( aText, rect, aBaseline, CGraphicsContext::ELeft );
|
|
1440 |
}
|
|
1441 |
else
|
|
1442 |
{
|
|
1443 |
gc.DrawText( aText, oldRect, aBaseline, CGraphicsContext::ERight );
|
|
1444 |
gc.SetPenColor( KRgbBlack );
|
|
1445 |
gc.DrawText( aText, rect, aBaseline, CGraphicsContext::ERight );
|
|
1446 |
}
|
|
1447 |
|
|
1448 |
gc.DiscardFont();
|
|
1449 |
}
|
|
1450 |
|
|
1451 |
// ---------------------------------------------------------------------------
|
|
1452 |
// CCamSceneSettingContainer::DrawIcon
|
|
1453 |
// Draws the icon each time Animate() is called
|
|
1454 |
// ---------------------------------------------------------------------------
|
|
1455 |
//
|
|
1456 |
void CCamSceneSettingContainer::DrawIcon( TBool aFadeOut )
|
|
1457 |
{
|
|
1458 |
TRect oldRect;
|
|
1459 |
TRect bmpRect;
|
|
1460 |
const CFbsBitmap* bitmap = NULL;
|
|
1461 |
|
|
1462 |
TRect largeIcon = iHighlightIcons[0].Rect();
|
|
1463 |
TRect smallIcon = iNormalIcons[0].Rect();
|
|
1464 |
|
|
1465 |
if ( aFadeOut )
|
|
1466 |
{
|
|
1467 |
bitmap = iAnimData.iIconFadeOut;
|
|
1468 |
TSize bmpSize = bitmap->SizeInPixels();
|
|
1469 |
|
|
1470 |
TInt iconYPos = ( iAnimData.iPreviousRect.Height() - bmpSize.iHeight ) / 2;
|
|
1471 |
|
|
1472 |
TPoint iconPos( ( largeIcon.iTl.iX + (TInt)iAnimData.iIconLeftOffset ),
|
|
1473 |
( iAnimData.iPreviousRect.iTl.iY + iconYPos ) );
|
|
1474 |
|
|
1475 |
iAnimData.iIconRectFadeOutOld = iAnimData.iIconRectFadeOut;
|
|
1476 |
iAnimData.iIconRectFadeOut.SetRect( iconPos, bmpSize );
|
|
1477 |
|
|
1478 |
oldRect = iAnimData.iIconRectFadeOutOld;
|
|
1479 |
bmpRect = iAnimData.iIconRectFadeOut;
|
|
1480 |
}
|
|
1481 |
else
|
|
1482 |
{
|
|
1483 |
bitmap = iAnimData.iIconFadeIn;
|
|
1484 |
TSize bmpSize = bitmap->SizeInPixels();
|
|
1485 |
|
|
1486 |
TInt iconYPos = ( iAnimData.iCurrentRect.Height() - bmpSize.iHeight ) / 2;
|
|
1487 |
|
|
1488 |
TPoint iconPos( ( smallIcon.iTl.iX - (TInt)iAnimData.iIconLeftOffset ),
|
|
1489 |
( iAnimData.iCurrentRect.iTl.iY + iconYPos ) );
|
|
1490 |
|
|
1491 |
iAnimData.iIconRectFadeInOld = iAnimData.iIconRectFadeIn;
|
|
1492 |
iAnimData.iIconRectFadeIn.SetRect( iconPos, bmpSize );
|
|
1493 |
|
|
1494 |
oldRect = iAnimData.iIconRectFadeInOld;
|
|
1495 |
bmpRect = iAnimData.iIconRectFadeIn;
|
|
1496 |
}
|
|
1497 |
|
|
1498 |
CWindowGc& gc = SystemGc();
|
|
1499 |
gc.Clear( oldRect );
|
|
1500 |
gc.BitBlt( bmpRect.iTl, bitmap );
|
|
1501 |
}
|
|
1502 |
|
|
1503 |
// ---------------------------------------------------------------------------
|
|
1504 |
// CCamSceneSettingContainer::DrawHighlight
|
|
1505 |
// Draws the highlight rect each time Animate() is called
|
|
1506 |
// ---------------------------------------------------------------------------
|
|
1507 |
//
|
|
1508 |
void CCamSceneSettingContainer::DrawHighlight() const
|
|
1509 |
{
|
|
1510 |
if( Flags() & CListItemDrawer::ESingleClickDisabledHighlight )
|
|
1511 |
{
|
|
1512 |
return;
|
|
1513 |
}
|
|
1514 |
|
|
1515 |
CWindowGc& gc = SystemGc();
|
|
1516 |
|
|
1517 |
TSize corner( KCornerSize,KCornerSize );
|
|
1518 |
// Clear the old highlight
|
|
1519 |
gc.SetPenSize( TSize( KBorderSize, KBorderSize ) );
|
|
1520 |
TLogicalRgb backgroundColour( TLogicalRgb::ESystemBackgroundColor );
|
|
1521 |
gc.SetPenColor( backgroundColour );
|
|
1522 |
gc.DrawRoundRect( iAnimData.iCurrentRectOld, corner );
|
|
1523 |
if ( !iAnimData.iScrolling )
|
|
1524 |
{
|
|
1525 |
gc.DrawRoundRect( iAnimData.iPreviousRectOld, corner );
|
|
1526 |
}
|
|
1527 |
// Draw the new highlight
|
|
1528 |
gc.SetPenSize( TSize( KBorderSize, KBorderSize ) );
|
|
1529 |
gc.SetPenColor( iAnimData.iPenFadeIn );
|
|
1530 |
gc.DrawRoundRect( iAnimData.iCurrentRect, corner );
|
|
1531 |
if ( !iAnimData.iScrolling )
|
|
1532 |
{
|
|
1533 |
gc.SetPenColor( iAnimData.iPenFadeOut );
|
|
1534 |
gc.DrawRoundRect( iAnimData.iPreviousRect, corner );
|
|
1535 |
}
|
|
1536 |
}
|
|
1537 |
|
|
1538 |
// ---------------------------------------------------------------------------
|
|
1539 |
// CCamSceneSettingContainer::DrawListL
|
|
1540 |
// Draws the list to an off-screen bitmap
|
|
1541 |
// ---------------------------------------------------------------------------
|
|
1542 |
//
|
|
1543 |
void CCamSceneSettingContainer::DrawListL()
|
|
1544 |
{
|
|
1545 |
// create an off-screen device and context
|
|
1546 |
CFbsBitGc* bitmapGc = NULL;
|
|
1547 |
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( iAnimData.iOffScreenBitmap );
|
|
1548 |
CleanupStack::PushL( bitmapDevice );
|
|
1549 |
User::LeaveIfError( bitmapDevice->CreateContext( bitmapGc ) );
|
|
1550 |
CleanupStack::PushL( bitmapGc );
|
|
1551 |
|
|
1552 |
bitmapGc->SetPenStyle( CGraphicsContext::ENullPen );
|
|
1553 |
bitmapGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
|
|
1554 |
bitmapGc->DrawRect( TRect( iAnimData.iOffScreenBitmap->SizeInPixels() ) );
|
|
1555 |
|
|
1556 |
TInt i;
|
|
1557 |
// only draw top 4 items in the list
|
|
1558 |
for ( i = 0; i < iNumberOfIconsToDisplay-1; i++ )
|
|
1559 |
{
|
|
1560 |
TInt position = iTopDisplayPosition + i;
|
|
1561 |
CCamSceneSettingItem* item = iSettingItemArray[position];
|
|
1562 |
|
|
1563 |
// Draw the standard icon
|
|
1564 |
iDisplacedIcons[i].DrawImage( *bitmapGc,
|
|
1565 |
const_cast<CFbsBitmap*>( item->Icon( ECamIconSizeSmall ) ), NULL );
|
|
1566 |
// Draw the header text
|
|
1567 |
iDisplacedTitles[i].DrawText( *bitmapGc, *item->Title() );
|
|
1568 |
}
|
|
1569 |
|
|
1570 |
CleanupStack::PopAndDestroy( bitmapGc );
|
|
1571 |
CleanupStack::PopAndDestroy( bitmapDevice );
|
|
1572 |
}
|
|
1573 |
|
|
1574 |
// ---------------------------------------------------------------------------
|
|
1575 |
// CCamSceneSettingContainer::ScrollList
|
|
1576 |
// Scrolls the list
|
|
1577 |
// ---------------------------------------------------------------------------
|
|
1578 |
//
|
|
1579 |
TBool CCamSceneSettingContainer::ScrollList()
|
|
1580 |
{
|
|
1581 |
SystemGc().BitBlt( iAnimData.iOffScreenPos, iAnimData.iOffScreenBitmap );
|
|
1582 |
if ( iAnimData.iMovingDown )
|
|
1583 |
{
|
|
1584 |
iAnimData.iOffScreenPos.iY -= iAnimData.iScrollingY;
|
|
1585 |
if ( iAnimData.iOffScreenPos.iY <= 0 )
|
|
1586 |
{
|
|
1587 |
return ETrue;
|
|
1588 |
}
|
|
1589 |
}
|
|
1590 |
else
|
|
1591 |
{
|
|
1592 |
iAnimData.iOffScreenPos.iY += iAnimData.iScrollingY;
|
|
1593 |
if ( iAnimData.iOffScreenPos.iY >= iDisplacedIcons[1].Rect().iTl.iY )
|
|
1594 |
{
|
|
1595 |
return ETrue;
|
|
1596 |
}
|
|
1597 |
}
|
|
1598 |
return EFalse;
|
|
1599 |
}
|
|
1600 |
|
|
1601 |
// ---------------------------------------------------------------------------
|
|
1602 |
// CCamSceneSettingContainer::MoveHighlight
|
|
1603 |
// Moves the highlight to its new position, ready to be animated
|
|
1604 |
// ---------------------------------------------------------------------------
|
|
1605 |
//
|
|
1606 |
void CCamSceneSettingContainer::MoveHighlight()
|
|
1607 |
{
|
|
1608 |
iAnimData.iPreviousRect = iAnimData.iCurrentRect;
|
|
1609 |
|
|
1610 |
TInt curIndex = iCurrentArrayPosition - iTopDisplayPosition;
|
|
1611 |
TInt prevIndex = iPreviousArrayPosition - iTopDisplayPosition;
|
|
1612 |
|
|
1613 |
TRect iconRect;
|
|
1614 |
TRect titleRect;
|
|
1615 |
|
|
1616 |
if ( iAnimData.iMovingDown )
|
|
1617 |
{
|
|
1618 |
TInt defaultIndex = curIndex - 1;
|
|
1619 |
iconRect = iNormalIcons[defaultIndex].Rect();
|
|
1620 |
titleRect = iNormalTitles[defaultIndex].TextRect();
|
|
1621 |
}
|
|
1622 |
else
|
|
1623 |
{
|
|
1624 |
iconRect = iDisplacedIcons[curIndex].Rect();
|
|
1625 |
titleRect = iDisplacedTitles[curIndex].TextRect();
|
|
1626 |
}
|
|
1627 |
|
|
1628 |
iAnimData.iCurrentRect = iHighlightArray[curIndex].Rect();
|
|
1629 |
iAnimData.iCurrentRect.iTl.iY = iconRect.iTl.iY;
|
|
1630 |
iAnimData.iCurrentRect.iBr.iY = iAnimData.iCurrentRect.iTl.iY + iconRect.Height();
|
|
1631 |
|
|
1632 |
iAnimData.iTitleFadeOut = iHighlightTitles[prevIndex].TextRect();
|
|
1633 |
iAnimData.iTitleFadeIn = titleRect;
|
|
1634 |
|
|
1635 |
iAnimData.iIconRectFadeOut = iHighlightIcons[prevIndex].Rect();
|
|
1636 |
iAnimData.iIconRectFadeIn = iconRect;
|
|
1637 |
}
|
|
1638 |
|
|
1639 |
// End of File
|