systemswuis/touchscreencalib/src/TouchScreenCalibAppUi.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:33:30 +0100
branchRCL_3
changeset 14 5f281e37a2f5
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201029 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2006 - 2008 Nokia Corporation and/or its subsidiary(-ies).
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0""
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:  AppUi class of the application.
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
// SYSTEM INCLUDES
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
#include <aknnotewrappers.h>
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
#include <touchscreencalib.rsg>
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include <e32property.h>
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include "touchscprivatepskeys.h"
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#else //RD_STARTUP_ANIMATION_CUSTOMIZATION
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <StartupAppInternalPSKeys.h>
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
#include <aknlayoutscalable_apps.cdl.h>
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include <layoutmetadata.cdl.h>
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
#include <centralrepository.h>
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
#include <starterdomaincrkeys.h>
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
#include <starterclient.h>     //used for RemoveSplashScreen
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
// USER INCLUDES
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
#include "TouchScreenCalibApplication.h"
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
#include "TouchScreenCalibAppUi.h"
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#include "TouchScreenCalibDefines.h"
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#include "TouchScreenCalibDocument.h"
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#include "TouchScreenCalibView.h"
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
#include "TouchScreenCalibPubSubObserver.h"
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
// CONSTANTS
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
_LIT_SECURITY_POLICY_C1(KReadDeviceDataPolicy, ECapabilityReadDeviceData);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
_LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
// ================= MEMBER FUNCTIONS =======================
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
//
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
// CTouchScreenCalibAppUi::CTouchScreenCalibAppUi()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
CTouchScreenCalibAppUi::CTouchScreenCalibAppUi():
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
    iTouchScreenCalibPubSubObserver( NULL ),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
    iCurrentCalibrationStep( 0 ),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
    iExitting( EFalse ),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
    iCalibrationDone( EFalse ),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
    iCalibrationCancel( EFalse )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
    TRACES("CTouchScreenCalibAppUi::CTouchScreenCalibAppUi");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
    iNativeOrientation = KUnknownOrientation;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
// CTouchScreenCalibAppUi::ConstructL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
void CTouchScreenCalibAppUi::ConstructL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
    TRACES("CTouchScreenCalibAppUi::ConstructL()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
    TInt flags = EStandardApp|EAknEnableSkin;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
    BaseConstructL(flags);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
    RProperty::Define(KPSUidTouchScreenCalibration,
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
#else //RD_STARTUP_ANIMATION_CUSTOMIZATION    
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
    RProperty::Define(KPSUidStartup,
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
                      KPSTouchScreenCalibration,
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
                      RProperty::EInt,
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
                      KReadDeviceDataPolicy,
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
                      KWriteDeviceDataPolicy );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
    
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
    // Clearing the calibration before doing the actual calibration
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
    TDigitizerCalibrationType caltype = EFactory;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
    UserHal::RestoreXYInputCalibration(caltype);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
    ResetTapPoints();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
    
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
//    SetOrientation();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
    iCalibrationPoints = CalibrationPoints();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
    // Set TSC application to be system application
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
    CEikonEnv& eikEnv = *CEikonEnv::Static();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
    eikEnv.SetSystem( ETrue );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
    iTouchScreenCalibLayout.iAnimImageLayout1.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g1().LayoutLine());
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
    iTouchScreenCalibLayout.iAnimImageLayout2.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g2().LayoutLine());
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
    iTouchScreenCalibLayout.iAnimImageLayout3.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g3().LayoutLine());
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
    iTouchScreenCalibLayout.iAnimImageLayout4.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g4().LayoutLine());
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
    iTouchScreenCalibView = CTouchScreenCalibView::NewL( this );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
    AddToStackL( iTouchScreenCalibView );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
    iTouchScreenCalibView->SetWinPriority(0);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
    // Disable priority changes of window server
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
    eikEnv.WsSession().ComputeMode( RWsSession::EPriorityControlDisabled );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
    UpdateL();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
    
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
    iTouchScreenCalibPubSubObserver = CTouchScreenCalibPubSubObserver::NewL( this );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
    if (FirstBoot())
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
        TRACES("CTouchScreenCalibAppUi::ConstructL(): First boot ongoing");        
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
        TRACES("CTouchScreenCalibAppUi::ConstructL(): Connect to Starter");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
        RStarterSession startersession;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
        if( startersession.Connect() == KErrNone )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
            TRACES("CTouchScreenCalibAppUi::ConstructL(): Connected to Starter");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
            startersession.EndSplashScreen();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
            TRACES("CTouchScreenCalibAppUi::ConstructL(): Splash screen removed");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
            startersession.Close();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
    NextCalibrationStepL();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
    TRACES("CTouchScreenCalibAppUi::ConstructL(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
// CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
    TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
    if (iTouchScreenCalibView)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
        TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi(): delete iTouchScreenCalibView");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
        RemoveFromStack( iTouchScreenCalibView );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
        delete iTouchScreenCalibView;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
    if (iTouchScreenCalibPubSubObserver)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
        TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi(): delete iTouchScreenCalibPubSubObserver");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
        delete iTouchScreenCalibPubSubObserver;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
    TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
// CTouchScreenCalibAppUi::NextCalibrationStepL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
void CTouchScreenCalibAppUi::NextCalibrationStepL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
    TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
    TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint1: %d %d",iTapPoints.iTl.iX, iTapPoints.iTl.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
    TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint2: %d %d",iTapPoints.iTr.iX, iTapPoints.iTr.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
    TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint3: %d %d",iTapPoints.iBr.iX, iTapPoints.iBr.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
    TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint4: %d %d",iTapPoints.iBl.iX, iTapPoints.iBl.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
    iCurrentCalibrationStep++;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
    TRACES1("CTouchScreenCalibAppUi::NextCalibrationStepL(): CurrentCalibrationStep: %d",iCurrentCalibrationStep);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
    if (iCurrentCalibrationStep > 4)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
        TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): Calibration succesfully completed. Save it and exit application.");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
        SaveCalibration();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
        iCalibrationDone = ETrue;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
        iTouchScreenCalibView->EndTargetAnimation();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
        iTouchScreenCalibView->SetWinPriority(ECoeWinPriorityNormal);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
        TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): Show 'Calibration Done' note");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
        HBufC* noteText = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_DONE );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
        CAknInformationNote* note =
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
            new( ELeave ) CAknInformationNote( ETrue );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
        note->ExecuteLD( *noteText );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
        CleanupStack::PopAndDestroy( noteText );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
        if ( FirstBoot() )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
            iTouchScreenCalibView->DrawEndingBackground();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
            RProperty::Set( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, ETouchScreenCalibrationOk );    
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
#else //RD_STARTUP_ANIMATION_CUSTOMIZATION    
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
            RProperty::Set( KPSUidStartup, KPSTouchScreenCalibration, ETouchScreenCalibrationOk );    
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION            
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
            iTouchScreenCalibView->SetWinPriority(0);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
        else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
            PrepareToExit();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
    else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
        TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): Update next step.");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
        UpdateL();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
    TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
// CTouchScreenCalibAppUi::SaveCalibration()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
void CTouchScreenCalibAppUi::SaveCalibration()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
    TRACES("CTouchScreenCalibAppUi::SaveCalibration()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
    // Touch Screen driver supports only portrait orientation. If device is now in
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
    // landscape mode, convert points to portrait.
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
    TDigitizerCalibration tapPoints = ConvertToCorrectOrientation(iTapPoints,
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
                                                                  KConvertSaveCase);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
    UserHal::SetXYInputCalibration(tapPoints);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
    TRACES("CTouchScreenCalibAppUi::SaveCalibration(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
// CTouchScreenCalibAppUi::ResetCalibrationStepsL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
// ----------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
void CTouchScreenCalibAppUi::ResetCalibrationStepsL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
    iCurrentCalibrationStep = 0;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
    ResetTapPoints();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
    NextCalibrationStepL();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
// CTouchScreenCalibAppUi::HandleForegroundEventL(TBool aForeground)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
void CTouchScreenCalibAppUi::HandleForegroundEventL( TBool aForeground )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
    // call super-class first
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
    CAknAppUi::HandleForegroundEventL( aForeground );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
    TRACES1("CTouchScreenCalibAppUi::HandleForegroundEventL( %d )", aForeground);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
    if ( aForeground )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
        // if we are coming to foreground
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
        UpdateL();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
    else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
        if (!FirstBoot())
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
            // Take old calibration in use                
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
            TDigitizerCalibrationType caltype = ESaved;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
            UserHal::RestoreXYInputCalibration(caltype);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
            PrepareToExit();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
// CTouchScreenCalibAppUi::HandleKeyL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/ )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
void CTouchScreenCalibAppUi::HandleKeyL( const TKeyEvent& aKeyEvent, TEventCode /*aType*/ )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
    TRACES1("CTouchScreenCalibAppUi::HandleKeyL(): %d",aKeyEvent.iCode);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
    if (aKeyEvent.iCode == EKeyYes) //Send key
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
        TRACES("CTouchScreenCalibAppUi::HandleKeyL(): Send Key");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
        if (FirstBoot()) // Restart calibration from step 1
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
            TRACES("CTouchScreenCalibAppUi::HandleKey(): Go to first calibration step");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
            ResetCalibrationStepsL();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
        else// Show "Calibration cancelled" Information note.
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
            TRACES("CTouchScreenCalibAppUi::HandleKeyL(): Show cancel note");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
            iCalibrationCancel = ETrue;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
            
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
            iTouchScreenCalibView->EndAnimation();          
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
            iTouchScreenCalibView->SetWinPriority(ECoeWinPriorityNormal);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
            HBufC* noteText = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_CANCEL );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
            CAknInformationNote* note =
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
                new( ELeave ) CAknInformationNote( ETrue );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
            note->ExecuteLD( *noteText );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
            CleanupStack::PopAndDestroy( noteText );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
            
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
            // Take old calibration in use
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
            TDigitizerCalibrationType caltype = ESaved;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
            UserHal::RestoreXYInputCalibration(caltype);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
            PrepareToExit();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
    else if ( aKeyEvent.iCode == EKeyNo || aKeyEvent.iCode == EKeyApplication0 
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
                     || ( aKeyEvent.iCode == EKeyNull && aKeyEvent.iScanCode == EStdKeyDevice7 ))
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
        TRACES("CTouchScreenCalibAppUi::HandleKeyL(): End Key or App Key");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
        if (!FirstBoot())
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
            // Take old calibration in use                
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
            TDigitizerCalibrationType caltype = ESaved;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
            UserHal::RestoreXYInputCalibration(caltype);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
            PrepareToExit();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
    TRACES("CTouchScreenCalibAppUi::HandleKeyL(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
// CTouchScreenCalibAppUi::HandlePointerL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
void CTouchScreenCalibAppUi::HandlePointerL( TPoint aPos )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
    TRACES("CTouchScreenCalibAppUi::HandlePointerL()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
    switch(iCurrentCalibrationStep)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
        case 1:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
            TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 1");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
            iTapPoints.iTl.iX = aPos.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
            iTapPoints.iTl.iY = aPos.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
        case 2:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
            TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 2");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
            iTapPoints.iTr.iX = aPos.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
            iTapPoints.iTr.iY = aPos.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
        case 3:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
            TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 4");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
            iTapPoints.iBr.iX = aPos.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
            iTapPoints.iBr.iY = aPos.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
        case 4:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
            TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 3");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
            iTapPoints.iBl.iX = aPos.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
            iTapPoints.iBl.iY = aPos.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
        default:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
            TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case default");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
    TRACES("CTouchScreenCalibAppUi::HandlePointerL(): End: Continue calibration");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
    NextCalibrationStepL();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
// CTouchScreenCalibAppUi::PrepareToExit()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
void CTouchScreenCalibAppUi::PrepareToExit()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
    TRACES("CTouchScreenCalibAppUi::PrepareToExit()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
    if (!iExitting)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
        iExitting = ETrue;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
        CEikAppUi::PrepareToExit();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
        Exit();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
    TRACES("CTouchScreenCalibAppUi::PrepareToExit(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
// CTouchScreenCalibAppUi::ResetTapPoints()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
void CTouchScreenCalibAppUi::ResetTapPoints()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
    TRACES("CTouchScreenCalibAppUi::ResetTapPoints()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
    iTapPoints.iTl.iX = 0;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
    iTapPoints.iTl.iY = 0;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
    iTapPoints.iTr.iX = 0;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
    iTapPoints.iTr.iY = 0;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
    iTapPoints.iBr.iX = 0;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
    iTapPoints.iBr.iY = 0;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
    iTapPoints.iBl.iX = 0;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
    iTapPoints.iBl.iY = 0;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
    TRACES("CTouchScreenCalibAppUi::ResetTapPoints(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
// CTouchScreenCalibAppUi::UpdateL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
void CTouchScreenCalibAppUi::UpdateL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
    TRACES("CTouchScreenCalibAppUi::UpdateL()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
    TRACES1("CTouchScreenCalibAppUi::UpdateL(): iCurrentCalibrationStep: %d",iCurrentCalibrationStep);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
    TAknLayoutText textLayout;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
    textLayout.LayoutText(TRect(), AknLayoutScalable_Apps::main_touch_calib_pane_t1().LayoutLine());
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
    TRACES2("CTouchScreenCalibAppUi::UpdateL(): Text rect top:    X:%d Y:%d",textLayout.TextRect().iTl.iX, textLayout.TextRect().iTl.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
    TRACES2("CTouchScreenCalibAppUi::UpdateL(): Text rect:bottom: X:%d Y:%d",textLayout.TextRect().iBr.iX, textLayout.TextRect().iBr.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
    iTouchScreenCalibView->UpdateL(textLayout);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
    TRACES("CTouchScreenCalibAppUi::UpdateL(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
// CTouchScreenCalibAppUi::GetCalibrationStep()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
TInt CTouchScreenCalibAppUi::GetCalibrationStep()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
    return iCurrentCalibrationStep;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   394
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
// CTouchScreenCalibAppUi::GetAnimImageRect()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
TRect CTouchScreenCalibAppUi::GetAnimImageRect(TInt aPointNumber)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
    TRACES1("CTouchScreenCalibAppUi::GetAnimImageRect(%d)", aPointNumber);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
    TRect rect;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
    TInt width(0);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
    TInt height(0);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
    // If aPointNumber is 0, return current calibration point.
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
    if (aPointNumber == 0)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
        aPointNumber = GetCalibrationStep();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
    switch (aPointNumber)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
        case 1:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
            width = iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iBr.iX -
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
                         iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iTl.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   416
            height= iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iBr.iY -
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
                         iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iTl.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
            rect = TRect(TPoint( iCalibrationPoints.iTl.iX - (width/2),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
                                 iCalibrationPoints.iTl.iY - (height/2)),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   421
                         TPoint( iCalibrationPoints.iTl.iX + (width/2),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   422
                                 iCalibrationPoints.iTl.iY + (height/2)));
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   423
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
        case 2:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
            width = iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iBr.iX -
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
                         iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iTl.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
            height= iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iBr.iY -
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
                         iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iTl.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
            rect = TRect(TPoint( iCalibrationPoints.iTr.iX - (width/2),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
                                 iCalibrationPoints.iTr.iY - (height/2)),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
                         TPoint( iCalibrationPoints.iTr.iX + (width/2),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
                                 iCalibrationPoints.iTr.iY + (height/2)));
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
        case 3:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
            width = iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iBr.iX -
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
                         iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iTl.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
            height= iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iBr.iY -
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
                         iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iTl.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
            rect = TRect(TPoint( iCalibrationPoints.iBr.iX - (width/2),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
                                 iCalibrationPoints.iBr.iY - (height/2)),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
                         TPoint( iCalibrationPoints.iBr.iX + (width/2),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   444
                                 iCalibrationPoints.iBr.iY + (height/2)));
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   445
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   446
        case 4:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   447
            width = iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iBr.iX -
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
                         iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iTl.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
            height= iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iBr.iY -
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
                         iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iTl.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
            rect = TRect(TPoint( iCalibrationPoints.iBl.iX - (width/2),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
                                 iCalibrationPoints.iBl.iY - (height/2)),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
                         TPoint( iCalibrationPoints.iBl.iX + (width/2),
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
                                 iCalibrationPoints.iBl.iY + (height/2)));
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
        default:
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
            break;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
    TRACES("CTouchScreenCalibAppUi::GetAnimImageRect(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
    return rect;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
// CTouchScreenCalibAppUi::HandleResourceChange(...)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
void CTouchScreenCalibAppUi::HandleScreenDeviceChangedL()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
    TRACES("CTouchScreenCalibAppUi::HandleResourceChange()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
    CAknAppUiBase::HandleScreenDeviceChangedL();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
    if (!iCalibrationDone && !iCalibrationCancel )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
        TRACES("CTouchScreenCalibAppUi::HandleResourceChange(): Restart calibration");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
        iCalibrationPoints = CalibrationPoints();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
        if (iTouchScreenCalibView)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
            RemoveFromStack( iTouchScreenCalibView );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
            delete iTouchScreenCalibView;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
            iTouchScreenCalibView = NULL;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
        iTouchScreenCalibView = CTouchScreenCalibView::NewL( this );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   483
        AddToStackL( iTouchScreenCalibView );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
        ResetCalibrationStepsL();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
    else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
        TRACES("CTouchScreenCalibAppUi::HandleResourceChange(): Update ending background");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
        iTouchScreenCalibView->DrawEndingBackground();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
    TRACES("CTouchScreenCalibAppUi::HandleResourceChange(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
// CTouchScreenCalibAppUi::CalibrationPoints();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
TDigitizerCalibration CTouchScreenCalibAppUi::CalibrationPoints()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
    TRACES("CTouchScreenCalibAppUi::CalibrationPoints()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   500
    TDigitizerCalibration calibrationPoints;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   501
#if defined(__WINS__)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
    // Dummy values for emulator for testing purposes
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
    TRect rect = iAvkonAppUi->ApplicationRect();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   504
    TRACES2("CTouchScreenCalibAppUi::CalibrationPoints(): Window resolution: (%d. %d)",rect.iBr.iX,rect.iBr.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   506
    calibrationPoints.iTl.iX = rect.iTl.iX+50;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   507
    calibrationPoints.iTl.iY = rect.iTl.iY+50;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
    calibrationPoints.iTr.iX = rect.iBr.iX-50;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
    calibrationPoints.iTr.iY = rect.iTl.iY+50;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
    calibrationPoints.iBr.iX = rect.iBr.iX-50;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
    calibrationPoints.iBr.iY = rect.iBr.iY-50;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   512
    calibrationPoints.iBl.iX = rect.iTl.iX+50;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   513
    calibrationPoints.iBl.iY = rect.iBr.iY-50;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
#else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
    UserHal::CalibrationPoints(calibrationPoints);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
#endif
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
    // Orientation in driver level could be different than window orientation. Convert
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
    // points to correct orientation.
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
    if (calibrationPoints.iBr.iX > calibrationPoints.iBr.iY )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
        TRACES("CTouchScreenCalibAppUi::CalibrationPoints(): Native orientation: landscape");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
        iNativeOrientation = KLandscapeOrientation;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
    else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
        TRACES("CTouchScreenCalibAppUi::CalibrationPoints(): Native orientation: portrait");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
        iNativeOrientation = KPortraitOrientation;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   530
    calibrationPoints = ConvertToCorrectOrientation(calibrationPoints, KConvertGetCase);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   531
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
    TRACES("CTouchScreenCalibAppUi::CalibrationPoints(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
    return calibrationPoints;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   537
// CTouchScreenCalibAppUi::ConvertToCorrectOrientation(TDigitizerCalibration aPoints);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   538
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   539
TDigitizerCalibration CTouchScreenCalibAppUi::ConvertToCorrectOrientation(TDigitizerCalibration aPoints,
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   540
                                                                          TInt aConvertCase)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   542
    TRACES("CTouchScreenCalibAppUi::ConvertToCorrectOrientation()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   543
    TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iTl.iX,aPoints.iTl.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   544
    TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iTr.iX,aPoints.iTr.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   545
    TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iBr.iX,aPoints.iBr.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
    TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iBl.iX,aPoints.iBl.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   547
    TDigitizerCalibration points;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   548
    TPoint destReso;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
    TRect rect = iAvkonAppUi->ApplicationRect();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   551
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   552
    if (!IsCorrectOrientation(rect))
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   553
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   554
        TRACES("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): Points are not for current layout.");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   555
        if (aConvertCase == KConvertGetCase)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   556
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   557
            destReso.iX = rect.iBr.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   558
            destReso.iY = rect.iBr.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   559
            TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): Destin reso: X:%d Y:%d", destReso.iX,destReso.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   560
            points = ChangeOrientation(aPoints, destReso);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   561
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   562
        else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   563
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   564
            destReso.iX = rect.iBr.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   565
            destReso.iY = rect.iBr.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   566
            TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): Destin reso: X:%d Y:%d", destReso.iX,destReso.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   567
            points = ChangeOrientation(aPoints, destReso);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   568
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   569
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   570
    else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   571
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   572
        points = aPoints;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   573
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   574
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   575
    TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iTl.iX,points.iTl.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   576
    TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iTr.iX,points.iTr.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   577
    TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iBr.iX,points.iBr.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   578
    TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iBl.iX,points.iBl.iY);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   579
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   580
    TRACES("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   581
    return points;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   582
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   583
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   584
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   585
// CTouchScreenCalibAppUi::IsCorrectOrientation(TRect aRect)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   586
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   587
TBool CTouchScreenCalibAppUi::IsCorrectOrientation(TRect aRect)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   588
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   589
    TRACES("CTouchScreenCalibAppUi::IsCorrectOrientation()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   590
    TBool ret(ETrue);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   591
    TBool nativePortrait(ETrue);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   592
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   593
    if (iNativeOrientation == KLandscapeOrientation)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   594
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   595
        TRACES("CTouchScreenCalibAppUi::IsCorrectOrientation(): Native orientation: landscape");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   596
        nativePortrait = EFalse;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   597
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   598
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   599
    TBool windowsPortrait(ETrue);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   600
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   601
    if (aRect.iBr.iX > aRect.iBr.iY)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   602
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   603
        TRACES("CTouchScreenCalibAppUi::IsCorrectOrientation(): Window orientation: landscape");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   604
        windowsPortrait = EFalse;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   605
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   606
    else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   607
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   608
        windowsPortrait = ETrue;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   609
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   610
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   611
    if (nativePortrait != windowsPortrait)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   612
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   613
        ret = EFalse;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   614
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   615
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   616
    TRACES1("CTouchScreenCalibAppUi::IsCorrectOrientation(): End: returns %d",ret);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   617
    return ret;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   618
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   619
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   620
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   621
// CTouchScreenCalibAppUi::ChangeOrientation(TDigitizerCalibration aPoints);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   622
// ---------------------------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   623
TDigitizerCalibration CTouchScreenCalibAppUi::ChangeOrientation(TDigitizerCalibration aSourcePoints,
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   624
                                                                TPoint aDestReso)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   625
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   626
    TRACES("CTouchScreenCalibAppUi::ChangeOrientation()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   627
    TDigitizerCalibration destPoints;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   628
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   629
    destPoints.iTl.iX = aSourcePoints.iTr.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   630
    destPoints.iTl.iY = aDestReso.iY - aSourcePoints.iTr.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   631
    destPoints.iTr.iX = aSourcePoints.iBr.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   632
    destPoints.iTr.iY = aDestReso.iY - aSourcePoints.iBr.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   633
    destPoints.iBr.iX = aSourcePoints.iBl.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   634
    destPoints.iBr.iY = aDestReso.iY - aSourcePoints.iBl.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   635
    destPoints.iBl.iX = aSourcePoints.iTl.iY;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   636
    destPoints.iBl.iY = aDestReso.iY - aSourcePoints.iTl.iX;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   637
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   638
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   639
    TRACES("CTouchScreenCalibAppUi::ChangeOrientation(): End");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   640
    return destPoints;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   641
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   642
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   643
// ---------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   644
// CTouchScreenCalibAppUi::FirstBoot()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   645
// ---------------------------------------------------------
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   646
TBool CTouchScreenCalibAppUi::FirstBoot()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   647
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   648
    TRACES("CTouchScreenCalibAppUi::FirstBoot()");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   649
    TInt value( 0 );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   650
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   651
    TRACES("CTouchScreenCalibAppUi::FirstBoot(): Read first boot info from Central Repository ");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   652
    CRepository* repository(NULL);
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   653
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   654
    TRAPD( err, repository = CRepository::NewL( KCRUidStartup ) );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   655
    if ( err == KErrNone )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   656
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   657
        err = repository->Get( KStartupFirstBoot, value );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   658
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   659
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   660
    delete repository;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   661
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   662
    if (value)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   663
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   664
        TRACES("CTouchScreenCalibAppUi::FirstBoot(): End, return EFalse");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   665
        return EFalse;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   666
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   667
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   668
    else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   669
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   670
        TRACES("CTouchScreenCalibAppUi::FirstBoot(): End, return ETrue");
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   671
        return ETrue;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   672
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   673
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   674
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   675
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   676
/*
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   677
 * This funcntion is used to change the screen orientation to the
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   678
 * same orientation with the factory given calibration data. But it 
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   679
 * is not used now. So just leave it here!
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   680
 * */
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   681
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   682
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   683
void CTouchScreenCalibAppUi::SetOrientation()
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   684
    {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   685
#ifndef __WINS__
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   686
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   687
    TInt orientation = KUnknownOrientation;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   688
    TInt nativeOrientation = KUnknownOrientation;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   689
    TDigitizerCalibration Points;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   690
    UserHal::CalibrationPoints( Points );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   691
    if ( Points.iBr.iX  > Points.iBr.iY)
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   692
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   693
        orientation = KLandscapeOrientation;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   694
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   695
    else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   696
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   697
        orientation = KPortraitOrientation;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   698
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   699
    TRect rect = iAvkonAppUi->ApplicationRect();
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   700
    if ( rect.iBr.iX > rect.iBr.iY )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   701
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   702
        nativeOrientation = KLandscapeOrientation;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   703
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   704
    else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   705
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   706
        nativeOrientation = KPortraitOrientation;
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   707
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   708
    
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   709
    if (orientation != nativeOrientation )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   710
        {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   711
        if ( orientation == KLandscapeOrientation )
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   712
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   713
            SetOrientationL( CAknAppUiBase::EAppUiOrientationLandscape );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   714
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   715
        else
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   716
            {
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   717
            SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait );
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   718
            }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   719
        }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   720
#endif
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   721
    }
5f281e37a2f5 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   722
// End of file