diff -r 000000000000 -r 2f259fa3e83a uifw/EikStd/srvuisrc/eikkeysoundmap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uifw/EikStd/srvuisrc/eikkeysoundmap.cpp Tue Feb 02 01:00:49 2010 +0200 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: EikSrv keysound map. +* +*/ + +#include "eikkeysoundmap.h" +#include + +const TInt KEikKeySoundMapGranularity = 4; +const TInt KEikSKeyGranularity = 16; + +// class TSkey - SKey definition +// Keycode and Repeat are stored as a single code, to enable fast searching +void TSKey::Set(TInt aKeyCode, TInt aRepeatType, TInt aSid) + { + iSid = aSid; + iKeyCode = aKeyCode + (aRepeatType << 16); + } + +// =============================== +// CEikKeySoundMap implementation. +// =============================== + +CEikKeySoundMap* CEikKeySoundMap::NewL() + { + CEikKeySoundMap* self = new(ELeave)CEikKeySoundMap(); + return self; + } + +CEikKeySoundMap::~CEikKeySoundMap() + { + } + +CEikKeySoundMap::CEikKeySoundMap() +:CArrayFixFlat(KEikSKeyGranularity) + { + } + +void CEikKeySoundMap::InternalizeL(RReadStream& aStream, TInt aItems, TInt aUid) + { + for (TInt ii=0; ii(KEikKeySoundMapGranularity) + { + } + +TBool CEikKeySoundStack::Find(TInt aScanCode, TInt aRepeat, TInt& aSid) + { + TSKey key; + // Decide on key-repeat type to check for + if (aRepeat == 0) + { + key.Set(aScanCode, ESKeyTypeShort, 0); + } + else + { + if (iPreviousRepeat == 0) + { + key.Set(aScanCode, ESKeyTypeLong, 0); + } + else + { + key.Set(aScanCode, ESKeyTypeRepeat, 0); + } + } + + iPreviousRepeat = aRepeat; + + // Check in top layer + TInt index = Count(); + while (index) + { + index--; + CEikKeySoundMap* map = At(index); + if (map->Find(key)) + { + if (key.iSid == EAvkonSIDNoSound) + return EFalse; + else if (key.iSid == EAvkonSIDDefaultSound) + { + // Go direct to play default sound + index = 1; + continue; + } + else + { + aSid = key.iSid; + return ETrue; + } + } + } + return EFalse; + } +