1 /* |
|
2 * Copyright (c) 2007-2010 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: This implements a control which acts as a container for the* |
|
15 */ |
|
16 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <gulutil.h> |
|
20 #include <aknview.h> |
|
21 #include <avkon.hrh> |
|
22 #include <AknUtils.h> |
|
23 #include <barsread.h> |
|
24 #include <AknsFrameBackgroundControlContext.h> |
|
25 #include <AknsDrawUtils.h> |
|
26 #include <aknlayoutscalable_apps.cdl.h> |
|
27 #include <touchfeedback.h> |
|
28 #include <akntoolbar.h> |
|
29 |
|
30 |
|
31 #include "CamCaptureSetupContainer.h" |
|
32 #include "CamAppController.h" |
|
33 #include "CamCaptureSetupControlHandler.h" |
|
34 #include "CamUtility.h" |
|
35 #include "CamCaptureSetupListBox.h" |
|
36 |
|
37 |
|
38 #include <cameraapp.rsg> |
|
39 #include <vgacamsettings.rsg> |
|
40 |
|
41 #include "CamAppUi.h" |
|
42 |
|
43 #include "camcameraevents.h" |
|
44 #include "mcamlistboxmodel.h" |
|
45 |
|
46 // =========================================================================== |
|
47 // CONSTANTS |
|
48 |
|
49 const TUint KCameraEventInterest = ECamCameraEventClassVfData; |
|
50 const TUint32 KToolbarExtensionBgColor = 0x00000000; |
|
51 const TInt KToolBarExtensionBgAlpha = 0x7F; |
|
52 |
|
53 // =========================================================================== |
|
54 // MEMBER FUNCTIONS |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CCamCaptureSetupContainer::NewL |
|
58 // Symbian OS two-phased constructor |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CCamCaptureSetupContainer* CCamCaptureSetupContainer::NewL( |
|
62 CCamAppController& aController, |
|
63 CAknView& aView, |
|
64 CCamCaptureSetupControlHandler& aControlHandler, |
|
65 const TRect& aRect, TBool aFullScreenVF ) |
|
66 { |
|
67 CCamCaptureSetupContainer* self = new( ELeave ) CCamCaptureSetupContainer( |
|
68 aController, |
|
69 aView, |
|
70 aControlHandler, |
|
71 aFullScreenVF ); |
|
72 CleanupStack::PushL( self ); |
|
73 self->ConstructL( aRect ); |
|
74 CleanupStack::Pop( self ); |
|
75 // return newly created CCamCaptureSetupContainer instance |
|
76 return self; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------- |
|
80 // CCamCaptureSetupContainer::~CCamCaptureSetupContainer |
|
81 // Destructor |
|
82 // --------------------------------------------------------- |
|
83 // |
|
84 CCamCaptureSetupContainer::~CCamCaptureSetupContainer() |
|
85 { |
|
86 PRINT( _L("Camera => ~CCamCaptureSetupContainer") ); |
|
87 // <CAMERAAPP_CAPI_V2_MIGRATION/> |
|
88 |
|
89 iController.ViewfinderWindowDeleted( &Window() ); |
|
90 |
|
91 iController.RemoveCameraObserver( this ); |
|
92 |
|
93 delete iCaptureSetupControl; |
|
94 delete iTitleText; |
|
95 PRINT( _L("Camera <= ~CCamCaptureSetupContainer") ); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------- |
|
99 // CCamCaptureSetupContainer::ConstructL |
|
100 // Symbian OS 2nd phase constructor |
|
101 // --------------------------------------------------------- |
|
102 // |
|
103 void CCamCaptureSetupContainer::ConstructL( const TRect& aRect ) |
|
104 { |
|
105 PRINT( _L("Camera => CCamCaptureSetupContainer::ConstructL ") ); |
|
106 |
|
107 SetMopParent( &iView ); |
|
108 CCamContainerBase::BaseConstructL( aRect ); |
|
109 if ( iController.IsTouchScreenSupported() ) |
|
110 { |
|
111 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
112 CAknToolbar* fixedToolbar = appUi->CurrentFixedToolbar(); |
|
113 if ( fixedToolbar ) |
|
114 { |
|
115 // Remove toolbar from the settings view, before drawing VF, |
|
116 // in order to avoid flickering |
|
117 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
118 } |
|
119 } |
|
120 iViewFinding = iControlHandler.ControlUsesViewFinder(); |
|
121 |
|
122 if( iViewFinding ) |
|
123 { |
|
124 iCaptureSetupControl = iControlHandler.CreateCaptureSetupControlL( this, !iFullScreenVF ); |
|
125 } |
|
126 else |
|
127 { |
|
128 iCaptureSetupControl = iControlHandler.CreateCaptureSetupControlL( this, ETrue ); |
|
129 } |
|
130 iCaptureSetupControl->SetContainerWindowL( *this ); |
|
131 |
|
132 // If the control requires a viewfinder then add it |
|
133 if ( iViewFinding ) |
|
134 { |
|
135 // <CAMERAAPP_CAPI_V2_MIGRATION> |
|
136 iController.AddCameraObserverL( this, KCameraEventInterest ); |
|
137 // iController.AddViewFinderObserverL( this ); |
|
138 // </CAMERAAPP_CAPI_V2_MIGRATION> |
|
139 } |
|
140 |
|
141 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, |
|
142 iLayoutAreaRect ); |
|
143 |
|
144 // layout area rectangle contains the area, where components need to be |
|
145 // drawn to. the container size is the whole screen, but the layouts are |
|
146 // for the client area. aRect is the container size that might include or |
|
147 // might not include statuspane area. calculating area self will |
|
148 // go around the problem |
|
149 |
|
150 TRect listboxRect; |
|
151 if ( CamUtility::IsNhdDevice() ) |
|
152 { |
|
153 listboxRect = TouchLayout(); |
|
154 } |
|
155 else |
|
156 { |
|
157 listboxRect = NonTouchLayout(); |
|
158 } |
|
159 |
|
160 if ( iControlHandler.ControlIsListBox() ) |
|
161 { |
|
162 CCamCaptureSetupListBox* listbox = |
|
163 static_cast<CCamCaptureSetupListBox*>(iCaptureSetupControl); |
|
164 |
|
165 // Determine the height of the listbox; Either the height based on the |
|
166 // number of items, or the maximum allowed listbox height. |
|
167 CEikScrollBarFrame::TScrollBarVisibility visibility = |
|
168 CEikScrollBarFrame::EOff; |
|
169 TInt maxListBoxHeight = listboxRect.Height(); |
|
170 TInt listBoxHeight = listbox->CalcHeightBasedOnNumOfItems( |
|
171 listbox->Model()->NumberOfItems() ); |
|
172 if ( maxListBoxHeight < listBoxHeight ) |
|
173 { |
|
174 listBoxHeight = maxListBoxHeight; |
|
175 visibility = CEikScrollBarFrame::EOn; |
|
176 } |
|
177 |
|
178 const AknLayoutUtils::SAknLayoutControl listboxLayout = |
|
179 { ELayoutEmpty, listboxRect.iTl.iX, listboxRect.iTl.iY, |
|
180 ELayoutEmpty, ELayoutEmpty, listboxRect.Width(), listBoxHeight }; |
|
181 |
|
182 AknLayoutUtils::LayoutControl( iCaptureSetupControl, iLayoutAreaRect, |
|
183 listboxLayout); |
|
184 |
|
185 listbox->CreateScrollBarFrameL( ETrue ); |
|
186 listbox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
187 CEikScrollBarFrame::EOff, visibility ); |
|
188 listbox->MakeVisible( ETrue ); |
|
189 listbox->SetFocus( EFalse, ENoDrawNow ); |
|
190 listbox->UpdateScrollBarsL(); |
|
191 listbox->ScrollBarFrame()->DrawScrollBarsNow(); |
|
192 listbox->SetListBoxObserver(this); |
|
193 } |
|
194 |
|
195 iCaptureSetupControl->MakeVisible( ETrue ); |
|
196 iCaptureSetupControl->SetFocus( EFalse, EDrawNow ); |
|
197 iTitleText = iEikonEnv->AllocReadResourceL( |
|
198 iControlHandler.ControlTitleResourceId() ); |
|
199 iController.SetViewfinderWindowHandle( &Window() ); |
|
200 |
|
201 PRINT( _L("Camera <= CCamCaptureSetupContainer::ConstructL") ); |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // CCamCaptureSetupContainer::ControlPositionL |
|
206 // Return the top left position for the control |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 TPoint CCamCaptureSetupContainer::ControlPositionL() const |
|
210 { |
|
211 TPoint pos; |
|
212 |
|
213 // If the viewfinder preview is showing |
|
214 if ( iViewFinding ) |
|
215 { |
|
216 /* |
|
217 // Get the control pos from resource |
|
218 TResourceReader reader; |
|
219 TInt resource = iControlHandler.ControlPositionResourceId(); |
|
220 iEikonEnv->CreateResourceReaderLC( reader, resource ); |
|
221 |
|
222 pos.iX = reader.ReadInt16( ); |
|
223 pos.iY = reader.ReadInt16( ); |
|
224 iCaptureSetupControl->SetPosition( pos ); |
|
225 |
|
226 // Cleanup the resource reader. |
|
227 CleanupStack::PopAndDestroy(); // resource reader |
|
228 */ |
|
229 |
|
230 } |
|
231 else // The control should be centered horizontally |
|
232 { |
|
233 |
|
234 /* |
|
235 pos.iX = ( Rect().Width() - iListBoxWidth ) /2; |
|
236 pos.iY = ( Rect().Height() - |
|
237 iCaptureSetupControl->MinimumSize().iHeight ) /2; |
|
238 */ |
|
239 |
|
240 |
|
241 } |
|
242 return pos; |
|
243 } |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // CCamCaptureSetupContainer::CCamCaptureSetupContainer |
|
247 // C++ constructor |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 CCamCaptureSetupContainer::CCamCaptureSetupContainer( |
|
251 CCamAppController& aController, |
|
252 CAknView& aView, |
|
253 CCamCaptureSetupControlHandler& aControlHandler, |
|
254 TBool aFullScreenVF ) |
|
255 : CCamContainerBase( aController, aView ), |
|
256 iControlHandler( aControlHandler ), |
|
257 iActivateOnTouchRelease(EFalse), |
|
258 iFullScreenVF(aFullScreenVF) |
|
259 { |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------- |
|
263 // CCamCaptureSetupContainer::CountComponentControls |
|
264 // Returns the number of controls owned |
|
265 // --------------------------------------------------------- |
|
266 // |
|
267 TInt CCamCaptureSetupContainer::CountComponentControls() const |
|
268 { |
|
269 return CCamContainerBase::CountComponentControls() + 1; // Return the number of controls inside this container |
|
270 } |
|
271 |
|
272 // --------------------------------------------------------- |
|
273 // CCamCaptureSetupContainer::ComponentControl |
|
274 // --------------------------------------------------------- |
|
275 // |
|
276 CCoeControl* CCamCaptureSetupContainer::ComponentControl( TInt aIndex ) const |
|
277 { |
|
278 CCoeControl* control = CCamContainerBase::ComponentControl( aIndex ); |
|
279 if( control == NULL) |
|
280 { |
|
281 control = iCaptureSetupControl; |
|
282 } |
|
283 return control; |
|
284 } |
|
285 |
|
286 // --------------------------------------------------------- |
|
287 // CCamCaptureSetupContainer::Draw |
|
288 // Draw control |
|
289 // --------------------------------------------------------- |
|
290 // |
|
291 void CCamCaptureSetupContainer::Draw( const TRect& aRect ) const |
|
292 { |
|
293 PRINT( _L("Camera => CCamCaptureSetupContainer::Draw")) |
|
294 CWindowGc& gc = SystemGc(); |
|
295 |
|
296 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
297 AknsDrawUtils::Background( skin, iBgContext, gc, aRect/*Rect()*/ ); |
|
298 |
|
299 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
300 |
|
301 PRINT( _L("Camera => CCamCaptureSetupContainer::Draw direct VF")) |
|
302 |
|
303 if( appUi->IsDirectViewfinderActive() && |
|
304 iViewFinding ) |
|
305 { |
|
306 // Fill control with transparency bg colour |
|
307 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
308 |
|
309 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
310 gc.SetBrushColor( TRgb::Color16MA( 0 ) ); |
|
311 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
312 if( iFullScreenVF ) |
|
313 { |
|
314 gc.DrawRect( aRect ); |
|
315 } |
|
316 else |
|
317 { |
|
318 gc.DrawRect( iViewFinderRectLayout.Rect() ); |
|
319 } |
|
320 |
|
321 // Reset the brush after use (otherwise anything drawn |
|
322 // after the viewfinder will also show viewfinder frames) |
|
323 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
324 } |
|
325 |
|
326 // draw the title text |
|
327 TRgb color; |
|
328 AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, |
|
329 EAknsCIQsnTextColorsCG6 ); |
|
330 if ( CamUtility::IsNhdDevice() ) |
|
331 { |
|
332 if( appUi->IsDirectViewfinderActive() && |
|
333 iViewFinding && iFullScreenVF ) |
|
334 { |
|
335 gc.SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) ); |
|
336 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
337 gc.DrawRect( TRect( iLayoutAreaRect.iTl.iX, |
|
338 iLayoutAreaRect.iTl.iY, |
|
339 iLayoutAreaRect.iBr.iX, |
|
340 iTitleTextRectLayout.TextRect().iBr.iY ) ); |
|
341 |
|
342 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
343 |
|
344 color=TRgb( KRgbWhite ); |
|
345 iTitleTextRectLayout.DrawText( gc, *iTitleText, ETrue, color ); |
|
346 } |
|
347 else |
|
348 { |
|
349 iTitleTextRectLayout.DrawText( gc, *iTitleText, ETrue, color ); |
|
350 } |
|
351 } |
|
352 else |
|
353 { |
|
354 TRAP_IGNORE( appUi->SetTitleL( *iTitleText )); |
|
355 } |
|
356 PRINT( _L("Camera <= CCamCaptureSetupContainer::Draw")) |
|
357 } |
|
358 |
|
359 // ---------------------------------------------------- |
|
360 // CCamCaptureSetupContainer::OfferKeyEventL |
|
361 // ---------------------------------------------------- |
|
362 // |
|
363 TKeyResponse CCamCaptureSetupContainer::OfferKeyEventL( |
|
364 const TKeyEvent& aKeyEvent, |
|
365 TEventCode aType ) |
|
366 { |
|
367 if( iController.CurrentMode() == ECamControllerIdle || |
|
368 iController.CurrentMode() == ECamControllerShutdown ) |
|
369 { |
|
370 if( !iController.IsViewFinding() && iViewFinding |
|
371 && ( IsCaptureKeyL( aKeyEvent, aType ) |
|
372 || IsShutterKeyL( aKeyEvent, aType ) ) ) |
|
373 { |
|
374 PRINT( _L("Camera <> CCamCaptureSetupContainer::OfferKeyEventL coming back from standby" )) |
|
375 ReserveAndStartVF(); |
|
376 } |
|
377 return EKeyWasNotConsumed; |
|
378 } |
|
379 |
|
380 PRINT( _L("Camera => CCamCaptureSetupContainer::OfferKeyEventL" )) |
|
381 iController.StartIdleTimer(); |
|
382 |
|
383 if( !iController.IsViewFinding() && iViewFinding |
|
384 && IsCaptureKeyL( aKeyEvent, aType ) ) |
|
385 { |
|
386 // If VF was stopped by stand-by-timer, restart VF here |
|
387 ReserveAndStartVF(); |
|
388 } |
|
389 |
|
390 // If the Ok button or shutter key is pressed, select the current item |
|
391 if ( ( aKeyEvent.iCode == EKeyOK && aKeyEvent.iRepeats == 0 && aType == EEventKey ) || |
|
392 ( aType == EEventKey && |
|
393 ( IsCaptureKeyL( aKeyEvent, aType ) || IsShutterKeyL( aKeyEvent, aType ) ) ) ) |
|
394 { |
|
395 TKeyResponse response = iCaptureSetupControl->OfferKeyEventL( aKeyEvent, aType ); |
|
396 if ( aType == EEventKey && response == EKeyWasNotConsumed && aKeyEvent.iCode != EKeyOK && |
|
397 ( ECamSettingItemDynamicPhotoFlash == iControlHandler.SettingType() || |
|
398 ECamSettingItemDynamicSelfTimer == iControlHandler.SettingType() ) ) |
|
399 { |
|
400 iView.HandleCommandL( EAknSoftkeyCancel ); |
|
401 } |
|
402 else |
|
403 { |
|
404 iView.HandleCommandL( EAknSoftkeyOk ); |
|
405 } |
|
406 return EKeyWasConsumed; |
|
407 } |
|
408 return iCaptureSetupControl->OfferKeyEventL( aKeyEvent, aType ); |
|
409 } |
|
410 |
|
411 // <CAMERAAPP_CAPI_V2_MIGRATION> |
|
412 // =========================================================================== |
|
413 // From MCamCameraObserver |
|
414 |
|
415 // --------------------------------------------------------------------------- |
|
416 // virtual HandleCameraEventL |
|
417 // --------------------------------------------------------------------------- |
|
418 // |
|
419 void |
|
420 CCamCaptureSetupContainer::HandleCameraEventL( TInt aStatus, |
|
421 TCamCameraEventId aEventId, |
|
422 TAny* aEventData /*= NULL*/ ) |
|
423 { |
|
424 if ( iViewFinding |
|
425 && ECamCameraEventVfFrameReady == aEventId |
|
426 && KErrNone == aStatus ) |
|
427 { |
|
428 CFbsBitmap* frame = static_cast<CFbsBitmap*>( aEventData ); |
|
429 if( frame ) |
|
430 { |
|
431 // Draw a portion of the viewfinder |
|
432 CWindowGc& gc = SystemGc(); |
|
433 gc.Activate( *DrawableWindow() ); |
|
434 TRect rect = iViewFinderRectLayout.Rect(); |
|
435 RWindow window = Window(); |
|
436 window.Invalidate( rect ); |
|
437 window.BeginRedraw( rect ); |
|
438 TRect bitmapPortion = rect; |
|
439 TSize bitmapSize = frame->SizeInPixels(); |
|
440 // if the bitmap is too short to offset vertically |
|
441 // display from its top edge |
|
442 if ( bitmapSize.iHeight - rect.iTl.iY < rect.Height() ) |
|
443 { |
|
444 bitmapPortion.Move( 0, 0 - rect.iTl.iY ); |
|
445 } |
|
446 // if the bitmap is too narrow to offset horizontally |
|
447 // display from its left edge |
|
448 if ( bitmapSize.iWidth - rect.iTl.iX < rect.Width() ) |
|
449 { |
|
450 bitmapPortion.Move( 0 - rect.iTl.iX, 0 ); |
|
451 } |
|
452 gc.BitBlt( rect.iTl, frame, bitmapPortion ); |
|
453 |
|
454 window.EndRedraw(); |
|
455 gc.Deactivate(); |
|
456 } |
|
457 } |
|
458 } |
|
459 |
|
460 // --------------------------------------------------------- |
|
461 // CCamCaptureSetupContainer::HandlePointerEventL |
|
462 // --------------------------------------------------------- |
|
463 // |
|
464 void CCamCaptureSetupContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
465 { |
|
466 |
|
467 RDebug::Print(_L("CCamCaptureSetupContainer::HandlePointerEventL iType=%d iPosition=(%d, %d)"), |
|
468 aPointerEvent.iType, |
|
469 aPointerEvent.iPosition.iX, |
|
470 aPointerEvent.iPosition.iY ); |
|
471 if( !iController.IsViewFinding() && iViewFinding ) |
|
472 { |
|
473 PRINT ( _L("Camera <> CCamCaptureSetupContainer::HandlePointerEventL start viewfinder") ); |
|
474 ReserveAndStartVF(); |
|
475 } |
|
476 else |
|
477 { |
|
478 PRINT ( _L("Camera <> CCamCaptureSetupContainer::HandlePointerEventL handle selected item") ); |
|
479 iCaptureSetupControl->HandlePointerEventL( aPointerEvent ); |
|
480 } |
|
481 |
|
482 /*if( iController.CurrentMode() == ECamControllerIdle || |
|
483 iController.CurrentMode() == ECamControllerShutdown ) |
|
484 { |
|
485 return; |
|
486 } |
|
487 |
|
488 if( !iController.IsViewFinding() && iViewFinding ) |
|
489 { |
|
490 // First tap just starts viewfinder |
|
491 iController.StartViewFinder(); |
|
492 iController.StartIdleTimer(); |
|
493 return; |
|
494 } |
|
495 |
|
496 if ( iControlHandler.ControlIsListBox() && iCaptureSetupControl ) |
|
497 { |
|
498 |
|
499 TInt oldListItemIndex = -1; |
|
500 TInt newListItemIndex = -1; |
|
501 TBool handleItemActivation = EFalse; |
|
502 |
|
503 CCamCaptureSetupListBox* listbox = static_cast<CCamCaptureSetupListBox*>(iCaptureSetupControl); |
|
504 |
|
505 if ( listbox ) |
|
506 { |
|
507 oldListItemIndex = listbox->CurrentItemIndex(); |
|
508 } |
|
509 |
|
510 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
511 |
|
512 if ( listbox ) |
|
513 { |
|
514 newListItemIndex = listbox->CurrentItemIndex(); |
|
515 } |
|
516 |
|
517 if ( oldListItemIndex != -1 && newListItemIndex != -1 ) |
|
518 { |
|
519 |
|
520 // figure out if item was activated by touch down + release combination on same item |
|
521 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
522 { |
|
523 if ( newListItemIndex != oldListItemIndex ) |
|
524 { |
|
525 iActivateOnTouchRelease = EFalse; |
|
526 } |
|
527 else |
|
528 { |
|
529 // set the current item to be activated on touch release |
|
530 iActivateOnTouchRelease = ETrue; |
|
531 } |
|
532 } |
|
533 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
534 { |
|
535 if ( iActivateOnTouchRelease && ( newListItemIndex == oldListItemIndex ) ) |
|
536 { |
|
537 TInt pointedItemIndex; |
|
538 TBool focusableItemPointed = listbox->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointedItemIndex ); |
|
539 // check that pointer is in focusable area |
|
540 if ( focusableItemPointed ) |
|
541 { |
|
542 // only if list item index has not changed during event and iActivateOnTouchRelease is true |
|
543 handleItemActivation = ETrue; |
|
544 iActivateOnTouchRelease = EFalse; |
|
545 } |
|
546 else |
|
547 { |
|
548 iActivateOnTouchRelease = EFalse; |
|
549 } |
|
550 } |
|
551 } |
|
552 else |
|
553 { |
|
554 // aPointerEvent.iType == TPointerEvent::EDrag |
|
555 |
|
556 if ( newListItemIndex != oldListItemIndex ) |
|
557 { |
|
558 // change only when drag event changes the listitem index |
|
559 iActivateOnTouchRelease = EFalse; |
|
560 } |
|
561 |
|
562 } |
|
563 |
|
564 } // end if ( oldListItemIndex != -1 && newListItemIndex != -1 ) |
|
565 |
|
566 if ( handleItemActivation ) |
|
567 { |
|
568 iView.HandleCommandL( EAknSoftkeyOk ); |
|
569 } |
|
570 |
|
571 } // end if ( iControlHandler.ControlIsListBox() && iCaptureSetupControl ) |
|
572 else |
|
573 { |
|
574 // make sure that base class functionality is called even if |
|
575 // container has some other control than listbox |
|
576 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
577 }*/ |
|
578 //iCaptureSetupControl->HandlePointerEventL( aPointerEvent ); |
|
579 } |
|
580 |
|
581 // --------------------------------------------------------- |
|
582 // CCamCaptureSetupContainer::TouchLayout |
|
583 // --------------------------------------------------------- |
|
584 // |
|
585 TRect CCamCaptureSetupContainer::TouchLayout() |
|
586 { |
|
587 TRect statusPaneRect; |
|
588 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, |
|
589 statusPaneRect ); |
|
590 iLayoutAreaRect.BoundingRect( statusPaneRect ); |
|
591 |
|
592 if ( iControlHandler.ControlIsListBox() ) |
|
593 { |
|
594 TAknLayoutRect listboxLayoutRect; |
|
595 if ( iViewFinding ) |
|
596 { |
|
597 listboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
598 AknLayoutScalable_Apps::main_cset_listscroll_pane( 2 ) ); |
|
599 } |
|
600 else |
|
601 { |
|
602 listboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
603 AknLayoutScalable_Apps::main_cset_listscroll_pane( 3 ) ); |
|
604 } |
|
605 iViewFinderRectLayout.LayoutRect( iLayoutAreaRect, |
|
606 AknLayoutScalable_Apps::main_cam_set_pane_g2( 2 ) ); |
|
607 iTitleTextRectLayout.LayoutText( iLayoutAreaRect, |
|
608 AknLayoutScalable_Apps::main_cam_set_pane_t1( 3 ) ); |
|
609 return listboxLayoutRect.Rect(); |
|
610 } |
|
611 else // slider |
|
612 { |
|
613 TAknLayoutRect settingLayout; |
|
614 settingLayout.LayoutRect( iLayoutAreaRect, |
|
615 AknLayoutScalable_Apps::main_cam_set_pane( 0 ) ); |
|
616 TRect settingRect( settingLayout.Rect() ); |
|
617 AknLayoutUtils::LayoutControl( iCaptureSetupControl, settingRect, |
|
618 AknLayoutScalable_Apps::main_cset_slider_pane( 1 ) ); |
|
619 |
|
620 iViewFinderRectLayout.LayoutRect( iLayoutAreaRect, |
|
621 AknLayoutScalable_Apps::main_cam_set_pane_g2( 3 ) ); |
|
622 iTitleTextRectLayout.LayoutText( iLayoutAreaRect, |
|
623 AknLayoutScalable_Apps::main_cam_set_pane_t1( 5 ) ); |
|
624 return settingRect; |
|
625 } |
|
626 } |
|
627 |
|
628 // --------------------------------------------------------- |
|
629 // CCamCaptureSetupContainer::NonTouchLayout |
|
630 // --------------------------------------------------------- |
|
631 // |
|
632 TRect CCamCaptureSetupContainer::NonTouchLayout() |
|
633 { |
|
634 // Non-touch has a visible title & status panes |
|
635 TRect titlePaneRect; |
|
636 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, |
|
637 titlePaneRect ); |
|
638 iLayoutAreaRect.Move( 0, -titlePaneRect.Height() ); |
|
639 |
|
640 if ( iControlHandler.ControlIsListBox() ) |
|
641 { |
|
642 TAknLayoutRect listboxLayoutRect; |
|
643 if ( iViewFinding ) |
|
644 { |
|
645 listboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
646 AknLayoutScalable_Apps::main_cset6_listscroll_pane( 2 ) ); |
|
647 } |
|
648 else |
|
649 { |
|
650 listboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
651 AknLayoutScalable_Apps::main_cset6_listscroll_pane( 3 ) ); |
|
652 } |
|
653 iViewFinderRectLayout.LayoutRect( iLayoutAreaRect, |
|
654 AknLayoutScalable_Apps::main_cam6_set_pane_g2( 2 ) ); |
|
655 return listboxLayoutRect.Rect(); |
|
656 } |
|
657 else // slider |
|
658 { |
|
659 TAknLayoutRect settingLayout; |
|
660 settingLayout.LayoutRect( iLayoutAreaRect, |
|
661 AknLayoutScalable_Apps::main_cam6_set_pane() ); |
|
662 TRect settingRect( settingLayout.Rect() ); |
|
663 AknLayoutUtils::LayoutControl( iCaptureSetupControl, settingRect, |
|
664 AknLayoutScalable_Apps::main_cset6_slider_pane( 1 ) ); |
|
665 iViewFinderRectLayout.LayoutRect( iLayoutAreaRect, |
|
666 AknLayoutScalable_Apps::main_cam6_set_pane_g2( 3 ) ); |
|
667 return settingRect; |
|
668 } |
|
669 } |
|
670 |
|
671 // ---------------------------------------------------- |
|
672 // CCamContainerBase::HandleForegroundEvent |
|
673 // Called to notify of change of app fore/background state |
|
674 // ---------------------------------------------------- |
|
675 // |
|
676 void CCamCaptureSetupContainer::HandleForegroundEventL( TBool aForeground ) |
|
677 { |
|
678 |
|
679 if ( aForeground ) |
|
680 { |
|
681 DrawDeferred(); |
|
682 } |
|
683 } |
|
684 |
|
685 // --------------------------------------------------------------------------- |
|
686 // CCamCaptureSetupContainer::HandleListBoxEventL |
|
687 // Handles Listbox events |
|
688 // --------------------------------------------------------------------------- |
|
689 // |
|
690 void CCamCaptureSetupContainer::HandleListBoxEventL( CEikListBox* aListBox, |
|
691 TListBoxEvent aEventType ) |
|
692 { |
|
693 if( iController.CurrentMode() == ECamControllerIdle || |
|
694 iController.CurrentMode() == ECamControllerShutdown ) |
|
695 { |
|
696 return; |
|
697 } |
|
698 |
|
699 if( !iController.IsViewFinding() && iViewFinding ) |
|
700 { |
|
701 PRINT( _L("Camera <> CCamCaptureSetupContainer::HandleListBoxEventL start viewfinder") ); |
|
702 ReserveAndStartVF(); |
|
703 return; |
|
704 } |
|
705 |
|
706 switch( aEventType ) |
|
707 { |
|
708 |
|
709 case EEventItemDoubleClicked: |
|
710 { |
|
711 iView.HandleCommandL(EAknSoftkeyOk); |
|
712 } |
|
713 break; |
|
714 |
|
715 case EEventItemClicked: |
|
716 case EEventPenDownOnItem: // Fall through |
|
717 { |
|
718 MCamListboxModel* model = static_cast<MCamListboxModel*>( aListBox->Model() ); |
|
719 iControlHandler.HandleSettingValueUpdateL( model->ItemValue( aListBox->CurrentItemIndex() ) ); |
|
720 } |
|
721 break; |
|
722 case EEventItemSingleClicked: |
|
723 { |
|
724 MCamListboxModel* model = static_cast<MCamListboxModel*>( aListBox->Model() ); //Warning: downcasting |
|
725 iControlHandler.HandleSettingValueUpdateL( model->ItemValue( aListBox->CurrentItemIndex() ) ); |
|
726 iView.HandleCommandL(EAknSoftkeyOk); |
|
727 } |
|
728 break; |
|
729 default: |
|
730 break; |
|
731 } |
|
732 } |
|
733 /* |
|
734 // --------------------------------------------------------- |
|
735 // CCamCaptureSetupContainer::ShowViewFinderFrame |
|
736 // Receives new viewfinder frame when one is available |
|
737 // --------------------------------------------------------- |
|
738 // |
|
739 void CCamCaptureSetupContainer::ShowViewFinderFrame( const CFbsBitmap* aFrame, TBool /aFrozen/ ) |
|
740 { |
|
741 // If a bitmap pointer was passed |
|
742 if ( aFrame && iViewFinding ) |
|
743 { |
|
744 // draw a portion of the viewfinder |
|
745 // temporary values used, waiting for specification |
|
746 CWindowGc& gc = SystemGc(); |
|
747 gc.Activate( *DrawableWindow() ); |
|
748 TRect rect = iViewFinderRectLayout.Rect(); |
|
749 RWindow window = Window(); |
|
750 window.Invalidate( rect ); |
|
751 window.BeginRedraw( rect ); |
|
752 TRect bitmapPortion = rect; |
|
753 TSize bitmapSize = aFrame->SizeInPixels(); |
|
754 // if the bitmap is too short to offset vertically |
|
755 // display from its top edge |
|
756 if ( bitmapSize.iHeight - rect.iTl.iY < rect.Height() ) |
|
757 { |
|
758 bitmapPortion.Move( 0, 0 - rect.iTl.iY ); |
|
759 } |
|
760 // if the bitmap is too narrow to offset horizontally |
|
761 // display from its left edge |
|
762 if ( bitmapSize.iWidth - rect.iTl.iX < rect.Width() ) |
|
763 { |
|
764 bitmapPortion.Move( 0 - rect.iTl.iX, 0 ); |
|
765 } |
|
766 gc.BitBlt( rect.iTl, aFrame, bitmapPortion ); |
|
767 window.EndRedraw(); |
|
768 gc.Deactivate(); |
|
769 } |
|
770 else // otherwise a null bitmap pointer was passed |
|
771 { |
|
772 |
|
773 } |
|
774 } |
|
775 */ |
|
776 |
|
777 // </CAMERAAPP_CAPI_V2_MIGRATION> |
|
778 |
|
779 // End of File |
|