author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 11:51:19 +0300 | |
branch | RCL_3 |
changeset 62 | f0c0788c4de2 |
parent 57 | 2c87b2808fd7 |
child 67 | 756ad29ed18e |
permissions | -rw-r--r-- |
54 | 1 |
/* |
2 |
* Copyright (c) 2007-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: Camera Zoom Pane; shows the zoom level graphically* |
|
15 |
*/ |
|
16 |
||
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include <e32base.h> |
|
21 |
#include <e32std.h> |
|
22 |
#include <coemain.h> |
|
23 |
#include <eikenv.h> |
|
24 |
#include <cameraapp.mbg> |
|
25 |
#include <eikappui.h> // For CCoeAppUiBase |
|
26 |
#include <eikapp.h> // For CEikApplication |
|
27 |
#include <barsread.h> // resource reader |
|
28 |
#include <AknIconUtils.h> |
|
29 |
#include <centralrepository.h> |
|
30 |
#include <layoutmetadata.cdl.h> |
|
31 |
#include <aknlayoutscalable_apps.cdl.h> |
|
32 |
#include <touchfeedback.h> |
|
33 |
#include <cameraapp.rsg> |
|
34 |
#include <vgacamsettings.rsg> |
|
35 |
#include "CameraUiConfigManager.h" |
|
36 |
#include "CamPanic.h" // Panic codes |
|
37 |
#include "CamUtility.h" |
|
38 |
#include "CamZoomPane.h" |
|
39 |
#include "CamZoomModel.h" |
|
40 |
#include "CamAppUi.h" |
|
41 |
#include "CamBmpRotatorAo.h" |
|
42 |
#include "CameraappPrivateCRKeys.h" |
|
43 |
#include "CamTimer.h" |
|
44 |
||
45 |
||
46 |
// CONSTANTS |
|
47 |
const TInt KDivisorFactor = 10000; // integer scaling factor to avoid the |
|
48 |
// use of floating point arithmetic |
|
49 |
const TInt KTouchAreaExpansion = 35; // Pixels to grow touchable area |
|
50 |
const TInt KFastZoomMultiplier = 4; // Multiplier to skip some zoom levels |
|
51 |
// to make zooming faster. Used with double tap. |
|
52 |
||
53 |
// ============================ MEMBER FUNCTIONS =============================== |
|
54 |
||
55 |
// ----------------------------------------------------------------------------- |
|
56 |
// CCamZoomPane::CCamZoomPane |
|
57 |
// C++ default constructor can NOT contain any code, that |
|
58 |
// might leave. |
|
59 |
// ----------------------------------------------------------------------------- |
|
60 |
// |
|
61 |
CCamZoomPane::CCamZoomPane( CCamAppController& aController, TBool aOverlayViewFinder ) |
|
62 |
: iController( aController ), |
|
63 |
iOverlayViewFinder( aOverlayViewFinder ) |
|
64 |
{ |
|
65 |
} |
|
66 |
||
67 |
// ----------------------------------------------------------------------------- |
|
68 |
// CCamZoomPane::ConstructL |
|
69 |
// Symbian 2nd phase constructor can leave. |
|
70 |
// ----------------------------------------------------------------------------- |
|
71 |
// |
|
72 |
void CCamZoomPane::ConstructL() |
|
73 |
{ |
|
74 |
PRINT( _L( "Camera => CCamZoomPane::ConstructL " ) ); |
|
75 |
// Load the zoom pane orientation value from the Central Repository |
|
76 |
CRepository* repository = CRepository::NewL( KCRUidCameraappSettings ); |
|
77 |
TInt val = 0; |
|
78 |
TInt err = repository->Get( KCamCrZoomPaneOrientation, val ); |
|
79 |
||
80 |
// If there is an error then assume standard (vertical) orientation |
|
81 |
if ( err != KErrNone ) |
|
82 |
{ |
|
83 |
iOrientation = EZPOrientationVertical; |
|
84 |
} |
|
85 |
else |
|
86 |
{ |
|
87 |
iOrientation = static_cast<TZPOrientation>( val ); |
|
88 |
} |
|
89 |
#if !( defined(__WINS__) || defined(__WINSCW__) ) |
|
90 |
// Get Central Repository key indicating if product uses volume keys for zoom |
|
91 |
err = repository->Get( KCamCrZoomUsingVolumeKeys, val ); |
|
92 |
||
93 |
// If there is an error then assume volume keys not used |
|
94 |
if ( err != KErrNone ) |
|
95 |
{ |
|
96 |
iZoomUsingVolumeKeys = EFalse; |
|
97 |
} |
|
98 |
else |
|
99 |
{ |
|
100 |
iZoomUsingVolumeKeys = val; |
|
101 |
} |
|
102 |
||
103 |
iZoomUsingVolumeKeys = EFalse; |
|
104 |
||
105 |
// Get Central Repository key indicating if product uses navi-keys for zoom |
|
106 |
err = repository->Get( KCamCrZoomUsingNaviKeys, val ); |
|
107 |
||
108 |
// If there is an error then assume navi-keys not used |
|
109 |
if ( err != KErrNone ) |
|
110 |
{ |
|
111 |
iZoomUsingNaviKeys = EFalse; |
|
112 |
} |
|
113 |
else |
|
114 |
{ |
|
115 |
iZoomUsingNaviKeys = val; |
|
116 |
} |
|
117 |
#else |
|
118 |
iZoomUsingVolumeKeys = EFalse; |
|
119 |
iZoomUsingNaviKeys = ETrue; |
|
120 |
#endif // !( defined(__WINS__) || defined(__WINSCW__) ) |
|
121 |
||
122 |
delete repository; |
|
123 |
repository = NULL; |
|
124 |
||
125 |
// Find the name and path of the MBM file for zoom pane bitmaps |
|
126 |
TFileName resFileName; |
|
127 |
CamUtility::ResourceFileName( resFileName ); |
|
128 |
TPtrC resname = resFileName; |
|
129 |
||
130 |
// Create component bitmaps |
|
131 |
AknIconUtils::CreateIconL( iIconZoomTop[0], |
|
132 |
iIconZoomTop[1], |
|
133 |
resname, |
|
134 |
EMbmCameraappQgn_indi_cam4_zoom_top, |
|
135 |
EMbmCameraappQgn_indi_cam4_zoom_top_mask ); |
|
136 |
||
137 |
AknIconUtils::CreateIconL( iIconZoomMiddle[0], |
|
138 |
iIconZoomMiddle[1], |
|
139 |
resname, |
|
140 |
EMbmCameraappQgn_indi_cam4_zoom_middle, |
|
141 |
EMbmCameraappQgn_indi_cam4_zoom_middle_mask ); |
|
142 |
||
143 |
AknIconUtils::CreateIconL( iIconZoomBottom[0], |
|
144 |
iIconZoomBottom[1], |
|
145 |
resname, |
|
146 |
EMbmCameraappQgn_indi_cam4_zoom_bottom, |
|
147 |
EMbmCameraappQgn_indi_cam4_zoom_bottom_mask ); |
|
148 |
||
149 |
AknIconUtils::CreateIconL( iIconZoomMarker[0], |
|
150 |
iIconZoomMarker[1], |
|
151 |
resname, |
|
152 |
EMbmCameraappQgn_indi_cam4_zoom_marker, |
|
153 |
EMbmCameraappQgn_indi_cam4_zoom_marker_mask ); |
|
154 |
||
155 |
AknIconUtils::CreateIconL( iIconZoomMarkerGray[0], |
|
156 |
iIconZoomMarkerGray[1], |
|
157 |
resname, |
|
158 |
EMbmCameraappQgn_indi_cam4_zoom_marker_selected, |
|
159 |
EMbmCameraappQgn_indi_cam4_zoom_marker_selected_mask ); |
|
160 |
||
161 |
AknIconUtils::CreateIconL( iIconZoomMin[0], |
|
162 |
iIconZoomMin[1], |
|
163 |
resname, |
|
164 |
EMbmCameraappQgn_indi_cam4_zoom_min, |
|
165 |
EMbmCameraappQgn_indi_cam4_zoom_min_mask ); |
|
166 |
||
167 |
AknIconUtils::CreateIconL( iIconZoomMax[0], |
|
168 |
iIconZoomMax[1], |
|
169 |
resname, |
|
170 |
EMbmCameraappQgn_indi_cam4_zoom_max, |
|
171 |
EMbmCameraappQgn_indi_cam4_zoom_max_mask ); |
|
172 |
||
173 |
SizeChanged(); // Initialize layouts and set sizes |
|
174 |
CamUtility::SetAlphaL( iIconZoomTop[0], iIconZoomTop[1] ); |
|
175 |
CamUtility::SetAlphaL( iIconZoomMiddle[0], iIconZoomMiddle[1] ); |
|
176 |
CamUtility::SetAlphaL( iIconZoomBottom[0], iIconZoomBottom[1] ); |
|
177 |
CamUtility::SetAlphaL( iIconZoomMarker[0], iIconZoomMarker[1] ); |
|
178 |
CamUtility::SetAlphaL( iIconZoomMarkerGray[0], iIconZoomMarkerGray[1] ); |
|
179 |
CamUtility::SetAlphaL( iIconZoomMin[0], iIconZoomMin[1] ); |
|
180 |
CamUtility::SetAlphaL( iIconZoomMax[0], iIconZoomMax[1] ); |
|
181 |
iIconZoomMarkerCurrent = iIconZoomMarker[0]; |
|
182 |
||
183 |
// Retrieve product-specific information about zoom support |
|
184 |
CamUtility::GetPsiInt( ECamPsiVideoZoomSupport, iZoomSupport ); |
|
185 |
||
186 |
// Retrieve the timing and step values for each of the zoom bar |
|
187 |
// segments/modes eg Optical/Digital/Extended |
|
188 |
TPckgBuf <TCamZoomLAF> pckg; |
|
189 |
CamUtility::GetPsiAnyL( ECamPsiZoomBarLAF, &pckg); |
|
190 |
iZoomLAF = pckg(); |
|
191 |
||
192 |
// Register for notification of controller events |
|
193 |
iController.AddControllerObserverL( this ); |
|
194 |
||
195 |
iModel = CCamZoomModel::NewL( iController, this ); |
|
196 |
iFeedback = MTouchFeedback::Instance(); |
|
197 |
||
198 |
PRINT( _L( "Camera <= CCamZoomPane::ConstructL " ) ); |
|
199 |
} |
|
200 |
||
201 |
// ----------------------------------------------------------------------------- |
|
202 |
// CCamZoomPane::LoadResourceDataL() |
|
203 |
// Reads in all information needed from resources |
|
204 |
// ----------------------------------------------------------------------------- |
|
205 |
// |
|
206 |
void CCamZoomPane::LoadResourceDataL() |
|
207 |
{ |
|
208 |
PRINT( _L( "Camera => CCamZoomPane::LoadResourceDataL " ) ); |
|
209 |
ReadLayoutL(); |
|
210 |
PRINT( _L( "Camera <= CCamZoomPane::LoadResourceDataL " ) ); |
|
211 |
} |
|
212 |
||
213 |
// ----------------------------------------------------------------------------- |
|
214 |
// CCamZoomPane::UnloadResourceData() |
|
215 |
// Frees all dynamic resources allocated in LoadResourceDataL |
|
216 |
// ----------------------------------------------------------------------------- |
|
217 |
// |
|
218 |
void CCamZoomPane::UnloadResourceData() |
|
219 |
{ |
|
220 |
PRINT( _L( "Camera => CCamZoomPane::UnloadResourceData " ) ); |
|
221 |
PRINT( _L( "Camera <= CCamZoomPane::UnloadResourceData " ) ); |
|
222 |
} |
|
223 |
||
224 |
// ----------------------------------------------------------------------------- |
|
225 |
// CCamZoomPane::ReloadResourceDataL() |
|
226 |
// Refreshes all resource-based information stored in the class |
|
227 |
// ----------------------------------------------------------------------------- |
|
228 |
// |
|
229 |
void CCamZoomPane::ReloadResourceDataL() |
|
230 |
{ |
|
231 |
PRINT( _L( "Camera => CCamZoomPane::ReloadResourceDataL " ) ); |
|
232 |
UnloadResourceData(); |
|
233 |
LoadResourceDataL(); |
|
234 |
PRINT( _L( "Camera <= CCamZoomPane::ReloadResourceDataL " ) ); |
|
235 |
} |
|
236 |
||
237 |
// ----------------------------------------------------------------------------- |
|
238 |
// CCamZoomPane::NewL |
|
239 |
// Two-phased constructor. |
|
240 |
// ----------------------------------------------------------------------------- |
|
241 |
// |
|
242 |
CCamZoomPane* CCamZoomPane::NewL( CCamAppController& aController, |
|
243 |
TBool aOverlayViewFinder ) |
|
244 |
{ |
|
245 |
PRINT( _L( "Camera => CCamZoomPane::NewL " ) ); |
|
246 |
CCamZoomPane* self = new( ELeave ) CCamZoomPane ( aController, aOverlayViewFinder ); |
|
247 |
CleanupStack::PushL( self ); |
|
248 |
self->ConstructL(); |
|
249 |
CleanupStack::Pop( self ); |
|
250 |
PRINT( _L( "Camera <= CCamZoomPane::NewL " ) ); |
|
251 |
return self; |
|
252 |
} |
|
253 |
||
254 |
// ----------------------------------------------------------------------------- |
|
255 |
// CCamZoomPane::~CCamZoomPane |
|
256 |
// Destructor. |
|
257 |
// ----------------------------------------------------------------------------- |
|
258 |
// |
|
259 |
CCamZoomPane::~CCamZoomPane() |
|
260 |
{ |
|
261 |
PRINT( _L("Camera => ~CCamZoomPane" )) |
|
262 |
iController.RemoveControllerObserver( this ); |
|
263 |
||
264 |
delete iIconZoomTop[0]; |
|
265 |
delete iIconZoomMiddle[0]; |
|
266 |
delete iIconZoomBottom[0]; |
|
267 |
delete iIconZoomMarker[0]; |
|
268 |
delete iIconZoomMarkerGray[0]; |
|
269 |
delete iIconZoomMin[0]; |
|
270 |
delete iIconZoomMax[0]; |
|
271 |
delete iIconZoomTop[1]; |
|
272 |
delete iIconZoomMiddle[1]; |
|
273 |
delete iIconZoomBottom[1]; |
|
274 |
delete iIconZoomMarker[1]; |
|
275 |
delete iIconZoomMarkerGray[1]; |
|
276 |
delete iIconZoomMin[1]; |
|
277 |
delete iIconZoomMax[1]; |
|
278 |
||
279 |
delete iModel; |
|
280 |
||
281 |
if ( iRotatorAo && |
|
282 |
iRotatorAo->IsActive() ) |
|
283 |
{ |
|
284 |
iRotatorAo->Cancel(); |
|
285 |
} |
|
286 |
delete iRotatorAo; |
|
287 |
||
288 |
||
289 |
iZoomInKeys.Close(); |
|
290 |
iZoomOutKeys.Close(); |
|
291 |
||
292 |
PRINT( _L("Camera <= ~CCamZoomPane" )) |
|
293 |
} |
|
294 |
||
295 |
// ----------------------------------------------------------------------------- |
|
296 |
// CCamZoomPane::Draw |
|
297 |
// Draws the zoom pane |
|
298 |
// ----------------------------------------------------------------------------- |
|
299 |
// |
|
300 |
void CCamZoomPane::Draw( CBitmapContext& aGc ) const |
|
301 |
{ |
|
302 |
PRINT( _L( "Camera => CCamZoomPane::Draw " ) ); |
|
303 |
if ( !iMaxZoom ) |
|
304 |
{ |
|
305 |
PRINT( _L( "Camera <= CCamZoomPane::Draw not set up yet" ) ); |
|
306 |
return; // Not set up yet |
|
307 |
} |
|
308 |
||
309 |
if ( !iOverlayViewFinder ) |
|
310 |
{ |
|
311 |
aGc.Clear( iZoomPaneRect ); |
|
312 |
} |
|
313 |
||
314 |
DrawPlusMinus( aGc ); |
|
315 |
DrawShaft( aGc ); |
|
316 |
DrawThumb( aGc ); |
|
317 |
PRINT( _L( "Camera <= CCamZoomPane::Draw " ) ); |
|
318 |
} |
|
319 |
||
320 |
// ----------------------------------------------------------------------------- |
|
321 |
// CCamZoomPane::DrawPlusMinus |
|
322 |
// Draws the plus and minus icons |
|
323 |
// ----------------------------------------------------------------------------- |
|
324 |
// |
|
325 |
void CCamZoomPane::DrawPlusMinus( CBitmapContext& aGc ) const |
|
326 |
{ |
|
327 |
PRINT( _L( "Camera => CCamZoomPane::DrawPlusMinus " ) ); |
|
328 |
aGc.BitBlt( iPlusPoint, iIconZoomMax[0] ); |
|
329 |
aGc.BitBlt( iMinusPoint, iIconZoomMin[0] ); |
|
330 |
PRINT( _L( "Camera <= CCamZoomPane::DrawPlusMinus " ) ); |
|
331 |
} |
|
332 |
||
333 |
// ----------------------------------------------------------------------------- |
|
334 |
// CCamZoomPane::DrawShaft |
|
335 |
// Draws the shaft of the zoom pane |
|
336 |
// ----------------------------------------------------------------------------- |
|
337 |
// |
|
338 |
void CCamZoomPane::DrawShaft( CBitmapContext& aGc ) const |
|
339 |
{ |
|
340 |
PRINT( _L( "Camera => CCamZoomPane::DrawShaft " ) ); |
|
341 |
aGc.BitBlt( iTopPoint, iIconZoomTop[0] ); |
|
342 |
aGc.BitBlt( iMiddlePoint, iIconZoomMiddle[0] ); |
|
343 |
aGc.BitBlt( iBottomPoint, iIconZoomBottom[0] ); |
|
344 |
PRINT( _L( "Camera <= CCamZoomPane::DrawShaft " ) ); |
|
345 |
} |
|
346 |
||
347 |
// ----------------------------------------------------------------------------- |
|
348 |
// CCamZoomPane::SetPoint |
|
349 |
// Sets the value of a point based on another point and an (optional) modifier value. |
|
350 |
// This was added to simplify the bar drawing code, so the changes based on orientation |
|
351 |
// are (as much as possible) contained in this function |
|
352 |
// ----------------------------------------------------------------------------- |
|
353 |
// |
|
354 |
void |
|
355 |
CCamZoomPane::SetPoint( TPoint& aPoint, |
|
356 |
const TPoint& aOffset, |
|
357 |
TInt aAdditional ) const |
|
358 |
{ |
|
359 |
PRINT( _L( "Camera => CCamZoomPane::SetPoint " ) ); |
|
360 |
if ( PaneOrientation() == EZPOrientationVertical ) |
|
361 |
{ |
|
362 |
aPoint.iY = aOffset.iY + aAdditional; |
|
363 |
} |
|
364 |
else |
|
365 |
{ |
|
366 |
aPoint.iX = aOffset.iX - aAdditional; |
|
367 |
} |
|
368 |
PRINT( _L( "Camera <= CCamZoomPane::SetPoint " ) ); |
|
369 |
} |
|
370 |
||
371 |
// ----------------------------------------------------------------------------- |
|
372 |
// CCamZoomPane::PaneOrientation |
|
373 |
// Returns the current zoom pane orientation (taking into account whether this |
|
374 |
// should be forced or not if on secondary camera) |
|
375 |
// ----------------------------------------------------------------------------- |
|
376 |
// |
|
377 |
CCamZoomPane::TZPOrientation CCamZoomPane::PaneOrientation() const |
|
378 |
{ |
|
379 |
PRINT( _L( "Camera => CCamZoomPane::PaneOrientation " ) ); |
|
380 |
if ( iController.ActiveCamera() == ECamActiveCameraSecondary ) |
|
381 |
{ |
|
382 |
PRINT( _L( "Camera <= CCamZoomPane::PaneOrientation EZPOrientationVertical" ) ); |
|
383 |
return EZPOrientationVertical; |
|
384 |
} |
|
385 |
else |
|
386 |
{ |
|
387 |
PRINT( _L( "Camera <= CCamZoomPane::PaneOrientation iOrientation" ) ); |
|
388 |
return iOrientation; |
|
389 |
} |
|
390 |
} |
|
391 |
||
392 |
// ----------------------------------------------------------------------------- |
|
393 |
// CCamZoomPane::DrawThumb |
|
394 |
// Draws the thumb of the zoom pane |
|
395 |
// ----------------------------------------------------------------------------- |
|
396 |
// |
|
397 |
void CCamZoomPane::DrawThumb( CBitmapContext& aGc ) const |
|
398 |
{ |
|
399 |
PRINT( _L( "Camera => CCamZoomPane::DrawThumb " ) ); |
|
400 |
TPoint newThumbPos; |
|
401 |
// Knob bitmap has an empty area on the edge, thus it starts upper than top |
|
402 |
// of zoom slider |
|
403 |
// topPointY is iTl.iY of knob bitmap when maximum zoom is used. |
|
404 |
newThumbPos.iX = iZoomPaneRect.iTl.iX; |
|
405 |
||
406 |
TInt pixelsPerStep = ( iMaxOffset * KDivisorFactor ) / (iMaxZoom+1); |
|
407 |
TInt pixelsFromBase; |
|
408 |
pixelsFromBase = ( iTrgZoom * pixelsPerStep ); |
|
409 |
newThumbPos.iY = iTopPoint.iY + iMaxOffset - |
|
410 |
(pixelsFromBase + pixelsPerStep/2 + |
|
411 |
iIconZoomMarker[0]->SizeInPixels().iHeight * |
|
412 |
KDivisorFactor / 2) / KDivisorFactor; |
|
413 |
||
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
414 |
// Centralize thumb and slider X-axis. |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
415 |
TRect old = TRect(newThumbPos,iIconZoomMarkerCurrent->SizeInPixels()); |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
416 |
newThumbPos.iX += iSliderParentRect.Center().iX - old.Center().iX; |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
417 |
|
54 | 418 |
aGc.BitBlt( newThumbPos, iIconZoomMarkerCurrent ); |
419 |
PRINT( _L( "Camera <= CCamZoomPane::DrawThumb " ) ); |
|
420 |
} |
|
421 |
||
422 |
// ----------------------------------------------------------------------------- |
|
423 |
// CCamZoomPane::SetRect |
|
424 |
// Sets the rect that zoom pane is drawn into |
|
425 |
// ----------------------------------------------------------------------------- |
|
426 |
// |
|
427 |
void CCamZoomPane::SetRect( TRect aRect ) |
|
428 |
{ |
|
429 |
PRINT( _L( "Camera => CCamZoomPane::SetRect " ) ); |
|
430 |
iZoomPaneRect = aRect; |
|
431 |
PRINT( _L( "Camera <= CCamZoomPane::SetRect " ) ); |
|
432 |
} |
|
433 |
||
434 |
// ----------------------------------------------------------------------------- |
|
435 |
// CCamZoomPane::SetZoomRange |
|
436 |
// Specifies the range of values zoom supports |
|
437 |
// aMax should always be more than aMin. |
|
438 |
// ----------------------------------------------------------------------------- |
|
439 |
// |
|
440 |
TInt CCamZoomPane::SetZoomRange( TInt aMin, TInt aMax ) |
|
441 |
{ |
|
442 |
PRINT( _L( "Camera => CCamZoomPane::SetZoomRange " ) ); |
|
443 |
// The minimum value should always be less than the max. |
|
444 |
if ( aMin >= aMax || |
|
445 |
aMin < 0 ) |
|
446 |
{ |
|
447 |
PRINT( _L( "Camera <= CCamZoomPane::SetZoomRange KErrArgument" ) ); |
|
448 |
return KErrArgument; |
|
449 |
} |
|
450 |
||
451 |
iMinZoom = aMin; |
|
452 |
iMaxZoom = aMax; |
|
453 |
PRINT( _L( "Camera <= CCamZoomPane::SetZoomRange " ) ); |
|
454 |
return KErrNone; |
|
455 |
} |
|
456 |
||
457 |
// ----------------------------------------------------------------------------- |
|
458 |
// CCamZoomPane::SetZoomSteps |
|
459 |
// Sets the number of steps allowed in each category |
|
460 |
// ----------------------------------------------------------------------------- |
|
461 |
// |
|
462 |
void CCamZoomPane::SetZoomSteps( TInt aOptSteps, TInt aStdSteps, TInt aExtSteps ) |
|
463 |
{ |
|
464 |
PRINT( _L( "Camera => CCamZoomPane::SetZoomSteps " ) ); |
|
465 |
ASSERT( aOptSteps >= 0 && aStdSteps >= 0 && aExtSteps >= 0 ); |
|
466 |
||
467 |
iOptSteps = aOptSteps; |
|
468 |
iStdSteps = aStdSteps; |
|
469 |
iExtSteps = aExtSteps; |
|
470 |
PRINT( _L( "Camera <= CCamZoomPane::SetZoomSteps " ) ); |
|
471 |
} |
|
472 |
||
473 |
// ----------------------------------------------------------------------------- |
|
474 |
// CCamZoomPane::SetZoomValue |
|
475 |
// Specifies the current level of Zoom. |
|
476 |
// ----------------------------------------------------------------------------- |
|
477 |
// |
|
478 |
TInt CCamZoomPane::SetZoomValue( TInt aZoom ) |
|
479 |
{ |
|
480 |
PRINT1( _L( "Camera => CCamZoomPane::SetZoomValue aZoom=%d" ), aZoom ); |
|
481 |
if ( iController.UiConfigManagerPtr()->IsExtendedDigitalZoomSupported() ) |
|
482 |
{ |
|
483 |
// this may happen if in the extended zoom range |
|
484 |
// and we switch the extended range off - the |
|
485 |
// zoom value in the engine will be greater than |
|
486 |
// the max value allowed |
|
487 |
if ( aZoom > iMaxZoom ) |
|
488 |
{ |
|
489 |
aZoom = iMaxZoom; |
|
490 |
} |
|
491 |
} |
|
492 |
||
493 |
// Check supplied value is within valid range |
|
494 |
if ( aZoom < iMinZoom || aZoom > iMaxZoom ) |
|
495 |
{ |
|
496 |
PRINT( _L( "Camera <= CCamZoomPane::SetZoomValue KErrArgument" ) ); |
|
497 |
return KErrArgument; |
|
498 |
} |
|
499 |
||
500 |
iCurZoom = aZoom; |
|
501 |
iTrgZoom = aZoom; |
|
502 |
||
503 |
if ( iVisible ) |
|
504 |
{ |
|
505 |
// force redraw of zoom pane |
|
506 |
MakeVisible( ETrue, ETrue ); |
|
507 |
} |
|
508 |
||
509 |
PRINT( _L( "Camera <= CCamZoomPane::SetZoomValue " ) ); |
|
510 |
return KErrNone; |
|
511 |
} |
|
512 |
||
513 |
// ----------------------------------------------------------------------------- |
|
514 |
// CCamZoomPane::ZoomValue |
|
515 |
// Returns the current zoom value (as the ZoomPane knows it) |
|
516 |
// ----------------------------------------------------------------------------- |
|
517 |
// |
|
518 |
TInt CCamZoomPane::ZoomValue() const |
|
519 |
{ |
|
520 |
PRINT( _L( "Camera => CCamZoomPane::ZoomValue " ) ); |
|
521 |
PRINT1( _L( "Camera <= CCamZoomPane::ZoomValue iCurZoom=%d" ), iCurZoom ); |
|
522 |
return iCurZoom; |
|
523 |
} |
|
524 |
||
525 |
// ----------------------------------------------------------------------------- |
|
526 |
// CCamZoomPane::IsZoomAtMinimum |
|
527 |
// Returns whether the current zoom value is the minimum zoom |
|
528 |
// ----------------------------------------------------------------------------- |
|
529 |
// |
|
530 |
TBool CCamZoomPane::IsZoomAtMinimum() const |
|
531 |
{ |
|
532 |
PRINT2(_L("Camera =><= CCamZoomPane::IsZoomAtMinimum iCurZoom = %d, iMinZoom = %d"), iCurZoom, iMinZoom); |
|
533 |
return iCurZoom == iMinZoom; |
|
534 |
} |
|
535 |
||
536 |
// ----------------------------------------------------------------------------- |
|
537 |
// CCamZoomPane::IsZoomAtMaximum |
|
538 |
// Returns whether the current zoom value is the maximum zoom |
|
539 |
// ----------------------------------------------------------------------------- |
|
540 |
// |
|
541 |
TBool CCamZoomPane::IsZoomAtMaximum() const |
|
542 |
{ |
|
543 |
PRINT2(_L("Camera =><= CCamZoomPane::IsZoomAtMaximum iCurZoom = %d, iMaxZoom = %d"), iCurZoom, iMaxZoom); |
|
544 |
return iCurZoom == iMaxZoom; |
|
545 |
} |
|
546 |
||
547 |
// ----------------------------------------------------------------------------- |
|
548 |
// CCamZoomPane::OkToShowPane |
|
549 |
// Returns whether or not the Zoom Pane can currently be shown. |
|
550 |
// ----------------------------------------------------------------------------- |
|
551 |
// |
|
552 |
TBool CCamZoomPane::OkToShowPane() const |
|
553 |
{ |
|
554 |
PRINT( _L( "Camera => CCamZoomPane::OkToShowPane " ) ); |
|
555 |
// Are we currently recording video? |
|
556 |
if ( iRecordingVideo ) |
|
557 |
{ |
|
558 |
// Are we allowed to zoom when recording video? |
|
559 |
if ( ( iZoomSupport & ECamZoomWhenRecord ) ) |
|
560 |
{ |
|
561 |
PRINT( _L( "Camera <= CCamZoomPane::OkToShowPane ETrue" ) ); |
|
562 |
return ETrue; |
|
563 |
} |
|
564 |
else // If not allowed, return false |
|
565 |
{ |
|
566 |
PRINT( _L( "Camera <= CCamZoomPane::OkToShowPane EFalse" ) ); |
|
567 |
return EFalse; |
|
568 |
} |
|
569 |
} |
|
570 |
||
571 |
// If a sequence capture is in progress |
|
572 |
if ( iController.SequenceCaptureInProgress() ) |
|
573 |
{ |
|
574 |
PRINT( _L( "Camera <= CCamZoomPane::OkToShowPane EFalse" ) ); |
|
575 |
return EFalse; |
|
576 |
} |
|
577 |
||
578 |
PRINT( _L( "Camera <= CCamZoomPane::OkToShowPane ETrue" ) ); |
|
579 |
return ETrue; |
|
580 |
} |
|
581 |
||
582 |
// ----------------------------------------------------------------------------- |
|
583 |
// CCamZoomPane::HandleControllerEventL |
|
584 |
// Handle controller events, specifically to find out if video is currently |
|
585 |
// being recorded. Only called if Zooming while recording is NOT allowed |
|
586 |
// ----------------------------------------------------------------------------- |
|
587 |
// |
|
588 |
void CCamZoomPane::HandleControllerEventL( TCamControllerEvent aEvent, |
|
589 |
TInt /*aError*/ ) |
|
590 |
{ |
|
591 |
PRINT( _L( "Camera => CCamZoomPane::HandleControllerEventL " ) ); |
|
592 |
switch ( aEvent ) |
|
593 |
{ |
|
594 |
case ECamEventOperationStateChanged: |
|
595 |
{ |
|
596 |
iRecordingVideo = ECamControllerVideo == iController.CurrentMode() |
|
597 |
&& ECamCapturing == iController.CurrentOperation(); |
|
598 |
break; |
|
599 |
} |
|
600 |
case ECamEventCameraChanged: |
|
601 |
{ |
|
602 |
ReadLayoutL(); |
|
603 |
break; |
|
604 |
} |
|
605 |
case ECamEventCaptureComplete: |
|
606 |
{ |
|
607 |
// Release knob if image is captured with HW button while zooming. |
|
608 |
iIconZoomMarkerCurrent = iIconZoomMarker[0]; |
|
609 |
break; |
|
610 |
} |
|
611 |
default: |
|
612 |
break; |
|
613 |
} |
|
614 |
PRINT( _L( "Camera <= CCamZoomPane::HandleControllerEventL " ) ); |
|
615 |
} |
|
616 |
||
617 |
// ----------------------------------------------------------------------------- |
|
618 |
// CCamZoomPane::Rect |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
619 |
// Returns the whole zoom pane rect |
54 | 620 |
// ----------------------------------------------------------------------------- |
621 |
// |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
622 |
TRect CCamZoomPane::Extent() const |
54 | 623 |
{ |
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
624 |
PRINT( _L( "Camera =><= CCamZoomPane::Extent " ) ); |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
625 |
return iExtent; |
54 | 626 |
} |
627 |
||
628 |
// --------------------------------------------------------- |
|
629 |
// CCamZoomPane::ReadLayoutL |
|
630 |
// --------------------------------------------------------- |
|
631 |
// |
|
632 |
void CCamZoomPane::ReadLayoutL() |
|
633 |
{ |
|
634 |
PRINT( _L( "Camera =><= CCamZoomPane::ReadLayoutL " ) ); |
|
635 |
||
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
636 |
if ( AknLayoutUtils::PenEnabled() ) |
54 | 637 |
{ |
638 |
TouchLayout(); |
|
639 |
} |
|
640 |
else |
|
641 |
{ |
|
642 |
NonTouchLayout(); |
|
643 |
} |
|
644 |
} |
|
645 |
||
646 |
// ----------------------------------------------------------------------------- |
|
647 |
// CCamZoomPane::IsVisible |
|
648 |
// Is the zoom pane invisible |
|
649 |
// ----------------------------------------------------------------------------- |
|
650 |
// |
|
651 |
TBool CCamZoomPane::IsVisible() const |
|
652 |
{ |
|
653 |
PRINT( _L( "Camera =><= CCamZoomPane::IsVisible " ) ); |
|
654 |
return iVisible; |
|
655 |
} |
|
656 |
||
657 |
// ----------------------------------------------------------------------------- |
|
658 |
// CCamZoomPane::MakeVisible |
|
659 |
// Makes the zoom pane visible |
|
660 |
// ----------------------------------------------------------------------------- |
|
661 |
// |
|
662 |
void CCamZoomPane::MakeVisible( TBool aVisible, TBool aRedraw ) |
|
663 |
{ |
|
664 |
PRINT2( _L( "Camera => CCamZoomPane::MakeVisible aVisible=%d aRedraw=%d" ), aVisible, aRedraw ); |
|
665 |
iVisible = aVisible; |
|
666 |
||
667 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
668 |
||
669 |
// No zoom in secondary camera view |
|
670 |
if ( appUi && iController.ActiveCamera() == ECamActiveCameraPrimary ) |
|
671 |
{ |
|
672 |
if ( aVisible ) |
|
673 |
{ |
|
674 |
appUi->ShowZoomPane(aRedraw); |
|
675 |
} |
|
676 |
else |
|
677 |
{ |
|
678 |
appUi->HideZoomPane(aRedraw); |
|
679 |
iVisible = EFalse; |
|
680 |
} |
|
681 |
} |
|
682 |
PRINT( _L( "Camera <= CCamZoomPane::MakeVisible " ) ); |
|
683 |
} |
|
684 |
||
685 |
void CCamZoomPane::SetZoomKeys( const RArray<TInt>& aZoomIn, |
|
686 |
const RArray<TInt>& aZoomOut ) |
|
687 |
{ |
|
688 |
PRINT( _L( "Camera => CCamZoomPane::SetZoomKeys CAMERAAPP_MULTIPLE_ZOOM_KEYS" ) ); |
|
689 |
iZoomInKeys.Reset(); |
|
690 |
ReadZoomKeys( aZoomIn, iZoomInKeys ); |
|
691 |
iZoomOutKeys.Reset(); |
|
692 |
ReadZoomKeys( aZoomOut, iZoomOutKeys ); |
|
693 |
PRINT( _L( "Camera <= CCamZoomPane::SetZoomKeys " ) ); |
|
694 |
} |
|
695 |
||
696 |
// ----------------------------------------------------------------------------- |
|
697 |
// CCamZoomPane::ReadZoomKeys |
|
698 |
// ----------------------------------------------------------------------------- |
|
699 |
// |
|
700 |
void CCamZoomPane::ReadZoomKeys( const RArray<TInt>& aSource, |
|
701 |
RArray<TInt>& aTarget ) |
|
702 |
{ |
|
703 |
PRINT( _L( "Camera => CCamZoomPane::ReadZoomKeys " ) ); |
|
704 |
for ( TInt i = 0; i < aSource.Count(); i++ ) |
|
705 |
{ |
|
706 |
// here we ignore the error |
|
707 |
aTarget.Append( aSource[i] ); |
|
708 |
} |
|
709 |
PRINT( _L( "Camera <= CCamZoomPane::ReadZoomKeys " ) ); |
|
710 |
} |
|
711 |
||
712 |
// ----------------------------------------------------------------------------- |
|
713 |
// CCamZoomPane::CheckForZoomKey |
|
714 |
// ----------------------------------------------------------------------------- |
|
715 |
// |
|
716 |
TBool CCamZoomPane::CheckForZoomKey( const TKeyEvent& aKeyEvent, |
|
717 |
const RArray<TInt>& aKeys ) |
|
718 |
{ |
|
719 |
PRINT( _L( "Camera =><= CCamZoomPane::CheckForZoomKey " ) ); |
|
720 |
return (KErrNotFound != aKeys.Find( aKeyEvent.iScanCode )); |
|
721 |
} |
|
722 |
||
723 |
||
724 |
// ----------------------------------------------------------------------------- |
|
725 |
// CCamZoomPane::OfferKeyEventL |
|
726 |
// Handles key events for the zoom pane. |
|
727 |
// ----------------------------------------------------------------------------- |
|
728 |
// |
|
729 |
TKeyResponse CCamZoomPane::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
730 |
{ |
|
731 |
PRINT2( _L("Camera => CCamZoomPane::OfferKeyEventL (%d) (%d)"),aKeyEvent.iScanCode, aType ) |
|
732 |
TBool vertical = PaneOrientation() == EZPOrientationVertical; |
|
733 |
||
734 |
||
735 |
TBool foundZoomInKey = CheckForZoomKey( aKeyEvent, iZoomInKeys ); |
|
736 |
TBool foundZoomOutKey = CheckForZoomKey( aKeyEvent, iZoomOutKeys ); |
|
737 |
||
738 |
if ( foundZoomInKey && vertical || |
|
739 |
foundZoomOutKey && !vertical ) |
|
740 |
{ |
|
741 |
// Block key events if touch is active |
|
742 |
if ( iTouchActive ) |
|
743 |
{ |
|
744 |
return EKeyWasConsumed; |
|
745 |
} |
|
746 |
// Handle a zoom-in key as a valid event, and start zoom |
|
747 |
else if ( aType == EEventKeyDown ) |
|
748 |
{ |
|
749 |
iModel->ZoomIn(); |
|
750 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKeyDown, zoom in")) |
|
751 |
return EKeyWasConsumed; |
|
752 |
} |
|
753 |
// Handle an up zoom-in key as a valid event, only if currently |
|
754 |
// zooming. Can get stray up events if user woke from standby |
|
755 |
// with zoom key. This should filter these out. |
|
756 |
else if ( aType == EEventKeyUp && |
|
757 |
IsCurrentlyZooming() ) |
|
758 |
{ |
|
759 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKeyUp, stop zoom 1")) |
|
760 |
iModel->StopZoom(); |
|
761 |
return EKeyWasConsumed; |
|
762 |
} |
|
763 |
// Handle special zoom-in once request |
|
764 |
else if ( aType == EEventUser && |
|
765 |
!IsCurrentlyZooming() ) |
|
766 |
{ |
|
767 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKeyUp, zoom in once")) |
|
768 |
iModel->ZoomIn( ETrue ); |
|
769 |
return EKeyWasConsumed; |
|
770 |
} |
|
771 |
// Repeat "key" events are consumed (to keep the bar visible) but |
|
772 |
// no need to do anything with it as zooming is timer (not key event) based |
|
773 |
else if ( aType == EEventKey && |
|
774 |
aKeyEvent.iRepeats > 0 ) |
|
775 |
{ |
|
776 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKey repeated 1")) |
|
777 |
// Do nothing with it, but consume it |
|
778 |
return EKeyWasConsumed; |
|
779 |
} |
|
780 |
else |
|
781 |
{ |
|
782 |
// empty statement to remove Lint error. |
|
783 |
} |
|
784 |
||
785 |
} |
|
786 |
// If the orientation of the zoom pane changes, the keys to zoom in/out |
|
787 |
// need to switch to move in the correct direction on the zoom pane. |
|
788 |
else if ( foundZoomOutKey && vertical || |
|
789 |
foundZoomInKey && !vertical ) |
|
790 |
{ |
|
791 |
// Handle a zoom-out key as a valid event, and start zoom |
|
792 |
if ( aType == EEventKeyDown ) |
|
793 |
{ |
|
794 |
iModel->ZoomOut(); |
|
795 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKeyDown, zoom out")) |
|
796 |
return EKeyWasConsumed; |
|
797 |
} |
|
798 |
// Handle an up zoom-out key as a valid event, only if currently |
|
799 |
// zooming. Can get stray up events if user woke from standby |
|
800 |
// with zoom key. This should filter these out. |
|
801 |
else if ( aType == EEventKeyUp && |
|
802 |
IsCurrentlyZooming() ) |
|
803 |
{ |
|
804 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKeyUp, calling StopZoom")) |
|
805 |
iModel->StopZoom(); |
|
806 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKeyUp, stop zoom 2")) |
|
807 |
return EKeyWasConsumed; |
|
808 |
} |
|
809 |
// Handle special zoom-out once request |
|
810 |
else if ( aType == EEventUser && |
|
811 |
!IsCurrentlyZooming() ) |
|
812 |
{ |
|
813 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKeyUp, zoom out once")) |
|
814 |
iModel->ZoomOut( ETrue ); |
|
815 |
return EKeyWasConsumed; |
|
816 |
} |
|
817 |
// Repeat "key" events are consumed (to keep the bar visible) but |
|
818 |
// no need to do anything with it as zooming is timer (not key event) based |
|
819 |
else if ( aType == EEventKey && |
|
820 |
aKeyEvent.iRepeats > 0 ) |
|
821 |
{ |
|
822 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKey repeated 2")) |
|
823 |
// Do nothing with it, but consume it |
|
824 |
return EKeyWasConsumed; |
|
825 |
} |
|
826 |
else |
|
827 |
{ |
|
828 |
// empty statement to remove Lint error. |
|
829 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKey empty statement!")) |
|
830 |
} |
|
831 |
||
832 |
} |
|
833 |
// otherwise, do nothing |
|
834 |
else |
|
835 |
{ |
|
836 |
// empty statement to remove Lint error. |
|
837 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL EEventKey empty statement!!")) |
|
838 |
} |
|
839 |
PRINT( _L("Camera <= CCamZoomPane::OfferKeyEventL not consumed")) |
|
840 |
return EKeyWasNotConsumed; |
|
841 |
} |
|
842 |
||
843 |
// ----------------------------------------------------------------------------- |
|
844 |
// CCamZoomPane::HandleForegroundEvent |
|
845 |
// Performs required actions on gaining/losing foreground |
|
846 |
// ----------------------------------------------------------------------------- |
|
847 |
// |
|
848 |
void CCamZoomPane::HandleForegroundEvent( TBool aForeground ) |
|
849 |
{ |
|
850 |
PRINT( _L( "Camera => CCamZoomPane::HandleForegroundEvent " ) ); |
|
851 |
if ( !aForeground ) |
|
852 |
{ |
|
853 |
// Ensure any ongoing zoom is stopped |
|
854 |
PRINT( _L( "Camera <> CCamZoomPane::HandleForegroundEvent calling StopZoom" ) ); |
|
855 |
iModel->StopZoom(); |
|
856 |
} |
|
857 |
PRINT( _L( "Camera <= CCamZoomPane::HandleForegroundEvent " ) ); |
|
858 |
} |
|
859 |
||
860 |
// ----------------------------------------------------------------------------- |
|
861 |
// CCamZoomPane::IsCurrentlyZooming |
|
862 |
// Returns ETrue if the zoom model is currently zooming in/out, |
|
863 |
// else returns EFalse |
|
864 |
// ----------------------------------------------------------------------------- |
|
865 |
// |
|
866 |
TBool CCamZoomPane::IsCurrentlyZooming() const |
|
867 |
{ |
|
868 |
PRINT( _L( "Camera =><= CCamZoomPane::IsCurrentlyZooming " ) ); |
|
869 |
return iModel->IsCurrentlyZooming(); |
|
870 |
} |
|
871 |
||
872 |
// ----------------------------------------------------------------------------- |
|
873 |
// CCamZoomPane::ResetToDefaultAfterPrepare |
|
874 |
// Sets the zoompane to reset the zoom level to default values |
|
875 |
// next time the engine is prepared |
|
876 |
// ----------------------------------------------------------------------------- |
|
877 |
// |
|
878 |
void CCamZoomPane::ResetToDefaultAfterPrepare( TBool aReset ) |
|
879 |
{ |
|
880 |
PRINT( _L( "Camera =><= CCamZoomPane::ResetToDefaultAfterPrepare " ) ); |
|
881 |
iModel->ResetToDefaultAfterPrepare( aReset ); |
|
882 |
} |
|
883 |
||
884 |
// ----------------------------------------------------------------------------- |
|
885 |
// CCamZoomPane::IsResetPending |
|
886 |
// Whether or not the zoom level is waiting to be reset to default |
|
887 |
// ----------------------------------------------------------------------------- |
|
888 |
// |
|
889 |
TBool CCamZoomPane::IsResetPending() const |
|
890 |
{ |
|
891 |
PRINT( _L( "Camera =><= CCamZoomPane::IsResetPending " ) ); |
|
892 |
return iModel->IsResetPending(); |
|
893 |
} |
|
894 |
||
895 |
// ----------------------------------------------------------------------------- |
|
896 |
// CCamZoomPane::StopZoom |
|
897 |
// Stops zoom actions |
|
898 |
// ----------------------------------------------------------------------------- |
|
899 |
// |
|
900 |
void CCamZoomPane::StopZoom() |
|
901 |
{ |
|
902 |
PRINT( _L( "Camera => CCamZoomPane::StopZoom " ) ); |
|
903 |
iModel->StopZoom(); |
|
904 |
PRINT( _L( "Camera <= CCamZoomPane::StopZoom " ) ); |
|
905 |
} |
|
906 |
||
907 |
// ----------------------------------------------------------------------------- |
|
908 |
// CCamZoomPane::ResetZoomTo1x |
|
909 |
// Resets the zoom level to 1x. |
|
910 |
// ----------------------------------------------------------------------------- |
|
911 |
// |
|
912 |
void CCamZoomPane::ResetZoomTo1x() |
|
913 |
{ |
|
914 |
PRINT( _L( "Camera => CCamZoomPane::ResetZoomTo1x " ) ); |
|
915 |
iModel->ResetZoomTo1x(); |
|
916 |
PRINT( _L( "Camera <= CCamZoomPane::ResetZoomTo1x " ) ); |
|
917 |
} |
|
918 |
||
919 |
// ----------------------------------------------------------------------------- |
|
920 |
// CCamZoomPane::StartTouchZoomL |
|
921 |
// ----------------------------------------------------------------------------- |
|
922 |
// |
|
923 |
TBool CCamZoomPane::StartTouchZoomL( TInt aPointer ) |
|
924 |
{ |
|
925 |
PRINT( _L( "Camera => CCamZoomPane::StartTouchZoomL" ) ); |
|
926 |
||
927 |
// Block key events |
|
928 |
iTouchActive = ETrue; |
|
929 |
if ( !iMaxZoom ) // Avoid division by zero |
|
930 |
{ |
|
931 |
return EFalse; |
|
932 |
} |
|
933 |
TInt pixelsPerStep = ( iMaxOffset * KDivisorFactor ) / (iMaxZoom+1); |
|
934 |
||
935 |
PRINT1( _L( "Camera <> CCamZoomPane::StartTouchZoomL (iMaxZoom) %d" ), iMaxZoom ); |
|
936 |
PRINT1( _L( "Camera <> CCamZoomPane::StartTouchZoomL (iMinZoom) %d" ), iMinZoom ); |
|
937 |
PRINT1( _L( "Camera <> CCamZoomPane::StartTouchZoomL (pixelsPerStep) %d" ), pixelsPerStep ); |
|
938 |
||
939 |
// New zoom according to touched point |
|
940 |
TInt base = iSliderParentRect.iBr.iY - aPointer; |
|
941 |
PRINT1( _L( "Camera <> CCamZoomPane::StartTouchZoomL (base) %d" ), base ); |
|
942 |
||
943 |
// Target zoom level |
|
944 |
iTrgZoom = base * KDivisorFactor / pixelsPerStep; |
|
945 |
iTrgZoom = ( iTrgZoom < iMinZoom )? iMinZoom:iTrgZoom; |
|
946 |
iTrgZoom = ( iTrgZoom > iMaxZoom )? iMaxZoom:iTrgZoom; |
|
947 |
PRINT1( _L( "Camera <> CCamZoomPane::StartTouchZoomL (iTrgZoom) %d" ), iTrgZoom ); |
|
948 |
||
949 |
// Only update zoom when necessary |
|
950 |
if ( Abs( aPointer - iPointerPrevi ) >= pixelsPerStep / KDivisorFactor && |
|
951 |
iTrgZoom != iCurZoom ) |
|
952 |
{ |
|
953 |
PRINT( _L( "Camera <> CCamZoomPane::StartTouchZoomL ZoomTo" ) ); |
|
954 |
iModel->ZoomTo( iTrgZoom ); |
|
955 |
iPointerPrevi = aPointer; |
|
956 |
PRINT( _L( "Camera <= CCamZoomPane::StartTouchZoomL ETrue" ) ); |
|
957 |
return ETrue; |
|
958 |
} |
|
959 |
||
960 |
// Pointer didn't move, so we don't need to update anything |
|
961 |
PRINT( _L( "Camera <= CCamZoomPane::StartTouchZoomL EFalse" ) ); |
|
962 |
return EFalse; |
|
963 |
} |
|
964 |
||
965 |
// ----------------------------------------------------------------------------- |
|
966 |
// CCamZoomPane::HandlePointerEventL |
|
967 |
// ----------------------------------------------------------------------------- |
|
968 |
// |
|
969 |
TBool CCamZoomPane::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
970 |
{ |
|
971 |
PRINT( _L( "Camera => CCamZoomPane::HandlePointerEventL" ) ); |
|
972 |
||
973 |
if ( PaneOrientation() != EZPOrientationVertical ) |
|
974 |
{ |
|
975 |
PRINT( _L( "Camera <= CCamZoomPane::HandlePointerEventL (orientation)" ) ); |
|
976 |
return EFalse; // EZPOrientationHorizontal not supported |
|
977 |
} |
|
978 |
||
979 |
TRect tchZoomArea = iSliderParentRect; |
|
980 |
tchZoomArea.Grow( KTouchAreaExpansion, KTouchAreaExpansion ); |
|
981 |
TPointerEvent::TType type = aPointerEvent.iType; |
|
982 |
||
983 |
// Only make the pane appear on first touch |
|
984 |
if( !IsVisible() && |
|
985 |
type == TPointerEvent::EButton1Down ) |
|
986 |
{ |
|
987 |
Touchfeedback(); |
|
988 |
StopZoom(); |
|
989 |
MakeVisible( ETrue, ETrue ); |
|
990 |
PRINT( _L( "Camera <= CCamZoomPane::HandlePointerEventL (first touch)" ) ); |
|
991 |
return ETrue; |
|
992 |
} |
|
993 |
||
994 |
// At this point, the zoom pane should have already been visible |
|
995 |
// so we activate touch zoom if the pointer is on the zoom pane |
|
996 |
if ( IsVisible() && |
|
997 |
tchZoomArea.Contains( aPointerEvent.iPosition ) && |
|
998 |
type == TPointerEvent::EButton1Down ) |
|
999 |
{ |
|
1000 |
Touchfeedback(); |
|
1001 |
// Change zoom thumb to non-dimmed |
|
1002 |
iIconZoomMarkerCurrent = iIconZoomMarkerGray[0]; // Dimmed knob |
|
1003 |
// Force redraw of zoom pane, so knob will be dimmed |
|
1004 |
TBool ret = ETrue; |
|
1005 |
// Update zoom position, if necessary |
|
1006 |
StartTouchZoomL( aPointerEvent.iPosition.iY ); |
|
1007 |
PRINT( _L( "Camera <= CCamZoomPane::HandlePointerEventL (touch active)" ) ); |
|
1008 |
return ret; |
|
1009 |
} |
|
1010 |
||
1011 |
// If the zoom panel is visible, but the touch event is not in the |
|
1012 |
// zoom area, then make the zoom pane disappear. |
|
1013 |
if ( IsVisible() && |
|
1014 |
!tchZoomArea.Contains( aPointerEvent.iPosition ) && |
|
1015 |
type == TPointerEvent::EButton1Down ) |
|
1016 |
{ |
|
1017 |
Touchfeedback(); |
|
1018 |
// Cancel zoom if user is pushing the volume key |
|
1019 |
StopZoom(); |
|
1020 |
// Hide zoom pane |
|
1021 |
MakeVisible( EFalse, ETrue ); |
|
1022 |
PRINT( _L( "Camera <= CCamZoomPane::HandlePointerEventL (make disappear)" ) ); |
|
1023 |
// return EFalse so the calling component doesn't reactivate the zoom pane |
|
1024 |
return EFalse; |
|
1025 |
} |
|
1026 |
||
1027 |
// Only allow drag if the zoom is already active |
|
1028 |
if ( type == TPointerEvent::EDrag && |
|
1029 |
tchZoomArea.Contains( aPointerEvent.iPosition ) && |
|
1030 |
iTouchActive ) |
|
1031 |
{ |
|
1032 |
TBool ret = StartTouchZoomL( aPointerEvent.iPosition.iY ); |
|
1033 |
PRINT( _L( "Camera <= CCamZoomPane::HandlePointerEventL (dragging)" ) ); |
|
1034 |
return ret; |
|
1035 |
} |
|
1036 |
||
1037 |
// Clean up when the touch events are stopped |
|
1038 |
if ( type == TPointerEvent::EButton1Up || |
|
1039 |
(type == TPointerEvent::EDrag && |
|
1040 |
!tchZoomArea.Contains( aPointerEvent.iPosition ))) |
|
1041 |
{ |
|
1042 |
// don't do anything for stray touches |
|
1043 |
if ( iTouchActive ) |
|
1044 |
{ |
|
1045 |
// Key events are no longer blocked |
|
1046 |
iTouchActive = EFalse; |
|
1047 |
// Change zoom thumb to non-dimmed |
|
1048 |
iIconZoomMarkerCurrent = iIconZoomMarker[0]; |
|
1049 |
// force redraw of zoom pane, so knob is not dimmed anymore |
|
1050 |
MakeVisible( ETrue, ETrue ); |
|
1051 |
PRINT( _L( "Camera <= CCamZoomPane::HandlePointerEventL (touch stopped)" ) ); |
|
1052 |
return ETrue; |
|
1053 |
} |
|
1054 |
||
1055 |
PRINT( _L( "Camera <= CCamZoomPane::HandlePointerEventL (touch not active)" ) ); |
|
1056 |
return EFalse; |
|
1057 |
} |
|
1058 |
||
1059 |
PRINT( _L( "Camera <= CCamZoomPane::HandlePointerEventL (not handled)" ) ); |
|
1060 |
return EFalse; |
|
1061 |
} |
|
1062 |
||
1063 |
// --------------------------------------------------------- |
|
1064 |
// CCamZoomPane::SizeChanged |
|
1065 |
// Called when the view size is changed |
|
1066 |
// --------------------------------------------------------- |
|
1067 |
// |
|
1068 |
void CCamZoomPane::SizeChanged() |
|
1069 |
{ |
|
1070 |
PRINT( _L( "Camera => CCamZoomPane::SizeChanged" ) ); |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1071 |
if ( AknLayoutUtils::PenEnabled() ) |
54 | 1072 |
{ |
1073 |
TouchLayout(); |
|
1074 |
} |
|
1075 |
else |
|
1076 |
{ |
|
1077 |
NonTouchLayout(); |
|
1078 |
} |
|
1079 |
||
1080 |
PRINT( _L( "Camera <= CCamZoomPane::SizeChanged" ) ); |
|
1081 |
} |
|
1082 |
||
1083 |
// --------------------------------------------------------- |
|
1084 |
// CCamZoomPane::TouchLayout |
|
1085 |
// --------------------------------------------------------- |
|
1086 |
void CCamZoomPane::TouchLayout() |
|
1087 |
{ |
|
1088 |
PRINT( _L( "Camera => CCamZoomPane::TouchLayout()" ) ); |
|
1089 |
TRect mainPaneRect; |
|
1090 |
iMaxOffset = 0; |
|
1091 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, |
|
1092 |
mainPaneRect ); |
|
1093 |
mainPaneRect.Move( -mainPaneRect.iTl ); |
|
1094 |
||
1095 |
TInt variant = Layout_Meta_Data::IsLandscapeOrientation(); |
|
1096 |
TAknWindowComponentLayout l = AknLayoutScalable_Apps::cam4_zoom_pane(variant); |
|
1097 |
||
1098 |
TAknLayoutRect area; |
|
1099 |
area.LayoutRect( mainPaneRect, l.LayoutLine() ); |
|
1100 |
iZoomPaneRect = area.Rect(); |
|
1101 |
||
1102 |
l = AknLayoutScalable_Apps::cam4_zoom_cont_pane(variant); |
|
1103 |
area.LayoutRect( iZoomPaneRect, l.LayoutLine() ); |
|
1104 |
iSliderParentRect = area.Rect(); |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1105 |
iExtent = iSliderParentRect; |
54 | 1106 |
|
1107 |
l = AknLayoutScalable_Apps::cam4_zoom_pane_g1(variant); // + |
|
1108 |
area.LayoutRect( iZoomPaneRect, l.LayoutLine() ); |
|
1109 |
AknIconUtils::SetSize( iIconZoomMax[0], area.Rect().Size(), |
|
1110 |
EAspectRatioNotPreserved ); |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1111 |
iPlusPoint = area.Rect().iTl; |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1112 |
iExtent.BoundingRect(area.Rect()); |
54 | 1113 |
|
1114 |
l = AknLayoutScalable_Apps::cam4_zoom_pane_g2(variant); // - |
|
1115 |
area.LayoutRect( iZoomPaneRect, l.LayoutLine() ); |
|
1116 |
AknIconUtils::SetSize( iIconZoomMin[0], area.Rect().Size(), |
|
1117 |
EAspectRatioNotPreserved ); |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1118 |
iMinusPoint = area.Rect().iTl; |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1119 |
iExtent.BoundingRect(area.Rect()); |
54 | 1120 |
|
1121 |
l = AknLayoutScalable_Apps::cam4_zoom_cont_pane_g1(variant); // Top |
|
1122 |
area.LayoutRect( iSliderParentRect, l.LayoutLine() ); |
|
1123 |
AknIconUtils::SetSize( iIconZoomTop[0], area.Rect().Size(), |
|
1124 |
EAspectRatioNotPreserved ); |
|
1125 |
iTopPoint = area.Rect().iTl; |
|
1126 |
iMaxOffset += area.Rect().Height(); |
|
1127 |
||
1128 |
l = AknLayoutScalable_Apps::cam4_zoom_cont_pane_g3(variant); // Middle |
|
1129 |
area.LayoutRect( iSliderParentRect, l.LayoutLine() ); |
|
1130 |
iIconZoomMiddle[0]->Resize( area.Rect().Size()); |
|
1131 |
AknIconUtils::SetSize( iIconZoomMiddle[0], area.Rect().Size(), |
|
1132 |
EAspectRatioNotPreserved ); |
|
1133 |
iMiddlePoint = area.Rect().iTl; |
|
1134 |
iMaxOffset += area.Rect().Height(); |
|
1135 |
||
1136 |
l = AknLayoutScalable_Apps::cam4_zoom_cont_pane_g2(variant); // Bottom |
|
1137 |
area.LayoutRect( iSliderParentRect, l.LayoutLine() ); |
|
1138 |
AknIconUtils::SetSize( iIconZoomBottom[0], area.Rect().Size(), |
|
1139 |
EAspectRatioNotPreserved ); |
|
1140 |
iBottomPoint = area.Rect().iTl; |
|
1141 |
TRect bottomRect = area.Rect(); |
|
1142 |
iMaxOffset += area.Rect().Height(); |
|
1143 |
||
1144 |
l = AknLayoutScalable_Apps::cam4_zoom_pane_g3(variant); // Knob |
|
1145 |
area.LayoutRect(iSliderParentRect, l.LayoutLine() ); |
|
1146 |
TRect adj = iZoomPaneRect; |
|
1147 |
adj.SetHeight( area.Rect().Height() ); |
|
1148 |
adj.Move( bottomRect.Center() - adj.Center() ); |
|
1149 |
AknIconUtils::SetSize( iIconZoomMarker[0], adj.Size() ); |
|
1150 |
AknIconUtils::SetSize( iIconZoomMarkerGray[0], adj.Size() ); |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1151 |
|
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1152 |
if( iPlusPoint.iY < iTopPoint.iY ) |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1153 |
{ |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1154 |
// Thumb is drawn further than shaft. |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1155 |
// If Max(+) and Min(-) marks are extending shaft, |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1156 |
// parent rectangle covers everything. |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1157 |
iExtent = iZoomPaneRect; |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1158 |
} |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1159 |
else |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1160 |
{ |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1161 |
// If marks are drawn right side of shaft, |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1162 |
// extend area to redraw. |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1163 |
iExtent.Grow(0, adj.Size().iHeight/2); |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1164 |
} |
54 | 1165 |
|
1166 |
} |
|
1167 |
||
1168 |
// --------------------------------------------------------- |
|
1169 |
// CCamZoomPane::NonTouchLayout |
|
1170 |
// --------------------------------------------------------- |
|
1171 |
void CCamZoomPane::NonTouchLayout() |
|
1172 |
{ |
|
1173 |
TRect mainPaneRect; |
|
1174 |
iMaxOffset = 0; |
|
1175 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, |
|
1176 |
mainPaneRect ); |
|
1177 |
mainPaneRect.Move( -mainPaneRect.iTl ); |
|
1178 |
||
1179 |
TInt variant = Layout_Meta_Data::IsLandscapeOrientation(); |
|
1180 |
||
1181 |
TAknWindowComponentLayout l = AknLayoutScalable_Apps::cam6_zoom_pane(variant); |
|
1182 |
||
1183 |
TAknLayoutRect area; |
|
1184 |
area.LayoutRect( mainPaneRect, l.LayoutLine() ); |
|
1185 |
iZoomPaneRect = area.Rect(); |
|
1186 |
||
1187 |
l = AknLayoutScalable_Apps::cam6_zoom_cont_pane(variant); |
|
1188 |
area.LayoutRect( iZoomPaneRect, l.LayoutLine() ); |
|
1189 |
iSliderParentRect = area.Rect(); |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1190 |
iExtent = iSliderParentRect; |
54 | 1191 |
|
1192 |
l = AknLayoutScalable_Apps::cam6_zoom_pane_g1(variant); // + |
|
1193 |
area.LayoutRect( iZoomPaneRect, l.LayoutLine() ); |
|
1194 |
AknIconUtils::SetSize( iIconZoomMax[0], area.Rect().Size(), |
|
1195 |
EAspectRatioNotPreserved ); |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1196 |
iPlusPoint = area.Rect().iTl; |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1197 |
iExtent.BoundingRect(area.Rect()); |
54 | 1198 |
|
1199 |
l = AknLayoutScalable_Apps::cam6_zoom_pane_g2(variant); // - |
|
1200 |
area.LayoutRect( iZoomPaneRect, l.LayoutLine() ); |
|
1201 |
AknIconUtils::SetSize( iIconZoomMin[0], area.Rect().Size(), |
|
1202 |
EAspectRatioNotPreserved ); |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1203 |
iMinusPoint = area.Rect().iTl; |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1204 |
iExtent.BoundingRect(area.Rect()); |
54 | 1205 |
|
1206 |
l = AknLayoutScalable_Apps::cam6_zoom_cont_pane_g1(variant); // Top |
|
1207 |
area.LayoutRect( iSliderParentRect, l.LayoutLine() ); |
|
1208 |
AknIconUtils::SetSize( iIconZoomTop[0], area.Rect().Size(), |
|
1209 |
EAspectRatioNotPreserved ); |
|
1210 |
iTopPoint = area.Rect().iTl; |
|
1211 |
iMaxOffset += area.Rect().Height(); |
|
1212 |
||
1213 |
l = AknLayoutScalable_Apps::cam6_zoom_cont_pane_g3(variant); // Middle |
|
1214 |
area.LayoutRect( iSliderParentRect, l.LayoutLine() ); |
|
1215 |
iIconZoomMiddle[0]->Resize( area.Rect().Size()); |
|
1216 |
AknIconUtils::SetSize( iIconZoomMiddle[0], area.Rect().Size(), |
|
1217 |
EAspectRatioNotPreserved ); |
|
1218 |
iMiddlePoint = area.Rect().iTl; |
|
1219 |
iMaxOffset += area.Rect().Height(); |
|
1220 |
||
1221 |
l = AknLayoutScalable_Apps::cam6_zoom_cont_pane_g2(variant); // Bottom |
|
1222 |
area.LayoutRect( iSliderParentRect, l.LayoutLine() ); |
|
1223 |
AknIconUtils::SetSize( iIconZoomBottom[0], area.Rect().Size(), |
|
1224 |
EAspectRatioNotPreserved ); |
|
1225 |
iBottomPoint = area.Rect().iTl; |
|
1226 |
TRect bottomRect = area.Rect(); |
|
1227 |
iMaxOffset += area.Rect().Height(); |
|
1228 |
||
1229 |
l = AknLayoutScalable_Apps::cam6_zoom_pane_g3(variant); // Knob |
|
1230 |
area.LayoutRect(iSliderParentRect, l.LayoutLine() ); |
|
1231 |
iZoomPaneRect.iTl.iX += area.Rect().Width()/2; |
|
1232 |
AknIconUtils::SetSize( iIconZoomMarker[0], area.Rect().Size() ); |
|
1233 |
AknIconUtils::SetSize( iIconZoomMarkerGray[0], area.Rect().Size() ); |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1234 |
|
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1235 |
if( iPlusPoint.iY < iTopPoint.iY ) |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1236 |
{ |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1237 |
// Thumb is drawn further than shaft. |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1238 |
// If Max(+) and Min(-) marks are extending shaft, |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1239 |
// parent rectangle covers everything. |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1240 |
iExtent = iZoomPaneRect; |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1241 |
} |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1242 |
else |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1243 |
{ |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1244 |
// If marks are drawn right side of shaft, |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1245 |
// extend area to redraw. |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1246 |
iExtent.Grow(0, area.Rect().Size().iHeight/2); |
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
1247 |
} |
54 | 1248 |
} |
1249 |
||
1250 |
// --------------------------------------------------------- |
|
1251 |
// CCamZoomPane::Touchfeedback |
|
1252 |
// --------------------------------------------------------- |
|
1253 |
// |
|
1254 |
void CCamZoomPane::Touchfeedback() |
|
1255 |
{ |
|
1256 |
PRINT( _L( "Camera => CCamZoomPane::Touchfeedback" ) ); |
|
1257 |
if ( iFeedback ) |
|
1258 |
{ |
|
1259 |
iFeedback->InstantFeedback( iRecordingVideo? |
|
1260 |
ETouchFeedbackNone : ETouchFeedbackBasic ); |
|
1261 |
} |
|
1262 |
PRINT( _L( "Camera <= CCamZoomPane::Touchfeedback" ) ); |
|
1263 |
} |
|
1264 |
||
1265 |
// ----------------------------------------------------------------------------- |
|
1266 |
// CCamZoomPane::ZoomToMinimum |
|
1267 |
// Zooms out to min zoom level. Should be stopped by StopZoom(), if needed |
|
1268 |
// ----------------------------------------------------------------------------- |
|
1269 |
// |
|
1270 |
void CCamZoomPane::ZoomToMinimum() |
|
1271 |
{ |
|
1272 |
iModel->SetZoomMultiplier( KFastZoomMultiplier ); |
|
1273 |
iModel->ZoomOut(); |
|
1274 |
} |
|
1275 |
||
1276 |
// ----------------------------------------------------------------------------- |
|
1277 |
// CCamZoomPane::ZoomToMaximum |
|
1278 |
// Zooms in to max zoom level. Should be stopped by StopZoom(), if needed |
|
1279 |
// ----------------------------------------------------------------------------- |
|
1280 |
// |
|
1281 |
void CCamZoomPane::ZoomToMaximum() |
|
1282 |
{ |
|
1283 |
iModel->SetZoomMultiplier( KFastZoomMultiplier ); |
|
1284 |
iModel->ZoomIn(); |
|
1285 |
} |
|
1286 |
||
1287 |
// End of File |